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

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$.


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$.