Pythagorean Theorem Explained: a² + b² = c² with Worked Examples
The Pythagorean theorem is the one piece of geometry almost everyone remembers from school, and it is the workhorse behind right-angle layouts, screen diagonals and shortest-distance calculations. Here is what a² + b² = c² really says, how to use it to solve for any missing side, and where it stops working — plus the law of cosines that takes over when your triangle is not a right one.
The theorem in one sentence
In any right triangle, the square built on the longest side equals the two squares built on the other two sides put together. Written out it is the most famous equation in elementary geometry: a² + b² = c², where a and b are the legs that meet at the 90° angle and c is the hypotenuse opposite. The Pythagorean theorem calculator applies that identity in both directions — solving for the hypotenuse when you know the two legs, or for a missing leg when you know the hypotenuse and the other leg.
The result is exact when your inputs are exact. The 3-4-5 triangle every schoolchild meets is not an approximation; 3² + 4² = 9 + 16 = 25 = 5² on the nose. That clean integer behaviour is part of what makes the theorem so useful on building sites and in machine shops where decimals start to add up to drift.
Where the name comes from (and where the credit is due)
The theorem carries Pythagoras of Samos’ name, but it predates him by at least a thousand years. The Babylonian clay tablet Plimpton 322, dated to around 1800 BCE, lists fifteen Pythagorean triples — sets of three integers satisfying a² + b² = c² — in a way that suggests its scribes understood the relationship as a general rule rather than a coincidence. Ancient Indian Sulba Sutras and Chinese mathematical texts independently document the same identity, again centuries before Pythagoras lived.
What we owe to the Greek tradition is the first known proof, recorded by Euclid as Proposition 47 of Book I of the Elements (around 300 BCE). Euclid’s proof is geometric: he dissects the squares on the two legs and shows by a sequence of triangle congruences that their combined area exactly fills the square on the hypotenuse. The proof needs no algebra and no trigonometry; it sits on top of the parallel postulate and a handful of congruence rules, which is one reason it has survived more or less unchanged for two and a half thousand years.
How the formula actually works
Picture a right triangle drawn on graph paper. Build a literal square on each of its three sides, with the side of the triangle as one side of the square. The square on the hypotenuse has area c². The squares on the two legs have areas a² and b². The Pythagorean theorem is the claim that you can cut the two smaller squares into pieces and rearrange them — without overlap and without gaps — to exactly tile the larger square. There is no slack and no leftover. That is what an equation between three numbers actually means when those numbers are areas.
Algebraically the same identity gives you any side you do not already know. Rearrange for the hypotenuse and you get c = √(a² + b²). Rearrange for a leg and you get a = √(c² − b²). The Pythagorean theorem calculator picks whichever rearrangement matches the mode you select. Both branches refuse to run on non-positive inputs, and the leg branch additionally refuses inputs where the supposed hypotenuse is not strictly longer than the known leg — otherwise the formula returns the square root of a negative number, which is not a real length.
Worked example: the 3-4-5 triangle, and where it leads
Take the simplest case. Legs a = 3 and b = 4. Apply the theorem:
c² = 3² + 4² = 9 + 16 = 25c = √25 = 5
The hypotenuse is exactly five units. The triangle’s area is ½ × 3 × 4 = 6 square units, its perimeter is 3 + 4 + 5 = 12 units, and the two non-right angles work out as sin⁻¹(3 / 5) ≈ 36.87° and sin⁻¹(4 / 5) ≈ 53.13° — which, with the 90° corner, sum to the required 180°.
Now flip the problem. Suppose you know the hypotenuse is 13 and one leg is 5; what is the other leg?
b² = 13² − 5² = 169 − 25 = 144b = √144 = 12
Another integer answer. That is no accident: (5, 12, 13) is another Pythagorean triple. The Pythagorean theorem calculator would let you set up exactly this case by switching the solve-for mode from “hypotenuse” to “leg” and entering 13 as the hypotenuse and 5 as the known leg. Try it with the inputs from a roof, a TV diagonal, or a baseball diamond and the same machinery does the work.
Pythagorean triples worth memorising
A Pythagorean triple is a set of three positive integers (a, b, c) with a² + b² = c². Triples are useful precisely because the answer pops out as a whole number — no rounding, no calculator, no second-guessing. The classic primitives, in order of size, are:
- (3, 4, 5) — the one you cannot avoid. Carpenters use it as a built-in square.
- (5, 12, 13) — used on construction sites where 3-4-5 is too small to be accurate over a long run.
- (8, 15, 17) — comes up in problems involving 1-in-2 slopes and similar ratios.
- (7, 24, 25) — a near-isoceles triple that occasionally appears in roof framing.
- (20, 21, 29) — the smallest primitive whose two legs differ by just one.
- (9, 40, 41), (12, 35, 37), (11, 60, 61) — useful when you need a long, skinny right triangle.
Every integer multiple of a primitive triple is also a triple, so (6, 8, 10) and (9, 12, 15) and (30, 40, 50) all work too. The standard trick on a building site is to scale (3, 4, 5) up to whatever units are convenient — pegging 3 metres along one string and 4 metres along another and checking that the diagonal is exactly 5 metres gives a right angle accurate to a few millimetres without any specialist tools.
What right triangles are good for outside the textbook
Setting out a square corner
The 3-4-5 method is the oldest practical use of the theorem and still the most common one on construction sites. Stretch a string, mark a point three units along it, mark another point four units along a second string starting from the same anchor, and adjust the angle between the two strings until the distance between the two marked points is exactly five units. The corner is then a perfect right angle, accurate to the precision of your tape measure.
Diagonals of screens, rooms and boxes
Every screen size you have ever bought is a hypotenuse. A 55-inch TV is 55 inches measured corner to corner, not along an edge; the width and height come out of the Pythagorean theorem combined with the screen’s aspect ratio. A 16:9 panel with a 55-inch diagonal has width 55 × 16 / √(16² + 9²) ≈ 47.9 inches and height 55 × 9 / √(16² + 9²) ≈ 27 inches. The same idea sizes ramps, garage clearances and shipping crates.
Shortest distance between two points
Walk three blocks east and four blocks north and you have travelled seven blocks, but the bird flying directly between your start and end points has only travelled √(3² + 4²) = 5 blocks. That is the basis of the distance formula every coordinate geometry course teaches, and it is why the distance calculator uses a Pythagorean step under the hood. Extend the same idea into three dimensions by adding a vertical component and you can find the diagonal of any rectangular box.
Slopes, pitches and rafters
A roof rafter, a wheelchair ramp and a staircase stringer are all hypotenuses of right triangles whose legs are the horizontal run and the vertical rise. Given any two of (run, rise, slope-length) the third follows from a² + b² = c². The roof pitch calculator and the slope calculator both lean on this directly to convert between pitch expressed as an angle, as a rise-over-run ratio and as a percentage gradient.
Common mistakes
Confusing the hypotenuse with one of the legs
The most frequent error is plugging the hypotenuse into the formula as if it were a leg, or vice versa. Remember: the hypotenuse is the side opposite the right angle and it is always the longest side. If you find yourself computing √(a² + b²) with one of the inputs being a number that ought to be the hypotenuse, your answer will be wrong and usually much too large.
Squaring after adding instead of before
a² + b² is not the same as (a + b)². The second expands to a² + 2ab + b², with a cross term that is decidedly not part of the Pythagorean theorem. On the 3-4-5 triangle the right answer is √(9 + 16) = 5; the wrong shortcut gives √((3+4)²) = 7, which is the perimeter of the legs and bears no relation to the hypotenuse.
Using it on triangles that are not right triangles
If the triangle does not have a 90° corner, a² + b² = c² simply does not hold. Forcing it through anyway gives nonsense — the law of cosines, covered below, is the right tool. The triangle calculator covers the general case and the oblique triangle area calculator handles the area side of it specifically.
Mixing units
The formula is scale-free as long as all three sides use the same unit. Mixing inches with metres, or millimetres with feet, will silently give a meaningless number. Pick a unit, convert everything into it first, then apply the theorem. If you are working with an unfamiliar unit it is worth checking the area converter at the end to confirm that the area you compute is in sensible territory.
When the theorem stops applying: the law of cosines
The Pythagorean theorem only describes one corner of the universe of triangles. The general identity that handles every triangle, right or otherwise, is the law of cosines:
c² = a² + b² − 2ab·cos(C)
Here C is the angle opposite side c. When C is exactly 90° the cosine is zero, the last term vanishes, and you are back to a² + b² = c² — the Pythagorean theorem is the special case of the law of cosines for right triangles. When C is acute the last term is positive, so c comes out shorter than the Pythagorean prediction; when C is obtuse the cosine is negative, the last term flips sign, and c comes out longer.
If you are not sure whether your triangle is a right triangle, the safe move is to use the general triangle calculator in SSS or SAS mode. If you are sure it is a right triangle, the Pythagorean theorem calculator is the faster, more direct tool — fewer inputs, no trigonometry buttons, exact integer answers when the inputs form a triple.
A proof you can do on a napkin
Of the many hundreds of known proofs, the rearrangement proof is the easiest to picture. Draw a large square of side a + b. Inside it, place four identical copies of your right triangle rotated against the corners so that their hypotenuses form a smaller square in the middle of side c. The four triangles plus the inner square together fill the outer square, so:
(a + b)² = 4 × (½ × a × b) + c²a² + 2ab + b² = 2ab + c²a² + b² = c²
The cross-terms cancel and the Pythagorean theorem falls out in two lines. President James Garfield published a closely related dissection proof using a trapezoid in 1876, five years before he took office — one of the rare contributions to elementary mathematics by a head of state. If you want to play the same game yourself, the Pythagorean theorem calculator is a useful sanity check: pick any two leg values, watch it return the hypotenuse, and confirm that the two leg-squares actually add up.
Beyond the right angle
Once you are comfortable with the right-triangle case, the next steps depend on the kind of triangle you meet next. For any general (oblique) triangle, the triangle calculator handles SSS, SAS, ASA and AAS using the laws of sines and cosines. For specifically classifying or solving an all-acute triangle, the acute triangle calculator takes over. The centroid of a triangle calculator answers a different question — where its centre of mass sits — once the vertices are known. Stepping further out, the circle calculator, hexagon calculator and square footage calculator all sit in the same plane-geometry toolkit, often used alongside the Pythagorean theorem in real layout work.
For the right-triangle case itself, the Pythagorean theorem calculator remains the simplest tool on the site: pick the side you want, type the two you know, and the answer (plus area, perimeter and the two non-right angles) is one click away.
Frequently asked questions
What does the Pythagorean theorem actually say?
In any right triangle the square built on the longest side (the hypotenuse) has exactly the same area as the two squares built on the other two sides put together. Algebraically that is a² + b² = c², where a and b are the legs meeting at the right angle and c is the hypotenuse opposite. The relationship is geometric before it is algebraic — Euclid proved it in Book I, Proposition 47 of the Elements by literally cutting the squares apart and rearranging them.
Does the Pythagorean theorem work for any triangle?
No. It only holds for right triangles — triangles with one 90° angle. For any other triangle you need the more general law of cosines: c² = a² + b² − 2ab·cos(C). That formula reduces back to a² + b² = c² exactly when C is 90°, because cos(90°) = 0 and the last term disappears. If your triangle has no right angle, use the triangle calculator instead.
How do I know which side is the hypotenuse?
The hypotenuse is always the longest side of a right triangle and it is always the side opposite the right angle. If you can spot the 90° corner, the side that does not touch it is the hypotenuse. When solving for a missing leg, your hypotenuse must be strictly longer than the known leg — otherwise no real triangle exists and the formula produces the square root of a negative number.
What is a Pythagorean triple and why are they useful?
A Pythagorean triple is a set of three positive integers that satisfy a² + b² = c² exactly — no rounding, no decimals. The smallest is (3, 4, 5); other classic primitives include (5, 12, 13), (8, 15, 17) and (7, 24, 25). Builders, carpenters and surveyors use them to set out true right angles in the field with nothing more than a tape measure: peg three units along one string, four along another, and you only get the diagonal equal to five when the two strings meet at exactly 90°.
Can I use the theorem to find the distance between two points?
Yes — that is exactly what the distance formula does. The straight-line distance between (x₁, y₁) and (x₂, y₂) on a flat plane equals √((x₂ − x₁)² + (y₂ − y₁)²), which is just a² + b² = c² with a and b being the horizontal and vertical differences. The same idea extends to three dimensions by adding (z₂ − z₁)² under the square root, so the diagonal of a rectangular box follows from a single Pythagorean step.
Why does the theorem only work in flat (Euclidean) geometry?
The proof depends on parallel lines staying parallel and on the angles of a triangle summing to 180°. On the surface of a sphere those things stop being true: a triangle drawn on the Earth has angles that sum to more than 180°, and a "right triangle" with two 90° angles at the equator is perfectly possible. The spherical and hyperbolic equivalents of the Pythagorean theorem involve sines and cosines of the side lengths themselves and only collapse back to a² + b² = c² in the small-triangle limit where the curvature can be ignored.
How many proofs of the Pythagorean theorem exist?
Hundreds. Elisha Loomis collected 367 distinct proofs in his 1927 book The Pythagorean Proposition, and more have been published since — including one by US President James Garfield in 1876 that uses a trapezoid built from two copies of the triangle. The variety is part of the appeal: algebraic proofs, dissection proofs, similar-triangle proofs and even a fluid-dynamics analogue all converge on the same identity, which is one reason it sits so close to the bedrock of mathematics.
Informational only. Not personalised financial, legal, or tax advice.