Lelifi·tools

Pythagorean Theorem Calculator

A right triangle with legs of 3 and 4 has a hypotenuse of 5 (9 + 16 = 25). It also has an area of 6, a perimeter of 12 and angles of 36.87 and 53.13 degrees.

Pick the side you want to find, then enter the other two. All calculations run in your browser.

Box diagonal (optional)

Enter any two sides of a right triangle to get the third side, the area, the perimeter, both angles and a 3D diagonal, with each step shown.

By the Lelifi editors ·

Key takeaways

A 3-4-5 triangle with a square on each side a^2 = 9 b^2 = 16 c^2 = 25 a = 3 b = 4 c = 5 The two leg squares add up to the hypotenuse square: 9 + 16 = 25
The squares on the legs of a 3-4-5 triangle total the square on the hypotenuse.
An 8 ft ladder, 2 ft from the wall 8 ft ladder 2 ft h = 7.75 ft h^2 = 8^2 - 2^2 h^2 = 64 - 4 = 60 h = 7.746 ft
The ladder is the hypotenuse. Subtract the base square from the ladder square to get the height.
On this page
  1. The formula and the three sides
  2. Finding the hypotenuse
  3. Finding a missing leg
  4. Area, perimeter and the altitude
  5. Angles from side lengths
  6. Right, acute or obtuse: the converse
  7. Pythagoras in three dimensions and on screens
  8. Where the theorem stops applying

The formula and the three sides

The Pythagorean theorem links the three sides of a right triangle: the squares of the two shorter sides add up to the square of the longest side.

a^2 + b^2 = c^2

Side c is the hypotenuse, the side across from the 90 degree corner, and it is always the longest of the three. Sides a and b are the legs, the two sides that meet at the right angle. NASA's Glenn Research Center states the theorem the same way and notes that the square on the hypotenuse has the same area as the two leg squares combined.

The theorem works in one direction only: it applies to right triangles. MIT's Blossoms geometry notes give the area proof: four copies of the triangle sit inside a square of side a + b, and the uncovered area is c^2.

That proof is worth reading once, because it explains why the formula adds squares rather than sides. A triangle with a 91 degree corner does not satisfy it, and using the formula there returns a side that is too long. The last section covers the general version for those triangles.

Finding the hypotenuse

When the two legs are known, add their squares and take the square root:

c = square root of (a^2 + b^2)

A stair stringer is the board that carries the steps. If a staircase rises 7.5 ft over a run of 10 ft, the stringer is the hypotenuse: 7.5^2 + 10^2 = 56.25 + 100 = 156.25, and the square root of 156.25 is 12.5 ft. Buy a 13 ft board and cut it to length.

Squaring before adding is the part that catches people. Adding the sides first gives 17.5, which is a full 5 ft longer than the true diagonal. The square root of a sum is not the sum of the square roots, so 7.5 + 10 is not the answer.

The same arithmetic covers most household jobs. Each row below uses only the formula above.

JobKnown sidesWorkAnswer
Ladder against a wallLadder 8 ft, base 2 ft from the wall8^2 - 2^2 = 64 - 4 = 607.75 ft up the wall
Stair stringerRise 7.5 ft, run 10 ft7.5^2 + 10^2 = 56.25 + 100 = 156.2512.5 ft stringer
55 inch television, 16:9Diagonal 55 in, ratio 16 to 955 x 16 / 18.36 = 47.947.9 by 27.0 in
Box diagonalSides 3 ft, 4 ft, 12 ft3^2 + 4^2 + 12^2 = 9 + 16 + 144 = 16913 ft

In every row the unknown is the longest side or a leg, never both. That is the signal for which version of the formula to use: two legs known means add, hypotenuse and one leg known means subtract.

Finding a missing leg

When the hypotenuse and one leg are known, subtract instead of adding:

a = square root of (c^2 - b^2)

