Report on fortnightly maths prize question for 20 January 2015

You know 3,4,5 is a “Pythagorean triple”: the numbers could be the sides of a right-angled triangle. You probably know that 5,12,13 is a Pythagorean triple, too. Your task: to find out as much as you can about what other sets of three whole numbers are Pythagorean triples.

The prize was won by Hamse Adam.

First answers

A bit of arithmetic shows you that there is a sequence of Pythagorean triples like:
The first number goes up by 2 each time. The second number are four times the triangle numbers, and go up by 4n (from the [n−1]’th to the n’th triple]. The third number is the second number plus 1.

The general formula is 2n+1,2n(n+1),2n2+2n+1

These are all “primitive” Pythagorean triples, meaning that the whole numbers have no common factors.

From any “primitive” Pythagorean triple, you can get lots of others. For example, 3,4,5 gives 6,8,10 and 9,12,15 and 12,16,20… which are all Pythagorean triples.

The sequence above does not contain all the “primitive” Pythagorean triples. For example, there is 8,15,17.

Every primitive Pythagorean triple has an odd hypotenuse, and the other sides are one odd, one even. The even side is always not just even, but divisible by 4.

If you multiply together the three numbers of any Pythagorean triple, the answer is always divisible by 60.

Full answer


a, b, c is a primitive Pythagorean triple if a, b, c are whole numbers, they have no common factors, and:

c2 = a2 + b2

Examples: 3, 4, 5; 5, 12, 13; 8, 15, 17

All the Pythagorean triples can be got as ka, kb, kc, where k is a whole number and a, b, c is a primitive Pythagorean triple (PPT).

Example: 6, 8, 10 = 2×3, 2×4, 2×5.

We can find a rule to generate all the PPTs.

Claim 1: If a, b, c is a PPT, then one of a and b is even, the other is odd, and c is odd.

Proof: They can’t all be even, or 2 would be a common factor, and it wouldn’t be a PPT. If two of them were even, then the third would be. So at most one can be even.

They can’t all be odd, because Odd2 + Odd2 = Even.

So exactly one is even.

Odd2 + Odd2 is of form 4N + 2 for some N, so can’t = Even2.

So c is odd.

So just one of a and b must be even. ∎

From now on, assume that b is the even one.

Claim 2: If a, b, c is a Pythagorean triple, and two of them have a prime factor in common, then the third shares that prime factor. Consequently, if a, b, c is a PPT, it is not just that there is no factor common to all three: no two of them have a factor in common.

Proof: It’s the same reasoning that shows that if two numbers in a Pythagorean triple are even, then the third must also be even. ∎

Claim 3: All the possible PPT are given by c = m2 + n2, a = m2 − n2, and b = 2mn, with m and n coprime whole numbers (i.e. whole numbers having highest common factor 1) and (m-n) odd

Proof: (m2 + n2)2 – (m2 – n2)2 = (2mn)2 for all m and n, so for all m and n the quoted numbers are a Pythagorean triple.

If m and n are coprime, then (m2 + n2) and 2mn have no common prime factor. If they did, it would also be a common prime factor of (m2 + 2mn + n2), i.e. of (m+n)2, and so also of (m+n). The common prime factor cannot be 2, since by assumption m-n and m+n are odd. So it must be a prime factor of m which is also a prime factor of (m+n), and therefore of n; or a prime factor of n which is also a prime factor of (m+n), and therefore of m. Both of which are impossible.

And (m2 – n2) and 2mn have no common prime factor. If they did, it would also be a common prime factor of either m or n, and either (m-n) or (m+n), which is impossible if n and m have no common prime factor.

So the quoted a, b, c are coprime.

Now to prove that if a, b, c is a PPT, then it is of the quoted form.

Let (c+a)/b = m/n in lowest terms [1]

Since c2 – a2 = b2, (c+a)/b = b/(c-a). Therefore:

(c-a)/b = n/m [2]

[1] and [2] ⇒ c/b = (m2 + n2)/2mn and a/b = (m2 – n2)/2mn

By claim 2, c and b have no common factor, and a and b have no common factor, so c/b and a/b are fractions in lowest terms.

But by the reasoning above (m2 + n2)/2mn and (m2 – n2)/2mn are also fractions in lowest terms.

Therefore c = m2 + n2, a = m2 – n2, and b = 2mn ∎

Alternative proof (geometric)


The Pythagorean triples correspond to the points (a,b) on the unit circle for which a and b are both rational.

Considering the ratios of non-hypotenuse sides in the three similar right-angle triangles in this diagram

t/1=b/(1+a)=(1-a)/b [1]

