Skip to content

Pythagorean theorem: formula and examples

Updated on June 30, 2026 · by Rafael Rossi

The Pythagorean theorem states that in a right triangle, the square of the hypotenuse equals the sum of the squares of the other two sides. It is probably the most useful formula school teaches — and the one people most often forget they are allowed to use outside an exam.

The formula

a² + b² = c²

Where c is the hypotenuse (the side opposite the 90° angle, always the longest) and a and b are the legs. Rearranged for each unknown:

  • Find the hypotenuse: c = √(a² + b²)
  • Find a leg: a = √(c² − b²)

Worked example

A 5 ft ladder leaning against a wall reaches 4 ft up. How far is its base from the wall?

  1. The ladder is the hypotenuse: c = 5. The height is a leg: b = 4.
  2. a² = 5² − 4² = 25 − 16 = 9
  3. a = √9 = 3 feet

The most valuable use: squaring up a build

This is why the theorem shows up on job sites every day, with almost nobody calling it by name.

To guarantee a corner is exactly 90° — on a wall, a foundation, a deck, a garden bed — use the 3-4-5 method:

  1. From the corner, measure 3 units along one side and mark it.
  2. Measure 4 units along the other side and mark it.
  3. Measure between the two marks. Exactly 5 units means the corner is square. More than 5 means the angle is over 90°; less means under.

It works because 3² + 4² = 9 + 16 = 25 = 5². And it works in any unit and any multiple: 6-8-10 feet gives the same answer with more precision, because the larger the triangle, the smaller the effect of a small measuring error.

That is the theorem run backwards — its converse: if three sides satisfy a² + b² = c², then the angle is right. It is the only practical way to verify a 90° corner with nothing but a tape measure.

Triples worth knowing

Pythagorean triples are sets of three whole numbers that satisfy the formula. Recognising them saves you a square root:

TripleCheck
3 – 4 – 59 + 16 = 25
5 – 12 – 1325 + 144 = 169
8 – 15 – 1764 + 225 = 289
7 – 24 – 2549 + 576 = 625
9 – 40 – 4181 + 1,600 = 1,681

Any multiple of a triple is also a triple: 6-8-10, 9-12-15, 30-40-50.

Other everyday uses

  • Room diagonal. A room 12 × 14 ft has a diagonal of 18.44 ft — the number that decides whether a couch clears the turn or a long piece of furniture fits down a hallway upright.
  • TV size. Television inches measure the diagonal, not the width. A 65" 16:9 TV is 56.7" wide and 31.9" tall — which is the information that actually tells you whether it fits the console.
  • Distance between two points. The distance formula on a coordinate plane, d = √((x₂−x₁)² + (y₂−y₁)²), is literally Pythagoras applied to the triangle formed by the coordinate differences. It is what a GPS does at scale.
  • Cable, ramp and roof. The length of a cable run diagonally, of a ramp with known rise and run, or of a roof's hip — all hypotenuses.

When the theorem does not apply

Pythagoras holds only in right triangles. Applying it to any other triangle produces a wrong number with no warning whatsoever.

For triangles without a 90° angle, the generalisation is the law of cosines: c² = a² + b² − 2ab·cos(C). Notice that when C = 90°, the cosine is zero and the last term vanishes — Pythagoras is simply the special case.

Frequently asked questions

How do I know which side is the hypotenuse? It is always opposite the right angle, and always the longest of the three. If you place the longest side where a leg belongs, the calculation asks for the square root of a negative number — the error announces itself.

Does it work in three dimensions? It does, applied twice: the diagonal of a box with sides a, b and c is √(a² + b² + c²). That is how you work out whether a rod fits diagonally inside a container.

Why 3-4-5 and not some other combination? Because it is the smallest triple of whole numbers that satisfies the formula — the easiest to measure and remember in the field. Any other triple works just as well.

Is the theorem really Pythagoras's? The relationship was known and used by Babylonians and Egyptians centuries earlier, for exactly this practical purpose of squaring up land. What the Pythagorean school contributed was the general proof — the demonstration that it holds for every right triangle, not just the cases anyone had tested.

Open the calculator: Pythagorean theorem →