Fermat's Christmas Theorem

I'm going to present what I think is a cool proof of the following theorem (original pdf version):

Theorem: An odd prime pp can be expressed as

p=x2+y2p = x^2 + y^2

with x,yx, y integers if p1mod4p \equiv 1 \mod 4

Example: 5=12+225 = 1^2 + 2^2, 13=22+3213 = 2^2 + 3^2, 17=12+4217 = 1^2 + 4^2, 29=22+5229 = 2^2 + 5^2

Setup

Lemma 1: For every aa where pap \nmid a there exists bb such that ab1modpab \equiv 1 \mod p

Example: For a=2a = 2 and p=5p = 5 we may choose b=3b = 3.

Proof by Bézout’s theorem: Since aa and pp are coprime there exists integer nn and MM such that an+pm=1an + pm = 1 hence an1modpan \equiv 1 \mod p. :)

Lemma 2: For all prime numbers pp, (p1)!1modp(p-1)! \equiv -1 \mod p.

Example: 12341(23)(1)mod51 \cdot 2 \cdot 3 \cdot 4 \equiv 1 \cdot (2 \cdot 3) \cdot (\minus 1) \mod 5

Example: 123456789101112131(27)(39)(410)(58)(611)(1) \begin{align*} &1 \cdot 2 \cdot 3 \cdot 4 \cdot 5 \cdot 6 \cdot 7 \cdot 8 \cdot 9 \cdot 10 \cdot 11 \cdot 12 \\ \equiv_{13} \quad & 1 \cdot (2\cdot7)\cdot(3\cdot9)\cdot(4\cdot10)\cdot(5\cdot8)\cdot (6\cdot11)\cdot(-1) \end{align*}

Something fishy is going on, every pair of numbers I put in brackets multiples to something 1mod131 \mod 13. We can pair everything up with something else and have those multiply to 11 besides 11 and 1-1. Leaving 1111(1)1 \cdot 1 \cdot 1 \cdots 1 \cdot (-1). So 12!1mod1312! \equiv 1 \mod 13

Proof by pairing: Every number from 11 to 𝑝1𝑝 − 1 is coprime to 𝑝𝑝 and hence pairs uniquely to some other number from 11 to 𝑝1𝑝 − 1 to multiply to 11. Unique because 𝑎𝑏1𝑎𝑐𝑎𝑏 ≡1≡𝑎𝑐 implies 𝑎(𝑏𝑐)0𝑎(𝑏 −𝑐) ≡ 0 and hence 𝑝0𝑝 ∣ 0 or 𝑝𝑏𝑐𝑝 ∣ 𝑏 −𝑐 neither of which can be true. The only two numbers which pair with themselves are 𝑥𝑥 where 𝑥21𝑥^2 ≡ 1 hence (𝑥1)(𝑥+1)0(𝑥 −1)(𝑥 +1) ≡ 0 and so 𝑥±1mod𝑝𝑥 ≡ ±1 \mod 𝑝. The rest is trivial, you can do it yourself.

Lemma 3: For a prime number p1mod4p \equiv 1 \mod 4 , there exists nn such that

n21modpn^2 \equiv -1 \mod p

Proof: Let p=4k+1p = 4k + 1 and consider n1222kn \equiv 1 \cdot 2 \cdot 2 \cdots {2k}. n2p12(2k)(2k+1)(4k2)(4k1)(1)2k12(2k)(2k+1)(4k2)(4k1)(1)2k(p1)!(p1)!(1) \begin{align*} n^2 & \equiv_p 1 \cdot 2 \cdots (2k) \cdots (2k+1) \cdots (4k-2) \cdot (4k-1) \\ & \equiv (-1)^{2k} \cdot 1 \cdot 2 \cdots (2k) \cdot (2k+1) \cdots (4k-2) \cdot (4k-1) \\ & \equiv (-1)^{2k} (p-1)! \\ & \equiv (p-1)! \\ & \equiv (-1) \end{align*}

Minkowski’s Theorem

A lattice of points generated by nn linearly independent vectors v1,v2,,vnv_1, v_2, \dots, v_n is the set of all points of the form

a1v1+a2v2++anvn a_1 v_1 + a_2 v_2 + \dots + a_n v_n

where a1,a2,,ana_1, a_2, \dots, a_n are integers.

Minkowski’s Theorem: If a convex set in n\mathbb{R}^n is symmetric about the origin and has volume 2n2^n times the volume of the fundamental parallelepiped of a lattice in n\mathbb{R}^n, then the set contains a non-zero point of the lattice.

What this is really saying is that if you have a lattice of points in n\mathbb{R}^n and you blow a big enough balloon about the origin, you will eventually hit a lattice point. More specifically in the case of 2\mathbb{R}^2, if you have a lattice of points generated by two vectors v1v_1 and v2v_2 and you draw a circle with area of 4area(v1,v2)4 \cdot \text{area}(v_1,v_2) centered at the origin, then there must be a lattice point other than the origin inside that circle.

Conclusion

Proof of Fermat’s Christmas Theorem: Consider the lattice of points generated by the two vectors (n1)\begin{pmatrix} n \\ 1 \end{pmatrix} and (0p)\begin{pmatrix} 0 \\p \end{pmatrix}. The area of the parallelogram spanned by these two vectors is pp. What’s important is that every lattice point (x,y)(x,y) is such that x2+y20modpx^2 + y^2 \equiv 0 \mod p.

The aforementioned lattice

Now draw a circle of radius 4pπ\sqrt{\frac{4p}{\pi}} centered at the origin. The area of this circle is 4p4p and so by Minkowski’s Theorem there must be a lattice point (x,y)(x,y) inside this circle other than the origin.

px2+y2p \mid x^2 + y^2 and x2+y2<4pπx^2 + y^2 < \frac{4 p} \pi. So x2+y2=px^2 + y^2 = p . So there must exist integers xx and yy such that p=x2+y2p = x^2 + y^2.