#### Fact 14.2.1. Sums of three squares.

A positive integer may be written as a sum of

*three*squares if and only if it does*not*have the form of a product of an*even*power of two times an*odd*number which is congruent to seven modulo eight.There are many interesting questions one can ask about sums of squares we have not even touched upon. Each of these is very worthy of independent study by undergraduates, and also ideal for computer exploration.

A positive integer may be written as a sum of *three* squares if and only if it does *not* have the form of a product of an *even* power of two times an *odd* number which is congruent to seven modulo eight.

We will skip the proof, but see Exercise 14.4.4 and Exercise 14.4.6.

One might think at this point that even an arbitrary sum of squares might not represent every number, but we have this result (see also Exercise 14.4.7), first conjectured by our old friend Bachet.

Any nonnegative integer may be written as a sum of four squares.

There are algebraic proofs using facts similar to Fact 14.1.8, and also geometric proofs using (Minkowkskian, see Remark 13.4.1) ideas similar to those in Subsection 13.4.4. Both types of proof are interesting, because on the one hand an algebraic proof can use the extension of the complex numbers called the quaternions^{ 2 }, while on the other hand a geometric proof shows that geometric ideas can still work in more than two dimensions.

One can generalize in many ways.

For example, one can ask how *many* ways one can write a number as a sum of three, four, etc. squares. In Exercise 13.7.7 we defined \(r_2(n)\) as giving the number of ways to write \(n\) as a sum of two squares; the equivalent functions here would be \(r_k(n)\) for \(n\geq 1\text{.}\) In that case, Lagrange’s four square theorem above could be more succinctly stated as

\begin{equation*}
r_4(n)\geq 1\text{ for all }n\geq 0
\end{equation*}

But in general one may want to be able to compute this, or to give bounds for it as a function of \(n\text{.}\) If you just can’t wait to learn more about the sort of things known about \(r_k(n)\text{,}\) see Theorem 25.8.1.

There are other directions one can generalize our questions. For instance:

What numbers can be written as a sum of …

- Two
*cubes*? - Three cubes?
- \(k\) cubes?

It turns out that *any* number can be written as a sum of at most nine cubes. In the first half of the twentieth century, American mathematician L. E. Dickson proved this, and with the assistance of very substantial tables generated by hand by some of his assistants (*before* the advent of the digital computer!) he showed that every number except \(23\) and \(239\) can be represented by eight or fewer cubes!

Alternately, one could keep the number of powers the same, but change the powers.

What numbers can be written as a sum of …

- Two cubes?
- Two fourth powers?
- Two \(n\)th powers?

The reader should feel free to explore this in Exercise 14.4.8. Note that the answers for odd powers will be very different if one allows negative numbers! For a recent example of theory working with massive computation, see this article^{ 3 } about writing \(33\) as a sum of three cubes^{ 4 }.

Now it is time to recall our discussions in Section 3.4, alluded to in Remark 13.1.4. In that situation, we essentially were looking for integer solutions to

\begin{equation*}
x^2+y^2=z^2
\end{equation*}

In fact, we characterized such triples \(x,y,z\) in Theorem 3.4.6.

But we can reinterpret this as a question in this context – when is a *perfect square* a sum of two squares? In that case, the previous question can be further specialized:

What perfect …

- Cubes can be written as a sum of two cubes?
- Fourth powers can be written as a sum of two fourth powers?
- What about \(n\)th powers? What (integer) solutions are there to this?\begin{equation*} x^n+y^n=z^n \end{equation*}

Ordinarily, as author I would now send the reader to explore some of these questions in Exercise 14.4.9. However, as we saw in Exercise 3.6.17 (see the discussion at Corollary 3.4.13), Fermat already proved that other than trivial solutions (such as writing \(0^4+(-1)^4=1^4\)) there were no solutions in the case \(n=4\text{.}\) This is the simplest case of Fact 14.2.7. Euler *nearly* proved the same statement for \(n=3\text{,}\) but made a hidden assumption – the same one we will examine shortly in discussing Fact 15.3.5 (as there, see [E.4.14] for a correct proof).

There is a huge field which developed from these observations, but we will not digress much further upon it. If you recall the discussion in Subsection 11.6.4, it turns out Germain originally investigated \(n\) in the case where it is one of the numbers now known as Germain primes (recall Subsection 11.6.4); see [E.5.2, Chapter 11] for an accessible introduction to her plan.

Much of the field of algebraic number theory developed from pursuing this question in the nineteenth and early twentieth centuries. Finally in 1995 Andrew Wiles, along with his former student Richard Taylor, proved the following result via a very deep investigation of (among other things) elliptic curves (recall the brief mention in Section 3.5).

For \(n>2\text{,}\) there are no three positive integers \(x,y,z\) such that

\begin{equation*}
x^n+y^n=z^n
\end{equation*}

Hanc marginis exiguitas non caperet.

The English mathematician Edward Waring^{ 5 } asked for an outrageous generalization of these questions of sums of powers, which is still an active area of research called Waring’s Problem. The most important result is truly spectacular.

For each positive integer power \(m\text{,}\) there is a number \(g(m)\) such that *every* nonnegative integer can be written as a sum of \(g(m)\) \(m\)th powers.

There is even a potential formula that

\begin{equation*}
g(m)=2^m+\left\lfloor\left(\frac{3}{2}\right)^m\right\rfloor-2
\end{equation*}

This has been verified for \(m\) out to many millions, and is conjectured to always be true. The aforementioned Dickson^{ 6 } notes that this formula was first conjectured by Euler’s son, Johann Albrecht. See [E.2.16, Section 7.6] for a nice exposition of this, and see [E.4.26, Chapter 5] for Fact 14.2.8 itself.

On the other hand, the question of finding the *smallest* integer \(G(m)\) (for a given \(m\)) such that every *sufficiently large* number can be written as a sum of that many \(m\)th powers is still wide open. Perhaps you will explore it? (See e.g. Exercise 14.4.10 and Exercise 14.4.11.)

See an excellent video (

`www.youtube.com/watch?v=d4EgbgTm0Bg`

) by 3blue1brown (Grant Sanderson).`www.quantamagazine.org/sum-of-three-cubes-problem-solved-for-stubborn-number-33-20190326/`

To be precise, \(8866128975287528^3+(-8778405442862239)^3+(-2736111468807040)^3=33\text{.}\) The status of all positive integers less than \(100\) is now known; see Quanta magazine (

`www.quantamagazine.org`

).According to [E.5.3, Section 11-1], John Wilson of Wilson’s Theorem was his student.

`www.ams.org/journals/bull/1936-42-12/S0002-9904-1936-06432-3/S0002-9904-1936-06432-3.pdf`