ForHosting KIT · Math

Ptolemy theorem calculator

Ptolemy's theorem from four sides: for a cyclic quadrilateral with sides 3, 4, 3 and 4, the diagonals multiply to 25, shown as 9 plus 16 from the opposite pairs so you can write the algebra beside the answer. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
A
3
B
4
C
3
D
4
You get
Diagonal product
25

Ptolemy's theorem is the classical relation that ties the four consecutive sides of a cyclic quadrilateral to the product of its two diagonals. If a, b, c, and d are the sides in order around a quadrilateral that can be inscribed in a circle, and p and q are the diagonals, then the product p times q equals a times c plus b times d. This Ptolemy theorem calculator accepts those four finite positive side lengths, checks that they can form a simple closed quadrilateral, and returns the diagonal product with the opposite-side product terms made explicit so you can show the algebra next to the answer. No network, no randomness, and no Date.

What Ptolemy's theorem says for a cyclic quadrilateral

A cyclic quadrilateral is a four-sided polygon whose vertices all lie on a single circle. That inscription constraint is strong enough to force a simple multiplicative identity between sides and diagonals. Label the vertices A, B, C, D in cyclic order around the circle, write a for AB, b for BC, c for CD, and d for DA, and write p for diagonal AC and q for diagonal BD.

Ptolemy's theorem then asserts that the product of the diagonals equals the sum of the products of the pairs of opposite sides: p multiplied by q equals a multiplied by c plus b multiplied by d.

The statement is often remembered as a chord-length identity that generalizes the Pythagorean theorem: when the cyclic quadrilateral is a rectangle, the diagonals are equal and each equals the hypotenuse of the right triangles formed by the sides, so the product recovers the familiar a squared plus b squared pattern after the opposite sides repeat.

When the figure is a square of side s, each diagonal is s times the square root of two, so the product is two s squared, which matches a c plus b d equals s squared plus s squared. The formula uses only multiplications and one addition on the four side lengths, so it is O(1), deterministic, and free of iterative solvers or floating-point roots in the main path.

Where the diagonal product comes in handy

Secondary-school and college geometry courses constantly ask for the product of the diagonals of a cyclic quadrilateral once the four sides are known; a trusted calculator with a strict positivity and inequality gate speeds homework grading and removes spreadsheet mistakes where someone multiplies adjacent sides instead of opposite pairs. Exam-prep generators and LMS auto-graders need a deterministic oracle that marks negative side lengths and impossible outlines as failures rather than inventing a product.

Architecture, surveying, and fabrication notes sometimes already know the sequential edge lengths of a cyclic frame or plate; the diagonal product feeds intermediate checks, bracing estimates, and symbolic steps before full CAD reconstruction of each diagonal. Failed validation does not consume balance. Keep requests small, pin the rounded product in tests, and you get reproducible Ptolemy results for classrooms, LMS plugins, and edge workers without standing up symbolic geometry infrastructure of your own.

Related but different search intents—counting diagonals of an n-gon, square diagonal length, or trapezoid diagonals from bases and height—should stay on their own landings rather than overloading this cyclic-product page.

Classroom and homework checks

Enter four consecutive sides of a cyclic quadrilateral and verify the Ptolemy diagonal product pq = ac + bd against textbook methods.

How does the Ptolemy theorem calculator work?

Send finite positive sides a, b, c, and d in consecutive order.

What happens if a side is negative?

A negative side length is not valid for a cyclic quadrilateral and is not billed.

Does this return each diagonal length separately?

No. From sides alone Ptolemy gives the product of the diagonals, not each diagonal.

What side lengths are rejected besides negatives?

Zero or non-positive sides, missing or non-finite values, and any set that violates the quadrilateral inequality (each side less than the sum of the other three).

Which sides are opposite in Ptolemy's theorem?

With the corners labelled A, B, C and D around the circle, AB faces CD and BC faces DA. Multiply each opposite pair and add the two results; multiplying neighbouring sides is the classic mistake.

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.

POSThttps://api.kit.forhosting.com/geom/cyclic-quadrilateral-diagonals

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.

curl -X POST https://api.kit.forhosting.com/geom/cyclic-quadrilateral-diagonals \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a":3,"b":4,"c":5,"d":6}'
{
  "a": 3,
  "b": 4,
  "c": 5,
  "d": 6
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "geom.cyclic_quadrilateral_diagonals",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Any negative side fails with invalid_input; so do zero lengths and figures that break the quadrilateral inequality.

What Ptolemy's theorem says for a cyclic quadrilateral

This endpoint does not reconstruct the individual diagonal lengths from sides alone—that generally requires more data such as an angle or the circumradius—but it does return the exact product promised by Ptolemy, which is often what exam questions and intermediate algebraic steps ask for.

Input contract, validation, and response shape

Any side that is negative is rejected with a clear message that a negative side length is not valid; zero and other non-positive values are likewise rejected. Numeric fields are rounded to twelve decimal places for stable goldens across runtimes. Classic checks include a rectangle with sides three, four, three, four whose diagonal product is twenty-five, and a square with side five whose product is fifty. Pair the free browser tool with the same contract in scripts so homework checks and batch grading never disagree. POST a JSON body with four required finite positive numbers a, b, c, and d for the consecutive sides of the cyclic quadrilateral. Missing fields, empty strings, non-numeric text, NaN, and Infinity fail with invalid_input naming the field. The four positive lengths must also satisfy the strict quadrilateral inequality: each side must be less than the sum of the other three, otherwise no simple closed quadrilateral can exist and the request fails before Ptolemy is applied. On success the body echoes a, b, c, and d; returns diagonal_product equal to a times c plus b times d; includes opposite_side_products with the ac and bd terms so teaching UIs can display the summands; and sets formula to the Ptolemy identity string and method to ptolemy for logs and documentation. Successful API calls bill the published base of $0.002 per item; invalid input is not charged.

Exam and LMS auto-grading

Mark cyclic-quadrilateral items with a deterministic oracle that rejects negative sides and impossible outlines as invalid_input.

CAD, surveying, and geometry fixtures

From sequential edge lengths of a cyclic frame, recover the diagonal product for intermediate checks without a full CAS stack.

What does the Ptolemy theorem calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →