Theorem

Every prime \(p \equiv 1 \pmod 4\) is a sum of two squares.

The following proof is adapted from Don Zagier’s elegant one-sentence proof of Fermat’s two squares theorem in The American Mathematical Monthly.

Proof

The involution on the finite set \(S = {(x, y, z) \in \mathbb{N}^3 : x^2 + 4yz = p}\) is defined by:

$$f(x, y, z) \mapsto \begin{cases} (x + 2z,\ z,\ y – x – z) & \text{if } x < y - z, \\ (2y - x,\ y,\ x - y + z) & \text{if } y - z < x < 2y, \\ (x - 2y,\ x - y + z,\ y) & \text{if } x > 2y. \end{cases}$$

It has exactly one fixed point, so \(|S|\) is odd, and the involution \((x, y, z) \mapsto (x, z, y)\) must also have a fixed point. ∎

Explanation

This ingenious proof leverages a clever involution—a function that is its own inverse—on a finite set of integer triples \((x, y, z) \in \mathbb{N}^3 \) satisfying the equation \( x^2 + 4yz = p\), where \(p\) is a prime such that \(p \equiv 1 \pmod{4}\).

The first key insight is that:

  • The mapping defined in the proof either pairs elements of the set \(S\) or leaves them fixed.
  • It is constructed so that it has exactly one fixed point.
  • Therefore, the number of elements in \(S\) is odd.

The second key insight is that:

  • Consider a second involution that maps \((x,y,z) \mapsto (x,z,y)\). For its fixed points, \(y = z\).
  • If \(y = z\), then \(x^2 + 4yz = p\) becomes \(x^2 + 4z^2 = p = x^2 + (2z)^2\).

Hence, every prime \(p \equiv 1 \pmod 4\) can be expressed as a sum of two squares.

Example: p = 17

To illustrate the involution used in Zagier’s proof, consider the finite set \([S = { (x, y, z) \in \mathbb{N}^3 : x^2 + 4yz = p }]\) for the prime \(p = 17\). Each element of \(S\) is a triple of natural numbers satisfying this equation.

The involution defined in the proof maps each element of \(S\) to another element (or to itself) according to one of three distinct cases, depending on the relative values of \( x, y,\) and \( z \):

  • Case 1: If \(x < y – z\)
  • Case 2: If \(y – z < x < 2y\)
  • Case 3: If \(x > 2y\)

Figure 1 shows all elements of \(S\) for \(p = 17\). Each node corresponds to a triple \((x, y, z) \in S\), and the labels beneath each node indicate which case of the involution applies. Bidirectional blue arrows connect pairs of elements that map to each other under the involution—this can occur between Case 1 and Case 3, or between two elements within Case 2. The red loop indicates the unique fixed point, where an element maps to itself. This visualization highlights that all elements of \(S\) are paired under the involution, except for exactly one fixed point.

Figure 1: Elements of S and their involution pairings for p = 17

Acknowledgment

I first encountered this beautiful proof through a video by Adam Boocher, whose clear and engaging explanation on TikTok sparked my interest. I am grateful for the insight and accessibility his content provided in illuminating Don Zagier’s one-sentence proof of Fermat’s two squares theorem.

References

Zagier, Don. “A One-Sentence Proof That Every Prime p ≡ 1 (mod 4) Is a Sum of Two Squares.” American Mathematical Monthly, vol. 97, no. 2, 1990, p. 144.