Home > Maths

Fermat proved that there are no four squares are in arithmetic progression. This proof also appears here with some clarification by Graeme McRae. I present what is essentially the same proof, with further amplification which I hope makes it still clearer. It is long, but each step is elementary.

Graeme McRae also presents a proof M2 by Joel Karnofsky. I present this proof, modified slightly by me, here.

Lemma 1: If A, C are odd integers, and A = t-u and C = t+u, t and u are integers of opposite parity.

Proof:

t=(A+C)/2

u=(C-A)/2

As A and C are odd, t and u are integers. If A≡C modulo 4, t is odd and u is even; if A≠C modulo 4, t is even and u is odd. []

Lemma 2: If A, C are odd coprime integers, and A = t-u and C = t+u, t and u are coprime.

Proof: If some prime p divides t and u, p divides t-u=A and t+u=C. Contradiction.

Thus t and u are coprime. []

Lemma 3: If a2=bc, and b and c are coprime integers, then b and c have square absolute values and the same sign.

Proof: Let d2, e2 be the largest squares that divide b, c respectively, and let f=b/d2, g=c/e2. fg=a2/d2e2=h2, say.

Suppose a prime p divides f. Then p divides fg=h2, so p divides h, so p2 divides h2=fg, so p divides (f/p)g. By maximality of d, d2p2 does not divide b=d2f, so p does not divide f/p. Thus p divides g, and so c. This contradicts the given statement that b and c are coprime. So no prime divides f, so f = ±1, so b = ±d2, so |b| = d2. Similarly, c = ±e2, so |c| = e2.

bc is positive, so b and c have the same sign. []

Theorem (Fermat): No four squares are in arithmetic progression with positive common difference.

Proof (mathpages, further elucidated by Graeme McRae, further elucidated by me):

Suppose there were an example, and let (A2, B2, C2, D2) be an example with minimal common difference z=B2-A2, where z>0 and 0<A<B<C<D. Then no prime p divides all of A, B, C, D, as then ((A/p)2, (B/p)2, (C/p)2, (D/p)2) would be a smaller solution. Contradiction.

Modulo 4, if z ≠ 0, then at least two of A2, B2, C2 and D2 would ≡ 2 or 3. However, any square ≡ 0 or 1. Thus z ≡ 0, thus A2 ≡ B2 ≡ C2 ≡ D2. A, B, C and D do not have a common prime factor, in particular, they are not all even, so

A2 ≡ B2 ≡ C2 ≡ D2 ≡ 1, modulo 4 and A, B, C and D are all odd.

Let

t = (A+C)/2

u = (C-A)/2

v = (B+D)/2

w = (D-B)/2

Then

A = t-u

⇒ A2 = t2-2tu+u2

C = t+u

⇒ C2 = t2+2tu+u2

B = v-w

⇒ B2 = v2-2vw+w2

D = v+w

⇒ D2 = v2+2vw+w2

B2 = (A2+C2)/2 = t2+u2 ___ [1]

⇒ z = C2-B2 = 2tu ___ [2]

C2 = (B2+D2)/2 = v2+w2

⇒ z = D2-C2 = 2vw

⇒ tu = vw from equation [2]

Let

e = hcf(t, v)

f = t/e

g = v/e

h = u/g

Then

t = ef

u = gh

v = eg

w = fh

f and g, by the definition of e, are integers.

h is rational. If some prime p divides the denominator of h, then p divides both f and g, so pe divides both t and v, contradicting the definition of e. Thus h is an integer.

Then, from equation [2],

z = efgh ___ [3]

B = v-w = eg-fh

so, from equation [1],

(eg-fh)2 = e2f2 + g2h2 ___ [4]

By Lemma 1 applied to A and C, t and u are integers of opposite parity. By Lemma 1 applied to B and D, v and w are integers of opposite parity. Thus:

If, modulo 4, A≡C and B≡D, then t and v are odd, so e, f and g are odd, so h is even.

If, modulo 4, A≡C and B=/=D, then t and w are odd, so e, f and h are odd, so g is even. Swap e and f; swap g and h.

