CalcTrace

Pythagorean Theorem Calculator

Solve a² + b² = c² for whichever side is missing, with every square shown in the working. You can also test whether three lengths make a right angle, generate whole-number Pythagorean triples, and find the corner-to-corner diagonal of a box.

Last updated .

What do you want to do?

Calculation
Two known sides

Fill in two boxes and leave the side you want empty. The hypotenuse is the side opposite the right angle.

Lengths can be in any unit, as long as they all use the same one.

Result

Hypotenuse c

–

Show the working

    What the theorem says

    In any right-angled triangle, the square built on the hypotenuse has exactly the same area as the two squares built on the legs put together. With legs a and b and hypotenuse c (the side opposite the right angle, and always the longest):

    a² + b² = c²

    Rearranged for whichever side is missing:

    Hypotenuse: c = √(a² + b²)

    Leg: a = √(c² − b²)

    A tidy way to see why it is true: arrange four copies of the triangle inside a square of side a + b so that their hypotenuses form a tilted square in the middle. That inner square has area c². Slide the same four triangles into two rectangles instead and the space left over is an a² square and a b² square. The triangles have not changed, so the leftover areas must be equal.

    Worked examples

    Finding the hypotenuse

    Legs of 7 and 9.

    1. Square each leg: 7² = 49 and 9² = 81.
    2. Add the squares: 49 + 81 = 130.
    3. Take the square root: √130 = 11.4018.

    Finding a leg

    A 5 m ladder leans against a wall with its foot 1.5 m out. How high does it reach?

    1. Square both: 5² = 25 and 1.5² = 2.25.
    2. Subtract, because the ladder is the hypotenuse: 25 − 2.25 = 22.75.
    3. Take the square root: √22.75 = 4.7697 m.

    Testing for a right angle

    The theorem also runs backwards. If the squares of the two shorter sides add up to the square of the longest, the triangle must contain a right angle. Sides of 8, 15 and 17 pass: 64 + 225 = 289, and 17² = 289. The comparison tells you more than yes or no:

    Builders use this to square up a corner without a set square. Measure 3 units along one wall and 4 along the other; the corner is square when the gap between the marks is exactly 5. Any multiple works, and bigger is more accurate: 1.8 m, 2.4 m and 3.0 m is the same triangle scaled by 0.6, since 3.24 + 5.76 = 9.

    Pythagorean triples

    A Pythagorean triple is three whole numbers that satisfy the theorem. Every primitive triple, one with no common factor, comes from a formula in Euclid’s Elements. Choose whole numbers m and n with m larger than n:

    a = m² − n²    b = 2mn    c = m² + n²

    With m = 2 and n = 1 you get 3, 4, 5. With m = 3 and n = 2 you get 5, 12, 13, and m = 4 with n = 1 gives 15, 8, 17. The result is primitive when m and n share no factor and one of them is even. There are 16 primitive triples with a hypotenuse of 100 or less, and 52 once multiples such as 6, 8, 10 are counted.

    Extending it to three dimensions

    The longest straight line that fits inside a box runs between opposite corners. Apply the theorem twice, first across the base and then up through the height, and the two steps collapse into one formula for a box of length l, width w and height h:

    d = √(l² + w² + h²)

    For a box 30 cm by 40 cm by 120 cm, the diagonal of the base is √(900 + 1,600) = 50 cm, and the space diagonal is √(50² + 120²) = √16,900 = 130 cm. A 1.3 m rod only just fits.

    Common mistakes

    Adding the sides before squaring is the classic error: 7 + 9 = 16, but the hypotenuse is 11.40, not 16. Square first, add, then take the root. When the unknown is a leg, subtract instead of adding, and always subtract from the hypotenuse’s square. Keep every length in the same unit, so convert 150 cm to 1.5 m before combining it with metres. Finally, the theorem only holds when one angle is exactly 90°. For other triangles use the law of cosines in the triangle calculator.