Pythagorean Theorem Calculator

Computes the missing side of a right triangle using the Pythagorean theorem: the hypotenuse as the square root of a squared plus b squared, or a leg as the square root of c squared minus a squared. Takes two known side lengths as inputs, in hypotenuse or leg mode, and returns the missing side to four decimal places along with the triangle area and perimeter.

Solve for
Missing side
Area
Perimeter

Choose whether you are solving for the hypotenuse or for a leg, enter the two sides you know, and the calculator returns the missing side to four decimal places, along with the triangle's area and perimeter. The input fields switch automatically when you change modes, and everything runs in your browser as you type.

The formula and how it rearranges

The Pythagorean theorem states that in a right triangle the square built on the hypotenuse equals the combined area of the squares built on the two legs. The hypotenuse is the side opposite the right angle, and it is always the longest of the three sides, which is why the calculator keeps hypotenuse mode and leg mode separate.

c2 = a2 + b2

Solving for the unknown side gives the two forms the calculator actually evaluates: c = √(a2 + b2) for the hypotenuse, and b = √(c2a2) for a leg.

With the default inputs — legs of 3 and 4 — the arithmetic is 3² + 4² = 9 + 16 = 25, and √25 = 5. The area is (3 × 4) ÷ 2 = 6 and the perimeter is 3 + 4 + 5 = 12. Switch to leg mode with its defaults, a known leg of 3 and a hypotenuse of 13, and the result is √(169 − 9) = √160 = 12.6491. Change the known leg to 5 and the answer lands on exactly 12, because 5-12-13 is a Pythagorean triple.

Why the relationship is true

A short dissection makes the equality visible without algebra at first. Take four identical copies of the right triangle, with legs a and b, and fit them into the corners of a large square whose side is a + b, arranged so their hypotenuses face inward and outline a smaller tilted square. The large square has area (a + b)². The four triangles together cover 4 × ½ab, which is 2ab, and the tilted square left in the middle has area c². The whole equals the sum of its parts, so (a + b)² = 2ab + c². Expanding the left side gives a² + 2ab + b² = 2ab + c², and cancelling 2ab from both sides leaves a² + b² = c². Euclid reached the same conclusion by comparing areas rather than sliding shapes around; his argument, Proposition 47 of Book I of the Elements, is the oldest surviving axiomatic proof of the result. Because the theorem can be approached from so many directions — similar triangles, sheared parallelograms, plain algebra — mathematicians have catalogued an unusual number of distinct proofs. Elisha Scott Loomis spent decades collecting them: the first edition of his book The Pythagorean Proposition, printed in 1927, carried 230 proofs, and the second edition of 1940 raised the total to 370, sorted into 109 algebraic, 255 geometric, 4 quaternionic and 2 dynamic. Loomis also argued at length that no trigonometric or calculus proof was possible, on the grounds that the identities such a proof would need already assume the theorem, and he gave that claim its own section of the book.

An idea older than its name

The theorem carries the name of Pythagoras of Samos, who lived roughly between 570 and 495 BC, yet the relationship was in practical use long before him. Thomas Heath, whose translation of Euclid is still the standard English one, pointed out that no surviving Greek text from the five centuries after Pythagoras lived attributes the theorem to him specifically. The oldest firm evidence comes from Mesopotamia. Plimpton 322, a Babylonian clay tablet from Senkereh, the site of the ancient city of Larsa, and written around 1800 BC, sets out four columns and fifteen rows of numbers that line up with fifteen Pythagorean triples, some far larger than any schoolbook example — the fourth row corresponds to 12709, 13500, 18541. The scribe wrote down only the short side and the diagonal of each triangle and left the remaining leg to be worked out. A second tablet of the same era, YBC 7289, gives the diagonal of a square to several correct sexagesimal places, which is the isosceles right-triangle case of the rule. Egyptian material of comparable age, the Berlin Papyrus 6619, sets a problem whose solution is the 6-8-10 triple.

