# Lagrange's Theorem

### Every positive integer is the sum of the squares of four integers

Quaternions: A quaternion is a number of the form a+bi+cj+dk, where a, b, c, and c are real numbers, and i, j, and k, are imaginary, with the property that i2=j2=k2=ijk=-1. The product of a real number and an imaginary is commutative, but, obviously, the product of two distinct imaginaries is not: ij=k, jk=i, ki=j, ji=-k, kj=-i, ik=-j.

The quaternion a+bi+cj+dk can be represented by a matrix:

```
--                      --
|    a    b    c    d    |
|   -b    a   -d    c    |
|   -c    d    a   -b    |
|   -d   -c    b    a    |
--                      --

```

The conjugate of the quaternion a+bi+cj+dk is the quaternion a-bi-cj-dk. The norm (or many people would say the square of the norm) of the quaternion a+bi+cj+dk is the non-negative real number,
N(a+bi+cj+dk)=(a+bi+cj+dk)(a-bi-cj-dk)=a2+b2+c2+d2. We shall use the multiplicitive nature of the norm:
N((a+bi+cj+dk)(s+ti+uj+vk))=N(a+bi+cj+dk)N(s+ti+uj+vk).
You have probably already seen the corresponding result for complex numbrs:
N((a+bi)(s+ti))=N(a+bi)N(s+ti).

Wilson's Theorem (due to Waring, but evidently known by Leibniz).
If p is a prime, then (p-1)! + 1 is a multiple of p.

Corollary. If p is a prime with p=4k+1, then ((2k)!)2 + 1 is a multiple of p.

Theorem. If p is an odd prime, then there are integers x and y so that x2 + y2 + 1 is a multiple of p.

Proof. Let S = {-x2 mod p} and T = {1 + y2 mod p}. Then, |S| = |T| = (p+1)/2. Thus, there is an element in the intersection of S and T. Thus, -x2 mod p = 1 + y2 mod p, for some x and y. But this says that x2 + y2 + 1 is a multiple of p.

Theorem. If p is a prime with p=4k+1, then there are integers u and v with u2 + v2 = p.

Proof. We have already seen that there are integers x and y with x2 + y2 = kp, and with neither x nor y a mutiple of p. In particular, x = (2k)! and y = 1, have this property. We choose x and y so that k is as small as possible. We also note that we can always choose x and y so that -p < 2x < p and -p < 2y < p. Thus, k < p.

If k = 1, there is nothing to prove. Thus, we may assume that k > 1. If k divides both x and y, then k divides p. Now, choose s so that k divides x-s and -k ≤ 2s ≤ k, and choose t so that k divides y-t and -k ≤ 2t ≤ k. Hence, 0 < s2+t2 < k2, k divides s2+t2. Thus, s2+t2 = mk, where 0 < m < k.

Now, k2mp = (x2+y2)(s2+t2) =(xs+yt)2 + (xt-sy)2.

Note that (exercise) xs+yt = kq and xt-sy = kr, for some integers q and r, and thus mp = q2+r2, contradicting the choice of k.

Trivial Note. 12+12 = 2.

Theorem. If p is an odd prime, then there are integers w, x, y and z with w2 +x2 +y2 + z2 = p.

Proof. We have already seen that there are integers w, x, y and z, not all divisible by p, with w2 + x2 + y2 + z2 = kp, for some integer k. Again, we may assume that -p < 2w,2x,2y,2z < p, and thus k < p. Again, we may assume that we have chosen w, x, y, z, and k such that w2 + x2 + y2 + z2 = kp, 0 < k < p, and subject to this, so that k is minimum. If k = 1, there is nothing to prove, and we may therefore assume that k > 1.

Suppose, first, that k is even. Then, w+x+y+z is even, and there are three possible cases:
(i) each of w, x, y and z is even;
(ii) w, x, y and z is odd;
(ii) two of w, x, y and z are even and two are odd.
In case (iii), we may relabel so that w, x are even and y and z are odd.
Thus, (x+w)2 + (x-w)2 + (y+z)2 + (y-z)2 = 2(w2 +x2 +y2 + z2) = 2kp, but each of x+w, x-w, y+z and y-z is even. we may divide both sides of the equation by a factor of 4. It cannot be the case that all four terms are multiples of p. This contradicts the choice of k. Hence, k must be odd.

Note that not all of w, x, y and z can be multiples of k, since k does not divide p. Select integers s, t, u and v such that w-s, x-t, y-u and z-v are multiples of k and such that -k < s,t,u,v < k. Then, s2 + t2 + u2 + v2 = mk, 0 < m < k.

Now
 k2mp = (w2 + x2 + y2 + z2) (s2 + t2 + u2 + v2) = (ws+xt+yu+zv)2 + (wt-xs+yv-zu)2 + (wu-xv-ys+zt)2 + (wv+xu-yt-zs)2

Again (exercise): each of ws+xt+yu+zv, wt-xs+yv-zu, wu-xv-ys+zt, wv+xu-yt-zs is a multiple of k, and we may divide each side of the equation by k2, contradicting the choice of k.

Lagrange's Theorem. Every integer n is the sum of four integer squares.

Proof. Write n as a product of primes. Find the representation of each prime as a sum of four squares. As we have already seen, the product of two representable numbers is representable.

I have obviously leaned heavily on the excellent text by Hardy and Wright.

URL: http://math.fau.edu/locke/courses/ProblemSolving/Lagrange.htm