## Insight Things

### A scientific blog revealing the hidden links which shape our world

Have you ever wondered how the formula for the sum of squares (1+4+9+16+25+…) arises? Then this article is for you! We will see that there is a geometric interpretation for the problem of adding squared numbers. This interpretation will lead to the well-known formula (see “Sum of Squares, Cubes and Higher Powers” for higher powers). Curious? Then don’t let us waste time but start!

### An analogy for the sum of squares

The sum of squared numbers can be thought of as the volume of a pyramid built from square panels of height 1. I will refer to them as ‘bricks’. The picture below illustrates this idea.

Bricks with squared surface forming a pyramid

Calculating the volume of this 'brick pyramid' is actually not easy, because there is no formula right away. However, as shown in the above picture, you can design a normal pyramid around the brick pyramid. This outer pyramid will intersect only with the upper corners and edges of the brick pyramid. Fortunately, there is a formula to calculate the volume of the outer pyramide. The only thing left to do, is calculating the difference between the outer and inner pyramid.

### Filling the corners

The gap between both pyramids consists of several edges and corners. An example for each can you see in the picture below.

Examples for gaps to be filled

Let’s begin with the corners. Each corner is a (skew) pyramid itself with square base of size $B=0.5^{2}$  and height $h=1$ . Therefore, the volume of each corner is given by

$\displaystyle V_{corner}=\frac{1}{3}\times B \times h=\frac{1}{3}\times \left(\frac{1}{2}\right)^{2}\times 1=\frac{1}{12}$

There are $n$ layers and we need to place 4 corners at each of them. Plus a spire of course. 😉

$\displaystyle V_{corners}=4(n+1)\times V_{corner}=\frac{1}{3}(n+1)$

### Filling the edges

Let’s put focus on thedges now. They need some more maths than the corners. Maybe you have noticed that each edge looks like a prism with triangled base. When you break each edge into units of width 1 then their volums will equal

$\displaystyle V_{unit}=\frac{1\times \frac{1}{2}}{2}\times 1=\frac{1}{4}$

When moving from the top of the brick pyramid downwards, the edges’ widtsh are going to increase. The number of units needed on each side of the pyramid can be calculated using the arithmetic series 1+2+3+4+…+n. Just use the following formula (or see here how it arises).

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

As the pyramid consists of 4 sides, we multiply by four.

$\displaystyle V_{edges}=4\times a \times V_{unit}=\frac{n(n+1)}{2}$

### Result

Now, we are going to bring it all together.

$\displaystyle \sum_{x=1}^{n}x^{2}=V_{block pyramid}=V_{outer pyramid}-V_{corners}-V_{edges}$.

Just have a second look at the first picture presented in this article. The volume of the outer pyramid has not been given yet, but the calculation can be accomplished using the general volume formula for pyramids where $B$ is the base area and $h$ is the height of the pyramid.

$\displaystyle V_{outer pyramid}=\frac{1}{3}\times B \times h=\frac{1}{3}(n+1)^{2}(n+1)=\frac{1}{3}(n+1)^{3}$

Substituting this result into the formula for the volume of the block pyramid gives

$\displaystyle \sum_{x=1}^{n}x^{2}=V_{outer pyramid}-V_{corners}-V_{edges}=\frac{1}{3}(n+1)^{3}-\frac{1}{3}(n+1)-\frac{n(n+1)}{2}$

To save some time, I let Maxima – the CAS which I trust – simplify this expression.

$\displaystyle \sum_{x=1}^{n}x^{2}=\frac{n(n+1)(2n+1)}{6}$

This is the formula which you will also find when looking up the sum of the first $n$  squared numbers at Google. But now you also have a clue how to explain it 🙂