# Why is it harder to prove which integers are sums of three squares rather than sums of two squares or four squares?

Background: Let $n$ be an integer and let $p$ be a prime. If $p^{e} || n$, we write $v_{p}(n) = e$. A natural number $n$ is a sum of two integer squares if and only if for each prime $p \equiv 3 \pmod 4$, $v_{p}(n)$ is even. Every natural number is a sum of four squares. A natural number $n$ is a sum of three squares if and only if it is not of the form $4^{k}u$ where $u \equiv 7 \pmod 8$.

I would like to know why it is harder to prove the above result for sums of three squares as opposed to sums of two squares or four squares.

I've heard somewhere that one way to see this involves modular forms... but I don't remember any details. I would also like to know if there is a formula for the number of ways of representing a natural number n as a sum of three squares (or more generally, $m$ squares) that is similar in spirit to the formulas for the number of ways of representing a natural number as the sum of two squares and four squares.

• While I completely understand where you're coming from, the question is sort of strange to me because the shortest answer seems to me to be "if you try to prove it, it ends up being hard, and all the known proofs are also hard." Do you happen to know the proofs, by the way? – Qiaochu Yuan Dec 9 '10 at 8:37

The modular forms explanation is basically due to the fact that $3$ is odd and so the generating function for representations of sums of three squares is a modular form of half-integer weight.

In general if $r_k(n)$ is the number of representations of $n$ as a sum of $k$ squares then $$\sum_{n=0}^\infty r_k(n)q^n=\theta(z)^k$$ where $q=\exp(\pi i z)$ and $$\theta(z)=1+2\sum_{n=1}^\infty q^{n^2}.$$ Then $f_k(z)=\theta(z)^k$ is a modular form of weight $k/2$ for the group $\Gamma_0(4)$. This means that $$f_k((az+b)/(cz+d))=(cz+d)^{k/2}f_k(z)$$ whenever the matrix $\begin{pmatrix}a&b\\\\c&d\end{pmatrix}$ lies in $\Gamma_0(4)$, that is $a$, $b$, $c$ and $d$ are integers, $4\mid c$ and $ad-bc=1$.

This definition is easy to understand when $k$ is even, but for odd $k$ one needs to take the correct branch of $(cz+d)^{k/2}$, and this is awkward. The space of modular forms of weight $k/2$ is finite-dimensional for all $k$, and is one-dimensional for small enough $k$. For these small $k$ the space is spanned by an "Eisenstein series". Computing the Eisenstein series isn't too hard for even $k$, but is much nastier for odd $k$ where again square roots need to be dealt with. See Koblitz's book on modular forms and elliptic functions for the calculation for $k\ge5$ odd. The calculation for $k=3$ is even nastier as the Eisenstein series does not converge absolutely. In fact the cases where $k$ is divisible by $4$ are even easier, as even weight modular forms behave nicer.

For large $k$, Eisenstein series are no longer enough, one needs also "cusp forms". While fascinating, cusp forms have coefficients which aren't given by nice formulae unlike Eisenstein series.

Of course there is a formula for $r_3(n)$, due to Gauss in his Disquisitiones Arithmeticae. It involves class numbers of quadratic fields (or to Gauss numbers of classes of integral quadratic forms).

• I think there's a typo in your formula for $\Sigma r_k(n)q^n$; you want $\theta(z)^k$, not $\theta(z)^n$, on the RHS? – Steven Stadnicki Dec 9 '10 at 16:35
• Thanks Steven, I hope I've caught all the miscreant $n$s. – Robin Chapman Dec 9 '10 at 16:40
• Dear Robin, Since you are working on $\Gamma_0(4)$, I think that you want $q = e^{2 \pi i z}.$ Also, it might be better to write $\Gamma_1(4)$ rather than $\Gamma_0(4)$, because there will be a nebentypus (e.g. when $k = 2$, it is the non-trivial character of conductor 4). – Matt E Dec 9 '10 at 18:05
• I'm sure you're right, Matt. – Robin Chapman Dec 9 '10 at 18:44

An explanation from a different direction than you may be expecting: one reason why the sum-of-three-squares problem is so much harder is that there's no normed division algebra of dimension three. A key element of both the two-squares and four-squares proof is expressing the product of two numbers in the relevant form as another number in that form; these product formulas 'come from' the formulas for multiplying complex and quaternionic numbers respectively. That is, taking norms of $(a+bi)(c+di) = (ac-bd) + (ad+bc)i$ gives rise to the formula $(a^2+b^2)(c^2+d^2) = (ac-bd)^2+(ad+bc)^2$, and the equivalent formula for quaternions gives Euler's four-square identity. John Baez wrote a particularly interesting article on why you don't keep getting division algebras as you keep doubling the dimension; you should be able to find it on his homepage if you're curious.

• The fact you are referring to is the Frobenius theorem on division algebras over $\mathbb R$ and is available in most introductory algebra books. For instance it is given in I. N. Herstein, Topics in algebra, in which the four squares theorem is shown to be a consequence of the product identity you are alluding to. – user1119 Dec 9 '10 at 7:36
• You don't need to prove that there is no normed division algebra of dimension three to prove that an identity like the two-square or four-square identities can't exist, since you can readily find numbers not the sum of three squares whose product is, e.g. 7 * 7 = 1^2 + 5^2 + 5^2. – Qiaochu Yuan Dec 9 '10 at 9:12
• Unless I'm mistaken, 7*7 is 49, and 5^2 + 5^2 + 1^2 is 51. – JBirch Dec 9 '10 at 13:34
• There are also the octonions, which give rise to an 8 square identity! If you read German, read Hurwitz's original proof that these are the only identities; it uses elementary linear algebra to get this non-trivial result. – Yuval Filmus Dec 9 '10 at 15:45
• @Qiaochu I think you want that the other way around - you want two numbers, each of which is the sum of three squares, whose product isn't; e.g. $(1^2+1^2+1^2) * (2^2+1^2+0^2) = 15$. But the description in terms of division algebras explains why such an identity doesn't exist. – Steven Stadnicki Dec 9 '10 at 16:32