# Todd Trimble Lagrange four squares theorem

(Should return to this later, but the clean conceptual route is of course to work with Hurwitz quaternions, the $\mathbb{Z}$-span of $1, h, i, j, k$ where $h = \frac1{2}(1 + i + j + k)$.)

The four squares theorem says that every natural number can be expressed as a sum of four integer squares. For this it is useful to recall that for quaternions $\alpha = a + b i + c j + d k$, the central elements are real and are precisely the fixed points of the anti-involution $\alpha \mapsto \widebar{\alpha} = a - b i - c j - d k$. It follows quickly that the norm map $\alpha \mapsto N(\alpha) = \alpha \widebar{\alpha} = a^2 + b^2 + c^2 + d^2$ is multiplicative: we have

$N(\alpha \beta) = N(\alpha) N(\beta)$

for all quaternions $\alpha, \beta$.

This shows that sums of four integral squares are closed under multiplication, which reduces the four squares theorem to the statement that every prime $p$ is a sum of four squares. For $p = 2$ we have $2 = 1^2 + 1^2 + 0^2 + 0^2$.

###### Lemma

If a finite field $F$ has an odd number of elements $q$, then every element of $F$ is a sum of two squares. (The conclusion holds also in characteristic $2$, but we don’t need this.)

###### Proof

If some non-square $a$ is not a sum of any two squares, then this is true of every non-square $b$ (since $a/b$ must be a square, using cyclicity of the group $F^\times$), in which case it follows that the squares are closed under addition and form a proper subfield $E$, with $\frac{q+1}{2}$ elements. If $\dim_E(F) = d$, then $q = (\frac{q+1}{2})^d$, which is impossible.

###### Lemma

If $p$ is an odd prime, then there is some $m$ with $0 \lt m \lt p$ such that $m p$ is a sum of four squares.

###### Proof

We just saw that $-1$ is a sum of two squares in $F = \mathbb{Z}/(p)$, say $-1 \equiv u^2 + v^2$ where $u, v$ are represented in the range $-\frac{p-1}{2}, \ldots, 0, \ldots, \frac{p-1}{2}$. Then $p$ divides $u^2 + v^2 + 1^2 + 0^2 \leq 2\left(\frac{p-1}{2}\right)^2 + 1 \lt \frac{p^2}{2}$. It follows that some $m p$ with $0 \lt m \lt \frac{p}{2}$ is a sum of four squares.

###### Lemma

If $2 n$ is a sum of four squares, then so is $n$.

###### Proof

Writing $2 n = a^2 + b^2 + c^2 + d^2$, we have $a + b + c + d \equiv 0\; mod\; 2$, so we may assume WLOG that $a, b$ have the same parity as then do $c, d$. Then $n = \left(\frac{a+b}{2}\right)^2 + \left(\frac{a-b}{2}\right)^2 + \left(\frac{c+d}{2}\right)^2 + \left(\frac{c-d}{2}\right)^2$.

###### Theorem

Every odd prime $p$ is the sum of four squares.

###### Proof

Take $m \in \{1, \ldots, p-1\}$ to be the least element such that $m p$ is of the form $m p = a^2 + b^2 + c^2 + d^2$ (invoking Lemma ). The claim is that $m = 1$; since $p$ is prime, it suffices to show $m|p$. By Lemma and minimality, $m$ is odd. Write $\beta = a + b i + c j + d k$, so $N(\beta) = m p$. Take $w, x, y, z \in \{-\frac{m-1}{2}, \ldots, 0, \ldots, \frac{m-1}{2}\}$ so that

$w + x i + y j + z k \equiv \widebar{\beta} mod\; m.$

Put $\alpha = w + x i + y j + z k$. Then $\alpha \beta \equiv \widebar{\beta}\beta \; mod\; m$, and $\widebar{\beta} \beta = N(\beta) = m p$, so $\alpha \beta \equiv 0\; mod\; m$. Thus we may write $\alpha \beta$ in the form $\alpha \beta = m(r + s i + t j + u k)$.

We have $0 \leq N(\alpha) \leq 4\left(\frac{m-1}{2}\right)^2 = (m-1)^2$, and $N(\alpha) \equiv N(\beta) \equiv 0\; mod\; m$, so there is $n$ with $0 \leq n \lt m$ such that $N(\alpha) = m n$. Thus $m^2(r^2 + s^2 + t^2 + u^2) = N(\alpha \beta) = N(\alpha) N(\beta) = m^2 n p$, whence $r^2 + s^2 + t^2 + u^2 = n p$. This forces $n = 0$ by minimality of $m$. So $N(\alpha) = m n = 0$, forcing $w = x = y = z = 0$, and now we must conclude $a, b, c, d \equiv 0\; mod\; m$. Thus $m^2$ divides $a^2 + b^2 + c^2 + d^2 = m p$, so $m$ divides $p$ and we are done.

Revised on June 8, 2020 at 12:25:54 by Todd Trimble