acalculator

Pythagorean theorem calculator

Enter any two sides of a right triangle and get the third from a² + b² = c².

Your numbers

Hypotenuse c
5

A right triangle with legs 3 and 4 has a hypotenuse of 5.

a²
9
b²
16
c²
25

Hypotenuse c: 5. A right triangle with legs 3 and 4 has a hypotenuse of 5.

How to calculate

Finds the missing side of a right triangle from the other two with the Pythagorean theorem, a² + b² = c².

Example with the default inputs (Leg a 3, Leg b 4): A right triangle with legs 3 and 4 has a hypotenuse of 5.

Formula: a² + b² = c², where a and b are the legs and c is the hypotenuse of a right triangle.

  • The triangle has a right angle (90°) between legs a and b.
  • All three sides are more than 0 and at most 10¹⁰⁰, in the same unit; a hypotenuse worked out above 10¹⁰⁰ has no answer.
  • The hypotenuse must be longer than the leg you give with it.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Leg a 3, Leg b 4 gives Hypotenuse c 5, a² 9, b² 16, c² 25.Source: hand calculation in content.mdx: 9 + 16 = 25, √25 = 5
  2. Leg a 5, Hypotenuse c 13 gives Leg b 12.Source: hand calculation in content.mdx: 169 − 25 = 144, √144 = 12
  3. Leg b 24, Hypotenuse c 25 gives Leg a 7.Source: hand calculation in content.mdx: 625 − 576 = 49, √49 = 7
  4. Leg a 1, Leg b 1 gives Hypotenuse c 1.414214.Source: hand calculation in content.mdx: √(1 + 1) = √2; Python 3: math.hypot(1, 1) = 1.4142135623730951
  5. Leg a 2.5, Leg b 6 gives Hypotenuse c 6.5.Source: hand calculation in content.mdx: 6.25 + 36 = 42.25, √42.25 = 6.5

How it works

In a right triangle with legs a and b (the two sides that meet at the right angle) and hypotenuse c (the side opposite the right angle):

a² + b² = c²

Fill in any two sides and the calculator finds the third:

  • Hypotenuse: c = √(a² + b²).
  • Leg a: a = √(c² − b²), computed as √((c − b)(c + b)), which gives the same value with less rounding error when b is close to c.
  • Leg b: b = √(c² − a²), computed the same way.

It also shows the three squares, a², b² and c², so you can see that the first two add up to the third.

Assumptions

  • The angle between legs a and b is exactly 90°.
  • Every side is more than 0 and at most 10¹⁰⁰, and all three are in the same unit (the answer is in that unit too). A hypotenuse worked out above 10¹⁰⁰ has no answer.
  • To find a leg, the hypotenuse must be longer than the other leg. If it is not, no right triangle fits and the calculator says so.
  • When a leg is given as long as the hypotenuse or longer, the page gives no answer and says: "The hypotenuse (c) must be longer than each leg."

Worked examples by hand

Legs 3 and 4. a² = 9 and b² = 16, so c² = 9 + 16 = 25 and c = √25 = 5.

Leg 5 and hypotenuse 13. b² = 13² − 5² = 169 − 25 = 144, so b = 12.

Leg 24 and hypotenuse 25. a² = 625 − 576 = 49, so a = 7.

Legs 1 and 1. c² = 1 + 1 = 2, so c = √2 = 1.41421356.

Legs 2.5 and 6. c² = 6.25 + 36 = 42.25, so c = 6.5.

Other questions people ask

What is the Pythagorean theorem?

In a right triangle, the square of the hypotenuse (the side opposite the right angle) equals the sum of the squares of the other two sides: a² + b² = c². For legs 3 and 4, 9 + 16 = 25, so the hypotenuse is √25 = 5.

How do I find the hypotenuse?

Square both legs, add them, and take the square root: c = √(a² + b²). With legs 6 and 8: 36 + 64 = 100, and √100 = 10.

How do I find a missing leg?

Square the hypotenuse, subtract the square of the known leg, and take the square root: a = √(c² − b²). With a hypotenuse of 13 and a leg of 5: 169 − 25 = 144, and √144 = 12. The hypotenuse must be longer than the leg, or there is no triangle.

Does the Pythagorean theorem work for every triangle?

Only for right triangles. For any other triangle use the law of cosines, c² = a² + b² − 2ab cos C, which becomes the Pythagorean theorem when the angle C is 90° (cos 90° = 0).

What is a Pythagorean triple?

Three whole numbers that fit a² + b² = c², such as 3, 4, 5; 5, 12, 13; 8, 15, 17; and 7, 24, 25. Any whole-number multiple of a triple is also a triple, so 6, 8, 10 works too. Builders use 3-4-5 to check that a corner is square.

How can I check that a triangle has a right angle?

Measure all three sides and test whether the two shorter sides squared add up to the longest side squared. This is the converse of the theorem: if a² + b² = c², the angle opposite c is 90°.