Today we will discuss Fermat’s Two Squares Theorem using the approach of Gaussian Integers, the set of numbers of the form a+bi, where a, b are integers. This theorem is also called Fermat’s Christmas Theorem, presumably because it is proven during Christmas.
Have you ever wondered why , can be expressed as a sum of two squares, while not every prime can be? This is no coincidence, as we will learn from the theorem below.
Theorem: An odd prime p is the sum of two squares, i.e. where a, b are integers if and only if .
(=>) The forward direction is the easier one. Note that if a is even, and if a is odd. Similar for b. Hence can only be congruent to 0, 1 or 2 (mod 4). Since p is odd, this means .
(<=) Conversely, assume , where p is a prime. p=4k+1 for some integer k.
First we prove a lemma called Lagrange’s Lemma: If is prime, then for some integer n.
Proof: By Wilson’s Theorem, . . We may see this by observing that , , …, . Thus and hence , where .
Then . However since . Similarly, . Therefore is not a Gaussian prime, and it is thus not irreducible.
with and . , which means . Thus we may conclude , .
Let . Then and we are done.
This proof is pretty amazing, and shows the connection between number theory and ring theory.