Prove Theorem (8.13).
Let's remind ourselves of Theorem (8.13).
Every prime can be expressed as the sum of four squares.
We'll first prove a Lemma A:
If an even number $2n$ is the sum of four squares, so is $n$.
We write $2n=x^2 + y^2 + s^2 + t^2 $ where $x,y,s,t$ are natural numbers.
Because $2n$ is even, there are only 3 cases for these summands:
- all four summands are even
- all four summands are odd
- two are even, two are odd
Without loss of generality, let's assume that $x^2$ and $y^2$ have the same parity, and that $s^2$ and $t^2$ have the same parity. Noting that a number has the same parity as its square, and the the sum and difference of two numbers with the same parity gives an even integer, we have for some integers $j,k, l, m$,
$$ \begin{align} 2n = x^2 + y^2 + s^2 + t^2 & = \frac{(x+y)^2+(x-y)^2}{2} + \frac{(s+t)^2+(s-t)^2}{2} \\ \\ & = \frac{(2j)^2+(2k)^2}{2} + \frac{(2l)^2+(2m)^2}{2} \\ \\ & = 2j^2 + 2k^2 + 2l^2 + 2m^2 \\ \\ n & = j^2 + k^2 + l^2 + m^2 \end{align} $$
That is, if an even number $2n$ is the sum of four squares, so is $n$.
We first consider the only even prime 2, which can be written as the sum of four squares $2=1^2 + 1^2 +0^2 +0^2$.
We now consider the odd primes. Corollary (8.12) tells us that for any odd prime $p$ there exists a positive $m<p$ such that $mp$ can be expressed as the sum of four squares. That is, for some natural numbers $a,b,c,d$,
$$ mp = a^2 + b^2 + c^2 + d^2 $$
For the purpose of contradiction, let's assume $m$ is the minimal possible value. If we can find a natural number $1 \le n<m$ such that $np$ can be expressed as the sum of four squares, then we contradict that $m$ is the minimal possible value such that $mp$ can be expressed as a sum of four squares.
There are two cases for $m$, even and odd.
Case $m$ even
For the case $m$ is even, Lemma A tells us that $n=m/2$ can also be expressed as sum of four squares. So we have found an $n<m$ such that $np$ can be expressed as the sum of four squares, contradicting that $m$ is the minimal possible value.
Case $m$ odd
For the case $m$ is odd, we carefully choose
$$ \begin{align} a' & \equiv a \pmod m \\ b' & \equiv b \pmod m \\ c' & \equiv c \pmod m \\ d' & \equiv d \pmod m \end{align} \tag{i}$$
where each of the $a', b', c', d'$ are in the interval $(-m/2, m/2)$.
None of $a', b', c', d'$ can be $m/2$ because $m$ is odd and $m/2$ is not an integer. Similarly all $a', b', c', d'$ cannot be 0, since that would mean all of $a, b, c, d$ are multiples of $m$, leading to $m^2 \mid a^2 + b^2 + c^2 + d^2 = mp$, and the implied $m \mid p$, and requiring $m=p$ since $p$ is prime, but contradicting $m<p$.
And so, for $m>1$,
$$ 0 < a'^2 + b'^2 + c'^2 + d'^2 \; < \; 4 (\frac{m}{2})^2 \; = \; m^2 $$
Also,
$$ a'^2 + b'^2 + c'^2 + d'^2 \equiv a^2 + b^2 + c^2 + d^2 \equiv 0 \pmod m \tag{ii}$$
which means $a'^2 + b'^2 + c'^2 + d'^2 = nm$ for some natural number $n$. Since $0 < a'^2 + b'^2 + c'^2 + d'^2 < m^2$, that means
$$0 < n<m $$
Applying the Sum of Four Squares Identity (8.10) to the product $(a'^2 \times b'^2 \times c'^2 \times d'^2) \times (a^2 \times b^2 \times c^2 \times d^2)$ gives
$$ \begin{align} (a'^2 \times b'^2 \times c'^2 \times d'^2) \times (a^2 \times b^2 \times c^2 \times d^2) & = (a'a + b'b + c'c + d'd)^2 + (a'c− b'd− c'a + d'b)^2 \\ & + (a'b− b'a + c'd− d'c)^2 + (a'd + b'c− c'c− d'a)^2 \end{align} $$
The congruences in (i) and (ii) above tell us each of $ (a'a + b'b + c'c + d'd)$, $(a'c− b'd− c'a + d'b)$, $(a'b− b'a + c'd− d'c)$, and $(a'd + b'c− c'c− d'a)$ are congruent to 0 modulo $m$. That is, each is divisible by $m$. And so,
$$ \begin{align} n\cancel{m} \times \cancel{m}p & = (\frac{a'a + b'b + c'c + d'd}{m})^2 + (\frac{a'c− b'd− c'a + d'b}{m})^2 \\ & + (\frac{a'b− b'a + c'd− d'c}{m})^2 + (\frac{a'd + b'c− c'c− d'a}{m})^2 \\ \\ np & = (\frac{a'a + b'b + c'c + d'd}{m})^2 + (\frac{a'c− b'd− c'a + d'b}{m})^2 \\ & + (\frac{a'b− b'a + c'd− d'c}{m})^2 + (\frac{a'd + b'c− c'c− d'a}{m})^2 \ \end{align} $$
We have shown that $np$ can be expressed as a sum of squares, and $n<m$ which contradicts the minimality of $m$.
We have shown that for any $m$ such that $mp$ is expressible as a sum of four squares, we can always find a smaller $n$ such that $np$ is expressible as a sum of squares, unless $m=1$.
In totality, we have shown that any prime can be expressed as a sum of four squares.