An 8 ft ladder stands 2 ft from a wall. The ladder is the hypotenuse and the ground gap is one leg, so the height on the wall is the other leg: 8^2 - 2^2 = 64 - 4 = 60, and the square root of 60 is 7.746 ft. The top of the ladder sits about 7 ft 9 in up the wall.

The subtraction only works if the hypotenuse is the longest side. If c is shorter than b, the square under the root goes negative and there is no real triangle. A calculator that returns a number there is hiding an input error, which is why this page reports "no real triangle" instead.

Area, perimeter and the altitude

Once all three sides are known, the rest of the triangle follows without trigonometry. For a right triangle the legs are the base and the height, so the area is half their product:

area = a x b / 2

A 3-4-5 triangle has area 3 x 4 / 2 = 6 square units and perimeter 3 + 4 + 5 = 12. The altitude drawn from the right angle to the hypotenuse is a x b / c, which is 12 / 5 = 2.4. The circle that fits inside the triangle has radius (a + b - c) / 2 = (3 + 4 - 5) / 2 = 1.

Those four numbers, area, perimeter, altitude and inradius, are what most carpentry and geometry problems ask for. The side length is only the first step.

Whole-number triples are worth memorizing because they skip the square root entirely. The six below are the ones that show up in framing, layout and test questions.

abcAreaPerimeterAngle AAngle B
34561236.87°53.13°
51213303022.62°67.38°
81517604028.07°61.93°
72425845616.26°73.74°
2021292107043.60°46.40°
940411809012.68°77.32°

Each row satisfies a^2 + b^2 = c^2 exactly. A 20-21-29 triangle, for instance, gives 400 + 441 = 841, and the square root of 841 is 29. The angles are not round numbers even when the sides are.

Angles from side lengths

A right triangle has one angle fixed at 90 degrees, so the other two add up to 90. Their sizes come straight from the side ratios:

sin A = a / c, cos A = b / c, tan A = a / b

In the 3-4-5 triangle, angle A is the inverse sine of 3/5, which is 36.87 degrees, and angle B is the inverse sine of 4/5, which is 53.13 degrees. The two add to 90, as they must.

The ratios are scale free: a 6-8-10 triangle has the same angles as a 3-4-5 triangle because every side doubled. That is why roof pitches and ramps can be described by rise and run alone, with no lengths attached.

Right, acute or obtuse: the converse

The theorem runs backwards too. Take the longest side as c and compare a^2 + b^2 with c^2. If the two sides are equal, the triangle is right. If the sum is larger, the angle across from c is acute. If the sum is smaller, that angle is obtuse.

Sidesa^2 + b^2c^2CompareTriangle
3, 4, 52525equalright
6, 8, 910081greateracute
6, 8, 11100121lessobtuse
5, 12, 14169196lessobtuse

The comparison only works with the longest side in the c slot. Put a shorter side there and every triangle looks obtuse. A 6-8-9 triangle is acute because 36 + 64 = 100 is greater than 81, while 6-8-11 is obtuse because 100 is less than 121.

Pythagoras in three dimensions and on screens

The theorem extends to three dimensions by applying it twice. The diagonal of a box is the square root of the sum of all three squared sides:

d = square root of (x^2 + y^2 + z^2)

A box 3 ft by 4 ft by 12 ft has a diagonal of 13 ft, because 9 + 16 + 144 = 169. The same arithmetic sizes a television: a 55 inch set with a 16:9 screen has a diagonal of 55, and the width and height follow from the ratio. The ratio's own diagonal is the square root of 16^2 + 9^2, which is 18.36, so the width is 55 x 16 / 18.36 = 47.9 in and the height is 55 x 9 / 18.36 = 27.0 in.

Check it: 47.94^2 + 26.96^2 = 2,298.2 + 726.8 = 3,025, and the square root of 3,025 is 55. The screen fits a 48 by 27 inch opening, which is why a 55 inch set rarely fits a cabinet built for a 50 inch one.

Where the theorem stops applying