Similar knowledge appears independently in other cultures. In India the Baudhayana Sulba Sutra, dated variously between the 8th and 5th centuries BC, states the theorem in words and lists triples used to lay out sacrificial altars. In China the Zhoubi Suanjing preserves the gougu rule for the 3-4-5 triangle. What Greek mathematics contributed was not the fact but the deductive proof: Euclid, working in Alexandria around 300 BC, derived it from axioms rather than reading it off a table of measurements. The word hypotenuse is Greek as well, from hypoteinousa, meaning "stretching under" — a plain description of the side that stretches beneath the right angle. It entered English in the 1570s by way of Late Latin.

Triples worth recognizing

A Pythagorean triple is a set of three whole numbers that satisfies the theorem. They show up constantly in textbooks and on job sites because the arithmetic comes out clean.

Triple Common multiples
3, 4, 5 6-8-10, 9-12-15, 30-40-50
5, 12, 13 10-24-26
8, 15, 17 16-30-34
7, 24, 25 14-48-50
20, 21, 29 40-42-58

Any multiple of a triple is another triple. That is why framers square a deck with 6-8-10 feet rather than 3-4-5: the longer the sides, the less a small tape-measure error throws off the diagonal. Builders in metric markets run the same check with 60-80-100 cm.

Where the theorem earns its keep

Squaring corners and sizing diagonal braces are the classic construction uses, but the same triangle hides in more places. Screen sizes are the obvious one: a 27-inch monitor measures 27 inches corner to corner, which at 16:9 means only about 23.5 inches of actual width. Ladder guidance runs on a 4-to-1 rule: the US portable-ladder standard for construction sites asks that the foot of a non-self-supporting ladder sit roughly one quarter of the ladder's working length out from the top support, and UK guidance puts the same proportion as one unit out for every four units up. Either reading leans the ladder at close to 75 degrees, and the theorem turns that base offset and the ladder's length into its true vertical reach. The distance formula from coordinate geometry, √((x2 − x1)2 + (y2 − y1)2), is the theorem restated: the horizontal and vertical differences are the legs, and the straight-line distance is the hypotenuse. Surveyors and machinists lean on it whenever a straight-line distance must be recovered from horizontal and vertical offsets, and roofers reverse it to find rafter length from a roof's run and rise. Adding a third squared term for depth extends the same operation to three dimensions, giving the straight-line distance between two points in space that engineering and computer graphics both rely on.

What the calculator assumes

The relationship holds only when the angle between the two legs is exactly 90 degrees; for anything else the law of cosines applies instead. The hypotenuse must be strictly longer than either leg, so entering a hypotenuse shorter than or equal to the known leg produces an error rather than an imaginary side. Lengths carry no units here — feet, meters, or pixels all work, provided both known sides use the same one.

Frequently asked questions

How do I find the hypotenuse of a right triangle?

Square both legs, add the squares, and take the square root of the sum. With legs of 3 and 4 that is 9 + 16 = 25, and the square root of 25 is 5. The hypotenuse is always the longest side and always sits opposite the right angle.

How do I find a leg when I already know the hypotenuse?

Rearrange the theorem: subtract the square of the known leg from the square of the hypotenuse, then take the square root. With a hypotenuse of 13 and a leg of 5, that is 169 − 25 = 144, so the missing leg is 12. If your hypotenuse is not the longest side, the subtraction goes negative and no right triangle exists.

What is the 3-4-5 rule in construction?

It is a site trick for checking that a corner is square without any angle tool. Measure 3 units along one edge and 4 along the other; if the corner is a true 90 degrees, the diagonal between the two marks is exactly 5. Crews usually scale it up to 6-8-10 feet or 60-80-100 cm because longer measurements shrink the relative error.

Why is a 55-inch TV much narrower than 55 inches?

Screen sizes are quoted as the diagonal, which is the hypotenuse of the screen rectangle. A 55-inch 16:9 panel is about 47.9 inches wide and 27 inches tall, so it fits openings well under 55 inches across. The diagonal convention holds even in metric countries, where panels are still sold by the inch.

Does the Pythagorean theorem work on any triangle?

No, it holds only when one angle is exactly 90 degrees. Every other triangle needs the law of cosines, which adds a correction term of −2ab·cos(C) and collapses back to the Pythagorean theorem when C is 90 degrees. The comparison doubles as a test: if c² is smaller than a² + b², the angle opposite c is acute, and if larger, obtuse.