Find the hypotenuse of a right triangle from its two legs, or a missing leg from the hypotenuse and the other leg, with the working shown.
Pythagorean Theorem Calculator
Find the hypotenuse of a right triangle from its two legs, or a missing leg from the hypotenuse and the other leg.
Starting values: legs of 3 and 4 in the hypotenuse mode, which give a hypotenuse of 5, and a hypotenuse of 5 with a known leg of 3 in the missing leg mode, which gives a leg of 4. The results are shown to six decimal places.
How the calculator works
a² + b² = c²
Where:
- a and b are the two legs, which meet at the right angle.
- c is the hypotenuse, the side opposite the right angle and the longest side.
Find the hypotenuse
c = √(a² + b²)
Find a missing leg
b = √(c² − a²)
All lengths must be in the same unit, and the answer comes out in that unit. Every input must be greater than zero. In the missing leg mode, the hypotenuse must be longer than the known leg, and the tool shows a message if it is not.
Worked examples
The 3-4-5 triangle
c = √(9 + 16) = √25 = 5. Going the other way, with c = 5 and a = 3, b = √(25 − 9) = √16 = 4.
The 5-12-13 triangle
With legs of 5 and 12, c = √(25 + 144) = √169 = 13.
A result that is not a whole number
With two legs of 1, c = √2 = 1.414214. Most right triangles give a number that does not end, so the tool rounds it to six decimal places.
A diagonal across a room
A room of 15 ft by 12 ft has a diagonal of √(225 + 144) = √369 = 19.209373 ft, which is about 19 ft 2.5 in.
A missing leg
With a hypotenuse of 10 and a leg of 6, b = √(100 − 36) = √64 = 8. With a hypotenuse of 2 and a leg of 1, b = √3 = 1.732051.
Using the theorem
The theorem works only for a right triangle, so the tool cannot check that your triangle has a right angle. If it does not, the answer will be wrong. For a triangle without a right angle, use a triangle solver that handles any triangle.
Checking for a square corner
The 3-4-5 triangle gives a way to check that a corner is square. Measure 3 units along one side and 4 along the other. If the distance between the two marks is 5 units, the corner is a right angle. Any multiple works, such as 6, 8 and 10, which is easier to measure on a larger layout.
Slopes and ramps
The sloped length of a ramp or a roof is the hypotenuse, with the horizontal run and the vertical rise as the legs. A rise of 3 ft over a run of 12 ft has a sloped length of √(9 + 144) = √153 = 12.37 ft.
Which side is which
The hypotenuse is always the longest side. If you enter the hypotenuse in the wrong place, the missing leg mode will warn you that it must be longer than the known leg, which is a quick check on your inputs.
Common mistakes
Mixing units is the most frequent error, such as one leg in feet and the other in inches. Convert them first. Another is to add the legs and take the square root of the sum without squaring them first. The squares are added, not the lengths. Finally, a missing leg is found by subtracting the squares, not by adding them.
Related calculators
For other triangles, see the right triangle area calculator, the triangle solver and the triangle slope, grade and pitch calculator.
Related calculators you may need next: Right Triangle Area Calculator and Triangle Solver.
More worked examples
These show the theorem in common jobs.
A roof rafter
A run of 12 ft and a rise of 5 ft give a sloped length of √(144 + 25) = √169 = 13 ft. It is a 5-12-13 triangle.
A ladder against a wall
If the foot of a 13 ft ladder is 4 ft from the wall, the height it reaches is √(169 − 16) = √153 = 12.369 ft. Use the missing leg mode with c = 13 and a = 4.
A distance across a grid
A point that is 6 blocks east and 8 blocks north is √(36 + 64) = 10 blocks away in a straight line.
Checking a rectangle for squareness
A rectangle of 12 ft by 9 ft should have a diagonal of √(144 + 81) = √225 = 15 ft. If both diagonals measure 15 ft, the corners are square. If they differ, the shape is out of square.
Checking the answer
Two quick checks catch most errors. First, the hypotenuse must be longer than either leg, but shorter than the two legs added together. For legs of 3 and 4, the hypotenuse of 5 is between 4 and 7. Second, square your answer and compare it with the sum of the squares of the legs. For the 15 ft by 12 ft room, 19.209373² is about 369, which equals 225 + 144.
Frequently asked questions
How do I find the hypotenuse of a right triangle?
Square both legs, add the squares and take the square root. With legs of 3 and 4, c = √25 = 5.
How do I find a missing leg?
Square the hypotenuse and the known leg, subtract the second from the first and take the square root. With c = 5 and a = 3, b = √16 = 4.
Does the theorem work for any triangle?
No, only for a right triangle. The calculator cannot check for a right angle, so use a general triangle solver if you are not sure.
Can I use any unit?
Yes, as long as every side is in the same unit. The answer is in that unit as well.
