Pythagorean Theorem Calculator
a² + b² = c² · Leave one field at 0 to solve
Try an example
Solution
a = 3.0000
a=3, b=4, c=5.0000
Step-by-step solution
1. a² + b² = c²
2. a² + 4² = 5²
3. a² + 16 = 25
4. a² = 25 − 16 = 9
5. a = √9 = 3.0000
About the Pythagorean Theorem Calculator
The Pythagorean theorem states that in a right triangle, the square of the hypotenuse equals the sum of the squares of the other two sides. It applies only to right triangles, and only ever to right triangles — this constraint is what makes it so useful, because it means the relationship can also be run backwards to test whether an angle is truly 90°.
That reverse use is the theorem's most common real-world application, and it long predates the proof. Egyptian rope-stretchers, Babylonian surveyors and every carpenter since have used the fact that a triangle with sides 3, 4 and 5 must contain a right angle. You do not need a square, a level or any instrument — three measurements establish a perpendicular to whatever precision your tape allows.
The theorem also generalises further than most people realise. It is the definition of distance in Euclidean space, which means it underlies coordinate geometry, vector magnitude, standard deviation, least-squares regression, GPS trilateration and the norm calculations inside every machine learning library. When code computes sqrt(x*x + y*y), it is running this theorem.
Formula
a² + b² = c² → c = √(a² + b²) | a = √(c² − b²)
- a, b
- The two legs — the sides that meet at the right angle
- c
- The hypotenuse — always the longest side, always opposite the right angle
To find the hypotenuse, square both legs, add them, take the square root. To find a missing leg, subtract instead of adding: a = √(c² − b²). Getting these two operations the wrong way round is by far the most frequent error, and it always produces a hypotenuse shorter than a leg, which is impossible.
Identifying the hypotenuse correctly is the whole game. It is the side opposite the right angle and the longest side in the triangle. If you know the right angle's location, the hypotenuse is the side that does not touch it.
A quick sanity check: the hypotenuse must be longer than either leg but shorter than their sum. For legs of 5 and 12, c must lie strictly between 12 and 17. Any answer outside that range is wrong, and this catches most arithmetic slips instantly.
Worked Examples
Finding the hypotenuse: legs of 8 and 15
A right triangle with legs measuring 8 and 15 units. Find the third side.
Result: c = 17 units exactly
8-15-17 is a Pythagorean triple — three integers that satisfy the theorem exactly. The common ones worth memorising are 3-4-5, 5-12-13, 8-15-17 and 7-24-25, along with all their multiples.
Finding a missing leg: hypotenuse 13, one leg 5
A 13-foot ladder leans against a wall with its base 5 feet out. How high up the wall does it reach?
Result: The ladder reaches 12 feet up the wall
The ladder is the hypotenuse because it is opposite the right angle formed by the wall and the ground. Adding instead of subtracting here gives √194 ≈ 13.9 — longer than the ladder itself, which is the tell that the operation was reversed.
Squaring a corner with the 3-4-5 method
Laying out a deck footing and needing a genuinely square corner without a large framing square.
Result: The corner is square to within the accuracy of your tape
Use the largest multiple your space allows. A 3-4-5 in inches amplifies a 1/8 in error into roughly 1.8° of skew; a 6-8-10 in feet reduces the same absolute error to about 0.1°. Precision scales with the size of the triangle.
How to Use the Result
The converse: testing whether an angle is right
The theorem runs both ways. If a² + b² = c² holds for a triangle's three sides, then the angle opposite c must be exactly 90°. This is what makes it a practical measuring tool rather than just a calculation.
The comparison also tells you which way an angle is off when it does not hold. If a² + b² > c², the angle opposite c is acute — the corner is closed too tightly. If a² + b² < c², it is obtuse and the corner is splayed open. Contractors checking a room for square measure both diagonals: equal diagonals mean a true rectangle, and the difference tells you which corner to move.
Distance between two points
The distance formula is the theorem applied to coordinates. For points (x₁, y₁) and (x₂, y₂), the horizontal and vertical separations form the legs of a right triangle and the straight-line distance is the hypotenuse:
d = √[(x₂ − x₁)² + (y₂ − y₁)²]
It extends to three dimensions by adding another squared term: d = √(Δx² + Δy² + Δz²). This is how you find the length of a diagonal brace through a rectangular frame, or the true separation of two points in a 3D model. The generalisation continues to any number of dimensions, which is exactly what a vector norm is.
Common applications outside the classroom
The pattern appears wherever a right angle does, which in built environments is nearly everywhere:
- —Rafter and stair calculations. Rise and run are the legs; the rafter length or stair stringer is the hypotenuse. A 6 ft rise over an 8 ft run needs a 10 ft rafter.
- —Room diagonals. A 12 ft × 16 ft room has a 20 ft diagonal — the check for whether a long item will fit, and for verifying the room is actually rectangular.
- —Screen sizes. Televisions are sold by diagonal. A 55 in 16:9 screen is 47.9 in wide and 27.0 in tall, because √(16² + 9²) = 18.36 and 55/18.36 gives the scale factor.
- —Navigation and vectors. Combining a 30 km/h northward component with a 40 km/h eastward one gives a resultant speed of 50 km/h — the same 3-4-5 relationship.
- —Cable and conduit runs. The shortest path across a wall between two points at different heights is the hypotenuse, and it is always shorter than routing along both legs.
Edge Cases and Common Mistakes
It does not apply to non-right triangles
This is the single most consequential limitation. For any triangle without a 90° angle you need the law of cosines: c² = a² + b² − 2ab·cos(C). Notice that when C = 90°, cos(C) = 0 and the correction term vanishes, leaving the Pythagorean theorem — it is the special case, not the general rule.
A negative value under the root means impossible measurements
When solving for a leg, if c² − b² comes out negative you have given a "leg" longer than the hypotenuse. Either the sides were mislabelled or one measurement is wrong. The hypotenuse is always the longest side, without exception.
Units must match, and the answer inherits them
Mixing feet with inches or metres with centimetres produces nonsense, and squaring makes the error grow quadratically. Convert everything to a single unit first. For imperial work, converting fractional inches to decimal before squaring avoids a second source of error.
It fails on curved surfaces
The theorem is a statement about flat, Euclidean geometry. On a sphere it does not hold — a triangle on the Earth's surface with three right angles is entirely possible. For distances beyond a few dozen kilometres, spherical trigonometry (the haversine formula) is required, which is why GPS software does not simply square and add latitude and longitude differences.
Frequently Asked Questions
How do I know which side is the hypotenuse?
It is the side opposite the right angle, and it is always the longest of the three. If you can see the right angle marked, the hypotenuse is the one side that does not touch it. If you only have three lengths, the largest is the hypotenuse — assuming the triangle is right-angled at all.
Does the theorem work for any triangle?
No, only right triangles. For others, use the law of cosines, which adds a −2ab·cos(C) correction term. Applying the Pythagorean theorem to a non-right triangle will silently give a wrong answer rather than an obvious error, which makes it a dangerous mistake.
What are Pythagorean triples and why do they matter?
They are sets of three whole numbers satisfying a² + b² = c², such as 3-4-5, 5-12-13, 8-15-17 and 7-24-25. Any multiple of a triple is also a triple, so 6-8-10 and 9-12-15 work too. They matter practically because they let you lay out or verify a right angle using only a tape measure and whole-number lengths.
Can I use 3-4-5 in any unit?
Yes — inches, feet, metres, or arbitrary tape marks. Only the ratio matters. Use the largest multiple that fits your space, because measurement error stays constant in absolute terms while the triangle grows, so a bigger triangle gives a more accurate right angle.
How does this relate to the distance formula?
They are the same theorem. The distance formula √[(x₂−x₁)² + (y₂−y₁)²] simply names the legs as the horizontal and vertical coordinate differences. Anything that computes a straight-line distance in flat space is applying Pythagoras.
Why does squaring appear rather than just adding the sides?
Because the theorem is fundamentally about areas. The original geometric statement is that the square built on the hypotenuse has the same area as the two squares on the legs combined. The algebra is a restatement of an area equivalence, which is why the relationship is quadratic rather than linear.