If, modulo 4, A=/=C and B≡D, then u and v are odd, so e, g and h are odd, so f is even. Swap e and g; swap f and h.

If, modulo 4, A=/=C and B=/=D, then u and w are odd, so f, g and h are odd, so e is even. Swap e and h; swap f and g.

Then equation [4], by its symmetry, is still true. Now e, f and g are odd, so h is even.

From equation [4],

e2g2 - 2efgh + f2h2 = e2f2 + g2h2

⇒ (f2-g2)h2 - (2efg)h + (e2g2-e2f2) = 0

⇒ h = [ 2efg ± √( 4e2f2g2 - 4(f2-g2)(e2g2-e2f2) ) ] / 2(f2-g2)

= [ efg ± √( e2f2g2 - (f2-g2)(e2g2-e2f2) ) ] / (f2-g2)

= e [ fg ± √( f2g2 - (f2-g2)(g2-f2) ) ] / (f2-g2)

= e [ fg ± √( f4 - f2g2 + g4 ) ] / (f2-g2)

= e [ fg ± √q ] / (f2-g2)

where

q = f4 - f2g2 + g4

h is an integer, so e √q is an integer, so √q is rational (it is a multiple of 1/e). q is an integer; therefore √q is an integer. f and g are odd, so q is odd, so there is a positive odd integer m such that

q = f4 - f2g2 + g4 = m2 ___ [5]

Let

x = (g2+f2)/2

y = (g2-f2)/2

Then

f2 = x-y ___ [6]

g2 = x+y ___ [7]

f and g are odd, so, by Lemma 1 with f2 and g2 for A and C, and with x and y for t and u, x and y are integers of opposite parity.

Substituting f2 and g2 from equation [6] and equation [7] into equation [5] gives

m2 = (x-y)2 - (x-y)(x+y) + (x+y)2

= x2 - 2xy + y2 - x2 + y2 + x2 + 2xy + y2

= x2 + 3y2 ___ [8]

If x were even, then equation [8], modulo 4, becomes

1 = 0 + 3*1,

which is false. Thus x is odd and y is even.

Lemma 4. e, f, g and h are pairwise coprime.

Proof: This proof starts by proving that A, B, C and D are pairwise coprime.

Suppose a prime p divides at least two of A, B, C and D. Then p≠2.

If p divides A and B, then p2 divides A2, B2, 2B2-A2=C2 and 2C2-B2=D2.

If p divides B and C, then p2 divides B2, C2, 2B2-C2=A2 and 2C2-B2=D2.

If p divides C and D, then p2 divides C2, D2, 2C2-D2=B2 and 2B2-C2=A2.

If p divides A and C, then p2 divides A2, C2, A2+C2=2B2, B2 and 2C2-B2=D2.

If p divides B and D, then p2 divides B2, D2, B2+D2=2C2, C2 and 2B2-C2=A2.

If p divides A and D, then p2 divides A2, D2 and 2A2+D2 = A2+B2+C2 = 3B2. Thus, if p≠3, p divides B. If p=3, p divides B2 so p divides B. Thus, whatever p is, p2 divides B2 and 2B2-A2=C2.

Thus, if p divides at least two of A, B, C and D, then p2 divides A2, B2, C2 and D2. #

Thus A, B, C and D are pairwise coprime.

By Lemma 2 applied to A and C, t and u are coprime. By Lemma 2 applied to B and D, v and w are coprime. Thus (by the definition of t, u, v and w) e, f, g and h are pairwise coprime. []

Lemma 5. x and y are coprime.

Proof. If a prime p divides x and y, p divides f and g, contradicting Lemma 4. []

Lemma 6. m, x and y are pairwise coprime.

Proof. If a prime p divides m and y, p divides m2-3y2 = x2 and thus p divides x, contradicting Lemma 5.

If a prime p divides m and x, p divides m2-x2 = 3y2.

If p≠3, then p divides y, contradicting Lemma 5.

If p=3, then

9 divides m2

