How to Use the Pythagorean Theorem (a² + b² = c²)

Find any missing side of a right triangle with a² + b² = c². Worked examples for ladders, screens, square corners and 3D diagonals.

The Pythagorean theorem says that in any right triangle, a² + b² = c², where a and b are the two legs and c is the hypotenuse, the longest side opposite the right angle. If the legs are 6 and 8, the hypotenuse is √(36 + 64) = √100 = 10. To find a missing leg, subtract: a = √(c² − b²).

The theorem is named for the Greek mathematician Pythagoras, though Babylonian and Indian mathematicians used the relationship centuries earlier. It remains one of the most used formulas in construction, navigation, design and physics.

The formulas

c = √(a² + b²)   (hypotenuse)
a = √(c² − b²)   (a leg)

Steps

  1. Confirm the triangle has a 90° angle.
  2. Identify the hypotenuse: the side across from the right angle.
  3. Square the two known sides.
  4. Add them if you want the hypotenuse; subtract the smaller from the larger if you want a leg.
  5. Take the square root.

Worked examples

Finding the hypotenuse: a rectangle’s diagonal

A rectangular room is 12 feet by 16 feet. How long is the diagonal?

c = √(12² + 16²) = √(144 + 256) = √400 = 20 ft

Finding a leg: a ladder against a wall

A 20-foot ladder stands with its base 5 feet from the wall. How high does it reach?

a = √(20² − 5²) = √(400 − 25) = √375 ≈ 19.36 ft

OSHA ladder rules call for setting the foot of a leaning ladder out about one-quarter of its working length, roughly a 4-to-1 ratio. Here 19.36 ÷ 5 ≈ 3.9, close to that guideline.

Screen sizes

TVs and monitors are sold by their diagonal. For a 55-inch screen with a 16:9 aspect ratio, the diagonal of a 16 × 9 rectangle is √(16² + 9²) = √337 ≈ 18.36 units, so:

Width = 55 × 16 ÷ 18.36 ≈ 47.9 in

Height = 55 × 9 ÷ 18.36 ≈ 27.0 in

The screen size calculator does this for any diagonal and aspect ratio, and how to calculate aspect ratio explains the ratios themselves.

A roof rafter

A roof rises 4 feet over a horizontal run of 12 feet. The rafter length (before overhang) is √(12² + 4²) = √160 ≈ 12.65 ft. Stair stringers work the same way, with the total rise and run as the legs; see how to calculate stairs.

Pythagorean triples

Some right triangles have whole-number sides. Knowing them saves time and makes great mental-math checks.

Triple Check
3, 4, 5 9 + 16 = 25
5, 12, 13 25 + 144 = 169
8, 15, 17 64 + 225 = 289
7, 24, 25 49 + 576 = 625
20, 21, 29 400 + 441 = 841
9, 40, 41 81 + 1,600 = 1,681

Any multiple of a triple is also a triple: 6-8-10, 9-12-15 and 30-40-50 all come from 3-4-5. You can generate new triples with Euclid’s formula: pick whole numbers m > n, then 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.

Squaring a corner with 3-4-5

Builders use the triple to lay out right angles for foundations, decks, patios and walls:

  1. From the corner, measure 3 feet along one line and mark it.
  2. Measure 4 feet along the other line and mark it.
  3. Measure between the marks. If it reads exactly 5 feet, the corner is square.

For larger layouts, use 6-8-10 or 9-12-15 feet; the bigger triangle magnifies small errors so they are easier to see. A related check for a rectangle is to compare its two diagonals; they are equal only if every corner is square.

The converse: is this a right triangle?

The theorem also works backward. Compare the square of the longest side with the sum of the squares of the other two:

Result Triangle type
c² = a² + b² Right
c² < a² + b² Acute (all angles under 90°)
c² > a² + b² Obtuse (one angle over 90°)

For sides 7, 9 and 12: 7² + 9² = 130 and 12² = 144. Since 144 > 130, the triangle is obtuse.

Extensions

Distance between two points

On a coordinate grid, the horizontal and vertical gaps form the legs of a right triangle:

d = √[(x2 − x1)² + (y2 − y1)²]

From (1, 2) to (7, 10): √(6² + 8²) = √100 = 10. The distance calculator handles any pair of points.

Three dimensions

For the space diagonal of a box with length l, width w and height h, apply the theorem twice:

d = √(l² + w² + h²)

A 3 × 4 × 12 box has a space diagonal of √(9 + 16 + 144) = √169 = 13. That tells you the longest rod that fits inside.

Non-right triangles

When there is no right angle, use the law of cosines, c² = a² + b² − 2ab cos C. With C = 90°, cos C = 0 and the formula becomes the Pythagorean theorem. The law of cosines calculator covers those cases, and the trigonometric ratios that link right-triangle sides to angles are explained in SOHCAHTOA explained.

Common mistakes

  • Adding when finding a leg. If you know the hypotenuse, subtract. A leg can never be longer than the hypotenuse.
  • Forgetting the square root. 6² + 8² = 100, but the side is 10.
  • Adding the sides before squaring. (6 + 8)² = 196 is not 6² + 8².
  • Mixing units. Convert feet and inches to one unit first.

For any right triangle, the Pythagorean theorem calculator finds the missing side, and the right triangle calculator adds the angles, area and perimeter.

Frequently asked questions

What is the Pythagorean theorem?

In a right triangle, the square of the hypotenuse equals the sum of the squares of the other two sides: a² + b² = c². The hypotenuse c is the longest side, opposite the right angle.

How do I find a missing leg instead of the hypotenuse?

Subtract instead of add: a = √(c² − b²). For a 20-foot ladder with its base 5 feet from a wall, the height reached is √(20² − 5²) = √375 ≈ 19.36 feet.

Does the Pythagorean theorem work for all triangles?

No, only right triangles. For other triangles, use the law of cosines, c² = a² + b² − 2ab cos C, which reduces to the Pythagorean theorem when angle C is 90°.

What is the 3-4-5 rule in construction?

It is a way to check a square corner. Measure 3 units along one side and 4 along the other; if the diagonal between the marks is exactly 5, the corner is 90°. Multiples such as 6-8-10 or 9-12-15 are more accurate on larger layouts.

How do you know which side is the hypotenuse?

It is the side opposite the right angle and always the longest side. In a² + b² = c², c must be the hypotenuse; mixing up the sides is the most common error.