How to get to the formula for the sum of squares of first n numbers? [duplicate]

I know that the sum of the squares of the first n natural numbers is $\frac{n(n + 1)(2n + 1)}{6}$. I know how to prove it inductively. But how, presuming I have no idea about this formula, should I determine it? The sequence $a(n)=1^2+2^2+...+n^2$ is neither geometric nor arithmetic. The difference between the consecutive terms is 4, 9, 16 and so on, which doesn't help. Could someone please help me and explain how should I get to the well known formula assuming I didn't know it and was on some desert island?

• The first chapter of Concrete Mathematics by Graham, Knuth, and Patashnik presents about seven different techniques for deriving this identity, so you might be interested to look at that.
– MJD
Aug 16 '12 at 18:19
• Coincidentally, I uploaded a web page recently regarding this topic. There I don't prove the formula (or even present it), but I provide the student a geometric strategy for finding it. mathuprising.comlu.com/sumofsquares Aug 19 '14 at 16:18
• You can find a formal approach for even higher powers here as well as a nice geometric approach here. Mar 10 '16 at 12:08
• Khan Academy videos youtu.be/i7iKLZQ-vCk and youtu.be/MkGXR8umLco Jul 19 '21 at 15:17

This is proven, for example, in Stewart's Calculus:

Consider the following sum: $$\sum_{i=1}^n((1+i)^3-i^3).$$

First, looking at it as a telescoping sum, you will get $$\sum_{i=1}^n((1+i)^3-i^3)=(1+n)^3-1.$$

On the other hand, you also have $$\sum_{i=1}^n((1+i)^3-i^3)=\sum_{i=1}^n(3i^2+3i+1)=3\sum_{i=1}^ni^2+3\sum_{i=1}^ni+n.$$

Using these two expressions, and the fact that $\sum_{i=1}^ni=\frac{n(n+1)}{2}$, you can now solve for $\sum_{i=1}^ni^2$.

• Shouldn't it be $3\sum_{i=1}^ni^2+3\sum_{i=1}^ni+\sum_{i=1}^n1$ instead of $3\sum_{i=1}^ni^2+3\sum_{i=1}^ni+1$? Oct 15 '14 at 11:54

You could start out by guessing that the formula you are looking for is a cubic, which means it can be written as $an^3+bn^2+cn+d$.

You might guess this either by analogy with the sum of first powers being a square or by analogy with integration. Then you can calculate the first four terms and solve for $a, b, c, d$. Another way is to observe that $a(n + 1)^3 + b(n + 1)^2 + c(n + 1) + d - (an^3 + bn^2 + cn + d) = (n + 1)^2$ and equate like powers of $n$.