Lagrange's Four Square Theorem
Lagrange's Four Square Theorem
Lemma 1: If $m, n \in \mathbb{N}$ can be written as a sum of four squares then $mn$ can be written as a sum of four squares. |
- Proof: Let $m, n \in \mathbb{N}$ and suppose that $m = x^2 + y^2 + z^2 + w^2$ and $n = a^2 + b^2 + c^2 + d^2$. Then:
\begin{align} \quad mn = (xa + yb + zc + wd)^2 + (xb - ya + zd - wc)^2 + (xc - yd - za + wb)^2 + (xd + yc - zb- wa)^2 \end{align}
- So $mn$ can be written as a sum of four squares. $\blacksquare$
Lemma 2: If $p$ is a prime then there exists $r, s \in \mathbb{Z}_p$ for which $r^2 + s^2 + 1 \equiv 0 \pmod p$. |
- Proof: If $p = 2$ then choose $r = 1$ and $s = 0$.
- So suppose that $p$ is an odd prime. Let:
\begin{align} \quad X &= \left \{ x^2 : 0 \leq x \leq \frac{p-1}{2} \right \} \\ \quad Y &= \left \{ -1 - y^2 : 0 \leq y \leq \frac{p-1}{2} \right \} \end{align}
- Observe that:
\begin{align} \quad |X| = \frac{p+1}{2} = |Y| \end{align}
- Since the elements of $X$ and $Y$ are all different we have that $|X \cup Y| = p + 1$. But $|\mathbb{Z}_p| = p$. So by the pigeonhold principle there must exists $r^2 \in X$ and $1 - s^2 \in Y$ for which:
\begin{align} r^2 \equiv -1 - s^2 \pmod p \end{align}
- That is, there exists integers $r$ and $s$ for which:
\begin{align} \quad r^2 + s^2 +1 \equiv 0 \pmod p \quad \blacksquare \end{align}
Theorem 3 (Lagrange's Four Square Theorem): Every natural number $n$ can be written as a sum of four squares. |
- Proof: By Lemma 1 we only need to prove the result for $1$ and prime numbers, for if $n \in \mathbb{N}$ and $n \geq 2$ then $n$ can be writtten as a product of primes and if each prime can be written as a sum of four squares then so can $n$.
- Clearly $1$ is a sum of four squares since:
\begin{align} \quad 1 = 1^2 + 0^2 + 0^2 + 0^2 \end{align}
- Let $p$ be a prime. By Lemma 2 there exists $r, s \in \mathbb{Z}_p$ such that:
\begin{align} \quad r^2 + s^2 + 1 \equiv 0 \pmod p \end{align}
- Let $A$ be the $4 \times 4$ matrix defined by:
\begin{align} \quad A = \begin{bmatrix} p & 0 & r & s\\ 0 & p & s & -r \\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1 \end{bmatrix} \end{align}
- Observe that $A$ is an upper triangular matrix with $\det(A) = p^2 \neq 0$. So $A$ is invertible. Let $\Lambda = A \mathbb{Z}^n$. Then $d(\Lambda) = |\det(A)| = p^2$.
- If $\vec{x} = (x_1, x_2, x_3, x_4) \in \Lambda$ then for some integer point $\vec{k} = (k_1, k_2, k_3, k_4) \in \mathbb{Z}^4$ we have that:
\begin{align} \quad \vec{x} = A\vec{k} = \begin{bmatrix} p & 0 & r & s\\ 0 & p & s & -r \\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} k_1\\ k_2\\ k_3\\ k_4 \end{bmatrix} = \begin{bmatrix} p & 0 & r & s\\ 0 & p & s & -r \\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} k_1\\ k_2\\ k_3\\ k_4 \end{bmatrix} = \begin{bmatrix} pk_1 + rk_3 + sk_4\\ pk_2 + sk_3 -rk_4\\ k_3\\ k_4 \end{bmatrix} \end{align}
- Since $A$ is an matrix of integers and $\vec{k} \in \mathbb{Z}^4$ we have that $\vec{x} \in \mathbb{Z}^4$. Furthermore, we have that:
\begin{align} \quad x_1^2 + x_2^2 + x_3^2 + x_4^2 & \equiv (pk_1 + rk_3 + sk_4)^2 + (pk_2 + sk_3 -rk_4)^2 + (k_3)^2 + (k_4)^2 \pmod p \\ & \equiv (rk_3 + sk_4)^2 + (sk_3 - rk_4)^2 + (k_3)^2 + (k_4)^2 \pmod p \\ & \equiv r^2k_3^2 + 2rsk_3k_4 + s^2k_4^2 + s^2k_3^2 - 2rsk_3k_4 + r^2k_4^2 + k_3^2 + k_4^2 \pmod p \\ & \equiv r^2k_3^2 + s^2k_4^2 + s^2k_3^2 + r^2k_4^2 + k_3^2 + k_4^2 \pmod p \\ & \equiv (r^2 + s^2 + 1)k_3^2 + (r^2 + s^2 + 1)k_4^2 \pmod p \\ & \equiv 0 \pmod p \end{align}
- Let $S = \{ (a, b, c, d) \in \mathbb{R}^4 : a^2 + b^2 + c^2 + d^2 < 2p \}$. That is, $S$ is a a $4$-dimensional ball centered at the origin with radius $2p$. Then the volume of $S$ is:
\begin{align} \quad \mathrm{volume} (S) = \frac{1}{2} \pi^2 (2p)^2 = 2 \pi^2 p^2 \end{align}
- Observe that $S$ is convex, symmetric about the origin, and:
\begin{align} \quad \mathrm{volume} (S) = 2\pi^2p^2 > 2^4p^2 = 2^4 d(\Lambda) \end{align}
- So by Minkowski's convex body theorem there exists a nonzero point $\vec{x} = (x_1, x_2, x_3, x_4) \in S$ which is a lattice point of $\Lambda$. That is, $0 < x_1^2 + x_2^2 + x_3^2 + x_4^2 < 2p$ and also $x_1^2 + x_2^2 + x_3^2 + x_4^2 \equiv 0 \pmod p$. Hence:
\begin{align} \quad p = x_1^2 + x_2^2 + x_3^2 + x_4^2 \quad \blacksquare \end{align}