Proof that sum of first $n$ cubes is always a perfect square [duplicate]

Let's prove this quickly by induction.

If needed I will edit this answer to provide further explanation.

To prove: $$\sum_{i=1}^n i^3=\left(\frac{n(n+1)}{2}\right)^2$$

Initial case $n=1$: $$\sum_{i=1}^1 i^3=1^3=\left(\frac{2}{2}\right)^2 = \left(\frac{1(1+1)}{2}\right)^2$$

Given for induction: $$\sum_{i=1}^n i^3=\left(\frac{n(n+1)}{2}\right)^2$$ To show in induction step: $$\sum_{i=1}^{n+1} i^3=\left(\frac{(n+1)(n+2)}{2}\right)^2$$ Induction step: $$ \sum_{i=1}^{n+1} i^3=(n+1)^3+\sum_{i=1}^{n} i^3\stackrel{!}{=} (n+1)^3+\left(\frac{n(n+1)}{2}\right)^2 = \left(\frac{4(n+1)^3+(n(n+1))^2}{2^2}\right) = \left(\frac{4(n+1)(n+1)^2+n^2(n+1)^2}{2^2}\right) = \left(\frac{(n+1)^2(4(n+1)+n^2)}{2^2}\right) = \left(\frac{(n+1)^2(n^2+2\cdot2n+2^2)}{2^2}\right) = \left(\frac{(n+1)(n+2)}{2}\right)^2 $$ In $(!)$ we used the equation holding for $n$.

If you are not familiar with the principle of induction, take a look at this.


A common complaint students have with proving identities like these via induction is that the proof by induction presumes you already know what the right-hand-side of the formula is supposed to look like. Here's an alternative to PBI that takes a more constructive approach.

The basic idea is to mimic the famous "Gaussian proof" for the sum of the first $n$ integers by adding the terms in reverse order. Define $S_{m}{\left(n\right)}$ to be the sum of the first $n$ integers each raised to the $m$-th power:

$$S_{m}{\left(n\right)}:=\sum_{k=1}^{n}k^m.$$

In particular, the sum of the first $n$ cubes would be $S_{3}{\left(n\right)}$. Since it doesn't matter what order in which we add the terms, we note:

$$S_{3}{\left(n\right)}=\sum_{k=1}^{n}k^3=\sum_{k=1}^{n}\left(n-k+1\right)^3.$$

Next, we add these two series together and make use of the general algebraic identity for the sum of two cubes, $a^3+b^3=(a+b)(a^2-ab+b^2)$, to simplify the general term:

$$\begin{align} 2\,S_{3}{\left(n\right)} &=\sum_{k=1}^{n}k^3+\sum_{k=1}^{n}\left(n-k+1\right)^3\\ &=\sum_{k=1}^{n}\left[k^3+\left(n-k+1\right)^3\right]\\ &=\sum_{k=1}^{n}\left(k+n-k+1\right)\left(k^2-k(n-k+1)+(n-k+1)^2\right)\\ &=\sum_{k=1}^{n}\left(n+1\right)\left(k^2-3(n+1)k+(n+1)^2\right)\\ &=\left(n+1\right)\sum_{k=1}^{n}\left(k^2-2(n+1)k+(n+1)^2-(n+1)k\right)\\ &=\left(n+1\right)\sum_{k=1}^{n}\left((k-n-1)^2-(n+1)k\right)\\ &=\left(n+1\right)\sum_{k=1}^{n}(n-k+1)^2-\left(n+1\right)\sum_{k=1}^{n}(n+1)k\\ &=\left(n+1\right)\sum_{k=1}^{n}k^2-\left(n+1\right)^2\sum_{k=1}^{n}k\\ &=\left(n+1\right)S_{2}{\left(n\right)}-\left(n+1\right)^2S_{1}{\left(n\right)}.\\ \end{align}$$

Presuming you've already figured out the formulas for the sum of the first $n$ squares and the sum of the first $n$ integers, the last line above can readily be seen to be equivalent to the desired expression for the sum of cubes.


Let's prove that using the mathematical induction.

Check the base

$n = 1$

$1^3 = (\frac{1(1 + 1)}{2})^2$

That's true

Suppose that is true for $n - 1$ and prove that is true for $n$.

We know $1^3 + 2^3 + \dots + (n-1)^3 = (\frac{(n-1)n}{2})^2$

Then

$1^3 + 2^3 + \dots + (n-1)^3 + n^3 = (\frac{(n-1)n}{2})^2 + n^3 = \frac{n^2(n-1)^2}{4} + n^3 = \frac{n^4 - 2n^3 + n^2}{4} + n^3 = \frac{n^4 + 2n^3 + n^2}{4} = \frac{n^2(n+1)^2}{4} = (\frac{n(n+1)}{2})^2$

QED