m = 2, n = 1
(3, 4, 5)
9 + 16 = 25.
For integers , the numbers , and form a Pythagorean triple: .
This page is easier if you are comfortable with:
Expanding the left side gives , which is the right side. Each triple satisfies Pythagoras' theorem, so it gives a right-angled triangle with whole-number sides. The formula comes from the Brahmagupta–Fibonacci identity with and , or from squaring a complex number .
The triple is primitive (no common factor) when and have no common factor and are not both odd. Examples: gives , and gives . Multiples such as are not primitive. Squares modulo 4 explain why one leg must be even; see squares modulo 4 and 8.
Triples are used for constructing right angles, as in Pythagoras in three dimensions, and for finding integer distances, see distance between two points. The hypotenuses are exactly the numbers described by the sum of two squares theorem.
Euclid's formula generates right-angled triangles with whole-number sides.
Each triangle is right-angled at the corner on the x-axis.
These examples are worked by hand, step by step, so you can compare your own working.
Find the triple from , .
Find the triple from , .
Find the triple from , .
A few situations come up again and again. Knowing them saves time and helps you spot answers that cannot be right.
(3, 4, 5)
9 + 16 = 25.
(5, 12, 13)
25 + 144 = 169.
(15, 8, 17)
225 + 64 = 289.
(21, 20, 29)
441 + 400 = 841.
For m > n > 0, (m² − n², 2mn, m² + n²) is a Pythagorean triple; it is primitive when gcd(m, n) = 1 and m, n have opposite parity.
Legs 3 and 4.
Legs 5 and 12.
Legs 15 and 8.
Legs 21 and 20.
primitive ✗
non-primitive ✓
Opposite parity needed.
allowed ✗
m > n ✓
Positive legs.
wrong ✗
m² + n² ✓
Largest.
both legs odd ✗
one leg 2mn ✓
Even leg.
Try each one on paper, then open the answer. Use the solver above to see the full working.
35
12
37
25
7
24
Unlimited fresh questions with instant marking. Choose a level, work it out on paper, then type your answer.
Solve: …
(m² − n², 2mn, m² + n²).
When gcd(m, n) = 1 and m, n have opposite parity.
(5, 12, 13).
Up to scaling, yes.
squares modulo 4 and 8.
sum of two squares theorem.
More in Discrete maths and number theory and the formula sheets.