# Integer is Sum of Three Triangular Numbers

## Theorem

Let $n$ be a positive integer.

Then $n$ is the sum of $3$ triangular numbers.

## Proof

From Integer as Sum of Three Squares, every positive integer not of the form $4^n \paren {8 m + 7}$ can be expressed as the sum of three squares.

Hence every positive integer $r$ such that $r \equiv 3 \pmod 8$ can likewise be expressed as the sum of three squares.

From Square Modulo 8, the squares modulo $8$ are $0, 1$ and $4$.

Thus for $r$ to be the sum of three squares, each of those squares needs to be congruent modulo $8$ to $1$.

Thus each square is odd, and $r$ can be expressed in the form $8 n + 3$ as the sum of $3$ odd squares.

So:

 $\, \displaystyle \forall n \in \Z_{\ge 0}: \,$ $\displaystyle 8 n + 3$ $=$ $\displaystyle \paren {2 x + 1}^2 + \paren {2 y + 1}^2 + \paren {2 z + 1}^2$ for some $x, y, z \in \Z_{\ge 0}$ $\displaystyle$ $=$ $\displaystyle 4 x^2 + 4 x + 4 y^2 + 4 y + 4 z^2 + 4 z + 3$ $\displaystyle$ $=$ $\displaystyle 4 \paren {x \paren {x + 1} + y \paren {y + 1} + z \paren {z + 1} } + 3$ $\displaystyle \leadsto \ \$ $\displaystyle n$ $=$ $\displaystyle \frac {x \paren {x + 1} } 2 + \frac {y \paren {y + 1} } 2 + \frac {z \paren {z + 1} } 2$ subtracting $3$ and dividing both sides by $8$

By Closed Form for Triangular Numbers, each of $\dfrac {x \paren {x + 1} } 2$, $\dfrac {y \paren {y + 1} } 2$ and $\dfrac {z \paren {z + 1} } 2$ are triangular numbers.

$\blacksquare$

## Also known as

This theorem is often referred to as Gauss's Eureka Theorem, from Carl Friedrich Gauss's famous diary entry.

## Historical Note

Carl Friedrich Gauss proved that every Integer is Sum of Three Triangular Numbers.

The $18$th entry in his diary, dated $10$th July $1796$, made when he was $19$ years old, reads:

$**\Epsilon\Upsilon\Rho\Eta\Kappa\Alpha \quad \text{num} = \Delta + \Delta + \Delta.$