Nicomachus's theorem (source code)

= Nicomachus's theorem
{c}
{title2=$\sum_{k=1}^{n}k^3=T_n^2$}

= Sum of cubes formula
{synonym}

For every <nonnegative integer> $n$,
$$
\sum_{k=1}^{n}k^3=\left(\frac{n(n+1)}2\right)^2=T_n^2.
$$
For example, $1^3+2^3+3^3+4^3=1+8+27+64=100=T_4^2$. A short proof uses the <triangular number recurrence> and the <triangular number square-complement identity>:
$$
T_k^2-T_{k-1}^2=(T_k-T_{k-1})(T_k+T_{k-1})=k\cdot k^2=k^3.
$$
Summing this <difference of squares> identity gives a <telescoping sum>; all intermediate <squared triangular numbers> cancel. <Nicomachus> describes a related grouping of the <odd integers>: take one, then the next two, then the next three, producing $1,3+5,7+9+11,\ldots$, which are $1^3,2^3,3^3,\ldots$. This historical grouping is recorded in <Introduction to Arithmetic by Nicomachus (Hahn teacher edition)> (Book II, Chapter 20, §5, printed p. 75).