In mathematics, Legendre's three-square theorem states that a natural number can be represented as the sum of three squares of integers
if and only if is not of the form for nonnegative integers and .
The first numbers that cannot be expressed as the sum of three squares (i.e. numbers that can be expressed as ) are 7, 15, 23, 28, 31, 39, 47, 55, 60, 63, 71 ... . 012072811211560240223923683311244964391566245471887526552208807632521008871284113697931612641087348139211953801520121034121648Unexpressible valuesup to 100 are in bold
History
Pierre de Fermat gave a criterion for numbers of the form 8a + 1 and 8a + 3 to be sums of a square plus twice another square, but did not provide a proof. N. Beguelin noticed in 1774Nouveaux Mémoires de l'Académie de Berlin (1774, publ. 1776), pp. 313–369. that every positive integer which is neither of the form 8n + 7, nor of the form 4n, is the sum of three squares, but did not provide a satisfactory proof.Leonard Eugene Dickson, History of the theory of numbers, vol. II, p. 15 (Carnegie Institute of Washington 1919; AMS Chelsea Publ., 1992, reprint). In 1796 Gauss proved his Eureka theorem that every positive integer n is the sum of 3 triangular numbers; this is equivalent to the fact that 8n + 3 is a sum of three squares. In 1797 or 1798 A.-M. Legendre obtained the first proof of his 3 square theorem.A.-M. Legendre, Essai sur la théorie des nombres, Paris, An VI (1797–1798), and pp. 398–399. In 1813, A. L. Cauchy notedA. L. Cauchy, Mém. Sci. Math. Phys. de l'Institut de France, (1) 14 (1813–1815), 177. that Legendre's theorem is equivalent to the statement in the introduction above. Previously, in 1801, Gauss had obtained a more general result,C. F. Gauss, Disquisitiones Arithmeticae, Art. 291 et 292. containing Legendre's theorem of 1797–8 as a corollary. In particular, Gauss counted the number of solutions of the expression of an integer as a sum of three squares, and this is a generalisation of yet another result of Legendre,A.-M. Legendre, Hist. et Mém. Acad. Roy. Sci. Paris, 1785, pp. 514–515. whose proof is incomplete. This last fact appears to be the reason for later incorrect claims according to which Legendre's proof of the three-square theorem was defective and had to be completed by Gauss.See for instance: Elena Deza and M. Deza. Figurate numbers. World Scientific 2011, p. 314
With Lagrange's four-square theorem and the two-square theorem of Girard, Fermat and Euler, the Waring's problem for k = 2 is entirely solved.
Proofs
The "only if" of the theorem is simply because modulo 8, every square is congruent to 0, 1 or 4. There are several proofs of the converse (besides Legendre's proof). One of them is due to Dirichlet (in 1850), and has become classical.See for instance vol. I, parts I, II and III of : E. Landau, Vorlesungen über Zahlentheorie, New York, Chelsea, 1927. Second edition translated into English by Jacob E. Goodman, Providence RH, Chelsea, 1958. It requires three main lemmas: the quadratic reciprocity law, Dirichlet's theorem on arithmetic progressions, and the equivalence class of the trivial ternary quadratic form.
Relationship to the four-square theorem
This theorem can be used to prove Lagrange's four-square theorem, which states that all natural numbers can be written as a sum of four squares. Gauss pointed out that the four squares theorem follows easily from the fact that any positive integer that is 1 or 2 mod 4 is a sum of 3 squares, because any positive integer not divisible by 4 can be reduced to this form by subtracting 0 or 1 from it. However, proving the three-square theorem is considerably more difficult than a direct proof of the four-square theorem that does not use the three-square theorem. Indeed, the four-square theorem was proved earlier, in 1770.
See also Fermat's two-square theorem Legendre's equation Sum of squares function Sum of two squares theorem
Notes