The Greeks already arranged pebbles into figures. With 1, 3, 6, 10 pebbles you make triangles; with 1, 4, 9, 16, squares; with 1, 5, 12, 22, pentagons. These are the polygonal numbers.

The formula

The $n$-th number with $k$ sides is obtained by adding up an arithmetic progression that starts at 1 and grows in steps of $k - 2$:

$$P_k(n) = 1 + (k-1) + (2k-3) + \cdots = \frac{n\,\big((k-2)n - (k-4)\big)}{2}.$$

For $k = 3$ we get the triangular numbers $\frac{n(n+1)}{2}$: 1, 3, 6, 10, 15, … For $k = 4$, the squares $n^2$. For $k = 5$, the pentagonal numbers $\frac{n(3n-1)}{2}$: 1, 5, 12, 22, 35, … We will also count zero, $P_k(0) = 0$.

Fermat’s claim

In 1638, in a letter to Mersenne, and later in a note in the margin of his copy of Diophantus, Pierre de Fermat claimed to have discovered a “very beautiful and entirely general” property:

Every number is triangular or the sum of two or three triangular numbers; square or the sum of two, three or four squares; pentagonal or the sum of two, three, four or five pentagonal numbers; and so on to infinity.

— Pierre de Fermat, note in his Diophantus (c. 1638)

As usual, Fermat left no proof. The case of squares resisted Euler for forty years and was settled by Lagrange in 1770. That of triangular numbers was proved by Gauss in 1796; in his diary he jotted down joyfully: “ΕΥΡΗΚΑ! num = Δ + Δ + Δ”. Pentagonal, hexagonal and all the others remained open.

Why $k$ are needed

Before the proof, it is worth seeing that Fermat did not exaggerate: some numbers really do need $k$ terms. Look at $2k - 1$. The $k$-sided numbers smaller than it are only $0$, $1$ and $k$, because the next one, $P_k(3) = 3k - 3$, is already larger than $2k - 1$ when $k > 2$. We can use $k$ at most once, since $2k > 2k - 1$. So

$$2k - 1 = k + \underbrace{1 + 1 + \cdots + 1}_{k-1}$$

is the most economical form: $k$ terms. For squares ($k = 4$), the number 7 needs four: $7 = 4 + 1 + 1 + 1$. For triangular numbers, $5 = 3 + 1 + 1$. For pentagonal numbers, $9 = 5 + 1 + 1 + 1 + 1$.

Cauchy’s proof

Cauchy presented the complete proof to the Academy in 1813 and published it in 1815. The starting point is Gauss’s theorem on triangular numbers or, equivalently, the fact that every number of the form $8m + 3$ is a sum of three odd squares. From there Cauchy proved an ingenious lemma: if $a$ and $b$ are odd and

$$b^2 < 4a \quad\text{and}\quad 3a < b^2 + 2b + 4,$$

then there are integers $s, t, u, v \ge 0$ with

$$a = s^2 + t^2 + u^2 + v^2 \quad\text{and}\quad b = s + t + u + v.$$

In other words, one can choose four squares adding up to $a$ and whose roots add up to $b$, both at once. Now, a polygonal number is a combination of $n^2$ and $n$, since $P_k(n) = \frac{k-2}{2}\,n^2 - \frac{k-4}{2}\,n$. Adding four of them with $n = s, t, u, v$, exactly $a$ and $b$ appear:

$$P_k(s) + P_k(t) + P_k(u) + P_k(v) = \frac{k-2}{2}\,a - \frac{k-4}{2}\,b.$$

With a careful choice of $a$ and $b$, Cauchy showed that every sufficiently large number equals this expression plus a small remainder, which is made up with terms equal to 0 or 1. The small numbers are checked one by one. The result is even stronger than Fermat’s: of the $k$ terms, all but four can be 0 or 1.

Exercise: the number 30 in three ways

Write 30 as a sum of three triangular numbers, of four squares and of five pentagonal numbers.

Triangular: $0, 1, 3, 6, 10, 15, 21, 28$. For example, $30 = 15 + 15 + 0$, or $30 = 21 + 6 + 3$.

Squares: $30 = 25 + 4 + 1 + 0$, or $30 = 16 + 9 + 4 + 1$.

Pentagonal: $0, 1, 5, 12, 22$. For example, $30 = 22 + 5 + 1 + 1 + 1$, or $30 = 12 + 12 + 5 + 1 + 0$.

Exercise: hexagonal numbers

Compute the first hexagonal numbers and check that 11 needs six terms.

With $k = 6$, $P_6(n) = \frac{n(4n - 2)}{2} = n(2n - 1)$: $0, 1, 6, 15, 28, \ldots$ To write $11 = 2 \cdot 6 - 1$, only 0, 1 and 6 are available, and 6 can be used at most once. The best form is $11 = 6 + 1 + 1 + 1 + 1 + 1$: six terms, exactly what the theorem allows.

Sources: Augustin-Louis Cauchy, “Démonstration du théorème général de Fermat sur les nombres polygones”, Mémoires de l’Institut (1813–1815), in Œuvres complètes, series 2, vol. 6 · Melvyn B. Nathanson, “A short proof of Cauchy’s polygonal number theorem”, Proceedings of the AMS 99 (1987) · Leonard E. Dickson, History of the Theory of Numbers, vol. 2, ch. 1 (1920).


All topics on Augustin-Louis Cauchy · ← The life of Augustin-Louis Cauchy · Determinants and permutations →

Image credits.