Pythagorean Triples Explained with Worked Examples

For integers , the numbers , and form a Pythagorean triple: .

Write 2x or 2*x to multiply, ^ for powers, and ; between simultaneous equations. You can also type factor, expand, derivative of, integrate … from a to b, limit … as x->0 or 15% of 80.

Try an example

Before you start

This page is easier if you are comfortable with:

What Pythagorean triples means

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.

What is it used for?

Euclid's formula generates right-angled triangles with whole-number sides.

How to use pythagorean triples

  1. Choose integers .
  2. Compute , and .
  3. The last number is the hypotenuse.
  4. Check with .

Graph

The (3, 4, 5) and (5, 12, 13) triangleshypotenuse 5hypotenuse 130246810121402468101214The (3, 4, 5) and (5, 12, 13) trianglesxyGraph with x from -1 to 14 and y from -1 to 14. Shows 3-4-5 (4); 5-12-13 (4); point hypotenuse 5 at (4, 3); point hypotenuse 13 at (12, 5).

Each triangle is right-angled at the corner on the x-axis.

Worked examples

These examples are worked by hand, step by step, so you can compare your own working.

Example 1: m = 2, n = 1

Find the triple from , .

Worked example Answer checked
Answer
(3, 4, 5)(3,\ 4,\ 5)
  1. Legs and hypotenuse
  2. Check

Example 2: m = 3, n = 2

Find the triple from , .

Worked example Answer checked
Answer
(5, 12, 13)(5,\ 12,\ 13)
  1. Values
  2. Check

Example 3: m = 4, n = 1

Find the triple from , .

Worked example Answer checked
Answer
(8, 15, 17)(8,\ 15,\ 17)
  1. Values
  2. Check

Special cases

A few situations come up again and again. Knowing them saves time and helps you spot answers that cannot be right.

m = 2, n = 1

(3, 4, 5)

9 + 16 = 25.

m = 3, n = 2

(5, 12, 13)

25 + 144 = 169.

m = 4, n = 1

(15, 8, 17)

225 + 64 = 289.

m = 5, n = 2

(21, 20, 29)

441 + 400 = 841.

Word problems

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.

m = 2, n = 1

Legs 3 and 4.

  1. 9 + 16
  2. Check: 25 = 5² ✓25

m = 3, n = 2

Legs 5 and 12.

  1. 25 + 144
  2. Check: 169 = 13² ✓169

m = 4, n = 1 Higher

Legs 15 and 8.

  1. 225 + 64
  2. Check: 289 = 17² ✓289

m = 5, n = 2 Higher

Legs 21 and 20.

  1. 441 + 400
  2. Check: 841 = 29² ✓841

Common mistakes

Same parity

primitive ✗

non-primitive ✓

Opposite parity needed.

m < n

allowed ✗

m > n ✓

Positive legs.

Hypotenuse m² − n²

wrong ✗

m² + n² ✓

Largest.

Missing 2mn

both legs odd ✗

one leg 2mn ✓

Even leg.

Exam tips

  1. (m² − n², 2mn, m² + n²).
  2. m > n.
  3. Primitive: coprime, opposite parity.
  4. Scale for non-primitive.
  5. Check a² + b² = c².

Practice questions

Try each one on paper, then open the answer. Use the solver above to see the full working.

1. m = 6, n = 1: m² − n² Foundation

35

2. m = 6, n = 1: 2mn Foundation

12

3. m = 6, n = 1: m² + n² Foundation

37

4. m = 4, n = 3: hypotenuse Higher

25

5. m = 4, n = 3: odd leg Higher

7

6. m = 4, n = 3: even leg Higher

24

Practice generator

Unlimited fresh questions with instant marking. Choose a level, work it out on paper, then type your answer.

Solve: …

Key terms

Pythagorean triple
a² + b² = c².
Primitive triple
gcd = 1.
Euclid’s formula
(m² − n², 2mn, m² + n²).
Coprime
gcd = 1.
Opposite parity
One odd, one even.
Hypotenuse
Longest side.

Frequently asked questions

What is Euclid’s formula?

(m² − n², 2mn, m² + n²).

When is the triple primitive?

When gcd(m, n) = 1 and m, n have opposite parity.

What is the triple for m = 3, n = 2?

(5, 12, 13).

Are all triples of this form?

Up to scaling, yes.

Which page covers squares mod 4 and 8?

squares modulo 4 and 8.

Which page covers the sum of two squares theorem?

sum of two squares theorem.

More in Discrete maths and number theory and the formula sheets.