Sums of Squares

In the past, I wrote about how the sum of the first N cubes is the square of the sum of the first N numbers. In it I remarked how finding the sum of the first N numbers raised to some power is easy to do using induction and telescoping series. This is fine, and probably the easiest way of doing it, but it seems a little indirect. So today I thought I’d try and come up with a more direct way of doing it, and here it is.

Define Q to be the sum of the first N squares:

$Q = 1^2 + 2^2 + \ldots + N^2$

The key is that it can be rewritten like this:

$Q = 1 + (2+2) + (3+3+3) + \ldots + (\underbrace{N+\ldots+N}_{N \mbox{ times}})$

Rearranging the terms of the sum, we have:

$Q = (1+2+3+\ldots+N) + (2+3+\ldots+N) + (3+4+\ldots+N) +\ldots + N$

And so:

$Q = N(1+2+\ldots+N) - [ 1 + (1+2) + (1+2+3) + \ldots + (1+2+\ldots+(N-1))]$

Using the equation for sum of the first N numbers, we have:

$Q = \frac{1}{2}N^2(N+1) - \sum_{i=1}^{N-1}\frac{1}{2}i(i+1)$

Expanding out the sum:

$Q = \frac{1}{2}N^2(N+1) - \frac{1}{2}\left[\sum_{i=1}^{N-1}i^2 + i\right]$

Expressing the sum of squares in terms of Q again, and applying the formula for the first N-1 numbers, we have:

$Q = \frac{1}{2}N^2(N+1) - \frac{1}{2}\left[Q-N^2 + \frac{1}{2}N(N-1)\right]$

Putting the equation in terms of Q yields:

$\frac{3}{2}Q = \frac{1}{4}N\left[2N(N+1) + 2N - (N-1)\right]$

Thus,

$Q = \frac{1}{6}N(N+1)(2N+1)$

Which is the correct answer.

This proof is much less elegant than induction or telescoping series, but it has the advantage that at no point was anything clever done. It really is ‘just doing it’.