Skip to main content

Pythagorean Theorem Calculator

Find the missing side of a right triangle from the other two, with the substitution written out step by step, plus area, perimeter and a scaled drawing.

For students checking homework and anyone measuring a diagonal.

Last updatedHow we build & check our tools
Results will appear here once you enter your values.

The theorem and the three ways to rearrange it

In any right triangle, the square of the hypotenuse equals the sum of the squares of the two legs: a^2 + b^2 = c^2. The hypotenuse c is the side opposite the 90 degree angle, and the legs a and b are the two sides that meet at it. That one equation gives three working formulas, which are the three settings in the Solve for menu.

  • Hypotenuse: c = sqrt(a^2 + b^2). Add the squares, then take the root.
  • Leg a: a = sqrt(c^2 - b^2). Subtract the known leg's square from the hypotenuse's square.
  • Leg b: b = sqrt(c^2 - a^2). Same idea with the other leg known.

The calculator shows the equation, the squared step with your numbers filled in, and the final substitution, so you can copy the working onto a worksheet. The squared step is hidden when any side is bigger than 1,000,000, since those intermediate numbers are too long to read, but the answer is still calculated. The side being solved is grayed out in the form and filled in for you.

Worked examples, including a real-world diagonal

A ladder problem shows why the leg setting matters. A 13 foot ladder leans against a wall with its foot 5 feet from the base. Choose Side a, enter b = 5 and c = 13. The tool shows a^2 = 169 - 25 = 144, so the ladder reaches 12 feet up the wall. The area of the triangle it makes is 30 square feet and the perimeter is 30 feet.

A diagonal measurement uses the hypotenuse setting. A rectangular frame is 6 inches by 8 inches. Enter a = 6 and b = 8: c^2 = 36 + 64 = 100, so the diagonal is 10 inches. If the sides are not a clean triple, the answer is a decimal. A square with legs of 1 and 1 has a diagonal of 1.41421356, the square root of 2.

  • Check a right angle: measure two sides of a corner and the diagonal across them. If a^2 + b^2 equals the diagonal squared, the corner is square. This is the carpenter's 3-4-5 check.
  • Screen or TV size: the advertised size is a diagonal. For a 16 by 9 shape, legs of 16 and 9 give a diagonal of about 18.36 in the same units.
  • Distance on a grid: the straight-line distance between two points that are 3 blocks east and 4 blocks north is 5 blocks.

What this calculator does not do

It assumes the triangle already has a right angle. If the triangle is not right-angled, a^2 + b^2 does not equal c^2 and the answer will be wrong. For other triangles use the law of cosines, which reduces to the Pythagorean theorem when the angle is 90 degrees. The calculator also does not find the acute angles; for those you need sine, cosine or tangent.

Every side must be a positive number. A zero, a negative number or an empty box shows an error instead of a result. The tool takes two sides and fills in the third, so it cannot directly check three numbers you already have. To test whether they form a right triangle, solve for one side and compare the result with the number you were given.

Source: the theorem is Proposition 47 of Book I of Euclid's Elements, and the rearranged formulas follow directly from it by algebra. The tool computes the hypotenuse with the standard Math.hypot function and subtracts squares in factored form, (c - leg)(c + leg), so that very large sides do not overflow before the root is taken.

Frequently Asked Questions

Common questions about the Pythagorean Theorem Calculator

Choose Solve for: Hypotenuse c, then enter the two legs as side a and side b. The tool squares each leg, adds them and takes the square root: c = sqrt(a^2 + b^2). With a = 3 and b = 4 it shows c^2 = 9 + 16 = 25, so c = 5. The hypotenuse is always the longest side and sits opposite the right angle.