# Pythagorean theorem calculator

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

- Page: https://www.acalculator.org/math/pythagorean-theorem-calculator
- JSON spec: https://www.acalculator.org/math/pythagorean-theorem-calculator.json
- Version: b9edb98b00b5

## Default answer

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

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| a | Leg a | One of the two shorter sides, which meet at the right angle. |
| b | Leg b | The other shorter side, which meets leg a at the right angle. |
| c | Hypotenuse c | The longest side, opposite the right angle. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| a | Leg a | One of the two shorter sides, which meet at the right angle. |
| b | Leg b | The other shorter side, which meets leg a at the right angle. |
| c | Hypotenuse c | The longest side, opposite the right angle. |
| a2 | a² | Leg a squared. |
| b2 | b² | Leg b squared. |
| c2 | c² | The hypotenuse squared: a² + b². |

## Method

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

## Assumptions

- 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.

## Worked examples

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

## FAQ

### 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°.

## Sources

- OpenStax, Elementary Algebra 2e, section 3.4 Solve Geometry Applications: Triangles, Rectangles, and the Pythagorean Theorem: https://openstax.org/books/elementary-algebra-2e/pages/3-4-solve-geometry-applications-triangles-rectangles-and-the-pythagorean-theorem
