Unique Square Sum


You are given that ALL primes that are one more than a multiple of 4 can be written as the sum of two squares. For example, 13 = 22+32.

Assuming that a prime is expressible as the sum of two squares, prove that it can be done in only one way.


Suppose that the prime, p = a2+b2 = c2+d2.

Clearly HCF(a,b)=1, otherwise a2+b2 would be composite; similarly HCF(c,d)=1.

We will begin by establishing a result that will be used later.

If ad = bc then a|bc, but as HCF(a,b)=1, a|c. Let c = ka.

therefore ad = kab implies d = kb.

So p = c2+d2 = (ka)2+(kb)2 = k2(a2+b2).

And because of the initial supposition, it is necessary that k = 1. Hence c = ka = a and d = kb = b.

By the symmetry of our initial supposition, from ad = bc we can freely interchange c and d to get ac = bd. And in the same way we can show that c = b and d = a.

Hence our proof will be complete if we can show that either ad = bc or ac = bd.

From the initial supposition, p = a2+b2 = c2+d2, we can write:

    a2 = pminusb2 and d2 = pminusc2.

therefore a2d2 = (pminusb2)(pminusc2) = p2minusp(b2+c2)+b2c2

therefore a2d2 congruent b2c2 mod p

therefore ad congruent plus or minusbc mod p

So either (i) adminusbc congruent 0 mod p, or (ii) ad+bc congruent 0 mod p.

As 0 less than a2, b2, c2, d2 less than p

    0 less than a, b, c, d less than radicalp

therefore 0 less than ad, bc less than p

Hence -p less than adminusbc less than p and 0 less than ad+bc less than 2p.

If (i) is true then adminusbc congruent 0 mod p, but as adminusbc lies between -p and p, it follows that adminusbc = 0 implies ad = bc. However, we have shown that if this is true, then c = a and d = b, and the square sum must be unique.

Let now consider (ii), ad+bc congruent 0 mod p. We have shown that ad+bc lies between 0 and 2p, so if this is true then ad+bc = p. This case requires a useful, and tricky, identity to be obtained.

 p2 = (a2+b2)(c2+d2)
  = a2c2+a2d2+b2c2+b2d2
  = (ad2+2abcd+b2c2)+(a2c2minus2abcd+b2d2)
  = (ad+bc)2+(acminusbd)2

Hence if ad+bc = p, then p2 = p2+(acminusbd)2.

This leads to acminusbd = 0 implies ac = bd. However, we have shown that if this is true, then c = b and d = a, and once again we show that the square sum is unique.

Hence we prove that p can be written as the sum of two squares in only one way.

Problem ID: 176 (May 2004)     Difficulty: 4 Star

Only Show Problem