The Pythagorean Theorem
The Pythagorean Theorem
Definition: In any right triangle, the sum of the squares of the two legs equals the square of the hypotenuse — a² + b² = c² — a relationship that holds for every right triangle regardless of size or proportion, and whose converse turns it into a test for “is this triangle right?” using nothing but the three side lengths.
How It Works
- A right triangle has exactly one 90° angle. The two shorter sides that form that angle are the legs (a and b); the side opposite the right angle — always the longest side — is the hypotenuse (c).
- The theorem states a² + b² = c²: the sum of the squares of the two legs always equals the square of the hypotenuse, for every right triangle, no matter how long or short its sides are.
- The converse runs the same logic backward: if three side lengths satisfy a² + b² = c², the triangle they form is guaranteed to have a right angle — even if no angle was ever measured. This turns the theorem into a test, not just a formula.
- A Pythagorean triple is a set of three positive integers that satisfy a² + b² = c² exactly, like (3, 4, 5) or (5, 12, 13). Scaling any triple by a whole number produces another triple: (3, 4, 5) → (6, 8, 10) → (9, 12, 15).
- Solving for the hypotenuse: c = √(a² + b²). Solving for a missing leg: isolate its square first — for example a² = c² − b² — then take the square root.
- The classic area proof makes the theorem literal rather than symbolic: draw an actual square on each of the three sides. The combined area of the two smaller squares (on the legs) exactly equals the area of the larger square (on the hypotenuse).
- The distance formula, d = √((x₂−x₁)² + (y₂−y₁)²), is the Pythagorean theorem in disguise: the horizontal and vertical gaps between two points form the legs of a right triangle, and the straight-line distance between the points is its hypotenuse.
- In three dimensions the theorem extends to a box’s space diagonal: applying it twice — once across the base, once up through the height — gives d = √(a² + b² + c²) for a box with edges a, b, and c.
- The theorem applies only to right triangles. For any other triangle, the more general Law of Cosines (c² = a² + b² − 2ab·cos C) is needed, and it collapses into the Pythagorean theorem exactly when C = 90°, since cos 90° = 0 erases the extra term.
- Because c² is a sum of two positive squares, c is always the largest of the three sides — the hypotenuse is always longer than either leg alone, though always shorter than their sum.
Illustration
var labelA = document.getElementById(‘pyth-label-a’); var labelB = document.getElementById(‘pyth-label-b’); var labelC = document.getElementById(‘pyth-label-c’); var sqLabelA = document.getElementById(‘pyth-sqlabel-a’); var sqLabelB = document.getElementById(‘pyth-sqlabel-b’); var sqLabelC = document.getElementById(‘pyth-sqlabel-c’);
var eqTxt = document.getElementById(‘pyth-eq’); var squaresTxt = document.getElementById(‘pyth-squares-txt’); var cTxt = document.getElementById(‘pyth-c-txt’); var tripleTxt = document.getElementById(‘pyth-triple-txt’);
var aIn = document.getElementById(‘pyth-a’); var bIn = document.getElementById(‘pyth-b’); var aOut = document.getElementById(‘pyth-a-out’); var bOut = document.getElementById(‘pyth-b-out’); var resetBtn = document.getElementById(‘pyth-reset’);
function fmt(n) { return n.toFixed(2); } function isNearInt(n) { return Math.abs(n - Math.round(n)) < 0.01; } function pts(list) { return list.map(function (p) { return p[0].toFixed(2) + ’,’ + p[1].toFixed(2); }).join(’ ’); }
function update() { var a = parseFloat(aIn.value); var b = parseFloat(bIn.value); var c = Math.sqrt(a * a + b * b); aOut.textContent = fmt(a); bOut.textContent = fmt(b);
var O = [ox, oy];
var Pa = [ox + a * s, oy];
var Pb = [ox, oy - b * s];
triangle.setAttribute('points', pts([O, Pa, Pb]));
// Square on leg a sits below the horizontal leg, outside the triangle.
var aCorners = [O, Pa, [Pa[0], Pa[1] + a * s], [O[0], O[1] + a * s]];
sqA.setAttribute('points', pts(aCorners));
// Square on leg b sits left of the vertical leg, outside the triangle.
var bCorners = [O, Pb, [Pb[0] - b * s, Pb[1]], [O[0] - b * s, O[1]]];
sqB.setAttribute('points', pts(bCorners));
// Square on the hypotenuse: draw it unrotated in a local frame anchored
// at Pa, with one edge of length c*s running along +x, then rotate the
// whole shape about Pa by the hypotenuse's own direction (Math.atan2 of
// Pb - Pa). That maps the local edge exactly onto segment Pa->Pb, and
// the square's far corners land on the outside of the triangle, away
// from the right-angle vertex O -- SVG's rotate(deg, cx, cy) uses the
// same y-down pixel convention as these coordinates, so no extra sign
// flip is needed beyond what atan2 already gives.
var h = c * s;
var thetaRad = Math.atan2(Pb[1] - Pa[1], Pb[0] - Pa[0]);
var thetaDeg = thetaRad * 180 / Math.PI;
var localC = [Pa, [Pa[0] + h, Pa[1]], [Pa[0] + h, Pa[1] + h], [Pa[0], Pa[1] + h]];
sqC.setAttribute('points', pts(localC));
sqC.setAttribute('transform', 'rotate(' + thetaDeg.toFixed(3) + ' ' + Pa[0].toFixed(2) + ' ' + Pa[1].toFixed(2) + ')');
// The actual (rotated) corners, needed only to center the c² label.
var cCorners = localC.map(function (p) {
var dx = p[0] - Pa[0], dy = p[1] - Pa[1];
return [
Pa[0] + dx * Math.cos(thetaRad) - dy * Math.sin(thetaRad),
Pa[1] + dx * Math.sin(thetaRad) + dy * Math.cos(thetaRad)
];
});
function centroid(list) {
var x = 0, y = 0;
list.forEach(function (p) { x += p[0]; y += p[1]; });
return [x / list.length, y / list.length + 4];
}
var ca = centroid(aCorners), cb = centroid(bCorners), cc = centroid(cCorners);
sqLabelA.setAttribute('x', ca[0]); sqLabelA.setAttribute('y', ca[1]);
sqLabelB.setAttribute('x', cb[0]); sqLabelB.setAttribute('y', cb[1]);
sqLabelC.setAttribute('x', cc[0]); sqLabelC.setAttribute('y', cc[1]);
// Side labels a, b, c, nudged a few pixels into the triangle's interior.
labelA.setAttribute('x', (O[0] + Pa[0]) / 2);
labelA.setAttribute('y', O[1] - 8);
labelB.setAttribute('x', O[0] + 12);
labelB.setAttribute('y', (O[1] + Pb[1]) / 2 + 4);
var midCx = (Pa[0] + Pb[0]) / 2, midCy = (Pa[1] + Pb[1]) / 2;
labelC.setAttribute('x', midCx - 12 * b / c);
labelC.setAttribute('y', midCy + 12 * a / c + 4);
eqTxt.textContent = fmt(a) + '² + ' + fmt(b) + '² = ' + fmt(c) + '²';
squaresTxt.textContent = 'a² = ' + fmt(a * a) + ' b² = ' + fmt(b * b) + ' c² = ' + fmt(a * a + b * b);
cTxt.textContent = 'c = √(a² + b²) = ' + fmt(c);
if (isNearInt(a) && isNearInt(b) && isNearInt(c)) {
tripleTxt.textContent = 'Pythagorean triple? Yes! This is a Pythagorean triple: (' + Math.round(a) + ', ' + Math.round(b) + ', ' + Math.round(c) + ').';
tripleTxt.style.fill = 'var(--brass-bright)';
tripleTxt.style.fontWeight = '700';
} else {
tripleTxt.textContent = 'Pythagorean triple? No — c does not land on a whole number here.';
tripleTxt.style.fill = '';
tripleTxt.style.fontWeight = '';
}
}
[aIn, bIn].forEach(function (el) { el.addEventListener(‘input’, update); }); resetBtn.addEventListener(‘click’, function () { aIn.value = 3; bIn.value = 4; update(); });
update(); })();
Under the Hood
The classic rearrangement proof measures the same area two different ways:
Large square of side (a + b), built from 4 identical copies of the right
triangle arranged around a smaller, tilted square in the middle:
Area of large square = (a + b)²
Area of large square = 4 × (area of one triangle) + area of tilted square
= 4 × (½ab) + c²
= 2ab + c²
(a + b)² = 2ab + c²
a² + 2ab + b² = 2ab + c² expand the left side
a² + b² = c² subtract 2ab from both sides
- Because this holds for the general side lengths a and b, not specific numbers, it proves the theorem for every right triangle at once, not just the one drawn.
Worked Example 1: Finding the hypotenuse. Given: a right triangle with legs a = 6 and b = 8. Step 1: apply c² = a² + b² = 6² + 8² = 36 + 64 = 100. Step 2: c = √100. Answer: c = 10 (the 6-8-10 triple, a doubled 3-4-5).
Worked Example 2: Finding a missing leg. Given: a right triangle with hypotenuse c = 13 and one leg a = 5. Step 1: rearrange to solve for the other leg: b² = c² − a² = 13² − 5² = 169 − 25 = 144. Step 2: b = √144. Answer: b = 12 (the 5-12-13 triple).
Worked Example 3: Ladder against a wall. Given: a 15 ft ladder leans against a vertical wall with its base 4 ft from the wall. Step 1: the ladder is the hypotenuse (c = 15) and the ground distance is one leg (a = 4); the height it reaches, b, is the unknown leg. Step 2: b² = c² − a² = 15² − 4² = 225 − 16 = 209. Step 3: b = √209 ≈ 14.46. Answer: the ladder reaches about 14.46 ft up the wall. Notice the answer isn’t a whole number this time — that’s the normal case; clean triples like 3-4-5 are the exception, not the rule.
History
- Babylonian mathematicians were using Pythagorean triples over a thousand years before Pythagoras was born. The clay tablet known as Plimpton 322 (c. 1800 BCE) lists rows of triples, likely compiled for surveying or teaching.
- Ancient Egyptian surveyors are widely believed to have used a rope knotted into 12 equal segments to lay out a 3-4-5 triangle on site, giving them a reliable right angle for construction long before anyone had proven why it worked.
- Indian mathematics recorded the relationship independently: the Baudhayana Sulba Sutra (c. 800 BCE) states a version of the theorem for constructing sacrificial altars, alongside several specific Pythagorean triples.
- Pythagoras and his followers (active roughly 570-495 BCE in ancient Greece) are traditionally credited with the first general deductive proof of the theorem — turning an observed pattern into a logically certain fact, which is the achievement the theorem is actually named for, not its discovery.
- Euclid gave a rigorous proof in his Elements (c. 300 BCE, Book I, Proposition 47), using an area argument that served as the standard reference version of the proof for over two thousand years.
- The theorem is now the most-proved statement in mathematics — an early-20th-century compilation gathered several hundred distinct proofs, including one published in 1876 by then-Congressman (and future U.S. President) James Garfield, built on the area of a trapezoid.
Why It Matters
- Construction and carpentry rely on the “3-4-5 rule”: measure 3 units along one wall and 4 along the other, then adjust the corner until the diagonal measures exactly 5 — a perfect 90° angle, checked without a protractor.
- GPS and navigation systems compute straight-line distances between coordinates with the distance formula, which is the Pythagorean theorem applied directly to positions on a local flat approximation of the map.
- Computer graphics and game engines use it constantly for distance and collision checks, often comparing squared distances directly so the program can skip the square root entirely for speed.
- Physics combines perpendicular quantities — horizontal and vertical velocity, for instance — into one resultant magnitude this way, since perpendicular components always behave like the legs of a right triangle.
- Surveying and architecture use it to derive diagonal braces, roof rafter lengths, and staircase stringers from separately known horizontal and vertical measurements.
- It underlies the very definition of distance in Euclidean space, making it one of the conceptual foundations beneath trigonometry, vector geometry, and much of physics and engineering.
Common Pitfalls
- Applying a² + b² = c² to a triangle that isn’t a right triangle. The relationship only holds when a genuine 90° angle is present; other triangles need the Law of Cosines instead.
- Misidentifying the hypotenuse. It is always the side opposite the right angle and always the longest side — plugging a leg into the “c” slot of the formula silently gives a wrong answer.
- Forgetting the final square root. Solving as far as c² = 25 and stopping there instead of finishing with c = 5 is a common last-step slip, especially under time pressure.
- Subtracting in the wrong order when solving for a missing leg. It is b² = c² − a² (hypotenuse squared minus the known leg squared), not a² − b² or c² + a², either of which produces a nonsensical or negative result.
- Keeping the negative root when solving for a side length. Algebraically √25 = ±5, but a triangle’s side length must be positive, so only the positive root is physically meaningful.
- Rounding an irrational intermediate value too early, such as truncating √50 to 7.07 mid-problem — the error compounds; keep full precision until the last step.
Comparison
| Triple | a | b | c | a² + b² | c² |
|---|---|---|---|---|---|
| 3-4-5 | 3 | 4 | 5 | 9 + 16 = 25 | 25 |
| 5-12-13 | 5 | 12 | 13 | 25 + 144 = 169 | 169 |
| 8-15-17 | 8 | 15 | 17 | 64 + 225 = 289 | 289 |
| 7-24-25 | 7 | 24 | 25 | 49 + 576 = 625 | 625 |
FAQ
Does the Pythagorean theorem work in 3D? Yes, in an extended form. For a rectangular box with edges a, b, and c, the space diagonal has length d = √(a² + b² + c²) — found by applying the theorem twice: once across the base to get the base diagonal, then again using that diagonal and the height as the two legs of a new right triangle.
Does a² + b² = c² work for any triangle, or only right triangles? Only right triangles. Every other triangle follows the more general Law of Cosines, c² = a² + b² − 2ab·cos(C), which reduces exactly to the Pythagorean theorem when angle C is 90°, since cos(90°) = 0 removes the extra term.
How can I tell if a triangle is right without measuring any angles? Measure all three sides and check the converse: square each one, then see if the sum of the two smaller squares equals the largest square. If it does, the triangle is guaranteed to have a right angle opposite the longest side — no protractor required.
Example
A moving company needs to know whether a 12 ft ladder, with its base 5 ft from a building, will reach an 11 ft window ledge. The ladder is the hypotenuse and the ground distance is one leg, so the reachable height is b = √(12² − 5²) = √(144 − 25) = √119 ≈ 10.9 ft — just short of the ledge, using the same relationship worked through above to turn two known lengths into a third.
Related Terms
Referenced by