Sum Formulas

The results on this page work for any integer $n \ge 1$. I animated the derivations with $n=7$, but similar derivations work for any other $n$ too.

Sum of positive integers up to $n$

Let's calculate $$ 1 + 2 + 3 + \dots + n. $$ This animation shows how this goes for $n=7$:

In the beginning, $1+2+\dots+n$ is represented with numbers inside squares, so we are interested in the sum of all numbers in the squares. This sum doubles when we make a copy of each square, but it doesn't change in other ways because the numbers get added when squares merge together. We ended up with $n+1=8$ showing $n$ times, once in each of the $n$ squares, so $$ \begin{align} 1+2+3+\dots+n &= \text{sum of numbers in the beginning} \\ &= \frac{1}{2}(\text{sum of numbers at end of animation}) \\ &= \frac{1}{2}n(n+1). \end{align} $$

$$ 1+2+\dots+n = \frac{n(n+1)}{2} $$

Sum of squares

This derivation is based on this video.

Let's calculate $$ 1^2 + 2^2 + 3^2 + \dots + n^2. $$ This animation shows how this goes for $n=7$:

In the beginning, $4^2$ is represented with $16 = 4 \cdot 4$ squares, each containing $1$. The the sum of all numbers in those squares is $4^2$. We represent other things being added similarly.

During the animation, the sum of all numberes changes only when the red and green copies of the drawing are created, and that triples the sum. At the end of the animation, there are $n$ rows, $n$ columns and $1$ diagonal of squares showing $1+2+\dots+n$. This means that we have $1+2+\dots+n$, repeated $2n+1$ times. With these things and the result from the previous derivation, we get $$ \begin{align} 1^2 + 2^2 + \dots + n^2 &= \text{sum of numbers in the beginning} \\ &= \frac{1}{3}(\text{sum of numbers at end of animation}) \\ &= \frac{1}{3}(2n+1)(1+2+\dots+n) \\ &= \frac{1}{3}(2n+1)\frac{n(n+1)}{2} \\ &= \frac{n(n+1)(2n+1)}{6}. \end{align} $$

$$ 1^2+2^2+\dots+n^2 = \frac{n(n+1)(2n+1)}{6} $$

Sum of cubes

As usual, the animation below has $n=7$.

In the beginning, there are many copies of $1+2+\dots+n$. There's one copy in top left corner, then two copies below that, and so on until $n$ copies at bottom right. For that reason, the number of copies is $1+2+\dots+n$; we have $1+2+\dots+n$ copies of $1+2+\dots+n$. This means that the sum of all numbers is $$ \begin{align} (1+2+\dots+n)(1+2+\dots+n) &= (1+2+\dots+n)^2 \\ &= \left( \frac{n(n+1)}{2} \right)^2 \\ &= \frac{n^2(n+1)^2}{4}, \end{align} $$ where the first result on this page was used to calculate $1+2+\dots+n$.

The sum of all numbers doesn't change during the animation. At the end, there is a column that contains $5$ squares with $5 \cdot 5$ in each, so a total of $$ 5(5 \cdot 5) = 5^3, $$ and similarly, the sums of numbers in each column are $1^3, 2^3, \dots, n^3$. For this reason, the sum of all numbers is $$ 1^3 + 2^3 + 3^3 + \dots + n^3. $$

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