⇒ 9 divides x2

⇒ 9 divides m2-x2 = 3y2

⇒ 3 divides y2

⇒ 3 divides y,

contradicting Lemma 5. []

Thus, applying Lemma 6 to equation [8] with p=3, modulo 3,

x ≡ ±1

⇒ x2 ≡ ±1

⇒ x2+3y2 = m2 ≡ ±1

⇒ m ≡ ±1

If x ≡ m, then change the sign of x. Then

m+x ≡ 0

⇒ x ≡ -m

⇒ m-x ≡ 2m

⇒ (m-x)/2 ≡ m =/= 0

From equation [8]

3y2 = m2 - x2

= (m+x)(m-x)

⇒ 3(y/2)2 = [(m+x)/2][(m-x)/2],

By Lemma 6, and by Lemma 2 applied to the two bracketed terms on the right hand side, these bracketed terms are coprime. By choice of sign of x, the first of these is a multiple of 3. Thus

(y/2)2 = [(m+x)/6][(m-x)/2],

and the two bracketed terms are coprime integers. If x>0, the first is positive; if x<0 the second is positive. By Lemma 3, their absolute values are squares and they are both positive. Thus there are positive integers s and r such that

(m-x)/2 = s2

(m+x)/6 = r2

Thus

m = 3r2+s2 ___ [9]

x = 3r2-s2

y = ±2sr.

Substitute for x and y back into equation [6] and equation [7]. Note that x now might or might not have the same sign as in equation [6] and equation [7]. At any rate, one of f2 and g2 is

±(x+2rs) = ±(3r2+2rs-s2) = -+(s+r)(s-3r)

and the other is

±(x-2rs) = ±(3r2-2rs-s2) = -+(s-r)(s+3r).

By Lemma 1, one of s and r is even and the other is odd, so the terms in the arithmetic progression (s-3r, s-r, s+r, s+3r) are odd. Thus, if a prime p divides s+r and s-3r, p/=2; p divides 4r, so p divides r, so p divides s, contradicting the fact that s and r are coprime. Thus the terms s-3r, s+r are coprime, so, by Lemma 3, s-3r and s+r have square absolute values and the same sign. s>0 and r>0, so s+r>0, so they are both positive, so they are both squares. Similarly, s-r and s+3r are squares. Thus we have four squares in arithmetic progression:

a2 = s-3r

b2 = s-r

c2 = s+r

d2 = s+3r

a2 > 0

⇒ 3r < s,

so from equation [9],

12r2 < m ___ [10]

Also equation [5] implies m < f2+g2, so

m2 = f4 - f2g2 + g4 (from equation [5])

⇒ m2 < f4 + 2f2g2 + g4

⇒ m < f2+g2

⇒ 12r2 < f2+g2 (from equation [10])

⇒ 4r2 < (f2+g2) / 3

⇒ (2r)2 < 2 max(|f|, |g|)2 / 3

⇒ 2r < √(2/3) max(|f|, |g|)

Thus a2, b2, c2 and d2 are four squares in arithmetic progression with the positive common difference 2r < 2efgh, the latter being the common difference z of the original four squares (from equation [3]). This contradicts the supposition that z is the smallest positive common difference for four squares in arithmetic progression. []

Commentary on the proof at M1.