so t+1/t=(1+t2)/t=2/b

so b=2t/(1+t2)

and a=(1-t2)/(1+t2) [2]

From [1], if a and b are rational, then t is rational; from [2], if t is rational, then a and b are rational.

Put t=n/m and we get


b=2mn/(m2+n2) ∎

Claim 4: In every PPT, b is not just even but divisible by 4.

Proof 1: If m-n in the proof above is odd, then one of m or n is even, therefore 2mn is divisible by 4 ∎

Proof 2: c and a are odd, so they are of form 2s+1 and 2t+1 for some s and t.

Therefore b2 = (4s2 + 4s + 1) – (4t2 + 4t + 1) = 4(s-t)(s+t+1)

If s and t are both odd or both even, then (s-t) is even

If s and t are opposite parities, then (s+t+1) is even

Either way, b2 is divisible by 8.

But if b were not divisible by 4, i.e. of form (4r+2) for some r, then

b2 = 16r2 + 16r + 4, which cannot be divisible by 8.

So b must be divisible by 4 ∎

Claim 5: abc is divisible by 60 for any PPT (and therefore for any Pythagorean triple)

Proof: We know b is divisible by 4 from claim 4. We will prove that one of a, b is divisible by 3; and that one of a, b, c is divisible by 5.

c2 = a2 + b2 mod 3 [1]

But the only square numbers mod 3 are 0 and 1

So the only way equation [1] can be satisfied is if it is of form 1 = 0 + 1

And so either a = 0 mod 3 or b = 0 mod 3

c2 = a2 + b2 mod 5 [2]

But the only square numbers mod 5 are 0 and 1 and 4

So the only way equation [2] can be satisfied is if it is of form 0 = 1 + 4 or 4 = 0 + 4 or 1 = 0 + 1

And so one of a, b, or c = 0 mod 5 ∎

Note 1: To prove the formula in claim 3, we must first think of it. How?

As in many other problems, start by taking the easiest cases. The easiest cases of PPTs are 3, 4, 5; 5, 12, 13; 7, 24, 25; 9, 40, 41; and so on.

For these (c-b)/a = 1/(2t+1) for some t

and so (c+b)/a = 2t+1

Hence c/a = (2t2 + 2t + 1)/(2t+1)

and b/a = (2t2 + 2t)/(2t+1)

Working out that the right-hand fractions in those equations must also be in lowest terms shows us

c = (2t2+2t+1), a = (2t+1), b = (2t2+2t)

We could generalise from that easiest case to when (c-b) = any odd number

Then (c-b)/a = n/m in lowest terms, with n and m both odd

And (c+b)/a = m/n

c/a = (m2+n2)/2mn = in lowest terms [(m2+n2)/2]/mn

b/a = (m2 – n2)/2mn = in lowest terms [(m2 – n2)/2]/mn

So a, b, c = mn, (m2-n2)/2, (m2+n2)/2

This formula, with m and n coprime and both odd, also gives us all the PPTs.

But looking back at the easiest PPTs, we also have:

(c-a)/b = 1/2; 2/3; 3/4; 4/5; etc.

So we could generalise instead with (c-a)/b = n/m in lowest terms, with m and n opposite parities, and that gives us a slightly preferable formula with no fractions in it.

Note 2: c = b + a has (c-1) solutions in positive whole numbers for every value of c ≥ 2.

We’ve just seen that c2 = a2+b2 has not quite as many.

c must be a multiple of a sum of the squares of two numbers of opposite parity, m2+n2, or a multiple of half the sum of squares of two numbers both odd, (m2+n2)/2. So, for example, 3, 4, 7, 8, 9, 11 are not possible values for c.

These are equivalent conditions. If c is the sum of (2t+1)2 and 2s2, then it is half the sum of (2t+2s+1)2 and (2t-2s+1)2. If c is half the sum of (2t+1)2 and (2s+1)2, then it is also the sum of (t+s+1)2 and (t-s)2. E.g. 5 = 22+12 = half of 32+12.

A positive whole number c can be expressed as a sum of two squares ⇔ c has prime factors of form (4n+1), and all its prime factors of form (4n+3) square out (or c=2). Click here. Every positive whole number can be expressed as the sum of four squares, but not necessarily of two.

For small c there may be only one value for a and b, but in general there may be a few different values of a and b for a given c. (Cf here). For example:

65 = 82+12 but also = 72+42, so:

652 = 632 + 162

but also

652 = 332 + 562

What about c3 = a3 + b3, c4 = a4 + b4, c5 = a5 + b5, etc.?

None of these have any solutions.

This is Fermat’s Last Theorem.