Trigonometry

Pythagorean Theorem

The Pythagorean theorem relates the sides of a right triangle: a² + b² = c², where c is the hypotenuse. Enter any two sides and leave the third blank; the calculator solves for the missing one and shows the working.

Pythagorean Theorem

Find the missing side of a right triangle.

Try:
Answerc = 10
  1. Hypotenusec = √(a² + b²) = √(36 + 64) = 10

Two directions, one relation

In a right triangle the three sides are not free to be whatever they like. Fix two of them and the third is determined — squared, the two shorter sides add to exactly the longest one squared. That single relation is why two measurements are enough to describe such a triangle completely.

This calculator solves it in whichever direction you need. Enter the two sides you know, leave the third blank, and it finds the missing one.

The theorem is usually met as a way to find the hypotenuse, but the same equation rearranges to find a leg — and that second case is where the sign changes and the errors appear. Adding two squares always works; subtracting them only works when the larger square is on the correct side.

Leaving a field blank rather than choosing a mode is what makes both directions the same operation. The tool reads which value is missing and rearranges accordingly, so nothing about the setup has to change.

How to use this calculator

  1. Enter the two sides you know Any two of the three fields. Leaving more or fewer than one blank is rejected, since the calculation needs exactly two knowns.
  2. Leave the unknown field empty That is how the missing side is identified. There is no separate mode to select — which field is blank determines the direction of the calculation.
  3. Respect the labelling The third field is the hypotenuse, the side opposite the right angle. The first two are the legs meeting at it, and they are interchangeable with each other.
  4. Read the working line It shows the two squares and whether they were added or subtracted, which distinguishes the two cases at a glance.

The formula, and where it comes from

a² + b² = c² c = √(a² + b²) a = √(c² − b²)

The relation is a statement about areas: squares built on the two legs together cover exactly the same area as a square built on the hypotenuse. That reading explains why every term is squared rather than being an arbitrary feature of the algebra.

Solving for the hypotenuse is an addition under a root and can never fail — two positive lengths always produce a valid third. The implementation uses the hypotenuse function rather than squaring and adding directly, which avoids overflow when the legs are very large and loses less precision when one is far smaller than the other.

Solving for a leg is a subtraction, and subtraction can go wrong. If the value entered as the hypotenuse is not larger than the known leg, the quantity under the root is negative or zero and no such triangle exists. The solver checks that before taking the root and reports the problem rather than returning a non-finite value.

The converse of the theorem is worth knowing alongside it: any triangle whose sides satisfy the relation must have a right angle. That makes the equation a test for perpendicularity as well as a way to compute a length.

What each input means

a First leg — form field “Leg a”
One of the two sides meeting at the right angle. Interchangeable with the other leg, since both are added.
b Second leg — form field “Leg b”
The other side at the right angle.
c Hypotenuse — form field “Hypotenuse c”
The side opposite the right angle, always the longest. Entering a value not exceeding the known leg is rejected.

Worked examples

Every number below is produced by the same calculation engine the tool above runs. Nothing here is typed by hand, so the walkthrough cannot drift from what you get when you enter the same values yourself.

Finding the hypotenuse

Legs of 6 and 8, with the hypotenuse left blank. The two squares add to a perfect square, so the answer is a whole number.

Inputs Leg a = 6, Leg b = 8, Hypotenuse c =

  1. Hypotenuse c = √(a² + b²) = √(36 + 64) = 10

Result c = 10

The squares are 36 and 64, adding to 100, whose root is 10. This is the 3-4-5 triangle scaled by two — one of the few side sets where all three lengths are whole numbers.

The hypotenuse comes out larger than either leg but smaller than their sum, which is true of every right triangle. That bracket is a quick check on any answer in this direction.

Finding a leg

A hypotenuse of 13 with one leg of 5, and the other leg left blank. Now the squares are subtracted rather than added.

Inputs Leg a = , Leg b = 5, Hypotenuse c = 13

  1. Missing leg a = √(c² − leg²) = √(169 − 25) = 12

Result a = 12

169 minus 25 is 144, whose root is 12. The order of the subtraction matters entirely: taking 25 from 169 gives a valid triangle, and reversing it would put a negative quantity under the root.

The answer is larger than the known leg here, which is possible because both are legs. Only the hypotenuse is constrained to be the longest of the three.

Reading the result

The hypotenuse is always the longest side

It sits opposite the largest angle, which in a right triangle is the right angle itself. Any set of three sides where the value called the hypotenuse is not the largest cannot form a right triangle at all.

Whole-number answers are the exception

Textbook triangles are chosen so the arithmetic works out, but most right triangles have an irrational side. A result like 7.81 is the ordinary case, not a sign that something went wrong.

The relation runs both ways

Given three side lengths, checking whether the two smaller squares sum to the largest tests whether the triangle is right-angled. That converse is often the more useful direction in practice.

When you would use this

Checking that a corner is square

Measuring three and four units along two edges and confirming the diagonal is exactly five proves the corner is a right angle. Builders use precisely this, and it is the converse of the theorem in action.

Finding a diagonal or a direct distance

The straight-line distance across a rectangle, or between two points offset horizontally and vertically, is the hypotenuse of the right triangle they form.

Assumptions and limitations

What this calculator assumes

  • The triangle has a right angle, without which the relation does not hold.
  • Exactly two of the three sides are supplied and the third is left blank.
  • All lengths are positive and expressed in the same unit.
  • When solving for a leg, the hypotenuse must exceed the known leg; otherwise no such triangle exists.

Where it stops being the right tool

  • Right triangles only. For a general triangle the law of cosines is the correct generalisation.
  • Sides only — the angles and the area are not reported here.
  • One missing side at a time; two unknowns cannot be recovered from a single equation.
  • No unit handling, so mixing units silently produces a meaningless answer.

Common mistakes

Adding the squares when solving for a leg

Why it happens. Addition is the version the theorem is remembered by, so it gets applied regardless of which side is missing. The answer comes out larger than the hypotenuse, which is geometrically impossible.

How to avoid it. Check which field was left blank. If it was a leg, the squares must be subtracted — and the result must be smaller than the hypotenuse.

Treating the wrong side as the hypotenuse

Why it happens. The three fields all take a length, and which side is opposite the right angle is a fact about the drawing rather than about the numbers.

How to avoid it. Identify the side facing the right angle. If the value entered as the hypotenuse is smaller than a leg, the calculator rejects it and the labelling is what to revisit.

Forgetting to take the square root

Why it happens. The sum or difference of the squares is a natural stopping point, and it looks like a finished number.

How to avoid it. Compare against the given sides. A missing side much larger than both inputs has not been rooted.

Key terms

Frequently asked questions

How do I use the calculator?

Enter the two sides you know and leave the third field blank. Exactly one must be empty — that is how the solver identifies which side to compute and which way to rearrange the equation.

Can it find a leg, not just the hypotenuse?

Yes. With the hypotenuse and one leg known, the missing leg is the square root of the difference of their squares. The solver checks first that the hypotenuse is the larger, since otherwise no such triangle exists.

Why must the hypotenuse be the longest side?

Because it lies opposite the right angle, which is the largest angle in the triangle, and a longer side always faces a larger angle. Algebraically, adding a positive square to another can only produce something bigger.

Does the theorem work for any triangle?

No — only for right-angled ones. For any other triangle the law of cosines applies instead, and it reduces to this relation exactly when the angle in question is 90 degrees.