{K044 has a proof which seems elementary but is rather long. I adapt it here. M1 copies K044's proof, but adds a little more explanation and working. However, this does little to solve the difficulties of the proof in K044. The following is a copy of M1's proof, with still more explanation and working which, I hope, eliminates the last remaining difficulties, and some notational changes which, in the context of an ASCII text file, I would say are improvements. (Greek letters would have eased the pressure on the lowercase alphabet but can't appear here!) I do not bother to keep every word of the earlier proofs intact, but graft my additions into the earlier proofs. This might entail changing how a sentence is phrased, and thus might entail removing some words from the earlier proofs.

K044 and M1 sometimes state without proof that certain integers exist with certain properties, e.g.

"we can find co-prime integers u,v" [my t, u]

"there exist four mutually co-prime integers A,B,C,D (exactly one even)" [my e, f, g, h]

"there exist co-prime integers x and y (exactly one even)"

I provide proofs or constructions.

K044 says, with my choice of names of variables, "This quadratic equation [4] is symmetrical in the four variables, so we can assume g is even and e, f, h are odd."

You can't, though. e, f, g, h are determined separately, not collectively, from t, u, v, w, which are determined separately, not collectively, from A, B, C, D. K044 has, in effect, assumed that t, w are odd and u, v are even, i.e. that, modulo 4, A≡C and B=/=D. K044 should really consider 4 cases.

It seems odd for K044 to pick g out of e, f, g, h to be the even one. Why not h?

M1 says, w.r.t. k(s+r)(s-3r) and k(s-r)(s+3r), "Since the right hand factors are co-prime, it follows that the four quantities (s-3r), (s-r), (s+r), (s+3r) must each have square absolute values". This is deficient. For all that that proof states, perhaps 3 | s in which case 3 | s-3r and 3 | s+3r.

Variable names

I used variable-names A, B, C, D, a, b, c, d, e, f, g, h, k, m, p, q, r, s, t, u, v, w, x, y, z. Every lower-case letter except i, j, l, n, o.

K044'smine
AA
BB
CC
DD
af
be
ch
dg
ut
vu

The modulus to which every odd square ≡ 1 is 8. However, modulo-4 arithmetic suffices in this proof. It has the advantage of having a more convenient set of all squares, viz {0, 1}.

This web page N also discusses the problem. It begins unenticingly with the author apparently unaware that there are no 4 squares in AP. A correspondent (Graeme Mcrae, who maintains M and enhanced K044's proof to get M1) reported further work on constraints on A2, B2, C2, D2, z mod m, for various m. We say that q is a quadratic residue mod m if there is an integer n with n2 ≡ q, mod m. We have:

m=8. Quadratic residues: 0, 1, 4. The only possible 4-term APs are (q,q,q,q), (0,4,0,4), (4,0,4,0). Those consisting wholly of even numbers are ruled out for primitive solutions, for which (1,1,1,1) is the only possibility, i.w.c. 8|z.

m=3. Quadratic residues: 0, 1. The only possible 4-term APs are (q,q,q,q), so 3|z.

The above results hold good even for 3-term APs of squares, thus proving that 24|z. This is attained with (12, 52, 72), where z=24.

m=5. Quadratic residues: 0, 1, 4. The only possible 4-term APs are (q,q,q,q), so 5|z.

m=7. Quadratic residues: 0, 1, 2, 4. The only possible 4-term APs are (q,q,q,q), so 7|z. (Note that there are some non-trivial 3-term APs: (0, 1, 2), (0, 2, 4), (0, 4, 1).)

m=11. Quadratic residues: 0, 1, 3, 4, 5, 9. The only possible 4-term APs are (q,q,q,q), so 11|z. (Note that there are some non-trivial 3-term APs: (3, 4, 5), (1, 3, 5), (1, 5, 9), (4, 9, 3).)

Thus 8.3.5.7.11=9240 | z. Unfortunately, the prospect of proving that every prime divides z, and thus that z=0, ends here. In fact there is a 4-term AP mod p for every prime >11. See K291. For example:

m=13. Quadratic residues: 0, 1, 3, 4, 9, 10, 12, with 4-term AP (10, 12, 1, 3).

K291 also proves that, for f=4 and f=5, for all but finitely many primes p, there is an f-term AP of squares mod p. For f=2...6, he lists those p for which f(p)=f, thus implying that, for any prime p not mentioned, f(p)>6. For f≤9, he states a p_0(f) s.t., for all primes p>p_0(f), there is an f-term AP of squares mod p, and he suggests that there is such a p_0(f) for every f. He gives f(p)=10 for p=109 and 25 for p=2689 and p=3529. Where n(f) is the number of primes p for which f(p)=f, n(f) for f=2...7 = 2, 3, 5, 8, 20, 30, ...


Home > Maths