English (unofficial) translations of posts at kexue.fm
Source

On Fermat's Last Theorem (Part 7): Fermat's Theorem on Sums of Two Squares

Translated by DeepSeek V4 Pro. Translations can be inaccurate, please refer to the original post for important stuff.

I was planning to begin preparations for the proof of n=3, but this requires introducing the concept of Eisenstein integers. Since we have already introduced Gaussian integers, their beauty has not yet been fully presented to the readers. From the two proofs for n=4, we know that the role of introducing Gaussian integers is to completely factorize expressions such as z^n - y^n. However, this does not showcase much of the magic of Gaussian integers. Readers may already know that many simple results in complex analysis, when described purely in terms of real numbers, can seem incredibly ingenious; the same is true in number theory involving Gaussian integers. In this article, let us consider Fermat’s Theorem on Sums of Two Squares to further appreciate the convenience of handling certain number theory problems within the Gaussian integers. — We start from Fermat’s Last Theorem, but we do not limit ourselves to it.

Fermat’s Theorem on Sums of Two Squares: An odd prime p can be expressed as the sum of two squares of integers if and only if the prime is of the form 4k+1. Furthermore, ignoring the order of the summands, this representation is unique.

There are many proofs of this theorem that remain entirely within the realm of rational integers, but most of these proofs leave us wondering, “How could anyone think of this step!” For those familiar with Gaussian integers, perhaps the proof within \mathbb{Z}[i] is the most natural. This theorem is not only a theorem about rational integers, but it also determines which rational primes are also Gaussian primes. The theorem tells us that rational primes of the form 4k+1 are not Gaussian primes, while primes of the form 4k+3 are Gaussian primes.

Lemma

Without further ado, let us prove Fermat’s Theorem on Sums of Two Squares. Before proving the theorem, we first need to prove the following lemma:

If p is a prime of the form 4k+1, then there exists an integer x such that p \mid x^2+1.

Note that this lemma holds entirely within the rational integers \mathbb{Z}. We will defer the proof of this lemma and first see how it allows us to quickly prove the Sum of Two Squares Theorem.

From the lemma, we have p \mid (x+i)(x-i) in \mathbb{Z}[i]. If p were a Gaussian prime (meaning the theorem does not hold), then p \mid x+i or p \mid x-i. However, \frac{x \pm i}{p} = \frac{x}{p} \pm \frac{1}{p}i, and the latter is not a Gaussian integer, which is a contradiction. Therefore, p is composite in \mathbb{Z}[i]. In fact, the most critical part of the proof has already been completed; the following is essentially just a detailed discussion. Let p=uv, with N(u), N(v) > 1. Then p^2 = N(p) = N(u)N(v) Since the norm is an operation within the rational integers, it must be that N(u)=p. Consequently, N(v)=N(u)=p. Since u \neq v, they must be conjugates of each other. Thus, we can set u=a+bi and v=a-bi, where a, b are rational integers. Then p = (a+bi)(a-bi) = a^2+b^2

Next, we prove uniqueness. Suppose p has two different representations: p = a^2+b^2 = c^2+d^2 Then (a+bi)(a-bi) = (c+di)(c-di), which implies (a+bi) \mid (c+di)(c-di). If a+bi is a Gaussian prime, then a+bi \mid c+di or a+bi \mid c-di. Correspondingly, a-bi \mid c-di or a-bi \mid c+di. Therefore, a+bi and c+di differ by at most a unit factor. In this case, a^2+b^2 = c^2+d^2 is actually the same representation, possibly differing only in the order of the summands. If a+bi is not a Gaussian prime, then a+bi = st, and p = (a+bi)(a-bi) = st\bar{s}\bar{t} = (s\bar{s})(t\bar{t}) This would split p into the product of two rational integers greater than 1, which contradicts the fact that p is prime.

Finally, we only need to prove that primes of the form 4k+3 cannot be expressed as the sum of two squares. This is simple: just consider the congruence modulo 4. Omitted.

Proof of the Lemma

However, it might come as a surprise that the proof of the lemma is not particularly easy. A complete proof of the lemma requires an idea called a “prime field.” This refers to the fact that for a prime p, the set \{1, 2, \dots, p-1\} forms a field under modulo p, where addition, subtraction, multiplication, and division can be performed just like with real numbers. This article does not intend to provide the full proof of this part; interested readers may refer to textbooks on elementary number theory. This does not mean that the proof in this article is not concise, as most pure rational integer proofs of this theorem are also based on this lemma.

Nevertheless, assuming Wilson’s Theorem, a proof of the lemma can be given quickly (though Wilson’s Theorem itself is proved using the idea of prime fields). We can prove that for p=4k+1: p \mid \left(\frac{p-1}{2}!\right)^2 + 1

From Wilson’s Theorem, we know that for any prime p, (p-1)! + 1 \equiv 0 \pmod{p}. Notice that mn \equiv (p-m)(p-n) \pmod{p}. Thus, if p-1 is a multiple of 4, we can split 1 \times 2 \times \dots \times (p-2) \times (p-1) into two halves. The terms in the first half are multiplied in pairs, and correspondingly, the terms in the second half are also multiplied in pairs. The second half is congruent to the first half, i.e., \begin{aligned} &(p-1)! = 1 \times 2 \times \dots \times \left(\frac{p-3}{2}\right)\left(\frac{p-1}{2}\right)\left(p-\frac{p-1}{2}\right)\left(p-\frac{p-3}{2}\right) \dots (p-2)(p-1) \\ &(p-1)(p-2) \equiv 1 \times 2 \pmod{p} \\ &(p-3)(p-4) \equiv 3 \times 4 \pmod{p} \\ &\dots \\ &\left(p-\frac{p-3}{2}\right)\left(p-\frac{p-1}{2}\right) \equiv \left(\frac{p-3}{2}\right)\left(\frac{p-1}{2}\right) \pmod{p} \end{aligned} Therefore, the product of the first half modulo p is the same as the product of the second half modulo p (when p=4k+1). Thus: (p-1)! + 1 \equiv \left(\frac{p-1}{2}!\right)^2 + 1 \pmod{p} Thus we obtain the formula to be proved.

When reprinting, please include the original link: https://kexue.fm/archives/2886

For more details on reprinting, please refer to: Scientific Space FAQ