Skip to main content

DigitalCalculators.net

Updated 13 November 2026 · Written by the Digital Calculators team

Key takeaways

  • In a right triangle, a² + b² = c², where c is the hypotenuse, the side opposite the right angle.
  • Hypotenuse: c = √(a² + b²). Missing leg: a = √(c² − b²).
  • 3-4-5 is the simplest whole-number right triangle, and builders use it (or 6-8-10) to check a corner is square.
  • OSHA’s ladder rule puts the foot one quarter of the working length out, which works out at about 75.5°.
  • It also works backwards: if a² + b² = c², the triangle has a right angle.

The Pythagorean theorem is one of the most useful formulas in everyday maths. It says that in any right triangle, the squares of the two shorter sides add up to the square of the longest side: a² + b² = c². A triangle with sides 3 and 4 has a longest side of 5, because 9 + 16 = 25.

That one relationship lets you find a length you cannot measure directly from two you can: the diagonal of a TV screen, how high a ladder reaches, the length of a roof rafter, or whether the corner of a deck is truly square. This guide explains the formula in plain terms, works through finding both the hypotenuse and a missing leg, lists the whole-number triangles worth knowing, shows a picture proof of why it works, and finishes with practical uses, including the ladder rule from federal workplace safety regulations. Our Pythagorean theorem calculator is built into the page for your own numbers.

Visual proof of the Pythagorean theorem: two equal squares each holding four right triangles, leaving c squared in one and a squared plus b squared in the other
Same big square, same four triangles: the space left over shows that c² = a² + b².

The formula and what each letter means

The OpenStax Prealgebra textbook states the theorem like this: in any right triangle ABC, a² + b² = c², where c is the length of the hypotenuse and a and b are the lengths of the legs.

  • A right triangle is a triangle with one angle of exactly 90°, a square corner.
  • The hypotenuse (c) is the side opposite that right angle. It is always the longest side.
  • The legs (a and b) are the two sides that form the right angle. It does not matter which one you call a and which b.

The theorem only applies to right triangles. For any other triangle, a² + b² will be bigger or smaller than c², which is actually useful, as we will see later.

“Squared” here means multiplied by itself, and the reverse step uses the square root. As OpenStax puts it, if m = n², then √m = n (for n ≥ 0). So to get a length back from a² + b², you take the square root.

How to find the hypotenuse

When you know both legs, square each one, add them, and take the square root:

c = √(a² + b²)

Example 1: whole numbers

Legs of 6 and 8: 6² + 8² = 36 + 64 = 100, and √100 = 10.

Example 2: decimals

Legs of 7 and 9: 7² + 9² = 49 + 81 = 130, and √130 = 11.40. Most answers will not be whole numbers, so round to a sensible precision at the end, not before.

Example 3: a TV screen

TVs are sold by their diagonal, which is the hypotenuse of the screen. A 65-inch screen with the usual 16:9 shape has width and height in the ratio 16 to 9. A 16 by 9 rectangle has a diagonal of √(16² + 9²) = √337 = 18.358, so each “unit” here is 65 ÷ 18.358 = 3.541 inches. That makes the screen 56.7 in wide and 31.9 in tall, which is what you need to check it will fit a wall space or cabinet.

Try your own numbers in the calculator below.

How to find a missing leg

When you know the hypotenuse and one leg, rearrange the formula to subtract instead of add:

a = √(c² − b²)

Always subtract the leg from the hypotenuse, never the other way round. The hypotenuse is the longest side, so c² − b² is always positive.

Example 1

Hypotenuse 13, one leg 5: 13² − 5² = 169 − 25 = 144, and √144 = 12.

Example 2: a ramp

A 12 ft ramp that rises 1 ft: the ramp is the hypotenuse and the rise is one leg, so the horizontal distance it covers is √(12² − 1²) = √143 = 11.96 ft.

Example 3: a corner brace

OpenStax has a neat version of this. A 10-inch bracket is to be fixed diagonally across a corner, the same distance down each side. If both legs are x, then x² + x² = 10², so 2x² = 100 and x = √50 = 7.07 inches from the corner on each side.

Pythagorean triples worth knowing

A Pythagorean triple is a set of three whole numbers that fit a² + b² = c² exactly. They are handy because they give you a right triangle with no square roots to worry about. These are the first ten “primitive” triples, meaning they are not just multiples of a smaller one:

abcCheck
3459 + 16 = 25
5121325 + 144 = 169
8151764 + 225 = 289
7242549 + 576 = 625
202129400 + 441 = 841
123537144 + 1225 = 1369
9404181 + 1600 = 1681
284553784 + 2025 = 2809
116061121 + 3600 = 3721
3356651089 + 3136 = 4225

Any multiple of a triple is also a triple. 3-4-5 gives 6-8-10, 9-12-15, 12-16-20 and so on, because multiplying all three sides by the same number keeps the shape.

All of these come from a formula attributed to Euclid: pick two whole numbers m > n, then a = m² − n², b = 2mn and c = m² + n². For m = 2 and n = 1 that gives 3, 4 and 5; for m = 3 and n = 2 it gives 5, 12 and 13.

The 3-4-5 rule for square corners

Builders use the 3-4-5 triple to check that a corner is exactly 90°. Measure 3 ft along one edge and 4 ft along the other, and the diagonal between those marks should be exactly 5 ft. For bigger layouts, such as a deck or a slab, scale it up: 6-8-10 or 9-12-15. If the diagonal is long, the angle is more than 90°; if short, it is less.

A picture proof: why it works

