Pythagorean Theorem Calculator
Enter two sides to get the third one, in exact or simplified radical form, with a right-triangle check.
Given two sides of a right triangle, the third follows from the Pythagorean theorem — the calculation behind setting out a right angle, checking a screen diagonal, or estimating a distance you cannot measure directly. Choose which two sides you have, enter them, and the third comes back as an exact integer where possible, otherwise as a simplified surd together with a decimal approximation.
Surds are simplified by pulling out square factors: √(a²b) = a√b, so √12 becomes 2√3. A reference table of common triples — 3-4-5, 5-12-13, 8-15-17 and their multiples — is included, and the 3-4-5 triple is exactly what builders use to square a corner: measure 3 and 4 along the two edges, and the diagonal must come out at 5.
Did this tool solve your problem?
Submitting sends the tool name, your input and the current result to the server. Please do not include ID numbers, phone numbers or other private data.
AI assistant It answers using your current input and result
Asking again sends your current input and result to the server once more. Please do not include private data.
How to use
- Choose which two sides you know (the two legs, or the hypotenuse and one leg).
- Enter the lengths.
- Read the third side — an exact integer, or a simplified surd with its decimal value.
- Check the squares relation and the common-triples table for context.
How it works
Two uses of a² + b² = c²
The Pythagorean theorem relates the sides of a right triangle: a² + b² = c², where c is the hypotenuse (the side opposite the right angle). Given the two legs, square-root the sum to get the hypotenuse; given the hypotenuse and one leg, subtract and square-root — the hypotenuse must exceed the known leg, or no solution exists.
Non-integer results: radicals and decimals
Results are not always integers. Legs 3 and 4 give 5; 6 and 8 give 10. But 1 and 1 give √2 ≈ 1.414214, and 2 and 3 give √13 ≈ 3.605551. The tool provides both the simplified radical (extracting perfect-square factors, e.g. √20 = 2√5) and a decimal approximation — exams and drawings usually want the former, quick distance estimates the latter.
Common Pythagorean triples and the right-angle test
The test also works in reverse: sort the three sides; if a² + b² = c² the angle opposite the longest side is right (like 3-4-5); if the sum is smaller the triangle is acute, if larger obtuse. Integer solutions are Pythagorean triples — 3-4-5, 5-12-13, 8-15-17, 7-24-25 — and any scale-up stays valid (6-8-10, 9-12-15).
Calculation basis: the Pythagorean theorem a² + b² = c². Integer results are given exactly; otherwise the sum or difference of squares is simplified by extracting perfect-square factors, producing the form √m or k√m plus a decimal approximation. The right-angle check compares the square of the longest side with the sum of the squares of the other two.
Code example
JavaScript Pythagoras: finding a side, and simplifying radicals
function hypot(a, b) { return Math.hypot(a, b); }
function leg(c, a) { return Math.sqrt(c * c - a * a); }
function simplifySqrt(n) { // √n → a√b
let a = 1;
for (let i = 2; i * i <= n; i++)
while (n % (i * i) === 0) { n /= i * i; a *= i; }
return a === 1 ? "√" + n : a + "√" + n;
}
hypot(3, 4); // 5
simplifySqrt(12); // "2√3"
Python math.hypot and simplification with sympy
import math
math.hypot(3, 4) # 5.0
math.sqrt(4 ** 2 - 3 ** 2) # 2.6457... (finding a leg)
# For exact radical simplification use sympy:
from sympy import sqrt, simplify
sqrt(12) # 2*sqrt(3) (reduced automatically)
FAQ
How do I test for a right triangle from three sides?
Sort the sides and compare the square of the longest with the sum of squares of the other two: equal means right, smaller (sum is bigger) means acute, larger means obtuse. 3-4-5, 6-8-10 and 5-12-13 all satisfy the right-angle relation.
What does the √2 in the result mean?
The exact value. 1² + 1² = 2, so the hypotenuse is √2 — an irrational number that decimals can only approximate (about 1.414214). Keeping the radical preserves precision, which is why it's the standard way to write an isosceles right triangle's hypotenuse.
Hypotenuse 5, one leg 3 — what is the other leg?
4. Because 5² − 3² = 25 − 9 = 16 and √16 = 4. Remember the hypotenuse you enter must be larger than the known leg, or the tool reports no solution.
What does the classic 3-4-5 triple mean?
It is the smallest integer right triangle: legs 3 and 4, hypotenuse 5. Builders still use it to square corners — any multiple works the same way (6-8-10, 9-12-15).
How does √20 simplify to 2√5?
Factor a perfect square out of the radicand: 20 = 4 × 5, so √20 = √4 · √5 = 2√5; likewise 50 = 25 × 2 and √50 = 5√2. The tool does this automatically, which helps combine radicals and estimate sizes.
How does this relate to trigonometry?
Very directly: sinθ and cosθ are defined as side ratios in a right triangle, and substituting the Pythagorean relation yields the identity sin²θ + cos²θ = 1. Distance and height problems routinely mix the two.
Are my side lengths uploaded?
No. Inputs only participate in local powers and square roots — nothing is sent to a server, nothing is tracked. History stays in this browser, clears with one click, and vanishes with an incognito window.