Ptolemy theorem calculator
Solve a missing side or diagonal of a quadrilateral inscribed in a circle with Ptolemy's theorem: with sides 3, 4, 5 and 6 and one diagonal of 5, the other diagonal is 7.8, since both products come to 39. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- A
- 3
- B
- 4
- C
- 5
- D
- 6
- Power (W)
- 5
- Decimal places
- 6
- Q
- 7.8
- Left
- 39
- Right
- 39
For cyclic quadrilateral: ac+bd=pq; solve missing side/diagonal. Search intent: ptolemy theorem calculator. No network calls or random seeds are required. Failed jobs are not billed.
What Ptolemy's theorem says
Ptolemy's theorem is about quadrilaterals whose four corners lie on the same circle, called cyclic quadrilaterals. Name the corners A, B, C and D in order around the circle, so the sides are a from A to B, b from B to C, c from C to D and d from D to A, and the diagonals are p from A to C and q from B to D. The theorem says that a times c plus b times d equals p times q: the two products of opposite sides add up to the product of the diagonals. Give five of the six lengths and the sixth follows from that single equation.
How to use it and where people slip
Leave empty the one length you want, and the calculator solves the equation for it, showing both sides so you can see that they match. With sides 3, 4, 5 and 6 and a diagonal of 5, both sides come to 39 and the missing diagonal is 7.8. The usual slips are pairing neighboring sides instead of opposite ones, labeling the corners out of order around the circle, and using the rule on a quadrilateral that is not inscribed in a circle, where it does not hold. Results can be rounded once, at the end, to the decimals you choose.
What you can do with it
Teaching
Pinned goldens.
FAQ
What does Ptolemy's theorem say?
In a quadrilateral whose four corners lie on one circle, the product of the two diagonals equals the sum of the products of opposite sides: a times c plus b times d equals p times q.
How do I find a missing diagonal with Ptolemy's theorem?
Enter the four sides and the diagonal you know, and leave the other one empty. With sides 3, 4, 5 and 6 and a diagonal of 5, the other diagonal is 7.8, because 3 times 5 plus 4 times 6 is 39, and 39 divided by 5 is 7.8.
Does Ptolemy's theorem work for any quadrilateral?
No. The equality only holds when the quadrilateral is cyclic, meaning all four corners lie on the same circle. For other quadrilaterals the two sides of the equation do not match, so check the shape before trusting a solved length.
Which sides count as opposite in Ptolemy's theorem?
Going around the circle in the order A, B, C, D, side AB is opposite CD and side BC is opposite DA. The diagonals join opposite corners, AC and BD. Mixing up this order is the most common reason for a wrong answer.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/math/ptolemy-theorem \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":3}'const res = await fetch("https://api.kit.forhosting.com/math/ptolemy-theorem", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 3
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/ptolemy-theorem",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 3
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/ptolemy-theorem", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":3}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":3}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/ptolemy-theorem", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a": 3
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.ptolemy_theorem",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks, automation, or teaching demos.
How it works
For cyclic quadrilateral: ac+bd=pq; solve missing side/diagonal. ac + bd = pq. No network calls or random seeds are required. Failed jobs are not billed. No network calls or random seeds are required. Failed jobs are not billed. The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks, automation, or teaching demos. The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks, automation, or teaching demos.
Inputs, limits and rounding
Optional decimals use half-up once. Optional output fields are omitted, never null. No network calls or random seeds are required. Failed jobs are not billed. No network calls or random seeds are required. Provide required JSON fields with DOM-safe names. Invalid types raise invalid_input. The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks, automation, or teaching demos. The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks,
When to use it
Use when search intent matches. For cyclic quadrilateral: ac+bd=pq; solve missing side/diagonal. EN-only delivery; Nitro hydrates locales. No network calls or random seeds are required. Failed jobs are not billed. No network calls or random seeds are required. Failed jobs The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks, automation, or teaching demos. The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks, automation, or teaching demos.
Integration use cases
Quick check
Free widget.
Automation
API same JSON.
Technical questions
Free?
Yes tier A.
Network?
No.
Bad input?
invalid_input.
API?
Yes.
Locales?
EN-only; Nitro hydrates.