Pythagorean Theorem Calculator
Find any side of a right triangle using the Pythagorean theorem.
Related calculators
About
Pythagorean Theorem Calculator
The Pythagorean theorem, also written as Pythagoras' theorem, is a relation between the three sides of a right triangle, meaning a triangle in which one angle is 90°. It states that the area of the square formed on the longest side, the hypotenuse, equals the sum of the areas of the squares formed on the other two sides.
Given that the longest side c is the hypotenuse and a and b are the other two sides:
This is the Pythagorean equation, named after the ancient Greek thinker Pythagoras. It is useful because knowing any two sides of a right triangle is enough to determine the third. With a = 3 and b = 4:
The same rearranges to find either leg when the hypotenuse is known:
The law of cosines generalises all of this to any triangle: c² = a² + b² − 2ab·cos(C), where C is the angle between sides a and b. When that angle is 90° its cosine is zero, the last term disappears, and what remains is the Pythagorean equation. Pythagoras is the special case, not the general rule.
Who actually discovered it
The relationship was in use long before Pythagoras, who lived around 570 to 495 BC. The Babylonian clay tablet catalogued as Plimpton 322, dated to roughly 1800 BC, lists what are plainly Pythagorean triples. The Baudhayana Sulba Sutra in India states the rule for the diagonal of a rectangle several centuries before Pythagoras, and the Chinese Zhoubi Suanjing records the gougu rule with a diagram amounting to a proof.
What the Greek tradition contributed was proof rather than discovery: a general argument that the relation holds for every right triangle, not a collection of cases that happen to work. Euclid set it out as Proposition 47 of Book I of the Elements, and the converse, that a triangle whose sides satisfy the equation must contain a right angle, follows as Proposition 48.
The proofs
There are a multitude of proofs of the Pythagorean theorem, possibly more than for any other theorem in mathematics. Elisha Loomis collected 367 of them in The Pythagorean Proposition in 1927, and the count has grown since. One is due to James Garfield, who published a trapezoid-based argument in 1876, five years before becoming president of the United States.
Two of the simplest are algebraic, and both work by arranging four copies of the same right triangle in different ways.
In the first arrangement, four copies of the triangle surround a tilted square of side c. Together they make a large square of side b + a. The area of that large square equals the tilted square plus the four triangles:
Expanding and cancelling gives c² = b² + 2ab + a² − 2ab, which is c² = a² + b², the Pythagorean equation.
In the second arrangement, the same four triangles enclose a small square of side b − a, and the outer boundary is a square of side c. Setting the outer area equal to the parts:
The −2ab and +2ab cancel again, leaving c² = a² + b². Numerous other proofs exist, from geometric dissections to arguments using differentials, but these two are among the easiest to follow.
Pythagorean triples
A Pythagorean triple is a set of three whole numbers satisfying the equation. The smallest is 3, 4, 5, followed by 5, 12, 13 then 8, 15, 17 then 7, 24, 25. Any multiple of a triple is another triple, so 6, 8, 10 works as well, and a triple whose three numbers share no common factor is called primitive.
Euclid gave a formula that generates every primitive triple. Take two coprime positive integers m and n with m greater than n and one of them even: then a = m² − n², b = 2mn and c = m² + n² is a triple. Setting m = 2 and n = 1 produces 3, 4, 5.
Builders still use the first of these to square a corner: measure 3 units along one wall, 4 along the other, and adjust until the diagonal reads exactly 5. It needs no instrument beyond a tape measure and is the oldest practical application of the theorem still in daily use.
Whole-number solutions are special to the exponent 2. Fermat claimed in about 1637 that aⁿ + bⁿ = cⁿ has no positive integer solutions for any n above 2, and the margin of his copy of Diophantus was famously too small for the proof. It took until 1994, when Andrew Wiles proved it after seven years of largely solitary work.
What else the calculator gives you
With two sides known, everything else about a right triangle follows. Both acute angles come from the ratios of the sides:
and they always add to 90°, since the third angle takes the remaining 90° of the 180° total. Angles are reported three ways here, as decimal degrees, as degrees, minutes and seconds, and in radians, because different fields expect different ones.
The area is half the product of the legs, since a right triangle is exactly half a rectangle with those sides. The altitude from the right angle to the hypotenuse, marked h, comes from equating two expressions for that area:
That altitude is more useful than it looks. It divides the triangle into two smaller triangles, both similar to the original and to each other, and h is the geometric mean of the two segments it cuts the hypotenuse into. Roof pitch, ramp clearance and the shortest distance from a corner to a sloped face are all this measurement.
Working with exact values
Both input boxes for each side let you enter a coefficient and a number under the root, so a side of 4√5 goes in exactly rather than as 8.944. This matters more than it first appears: right triangles produce irrational sides constantly. A unit square has a diagonal of √2, which is the number that famously broke the Pythagorean belief that everything could be written as a ratio of whole numbers.
Keeping values exact also keeps the answers exact. With a = 4√5 and b = 2√6, the hypotenuse is √104, which simplifies to 2√26, and the altitude works out to 4√195/13 after rationalising the denominator. Both are precise; their decimals, 10.198039027186 and 4.2966892442366, are truncations. The calculator carries the surd form through every step and prints the decimal alongside it.
Where it turns up
The distance formula in coordinate geometry is the Pythagorean theorem in disguise: the distance between two points is the square root of the squared differences in x and y, which is just a right triangle with legs parallel to the axes. Extending it to three dimensions gives the diagonal of a box as √(a² + b² + c²), and the same pattern continues into higher dimensions, which is how distance is defined in machine learning feature spaces.
Screen sizes are quoted as the diagonal, so the theorem converts a 16:9 ratio and a 55-inch diagonal into actual width and height. Navigation, surveying, structural bracing and any calculation involving a slope all reduce to the same relation. It is one of the few pieces of school mathematics that most people use again, usually without noticing.
Common questions
Frequently asked questions
For any right triangle, the square of the hypotenuse equals the sum of the squares of the other two sides: a² + b² = c². The hypotenuse is always the longest side and always sits opposite the right angle. It only holds for triangles containing a 90° angle.
Rearrange to a = √(c² − b²) or b = √(c² − a²). Subtract rather than add, and the hypotenuse must be the larger value or the square root turns negative. The calculator handles this automatically: fill in any two of the three boxes and it solves for whichever you left blank.
No. Use the law of cosines instead: c² = a² + b² − 2ab·cos(C), where C is the angle between sides a and b. When C is 90° its cosine is zero and the formula collapses back into the Pythagorean equation, which makes Pythagoras a special case of the law of cosines.
Whole-number side lengths that satisfy the equation, such as 3-4-5, 5-12-13, 8-15-17 and 7-24-25. Any multiple of one is also a triple. Builders use 3-4-5 to check that a corner is square with nothing but a tape measure, which is the oldest use of the theorem still in everyday practice.
Because right triangles produce irrational sides constantly, and typing a decimal throws away precision at the first step. Entering 4√5 exactly lets the calculator carry the surd through every stage, so the hypotenuse comes out as 2√26 and the altitude as 4√195/13 rather than as rounded decimals. Leave the second box blank for an ordinary number.
No. The Babylonian tablet Plimpton 322, from around 1800 BC, lists Pythagorean triples more than a thousand years earlier, and the rule appears independently in Indian and Chinese texts. What the Greek tradition added was a general proof rather than a list of cases that work, which Euclid set out as Proposition 47 of Book I.
The perpendicular distance from the right angle to the hypotenuse, calculated as h = ab/c. It splits the triangle into two smaller triangles, both similar to the original, and equals the geometric mean of the two pieces it cuts the hypotenuse into. It is the measurement behind roof pitch and ramp clearance.
Hundreds. Elisha Loomis collected 367 in The Pythagorean Proposition in 1927 and more have been published since, probably more than for any other theorem. They range from rearranging four copies of the triangle to arguments using calculus. James Garfield published one in 1876, five years before he became president of the United States.