How to use the Pythagorean theorem calculator
- Choose what to solve for: the hypotenuse c, or one of the legs, a or b.
- Enter the two sides you know. The hypotenuse is the longest side, the one opposite the right angle.
- Read the missing side at the top. Underneath you'll see the exact square root, whether the sides form a Pythagorean triple, the two acute angles, the area and the perimeter.
Use the same unit for every side. The answer comes out in that unit.
The Pythagorean theorem
In any right triangle, the square on the hypotenuse equals the sum of the squares on the two legs:
a and b are the legs, the two sides that meet at the right angle, and c is the hypotenuse. To find c, add the squares of the legs and take the square root. To find a leg, subtract the square of the other leg from the square of the hypotenuse first, which is why the hypotenuse has to be the longer side.
When the sides are whole numbers but the answer isn't, the calculator also simplifies the square root, so √50 becomes 5√2.
Worked example
The calculator starts with legs a = 3 and b = 4.
- Square the legs: 3² = 9 and 4² = 16.
- Add them: 9 + 16 = 25.
- Take the square root: c = √25 = 5.
All three sides are whole numbers, so 3, 4, 5 is a Pythagorean triple, and the smallest one. Solving the other way works too: with c = 5 and b = 4, a = √(25 − 16) = √9 = 3.
With two legs of 1, the hypotenuse is √(1 + 1) = √2 ≈ 1.414214, which is the diagonal of a unit square and cannot be written exactly as a decimal.
Pythagorean triples
A Pythagorean triple is a set of three whole numbers that fit a² + b² = c². A primitive triple has no common factor; multiply it by any whole number to get more triples, such as 6, 8, 10 from 3, 4, 5. The calculator lists eight primitive triples under the result and tells you when your sides form one.
You can build primitive triples from two whole numbers m > n with no common factor, one even and one odd: a = m² − n², b = 2mn and 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.
Everyday uses
- Checking a right angle. Builders mark 3 ft along one wall and 4 ft along the other. If the diagonal between the marks is exactly 5 ft, the corner is square. For bigger layouts use 6-8-10 or 9-12-15.
- Diagonals. A 12 × 9 ft room has a diagonal of √(144 + 81) = 15 ft.
- Distances on a grid. Going 6 blocks east and 8 blocks north puts you √(36 + 64) = 10 blocks away in a straight line. The distance calculator does this for any two points.
Frequently asked questions
Does the Pythagorean theorem work for every triangle?
Only for right triangles. For other triangles use the law of cosines, c² = a² + b² − 2ab cos C, which reduces to the Pythagorean theorem when C = 90°. The triangle calculator handles that case.
Why does the calculator say the hypotenuse is too short?
The hypotenuse is always the longest side. If c is not more than the leg you entered, c² − a² would be zero or negative, and there is no real square root. Check which side is opposite the right angle.
Can I use decimals?
Yes. Sides like 2.5 and 6 work the same way: √(6.25 + 36) = √42.25 = 6.5. The triple check only applies when all three sides come out as whole numbers.
How can I tell if three numbers make a right triangle?
Square the two smaller numbers and add them. If the total equals the square of the largest, the triangle has a right angle. For 5, 12 and 13: 25 + 144 = 169 = 13², so it does.
Related calculators
- Right Triangle Calculator — Enter any two of the legs, hypotenuse, angles or area to solve a right triangle completely.
- Triangle Calculator — Solve any triangle from three sides or angles: missing sides and angles, area, perimeter, heights and radii.
- Distance Calculator — Straight-line distance between 2D or 3D points, or the great-circle distance between two places on Earth.
- Root Calculator — Square roots, cube roots and any nth root, with the simplified radical form such as √72 = 6√2.
Results are calculated in your browser. Double-check anything important before you rely on it. See our disclaimer.