Fact14.2.1Sums of three squares
A positive integer may be written as a sum of three squares if and only if it is has 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 is has the form of a product of an even power of two times an odd number which is congruent to seven modulo eight.
One might think that every type of square sum is not always possible, but we have this result (see also Exercise 14.4.6), first conjectured by our old friend Bachet:
Any nonnegative integer may be written as a sum of four squares.
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\). 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\).
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.7. Note that the answers for odd powers will be very different if one allows negative numbers!
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.5.
But we can reinterpret this as a question in this context – when is a perfect square is 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 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.8. However, 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\); this is Fact 14.2.7. Euler nearly proved the same statement for \(n=3\), but made the same hidden assumption as in Fact 15.3.4 (and see [C.3.13] again for the proof).
There is a huge field (algebraic number theory) which developed from this, but we will not digress 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. 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\), there are no three positive integers \(x,y,z\) such that \begin{equation*}x^n+y^n=z^n\end{equation*}
The English mathematician Edward Waring 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\), 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\frac{3}{2}\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 notes that this formula was first conjectured by Euler's son, Johann Albrecht.
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.9.)