Math

Pythagorean Theorem Calculator

In any right triangle the squares of the two legs add up to the square of the hypotenuse. Enter the two shorter sides to get the hypotenuse, or enter the hypotenuse and one leg to get the other leg — the calculator also tells you whether a triangle would be right-angled at all.

Result
—
Hypotenuse (c)
—
Leg squares added
—
Hypotenuse squared (c²)
—
Longest side
—
c ÷ shorter leg
—

How the Pythagorean theorem works

For a right triangle with legs a and b meeting at the right angle, and hypotenuse c opposite it:

a² + b² = c²

To find the hypotenuse, add the leg squares and take the square root. To find a missing leg, subtract the known leg's square from the hypotenuse's square and take the root: a = √(c² − b²). The same equation also works as a right-angle test: if a² + b² equals c² exactly, the angle opposite c is 90°. The classic 3-4-5 triangle (9 + 16 = 25) is the smallest whole-number case.

Worked example

You need a diagonal brace across a wall. The wall is 3 ft tall and the brace must reach 5 ft horizontally: b = √(25 − 9) = √16 = 4 ft. Conversely, legs of 6 ft and 8 ft give a diagonal of √(36 + 64) = √100 = 10 ft — the other half of the 3-4-5 family, and the ratio behind the 0.6 × 0.8 × 1.0 right triangle used in roof and stair calculations.

Beyond flat right triangles

To find the space diagonal of a box, use the theorem in two steps: treat the box's footprint diagonal as one leg and the height as the other, then apply the theorem again. It is also the fastest way to check whether two lengths can form a triangle at all (a + b > c), and the basis of surveying offsets, roof rafter lengths and camera field-of-view diagonals.

Frequently asked questions

1. How do you find the hypotenuse of a right triangle?

Square both legs, add them, then take the square root: c = √(a² + b²). For legs of 3 and 4 this gives c = √25 = 5.

2. How do you find a missing leg?

Square the hypotenuse, subtract the square of the known leg, and take the root: a = √(c² − b²). The hypotenuse must always be subtracted from, never the other way round.

3. How do I know if a triangle is right-angled?

Check whether a² + b² equals c² for the three sides sorted shortest to longest. If it matches exactly, the angle opposite the longest side is 90°.

4. Does the Pythagorean theorem work on a sphere?

No — it applies to flat right triangles only. For spherical geometry angles and distances follow different rules, and for a 3D diagonal you extend the sum of squares with a third dimension.

Related tools