# For a proof of the three-square theorem without using Dirichlet's theorem on primes in arithmetic progressions

The three-square theorem states that $n\in\mathbb N=\{0,1,2,\ldots\}$ is the sum of three squares if and only if it is not of the form $4^k(8m+7)$ ($k,m\in\mathbb N$). This was first proved by Legendre during 1797-1798. In 1837 Dirichlet proved his famous theorem on primes in arithmetic progressions. Now I can only find proofs of Legendre's three-square theorem using Dirichlet's theorem, see, e.g., M. B. Nathanson's book "Additive Number Theory-The Classical Bases" (GTM 164, Springer, 1996).

Legendre's original proof did not involve Dirichlet's theorem which was proved later. A proof without using Dirichlet's theorem might be self-contained and hence suitable for the course of elementary number theory.

QUESTION: Where can I find a proof of the three-square theorem without using Dirichlet's theorem?

• I think the question is addressed in Vicky Neale's outreaching book "closing the gap" about Zhang's 2013 breakthrough and subsequent Polymath8b project. If I remember correctly, she uses quadratic forms as GH suggests in his answer below. – Sylvain JULIEN Jun 16 '18 at 22:10

## 1 Answer

I am not sure if Legendre's proof was complete (see this related MO entry), but surely Gauss gave a proof without Dirichlet's theorem (which came decades later).

A nice transparent proof (without Dirichlet's theorem) can be found in Serre's book "A course in arithmetic". Very roughly, the proof goes as follows. Assume that $n$ satisfies the necessary local conditions. Step 1: There exists a positive integer $t$ such that $t^2 n$ is the sum of three squares. This relies on the theory of quadratic forms over $\mathbb{Q}$. Step 2: The minimal $t$ that works in Step 1 is $t=1$. This relies on the following simple but key property: for any $(x_1,x_2,x_3)\in\mathbb{Q}^3$ there exists $(y_1,y_2,y_3)\in\mathbb{Z}^3$ such that $\sum (x_i-y_i)^2<1$.

• I cannot find Serre's book at present since I'm out of Nanjing. The two-step proof described by you looks like the proof in Section 5 of my talk maths.nju.edu.cn/~zwsun/Three-Square-Theorem.pdf. Though Step 2 does not involve Dirichlet's theorem, the whole proof still need that (see the details in the proof mentioned in my talk). – Zhi-Wei Sun Jun 16 '18 at 23:37
• @Zhi-WeiSun: I trust Serre and Weil more than Wikipedia. Serre's book proves Dirichlet's theorem, but later in the book (besides, I have read that book). Weil's historical book discusses issues with Legendre's proof of the three square theorem (not Gauss's refined version which relates the problem to class numbers). – GH from MO Jun 17 '18 at 0:56
• @Zhi-WeiSun: Your question was "Where can I find a proof of the three-square theorem without using Dirichlet's theorem?". I just answered that. Serre's book has such a proof. BTW I don't think Legendre or Gauss had a simpler proof than Serre's book. – GH from MO Jun 17 '18 at 4:46
• @FedorPetrov: Gauss, using his genus theory, could give a formula for the number of primitive representations of $n$ as a sum of three squares. It equals $(24/w)h(-4n)$ when $n\equiv 1,2,5,6\pmod{8}$, and $(48/w)h(-n)$ when $n\equiv 3\pmod{8}$. Here $h(D)$ is the class number of primitive binary quadratic forms of discriminant $D$, and $w$ is the number of automorphs of such a form: $w=2$ for $D<-4$, $w=4$ for $D=-4$, $w=6$ for $D=-3$. This is in Gauss' Disquisitiones arithmeticae, $\S 291$, but I have not read the original source, nor do I know a good modern course. Continued in next remark. – GH from MO 2 days ago
• Gauss's formula is a special case of Siegel's mass formula, which expresses the (weighted) average representation number over a genus of classes of primitive positive quadratic forms (in any number of variables) as a product of local densities. As the genus of $x^2+y^2+z^2$ consists of a single class, the averaging really equals the representation number sought, while the product of local densities returns $(24/\pi)\sqrt{n}L(1,\chi_{-4n})$ or $(24/\pi)\sqrt{n}L(1,\chi_{-n})$ depending on the residue of $n$ modulo $8$. Here $\chi_D$ denotes the unique primitive quadratic character modulo $D$. – GH from MO 2 days ago