Calculate the hypotenuse or missing side of any right triangle instantly using the Pythagorean theorem, with step-by-step explanations.
In any right-angled triangle, a² + b² = c², where c is the hypotenuse — the longest side, opposite the right angle. To find the hypotenuse, square both legs, add them and take the square root: c = √(a² + b²). To find a missing leg, subtract instead: a = √(c² − b²). Legs of 3 and 4 give a hypotenuse of exactly 5. The theorem works only for right triangles, and its converse is equally useful: if a² + b² = c², the triangle must be right-angled — which is exactly how builders check a corner is square.
Enter any two values and leave the unknown one blank, or enter all three to check whether the triangle is right-angled. c is always the hypotenuse — the longest side, opposite the right angle.
Keyboard: Enter calculates, Esc clears.
Common Right Triangles
Every triple is a right triangle with whole-number sides. Primitive triples have no common factor; the rest are multiples of one.
| a | b | c | Primitive? | Use |
|---|
Screens are sold by their diagonal, which tells you nothing about the width until you apply Pythagoras to the aspect ratio.
| Property | Value |
|---|
The Pythagorean theorem states that in any right-angled triangle, the square of the hypotenuse equals the sum of the squares of the other two sides: a² + b² = c².
It is probably the single most useful equation in practical mathematics. Any time you need a diagonal, a slope length, a bracing member, a distance across a grid or a screen width, you are using it — usually without noticing. Its power comes from turning a measurement you cannot easily take (across a diagonal, over rough ground, through a wall) into two you can.
Equally important is the converse: if the three sides of a triangle satisfy a² + b² = c², the triangle must contain a right angle. That is what turns the theorem from a calculating tool into a checking tool, and it is the basis of the 3-4-5 method used on building sites every day.
The relationship is far older than the man it is named after. The Babylonian tablet Plimpton 322, dated to roughly 1800 BCE, lists number triples that satisfy it — more than a thousand years before Pythagoras was born. Egyptian rope-stretchers used knotted cords to set out right angles for re-establishing field boundaries after the Nile floods, and ancient Chinese and Indian texts, including the Zhoubi Suanjing and the Sulba Sutras, record the same rule independently.
Pythagoras of Samos (c. 570–495 BCE) and his followers are credited with the first general proof in the Greek tradition, which is the crucial distinction: earlier cultures knew the rule worked, but a proof shows it must hold for every right triangle without exception. Around 300 BCE Euclid included a formal proof as Proposition 47 of Book I of the Elements, and the theorem has since accumulated hundreds of distinct proofs — geometric, algebraic and even one published by James Garfield before he became US president.
Read literally, the theorem is about areas, not lengths. Draw a square on each side of a right triangle and the two smaller squares together have exactly the same area as the square on the hypotenuse. That is why everything is squared: the equation balances areas, and taking the square root at the end converts back to a length.
The order of operations matters. Square first, then add or subtract, then take the root — never add the sides and square the total. And the rearrangement changes with what you are solving for: finding the hypotenuse means adding the squares, while finding a leg means subtracting.
Identifying the hypotenuse correctly is the most important step in any calculation, since putting a leg where it belongs produces a wrong answer that still looks plausible. Two quick checks: it never touches the right angle — the two legs form that — and it must be longer than either leg but shorter than both added together. If a result gives a hypotenuse shorter than one of its legs, the inputs have been mixed up; this calculator refuses such combinations rather than returning a meaningless answer.
| What you know | What you want | Formula | Example |
|---|---|---|---|
| Both legs | Hypotenuse | c = √(a² + b²) | a = 3, b = 4 → c = 5 |
| Hypotenuse and one leg | The other leg | a = √(c² − b²) | c = 13, b = 12 → a = 5 |
| All three sides | Is it right-angled? | Test a² + b² = c² | 6, 8, 10 → yes |
| Two coordinates | Distance between them | d = √(Δx² + Δy²) | (0,0) to (3,4) → 5 |
A Pythagorean triple is a set of three whole numbers that satisfies the theorem exactly. They are prized because they give clean answers with no decimals, which is why they appear constantly in textbooks and on job sites.
| Triple | Check | Where it shows up |
|---|---|---|
| 3, 4, 5 | 9 + 16 = 25 | The builder's set-out triangle |
| 5, 12, 13 | 25 + 144 = 169 | Classroom problems, bracing |
| 8, 15, 17 | 64 + 225 = 289 | Surveying and layout |
| 7, 24, 25 | 49 + 576 = 625 | Trigonometry practice |
| 9, 40, 41 | 81 + 1,600 = 1,681 | Larger set-outs |
| 20, 21, 29 | 400 + 441 = 841 | The near-isosceles case |
A triple is primitive when its three numbers share no common factor. Every other triple is a multiple of a primitive one: 6-8-10 and 30-40-50 are just 3-4-5 scaled up. Up to c = 100 there are 52 triples in total but only 16 primitives, and the generator above lists both.
Primitives can be produced systematically using Euclid's formula: pick two whole numbers m > n > 0 that are coprime and of opposite parity, then a = m² − n², b = 2mn and c = m² + n². With m = 2 and n = 1 that gives 3, 4, 5; with m = 3 and n = 2 it gives 5, 12, 13. The generator on this page uses exactly that method, which is why it stays fast even for large limits.
Measure 3 units along one edge and 4 along the other; if the diagonal between those marks measures exactly 5, the corner is a perfect right angle. If it does not, the corner is out and can be adjusted before anything is fixed.
Given two points, the horizontal difference Δx and the vertical difference Δy form the two legs of a right triangle, and the straight-line distance between them is its hypotenuse:
From (0, 0) to (3, 4) the differences are 3 and 4, so the distance is 5 — the same triangle as before, just placed on a grid. The three-dimensional version simply adds another squared term, and the pattern continues into any number of dimensions, which is how "distance" is defined in data science. See the distance calculator for coordinate work.
Squaring up is the daily use: slabs, wall frames, decks, fences and tiling grids are all set out with the 3-4-5 method or by checking that both diagonals of a rectangle match. Rafter lengths come straight from rise and run, stair stringers from total rise and going, and brace lengths from the panel dimensions they cross.
Surveyors work in coordinates, so every distance they compute between two points is the Pythagorean theorem applied to eastings and northings. It also underpins offset measurement, where a point is located by a perpendicular distance from a known line, and slope correction, which converts a distance measured along sloping ground into its true horizontal equivalent.
Engineers use it to resolve vectors: two perpendicular force or velocity components combine into a resultant whose magnitude is √(x² + y²). The same arithmetic gives cable and strut lengths in trusses, diagonal bracing in steel frames, impedance in AC electrical circuits, and the magnitude of any two-component quantity.
Televisions and monitors are advertised by their diagonal alone, which is why a 55-inch TV is not 55 inches wide. Applying the theorem to the aspect ratio gives the real dimensions: for a 16:9 screen, width = diagonal × 16 ÷ √(16² + 9²).
This is also why comparing screens of different aspect ratios by diagonal alone is misleading: a 32-inch 21:9 ultrawide is much wider but far shorter than a 32-inch 16:9 screen, and has noticeably less total area.
The clearest proof is a rearrangement one. Take four identical right triangles with legs a and b, and arrange them inside a large square of side (a + b). Placed one way, the uncovered space forms two squares of areas a² and b². Rearrange the same four triangles inside the same square and the uncovered space becomes a single square of side c. The triangles have not changed size, so the leftover area cannot have changed either — therefore a² + b² = c².
Euclid's proof takes a different route, showing that the square on each leg has the same area as a corresponding rectangle within the square on the hypotenuse. Hundreds of other proofs exist, using similar triangles, algebra, shearing, and even a proof discovered by a US president. The theorem holds only in flat Euclidean geometry: on the curved surface of a sphere it fails, which matters for long-distance navigation.
| Mistake | Why it goes wrong | How to avoid it |
|---|---|---|
| Using it on a non-right triangle | The theorem only holds when one angle is exactly 90° | Use the law of cosines for other triangles |
| Treating a leg as the hypotenuse | c must be the longest side, opposite the right angle | Identify the right angle first, then label c opposite it |
| Adding instead of subtracting for a leg | a² = c² − b², not c² + b² | Finding the hypotenuse adds; finding a leg subtracts |
| Forgetting the square root | You have c², not c | The root is always the final step |
| Squaring after adding | (a + b)² is not a² + b² | Square each side first, then add |
| Mixing units | Metres with centimetres gives a meaningless result | Convert everything to one unit first |
| Using slant length as a leg | The legs must meet at the right angle | Sketch the triangle and mark the 90° corner |
| Rounding too early | Errors compound through the squaring | Keep full precision until the final answer |
| Applying it to latitude and longitude | The Earth is curved, not a flat grid | Use the Haversine formula for geographic distance |
a² + b² = c² (c = hypotenuse)c = √(a² + b²)a = √(c² − b²)a² + b² = c² → right-angledc² < a²+b² acute · = right · > obtuseA = arctan(a/b), B = 90° − A½ab | Perimeter: a + b + cab / c | Inradius: (a + b − c) / 2c / 2 (the hypotenuse is a diameter)d = √(Δx² + Δy²)a = m²−n², b = 2mn, c = m²+n²3-4-5 · 5-12-13 · 8-15-17 · 7-24-25 · 9-40-41 · 20-21-29diagonal × w / √(w² + h²)
1) √(36 + 64) = √100 = 10 2) √(100 − 36) = √64 = 8 3) Yes — 25 + 144 = 169 = 13² 4) 15, the longest side, opposite the right angle 5) √(25 + 25) = √50 ≈ 7.07 cm
1) √(36 − 3.24) = √32.76 ≈ 5.723 m 2) √(17.64 + 12.96) = √30.6 ≈ 5.532 m 3) No — 9 + 16 = 25 but 6² = 36, so it is obtuse, with the largest angle about 117.28° 4) √(36 + 64) = 10 5) 65 × 16 ÷ √337 ≈ 56.65 in ≈ 143.9 cm 6) √(17.64 + 3.24) = √20.88 ≈ 4.569 m 7) c = 15, area = ½ × 9 × 12 = 54, perimeter = 36, altitude = 9 × 12 ÷ 15 = 7.2 8) a = 16 − 1 = 15, b = 2 × 4 × 1 = 8, c = 16 + 1 = 17 → the 8-15-17 triple
What is the Pythagorean theorem?
The Pythagorean theorem states that in any right-angled triangle, the square of the hypotenuse equals the sum of the squares of the other two sides: a² + b² = c². The hypotenuse is the side opposite the right angle and is always the longest. Read literally it is a statement about areas — the squares drawn on the two legs together equal the square drawn on the hypotenuse.
How do you calculate the hypotenuse?
Square both legs, add them, then take the square root: c = √(a² + b²). For legs of 3 and 4: 9 + 16 = 25, and √25 = 5. Always square each side first — squaring the sum instead, as (a + b)², gives a completely different and wrong answer.
How do you find the missing side of a triangle?
It depends which side is missing. For the hypotenuse, add the squares of the legs and take the root. For a leg, subtract instead: a = √(c² − b²). With c = 13 and b = 12: 169 − 144 = 25, so a = 5. This only works for right triangles — for any other triangle you need the law of cosines, which the triangle calculator handles.
What is the formula for Pythagoras' theorem?
a² + b² = c², where a and b are the legs meeting at the right angle and c is the hypotenuse. Rearranged, c = √(a² + b²) finds the hypotenuse and a = √(c² − b²) finds a leg. The same relationship written for coordinates becomes the distance formula, d = √(Δx² + Δy²).
What are Pythagorean triples?
A Pythagorean triple is a set of three whole numbers satisfying a² + b² = c², such as 3-4-5, 5-12-13, 8-15-17 and 7-24-25. They are useful because they give exact answers with no decimals. Up to c = 100 there are 52 triples, of which 16 are primitive — meaning the three numbers share no common factor. Every other triple is a multiple of a primitive one, so 6-8-10 is simply 3-4-5 doubled.
What is the 3-4-5 rule?
The 3-4-5 rule uses the converse of the theorem to check that a corner is square. Measure 3 units along one edge and 4 along the other; if the diagonal between those marks is exactly 5, the corner is a true right angle. Any multiple works — 1.2 m, 1.6 m and 2 m, or 6 m, 8 m and 10 m — and larger multiples are more accurate because measuring errors become a smaller proportion of the total.
Can the theorem be used for all triangles?
No. It applies only to right-angled triangles. For any other triangle use the law of cosines, c² = a² + b² − 2ab·cos(C), which reduces to the Pythagorean theorem when C = 90° because cos 90° = 0. Comparing c² with a² + b² does still tell you something about any triangle though: smaller means acute, equal means right-angled, larger means obtuse.
How is the Pythagorean theorem used in construction?
Constantly. Slabs, wall frames, decks and fences are squared up with the 3-4-5 method or by checking that both diagonals of a rectangle are equal. Rafter lengths come from rise and run, stair stringers from total rise and going, and diagonal bracing from the panel it crosses. A 4.2 m by 3.6 m room should have diagonals of exactly 5.532 m — if they differ, the room is not square.
How is the distance formula related to Pythagoras?
They are the same statement. Given two points, the horizontal difference Δx and the vertical difference Δy form the legs of a right triangle, and the straight-line distance between the points is its hypotenuse: d = √(Δx² + Δy²). From (0, 0) to (3, 4) the distance is 5 — the familiar triangle placed on a grid. Adding a Δz² term extends it into three dimensions.
Who invented the Pythagorean theorem?
Nobody invented it, and Pythagoras was not the first to know it. The Babylonian tablet Plimpton 322 lists Pythagorean triples around 1800 BCE, more than a millennium before he was born, and Egyptian, Chinese and Indian texts record the same relationship independently. Pythagoras of Samos (c. 570–495 BCE) and his school are credited with the first general proof in the Greek tradition, and Euclid later formalised it as Proposition 47 of Book I of the Elements.
Why does the theorem work?
The neatest explanation is a rearrangement proof. Place four identical right triangles inside a square of side (a + b): arranged one way, the uncovered area forms two squares of a² and b²; rearranged, the same uncovered area forms a single square of c². The triangles have not changed, so the leftover area cannot have changed either, which means a² + b² = c². Hundreds of other proofs exist. Note that it holds only in flat Euclidean geometry — on a curved surface such as the Earth it fails, which is why long-distance navigation uses different formulas.
How do builders use the 3-4-5 rule in practice?
They run two string lines from the corner being set out, mark 3 units along one and 4 along the other, then adjust until the diagonal between the marks reads exactly 5. On a house slab the usual choice is 6-8-10 in metres, because the bigger the triangle the smaller the effect of a millimetre of measuring error. The same check is repeated on every corner, and both diagonals of the finished rectangle are compared as a final confirmation.
Can this calculator show step-by-step solutions?
Yes. Every calculation lists the rearranged formula, the substituted numbers, the squares, the sum or difference, and the final square root, followed by a verification line. If you enter all three sides it switches to checking mode and shows whether the triangle is right-angled, acute or obtuse. You can also print the solution as a worksheet.
What is a right triangle?
A right triangle is a triangle containing one angle of exactly 90°. The two sides forming that angle are the legs, and the third side, opposite it, is the hypotenuse. Since the interior angles of any triangle total 180°, the other two angles must add to 90°, so both are acute and a triangle can never have more than one right angle.
How do I check if a triangle is right-angled?
Square all three sides, then test whether the two smaller squares add to the largest. If a² + b² = c², the triangle is right-angled by the converse of the theorem. Sides 5, 12 and 13 pass because 25 + 144 = 169. Sides 3, 4 and 6 fail, and because c² is larger than a² + b², that triangle is obtuse. Enter all three sides above and the calculator performs the test for you.
What are the most common Pythagorean triples?
The six worth memorising are 3-4-5, 5-12-13, 8-15-17, 7-24-25, 9-40-41 and 20-21-29. Spotting one in a problem saves calculating, and recognising a multiple — 6-8-10, 9-12-15, 30-40-50 — is just as useful. The generator on this page lists every triple up to any limit you choose, marking which are primitive.
How do engineers use the theorem?
Mostly for resolving vectors. Two perpendicular components of force, velocity or displacement combine into a resultant of magnitude √(x² + y²). It also gives strut and cable lengths in trusses, diagonal bracing in steel frames, impedance in AC circuits where resistance and reactance are perpendicular, and the magnitude of any quantity expressed as perpendicular components.
How do surveyors use the theorem?
Every distance a surveyor computes between two coordinate points is the theorem applied to eastings and northings. It also underpins offset measurement, where a point is fixed by a perpendicular distance from a known line, and slope correction, which converts a distance measured along sloping ground into its true horizontal equivalent — the measured slope distance is the hypotenuse, and the horizontal distance is a leg.
Can I calculate diagonals with this calculator?
Yes — a diagonal is just a hypotenuse. Enter the two side lengths as a and b and read c. A 4.2 m by 3.6 m room has a diagonal of 5.532 m, and a 5 cm square has a diagonal of √50 ≈ 7.07 cm. For screens, use the diagonal tool on this page, which works backwards from the advertised diagonal and the aspect ratio to give the actual width and height.
How do I work out the real width of a TV from its diagonal?
Apply the theorem to the aspect ratio: width = diagonal × w ÷ √(w² + h²). For a 16:9 screen that divisor is √337 ≈ 18.358, so a 55-inch TV is 55 × 16 ÷ 18.358 ≈ 47.94 inches (121.8 cm) wide and about 26.96 inches (68.5 cm) tall. Always add the bezel and stand before deciding whether it fits a cabinet, and remember that screens with different aspect ratios cannot be compared by diagonal alone.
What units can I use?
Any, as long as all three sides use the same one. The theorem does not change the units — enter metres and the answer is in metres, enter inches and it is in inches. The calculator offers a unit label purely so the results read clearly. The one rule is consistency: mixing metres with centimetres produces a meaningless answer.
How accurate is the calculator?
It uses standard double-precision floating-point arithmetic, accurate to roughly 15 significant figures, and results are displayed to six decimal places. That is far beyond any practical measurement — a building site works to millimetres, and a machinist to hundredths of a millimetre. Whole-number triples such as 3-4-5 return exactly, and the calculator keeps full precision internally, rounding only for display.
What are common mistakes with the Pythagorean theorem?
Applying it to a triangle that is not right-angled; treating a leg as the hypotenuse; adding when you should subtract to find a leg; forgetting the final square root; squaring the sum of the sides instead of each side separately; mixing units; and rounding too early, which compounds through the squaring. The calculator refuses combinations where the hypotenuse is not the longest side rather than returning a meaningless result.
Where does the theorem appear in real life?
Squaring up building work, cutting rafters and stair stringers, checking that a room or slab is square, working out screen and cabinet sizes, measuring the shortest path across a park, navigation and surveying, resolving forces in engineering, calculating impedance in electronics, and computing distance in computer graphics and machine learning. Any time two perpendicular measurements need combining into one, it is the theorem doing the work.
Does this calculator generate Pythagorean triples?
Yes. Set a maximum for c and the generator lists every triple up to that limit, marking which are primitive and showing the multiplier for the rest. It uses Euclid's formula — a = m² − n², b = 2mn, c = m² + n² for coprime m and n of opposite parity — so it stays fast even at large limits, and each row can be loaded straight into the calculator with one tap.
A one-page reference with the theorem, its rearrangements, the triples worth memorising and the 3-4-5 set-out method. Use the button to print it or save it as a PDF.
MegaCalcOnline.com · Right triangles, triples and the 3-4-5 rule
| Find | Formula | Notes |
|---|---|---|
| The theorem | a² + b² = c² | c = hypotenuse, opposite the right angle |
| Hypotenuse | c = √(a² + b²) | Add the squares |
| Missing leg | a = √(c² − b²) | Subtract the squares |
| Converse | a² + b² = c² → right angle | The basis of the 3-4-5 rule |
| Classification | c² vs a² + b² | less = acute, equal = right, greater = obtuse |
| Angles | A = arctan(a / b), B = 90° − A | Right angle is always C |
| Area | ½ab | The two legs are base and height |
| Altitude to hypotenuse | ab / c | Splits the triangle into two similar ones |
| Inradius | (a + b − c) / 2 | Right triangles only |
| Circumradius | c / 2 | The hypotenuse is a diameter |
| Distance formula | d = √(Δx² + Δy²) | The theorem on a coordinate grid |
| Euclid’s triples | a = m²−n², b = 2mn, c = m²+n² | m > n, coprime, opposite parity |
| Screen width | diagonal × w / √(w² + h²) | 16:9 divisor = √337 ≈ 18.358 |
| Triple | Check | Common multiples |
|---|---|---|
| 3, 4, 5 | 9 + 16 = 25 | 6-8-10, 9-12-15, 30-40-50 |
| 5, 12, 13 | 25 + 144 = 169 | 10-24-26, 15-36-39 |
| 8, 15, 17 | 64 + 225 = 289 | 16-30-34 |
| 7, 24, 25 | 49 + 576 = 625 | 14-48-50 |
| 9, 40, 41 | 81 + 1,600 = 1,681 | 18-80-82 |
| 20, 21, 29 | 400 + 441 = 841 | 40-42-58 |
3-4-5 set-out: mark 3 along one line, 4 along the other; the diagonal must read exactly 5. Use the largest multiple the site allows. Educational use only.