Proof that if p ≡ 1 (mod 4) then p is the Sum of 2 Squares by MCBT

# Proof that if p ≡ 1 (mod 4) then p is the Sum of 2 Squares by Minkowski's Convex Body Theorem

Theorem 1: If $p \equiv 1 \pmod 4$ then $p$ can be written as a sum of two squares. |

**Proof:**Since $p \equiv 1 \pmod 4$ we have the Legendre symbol $\left ( \frac{-1}{p} \right ) = 1$. So the congruence $x^2 \equiv -1 \pmod p$ has a solution, say $a^2 + 1 \equiv 0 \pmod p$. Let $A$ be the $2 \times 2$ matrix be defined by:

\begin{align} \quad A = \begin{bmatrix} p & a \\ 0 & 1 \end{bmatrix} \end{align}

- Then $A$ has determinant $\det(A) = p > 0$ and so $A$ is invertible. Let $\Lambda = A \mathbb{Z}^2$. Then $d(\Lambda) = |\det(A)| = p$.

- Let $\vec{x} = (x_1, x_2) \in \Lambda$. Then there exists an integer point $\vec{k} = (k_1, k_2) \in \mathbb{Z}^2$ for which:

\begin{align} \vec{x} = A\vec{k} = \begin{bmatrix} p & a \\ 0 & 1 \end{bmatrix} \begin{bmatrix} k_1 \\ k_2 \end{bmatrix} = \begin{bmatrix} pk_1 + ak_2 \\ k_2 \end{bmatrix} \end{align}

- Observe that:

\begin{align} \quad x_1^2 + x_2^2 = (pk_1 + ak_2)^2 + (k_2)^2 \equiv (ak_2)^2 + (k_2)^2 \equiv (a^2 + 1)k_2^2 \equiv 0 \pmod p \end{align}

- Let $S = \{ (a, b) : a^2 + b^2 < 2p \}$. Then $S$ is convex, symmetric about $0$, and:

\begin{align} \quad \mathrm{volume} (S) = \pi (2p) = 2\pi p > 2^2 p = 2^2 d(\Lambda) \end{align}

- So by Minkowski's convex body theorem there is a nonzero point $(x_1, x_2) \in S$ which is a lattice point of $\Lambda$. Namely, $x_1^2 + x_2^2 < 2p$ and $x_1^2 + x_2^2 \equiv 0 \pmod p$. Hence:

\begin{align} \quad p = x_1^2 + x_2^2 \quad \blacksquare \end{align}