The formula is exact for right triangles and wrong for everything else. For a triangle with sides a and b meeting at angle C, the general rule is the law of cosines:

c^2 = a^2 + b^2 - 2 x a x b x cos C

Two sides of 6 and 8 with a 60 degree angle between them give c^2 = 36 + 64 - 48 = 52, so c = 7.21. The Pythagorean answer would be 10, which is off by almost 3.

Two more limits matter in practice. The theorem measures straight-line distance on a flat surface, so it does not give the shortest path on a sphere or a curved roof. And it assumes the measurements are exact: a 1/8 inch error on each leg of a 3-4-5 triangle moves the hypotenuse from 5 to 5.175 inches, which is fine for a deck and not fine for a machine part.

Units have to match before any of this works. The table below converts the common ones; convert first, then square.

MeasureInchesFeetCentimeters
1 foot12130.48
1 meter39.373.281100
1 inch10.08332.54

Squaring a number in feet and a number in inches gives a meaningless result. Pick one unit for all three sides before you start.

Frequently asked questions

How do I find the hypotenuse of a right triangle?

Square both legs, add them, and take the square root. Legs of 6 and 8 give 36 + 64 = 100, so the hypotenuse is 10. Legs of 7.5 and 10 give 156.25, so the hypotenuse is 12.5.

How do I find a missing leg?

Square the hypotenuse and the known leg, subtract, then take the square root. An 8 ft ladder 2 ft from a wall reaches 8^2 - 2^2 = 60, and the square root of 60 is 7.746 ft.

What is the 3-4-5 rule?

A triangle with sides 3, 4 and 5 has a right angle between the two shorter sides, because 9 + 16 = 25. Builders use it to square a corner: measure 3 ft one way, 4 ft the other, and the diagonal should be 5 ft.

What are some other Pythagorean triples?

5-12-13, 8-15-17, 7-24-25, 20-21-29 and 9-40-41 are the common ones. Any multiple works too: 6-8-10 and 9-12-15 are scaled 3-4-5 triangles.

How do I find the area of a right triangle?

Multiply the two legs and divide by 2. A 3-4-5 triangle has area 3 x 4 / 2 = 6 square units, and its perimeter is 12.

How do I find the angles?

Use inverse sine: A = asin(a / c). In a 3-4-5 triangle, asin(3/5) = 36.87 degrees and asin(4/5) = 53.13 degrees. The two acute angles always add to 90.

Is a 6-8-9 triangle a right triangle?

No. 36 + 64 = 100, which is greater than 81, so the triangle is acute. A 6-8-10 triangle is right because 100 equals 100.

Does the theorem work for any triangle?

No. It holds only when one angle is exactly 90 degrees. For other triangles use the law of cosines: c^2 = a^2 + b^2 - 2ab cos C.

What is the diagonal of a box 3 by 4 by 12?

13. Square all three sides, add them, and take the root: 9 + 16 + 144 = 169, and the square root of 169 is 13.

What are the dimensions of a 55 inch 16:9 screen?

About 47.9 by 27.0 inches. The ratio diagonal is 18.36, so width = 55 x 16 / 18.36 and height = 55 x 9 / 18.36.

Why do I get an error when solving for a leg?

The hypotenuse must be longer than either leg. If the number you entered for c is smaller than b, then c^2 - b^2 is negative and no real triangle exists.

Can the theorem be used for distance on a map?

Only over short distances on a flat surface. On a sphere, the shortest path is a great circle, and the flat formula overstates the distance as the area grows.

How accurate is the result if my measurements are rough?

Errors grow with the sides. A 1/8 inch error on each leg of a 3-4-5 triangle moves the hypotenuse to 5.175 inches, about 0.17 inch long, so measure the longest side you can.

Spotted a wrong number or a broken result?

More Math tools

See all Math tools

Fee schedules, rates and rules change without notice. Always confirm important figures with the official source before you rely on them.