Pythagorean Theorem Calculator
Solve right triangles with the Pythagorean theorem without choosing a calculation mode first. Enter any two of a, b, and c and the calculator finds the missing side automatically. Enter all three to check whether they form a right triangle. Review exact radical form when available, calculation steps, a proportional triangle diagram, area, perimeter, altitude, and acute angles.
Additional
Controls displayed rounding only. The calculation keeps full numeric precision.
Exact radical form is shown when the squared expression can be simplified exactly by the calculator. Decimal-place selection does not change that exact form.
How to use the Pythagorean Theorem Calculator
Enter any two of the three side lengths a, b, and c. Leave the side you want to find blank.
Sides a and b are the legs that meet at the right angle. Side c is the hypotenuse opposite the right angle and is the longest side.
The calculator determines automatically which formula is needed. If you enter all three sides, it switches from solving to checking whether the lengths form a right triangle.
Choose an optional common unit. Decimal-place control is available under Additional and changes displayed rounding only.
The result includes the missing side or right-triangle verdict, a proportional diagram, worked calculation, and additional geometry.
| Enter | Leave blank | Calculator action | Formula |
|---|---|---|---|
| a and b | c | Find the hypotenuse | c = √(a² + b²) |
| b and c | a | Find side a | a = √(c² − b²) |
| a and c | b | Find side b | b = √(c² − a²) |
| a, b, and c | None | Check whether the triangle is right | Compare a² + b² with c² |
What the Pythagorean theorem says
For a right triangle, the square of the hypotenuse equals the sum of the squares of the two legs.
The relationship is written a² + b² = c².
Because c² contains both positive squared legs, the hypotenuse must be longer than either individual leg.
The theorem applies when the angle between a and b is 90 degrees.
Find the hypotenuse
When a and b are known, leave c blank.
The calculator uses c = √(a² + b²).
For a = 3 and b = 4, c = √(9 + 16) = √25 = 5.
Only the positive square root is used because a geometric length must be positive.
| Step | Operation | Result |
|---|---|---|
| Enter the known legs | a = 3 and b = 4 | Leave c blank |
| Apply the theorem | c = √(a² + b²) | c = √(3² + 4²) |
| Square the legs | 3² + 4² | 9 + 16 = 25 |
| Take the positive root | c = √25 | c = 5 |
| Calculate area | A = ab ÷ 2 | A = 6 square units |
| Calculate perimeter | P = a + b + c | P = 12 units |
Find a missing leg
When the hypotenuse and one leg are known, leave the other leg blank.
For side a, rearrange the theorem to a = √(c² − b²). For side b, use b = √(c² − a²).
The hypotenuse must be longer than the entered leg. Otherwise there is no positive missing leg for a right triangle.
For b = 12 and c = 13, leaving a blank gives a = √(169 − 144) = 5.
Check whether three sides form a right triangle
Enter values for a, b, and c to use the converse of the Pythagorean theorem.
The calculator treats c as the proposed hypotenuse and compares a² + b² with c².
It first validates that c is the longest side and that the three lengths satisfy the triangle inequality.
If the values do not describe a right triangle, the result shows the hypotenuse required by the entered legs so the difference is visible.
Exact radical and decimal answers
Not every right-triangle side has a terminating decimal or whole-number value.
For a = 1 and b = 1, the exact hypotenuse is √2 while 1.4142 is only a rounded decimal approximation.
When a supported integer radicand contains a square factor, the calculator simplifies it. For example, √8 becomes 2√2.
The exact form is useful for symbolic mathematics while a rounded decimal is often more practical for measurement.
| Legs a and b | Exact c | Approximate c | Result type |
|---|---|---|---|
| 3 and 4 | 5 | 5 | Whole-number result |
| 1 and 1 | √2 | 1.4142 | Irrational result |
| 2 and 2 | 2√2 | 2.8284 | Simplified radical |
| 5 and 6 | √61 | 7.8102 | Irrational result |
What else the calculator finds
Once a valid right triangle is known, the same three sides determine several other geometric quantities.
Area equals ab ÷ 2 because the two legs are perpendicular.
Perimeter is a + b + c.
The altitude from the right-angle vertex to the hypotenuse is ab ÷ c.
The two acute angles are derived from the leg ratios and together total 90 degrees.
| Result | Method | Available when |
|---|---|---|
| Missing side | Pythagorean theorem | Whenever exactly two valid sides are entered |
| Right-triangle check | Compare a² + b² with c² | When all three sides are entered |
| Area | ab ÷ 2 | For a completed right triangle |
| Perimeter | a + b + c | For a completed right triangle |
| Altitude to hypotenuse | ab ÷ c | For a completed right triangle |
| Acute angles | Inverse tangent ratios | For a completed right triangle |
Pythagorean triples
A Pythagorean triple is a set of positive whole numbers satisfying a² + b² = c² exactly.
The best-known example is 3–4–5.
Multiplying all three sides by the same positive factor preserves the right angle, so 6–8–10 and 9–12–15 are also right triangles.
Triples are convenient for examples and physical layout checks, but right-triangle side lengths do not need to be integers.
| Triple | Verification | Scaled examples | Common use |
|---|---|---|---|
| 3–4–5 | 9 + 16 = 25 | 6–8–10; 9–12–15 | Fast square-corner checks |
| 5–12–13 | 25 + 144 = 169 | 10–24–26 | Construction and surveying |
| 8–15–17 | 64 + 225 = 289 | 16–30–34 | Compact integer triangle |
| 7–24–25 | 49 + 576 = 625 | 14–48–50 | Geometry and layout work |
| 20–21–29 | 400 + 441 = 841 | 40–42–58 | Triangles with similar legs |
| 12–35–37 | 144 + 1,225 = 1,369 | 24–70–74 | Larger exact measurements |
Use a 3–4–5 triangle to square a corner
Measure 3 equal units along one edge and 4 equal units along the other.
If the straight-line distance between those marks is 5 of the same units, the three measurements satisfy the Pythagorean theorem.
Larger proportional measurements such as 6–8–10 can reduce the relative effect of small measuring errors.
The calculator supplies the geometry, but real layout work still depends on suitable measuring tools, tolerances, reference lines, and construction requirements.
Find diagonals with the theorem
Any rectangle can be divided into two right triangles by its diagonal.
Its width and height become the two legs, and the corner-to-corner diagonal becomes the hypotenuse.
For a rectangle measuring 9 by 12, the diagonal is √(9² + 12²) = 15.
The same relationship appears in screens, frames, braces, ramps, ladders, roofs, and other two-dimensional rectangular layouts.
The distance formula is the same geometry
On a flat coordinate plane, the horizontal coordinate change and vertical coordinate change are perpendicular.
Those changes form the two legs of a right triangle.
The straight-line distance between the points is therefore d = √((x₂ − x₁)² + (y₂ − y₁)²).
This is the Pythagorean theorem applied to coordinate differences.
Where the theorem is useful
The theorem is useful whenever two perpendicular measurements determine a direct diagonal or magnitude.
Examples include rectangular diagonals, construction layout, roof and ramp lengths, coordinate distance, and two-dimensional vector magnitude.
The perpendicular relationship must come from the geometry of the problem. Three arbitrary lengths do not automatically form a right triangle.
| Application | Perpendicular legs | Calculated value | Example |
|---|---|---|---|
| Square a layout | Two perpendicular measurements from one corner | Required diagonal | 3–4–5 confirms a 90° corner |
| Ramp, ladder, or roof | Horizontal run and vertical rise | Sloped length | 6 m run and 2 m rise require √40 m |
| Rectangle or display | Width and height | Corner-to-corner diagonal | 9 by 12 gives a diagonal of 15 |
| Coordinate distance | Horizontal and vertical coordinate changes | Straight-line distance | Δx = 6 and Δy = 8 gives distance 10 |
| Two-dimensional vector | Perpendicular vector components | Vector magnitude | Components 5 and 12 give magnitude 13 |
Units must match before calculation
All entered side lengths must use the same unit.
Do not enter a in metres and b in centimetres without converting one first.
The unit selector labels the answer, perimeter, altitude, and area. It does not alter the entered numbers or perform conversions.
Area uses the square of the selected length unit, such as cm² or ft².
Choosing decimal precision
The Additional control changes only how many decimal places are displayed.
The underlying calculation retains the available floating-point precision.
Choose a displayed precision that matches the precision of the original measurements rather than presenting unnecessary digits.
Exact radical output, when available, is independent of the decimal-place setting.
Why the proportional diagram can look unusual
The triangle diagram scales the two legs according to their calculated proportions.
If one leg is much longer than the other, the shorter leg may appear extremely small.
That is expected in a proportional drawing and is preferable to distorting the triangle merely to make every side visually prominent.
The diagram is explanatory rather than a construction drawing and should not be measured from the screen.
Numerical stability for large or close values
Directly squaring very large values can overflow even when the final hypotenuse remains representable.
The calculator uses Math.hypot when solving the hypotenuse to reduce that risk.
Missing-leg calculations use a factored form of c² − a² or c² − b² to reduce unnecessary overflow and cancellation.
For three-side checking, values are scaled before squared quantities are compared.
Results that remain outside JavaScript's finite numeric range are rejected or reported as unavailable.
Limits of the Pythagorean theorem
The equation a² + b² = c² applies specifically to right triangles.
A triangle without a 90-degree angle generally requires the law of cosines, law of sines, or additional angle information.
A three-dimensional box diagonal requires extending the theorem to three perpendicular dimensions, giving √(length² + width² + height²).
Long-distance routes over Earth require geographic or geodesic calculations rather than a flat-plane right triangle.
Structural design can also require loading, material properties, tolerances, code compliance, and professional analysis beyond side-length geometry.
Historical context
The right-triangle relationship was known in ancient mathematical traditions before the surviving Greek treatments.
Euclid gave a geometric proof in Book I, Proposition 47 of the Elements.
The familiar modern name associates the theorem with Pythagoras, although the historical record is broader than a single surviving discovery account.
Pythagorean theorem and right-triangle formulas
The missing-side formulas are rearrangements of a² + b² = c². Additional measurements are derived after the complete right triangle is known.
- First leg adjoining the right angle
- Second leg adjoining the right angle
- Hypotenuse opposite the right angle
- Area of the right triangle
- Perimeter
- Altitude from the right-angle vertex to the hypotenuse
- Acute angle opposite side a
- Acute angle opposite side b
- Straight-line two-dimensional coordinate distance
- Three-dimensional rectangular diagonal
Examples
Find the hypotenuse
Enter a = 3 and b = 4; leave c blank.
c = 5. Area = 6, perimeter = 12, and the acute angles are approximately 36.8699° and 53.1301°.
Find side a
Enter b = 12 and c = 13; leave a blank.
a = 5 because √(13² − 12²) = √25.
Find side b
Enter a = 9 and c = 15; leave b blank.
b = 12 because √(15² − 9²) = √144.
Keep an irrational answer exact
Enter a = 1 and b = 1.
Exact c = √2; decimal c ≈ 1.4142 at four displayed decimal places.
Simplify a radical
Enter a = 2 and b = 2.
Exact c = 2√2; decimal c ≈ 2.8284.
Verify a right triangle
Enter a = 6, b = 8, and c = 10.
Yes. The three values satisfy 6² + 8² = 10².
Reject a non-right set
Enter a = 5, b = 6, and c = 8.
No. The two legs require c ≈ 7.8102 rather than 8.
Find a rectangle diagonal
Treat width 9 ft as a and height 12 ft as b.
The diagonal c is 15 ft.
Find coordinate distance
Use horizontal change 6 as one leg and vertical change 8 as the other.
The straight-line distance is 10.
Frequently Asked Questions
What is the Pythagorean theorem?
For a right triangle with legs a and b and hypotenuse c, the theorem states a² + b² = c².
How do I use this calculator?
Enter any two side lengths and leave the unknown side blank. The calculator automatically determines which side to solve. Enter all three sides to check whether the triangle is right.
Do I need to choose what side to calculate first?
No. The blank side determines the calculation automatically.
How do I find the hypotenuse?
Enter sides a and b and leave c blank. The calculator uses c = √(a² + b²).
How do I find a missing leg?
Enter the hypotenuse c and the other known leg, then leave the missing leg blank.
How do I know which side is c?
Side c is opposite the 90-degree angle and is the longest side of a right triangle.
Can this check whether three sides form a right triangle?
Yes. Enter a, b, and c. The calculator validates the proposed triangle and compares a² + b² with c².
What happens if the three sides are not a right triangle?
The result reports that they are not right and shows the hypotenuse required by the entered legs a and b.
Why must c be longer than either leg?
The hypotenuse lies opposite the 90-degree angle and is the longest side. Algebraically, c² equals the sum of two positive squared legs.
Can I enter decimal side lengths?
Yes. Positive decimals, valid grouped values, and scientific notation are supported.
Can I enter negative values?
No. Geometric side lengths must be greater than zero.
Can I mix feet and inches?
Not directly. Convert all entered sides to one common unit before calculating.
Does the unit selector convert values?
No. It labels the entered and calculated measurements only.
Why does the calculator show an exact radical?
A radical such as √2 is exact, while its decimal representation is rounded.
Why is √8 simplified to 2√2?
Because 8 contains the square factor 4: √8 = √4 × √2 = 2√2.
Does changing decimal places change the calculation?
No. It changes displayed rounding only.
What is a Pythagorean triple?
It is a set of positive whole-number side lengths satisfying a² + b² = c² exactly, such as 3–4–5 or 5–12–13.
Does scaling a Pythagorean triple still work?
Yes. Multiplying all three sides by the same positive factor preserves the right angle.
How does the 3–4–5 method square a corner?
Measure 3 equal units along one edge and 4 along the other. A 5-unit diagonal between the marks forms a right triangle.
How is the distance formula related?
Horizontal and vertical coordinate changes are perpendicular, so their straight-line distance is the hypotenuse of a right triangle.
Can this calculate area?
Yes. For a valid right triangle, area is calculated as a × b ÷ 2.
Can this calculate the acute angles?
Yes. Once the right triangle is complete, the calculator derives both acute angles.
What is altitude to the hypotenuse?
It is the perpendicular distance from the right-angle vertex to side c. For a right triangle it equals ab ÷ c.
Does the theorem work for every triangle?
No. It applies specifically to right triangles. General triangles may require the law of cosines, law of sines, or additional angle information.
Can this calculate a box diagonal?
Not directly through the three side fields. A rectangular box diagonal is √(length² + width² + height²), which extends the same idea to three perpendicular dimensions.
Why can the diagram look extremely thin?
It is drawn in proportion. When one leg is much longer than the other, the shorter leg is correspondingly small.
Can I measure lengths from the diagram?
No. The diagram illustrates proportions and side relationships; it is not a construction or measurement instrument.
Does the calculator work with very large numbers?
It uses numerically safer methods for the hypotenuse, missing-leg calculations, and three-side comparisons, but values outside JavaScript's finite numeric range cannot be represented.