3

$$n^2 + (n-1)^2 + \dots +2^2 + 1^2 = \text{??}$$

I am reading that this equals

$$\frac{1}{3} n \left( n + \frac{1}{2} \right) (n+1) $$

But have no clue how.. The thing that strikes me most is the fact that the latter has a cubed factor when expanded (i.e. in big O notation it's O$(n^3)$).

onimoni
  • 6,706

4 Answers4

8

This can be done in several ways (and has been done many times on this site). Let's try something a bit different.

Let $$f(x)=\frac13x(x+\frac12)(x+1).$$ Then by differentiating we get $$ g(x)=f'(x)=x^2+x+\frac16. $$ It is easy to verify that $$ g(x)-g(x-1)=2x. $$ Integrating this gives us $$ f(x)-f(x-1)=x^2+C $$ for some constant $C$. As $f(0)=f(-1)=0$, we see that $C=0$, so for all $n$ we have $$ f(n)-f(n-1)=n^2 $$ Thus we are at the point Andrea Mori described. The rest is easy $$ 1^2+2^2+\cdots+n^2=(f(1)-f(0))+(f(2)-f(1))+\cdots+(f(n)-f(n-1))=f(n)-f(0)=f(n). $$

Jyrki Lahtonen
  • 140,891
  • It may be even easier to repeat the dose, and differentiate $g(x)$ also. So $g'(x)=2x+1$ and thus $g'(x)-g'(x-1)=2$. Therefore $g(x)-g(x-1)=2x+C$, but $g(0)=g(-1)=1/6$, so... You can also find formulas for $\sum_k k^3$ and higher powers in this way by integrating $f(x)$. Finding the constants of integration brings about Bernoulli numbers. – Jyrki Lahtonen Sep 13 '13 at 12:51
  • I made this CW, because I have a recollection of having described the techique in an earlier answer. Can't locate it now. – Jyrki Lahtonen Sep 13 '13 at 12:56
3

For a geometric "proof" or explanation with respect to how to make sense of the resulting identity for the sum of n consecutive squares, see the entry here.

It uses the equivalent identity: $$1^2 + 2^2 + \cdots + (n - 1)^2 + n^2 = \sum_{k = 1}^n k^2 = \frac 13(n)\left(n + \frac 12\right)(n+1) =\dfrac {n(n+1)(2n+1)}{6} $$ which can easily be "proven" by induction on $n$.

amWhy
  • 210,739
2

Let $$ S(n)=1^2+2^2+\cdots+n^2. $$ Since $S(n)-S(n-1)=n^2$ one can suspect that $S(n)$ is a cubic polynomial in $n$. Obviously, $S(n)\in\Bbb Z$ for all $n=1$, $2$, $3\dots$ and one knows that the ring of numeric polynomals, i.e. the polynomials in $\Bbb Q[X]$ which take integer values on $\Bbb N$ is freely generated over $\Bbb Z$ by the binomial coefficients $$ \binom Xk=\frac1{k!}X(X-1)\cdots(X-k+1). $$ Thus one may attempt to write $$ S(n)=a\binom X0+b\binom n1+c\binom n2+d\binom n3, $$ for some $a,b,c,d\in\Bbb Z$ (since $\binom Xk$ has degree $k$, those with $k\geq4$ will not enter). Some fiddling allows to find the right coefficients and confirm the formula.

Andrea Mori
  • 28,458
1

Hint: Use induction on $n$

$$n=1:\quad1^2=\frac{1}{3}(1)\left(\frac{3}{2}\right)(2)=1$$

Assume statement is true for $n$, then \begin{align*} (n+1)^2+n^2+\dots+2^2+1^2&=n^2+2n+1+\frac{1}{3}(n)\left(n+\frac{1}{2}\right)(n+1)\\ \end{align*} Then expand and factorise and you'll get your answer.

BlackAdder
  • 4,059
  • 1
    Given the expression, it is easy to prove (by induction) that it is true. But how could one come with that expression given the sum of squares? – onimoni Sep 13 '13 at 12:50
  • 3
    The question concerns how the closed form for the sum arises in the first place, and how to make sense of it, not about confirming/proving that it's true by induction. – amWhy Sep 13 '13 at 12:50