There are hundreds of proofs of the theorem. The one in our image above needs no algebra beyond area.

  1. Draw a big square with sides a + b. Inside it, place four copies of the right triangle, one in each corner, so that their hypotenuses form a tilted square in the middle. That middle square has area c².
  2. Draw a second big square of the same size, a + b. Arrange the same four triangles into two rectangles in opposite corners. The empty spaces left over are a square of side a and a square of side b, with areas a² and b².
  3. Both big squares have the same area, and both contain the same four triangles. So the space left over must also be equal: c² = a² + b².

You can check it with numbers. With a = 3 and b = 4, the big square is 7 × 7 = 49. Each triangle is 3 × 4 ÷ 2 = 6, so four of them make 24. The leftover space is 49 − 24 = 25 in both pictures: 5² on the left, and 3² + 4² = 9 + 16 on the right.

Real-world uses

Setting up a ladder safely

OSHA’s construction rules (29 CFR 1926.1053) say a ladder that leans against a support should be used at an angle where the horizontal distance from the top support to the foot is about one-quarter of the working length of the ladder. That is the Pythagorean theorem in action. For a ladder with a 20 ft working length, the foot goes 5 ft out from the wall, and the ladder reaches √(20² − 5²) = √375 = 19.36 ft up the wall. The angle with the ground is about 75.5°.

The same section requires the side rails to extend at least 3 ft above an upper landing you are climbing onto. To reach a 16 ft roof edge at the 1-in-4 angle, the rails must run about 16.5 ft to the edge, and the 3 ft of height above it takes another 3.1 ft of rail at that slope. That is 19.6 ft of usable ladder in total. Extension ladders lose some length to the overlap of their sections, so check the manufacturer’s maximum working length rather than the nominal size.

Roof rafters

A roof with a 6/12 pitch rises 6 inches for every 12 inches of horizontal run. Over a 14 ft run, it rises 7 ft, so the rafter length (before any overhang) is √(14² + 7²) = 15.65 ft. Our roof pitch calculator and stair calculator both rely on this.

The diagonal of a room or box

The theorem works in three dimensions by applying it twice. A room 12 ft long and 10 ft wide has a floor diagonal of √(144 + 100) = 15.62 ft. Add an 8 ft ceiling and the longest straight line from a floor corner to the opposite ceiling corner is √(12² + 10² + 8²) = 17.55 ft, useful for knowing whether a long item can be carried in.

Distance between two points

On a map grid or graph, the straight-line distance between (2, 3) and (10, 9) is the hypotenuse of a triangle with legs 10 − 2 = 8 and 9 − 3 = 6, so the distance is √(64 + 36) = 10. This is the distance formula, and our distance formula calculator does it for any two points.

Is it a right triangle? Using the converse

The theorem also works in reverse: if the three sides of a triangle satisfy a² + b² = c² (with c the longest side), then the triangle has a right angle. And if they do not, the comparison tells you what kind of triangle it is:

  • a² + b² = c²: right angle.
  • a² + b² > c²: all angles are less than 90° (acute).
  • a² + b² < c²: the largest angle is more than 90° (obtuse).
Sidesa² + b²c²Triangle
5, 12, 1325 + 144 = 169169Right
6, 7, 936 + 49 = 8581Acute
4, 5, 716 + 25 = 4149Obtuse
7, 24, 2549 + 576 = 625625Right

This is exactly why the 3-4-5 check works on a building site: if the measured diagonal squared equals the sum of the two side lengths squared, the corner is square.

Common mistakes

  • Using the wrong side as c. The hypotenuse is always opposite the right angle and always the longest side.
  • Adding the sides instead of their squares. 3 + 4 is not 5; 9 + 16 is 25, and √25 is 5.
  • Forgetting the square root. a² + b² gives c², not c.
  • Rounding too early. Keep full precision until the final answer.
  • Using it on a triangle without a right angle. For those, use the law of cosines; our triangle calculator handles any triangle.

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

How do I find the hypotenuse?

Square both legs, add them, and take the square root: c = √(a² + b²). Legs of 6 and 8 give √100 = 10.

How do I find a missing leg?

Subtract the square of the known leg from the square of the hypotenuse and take the square root: a = √(c² − b²). With c = 13 and b = 5, a = 12.

Does the Pythagorean theorem work for all triangles?

No, only for right triangles. For other triangles, use the law of cosines.

What is a Pythagorean triple?

Three whole numbers that satisfy a² + b² = c², such as 3-4-5, 5-12-13 and 8-15-17. Any multiple, such as 6-8-10, also works.

How do builders use the 3-4-5 rule?

They measure 3 units along one side and 4 along the other; if the diagonal between the marks is exactly 5, the corner is 90°. Larger versions such as 6-8-10 are used for bigger layouts.

How far from the wall should a ladder be?

OSHA’s rule for leaning ladders is a horizontal distance of about one quarter of the working length. For a 20 ft working length, that is 5 ft, and the ladder reaches about 19.4 ft high.

How do I know if a triangle is a right triangle?

Check whether the two shorter sides squared add up to the longest side squared. If they do, it has a right angle.

Sources

  1. Prealgebra 2e, 9.3 Use Properties of Angles, Triangles, and the Pythagorean Theorem, OpenStax, Rice University. Statement of the theorem, definitions of hypotenuse and legs, square roots and the corner-bracket example.
  2. 29 CFR 1926.1053, Ladders, Occupational Safety and Health Administration (eCFR). The one-quarter ladder angle rule and the 3 ft extension above a landing.