# How to derive the formula for the sum of the first $n$ perfect squares? [duplicate]

How do you derive the formula for the sum of the series when $S_n = \sum_{j=1}^n j^2$?

The relationship $(n, S_n)$ can be determined by a polynomial in $n$. You are supposed to use finite differences to determine the degree and then use a calculator to derive the function. But how?

• What have you tried? You should post that here. Also you should learn Latex so your questions are more readable. Jun 25 '15 at 19:22
• You mean something like $$S_{n}=\sum ^{n}_{j=1}j^{2}$$ Jun 25 '15 at 19:23
• Take a look at mathuprising.comlu.com/sum-squares.html . I don't give the answer away, but I do partially describe a geometric method based on completing a cube. Jun 25 '15 at 20:24
• None of the answers at the supposed duplicate actually addresses Jill’s specific question. Jun 25 '15 at 22:35

Here’s your table of finite differences:

$$\begin{array}{rcc} n:&1&&2&&3&&4&&5&&6\\ S_n:&1&&5&&14&&30&&55&&91\\ &&4&&9&&16&&25&&36\\ &&&5&&7&&9&&11\\ &&&&2&&2&&2 \end{array}$$

The third differences are (at least so far) constant, so we expect the formula to be cubic in $n$, i.e., of third degree. Depending on what you’ve already learned, there are more and less efficient ways to get the actual cubic polynomial from here. The most elementary is to write it out with unknown coefficients: $S_n=an^3+bn^2+cn+d$. Then make a table of finite differences from that general equation. I’ll have to orient this one vertically in order to make it fit:

$$\begin{array}{l|ll} n&S_n\\ \hline 1&a+b+c+d\\ &&7a+3b+c\\ 2&8a+4b+2c+d&&12a+2b\\ &&19a+5b+c&&&&6a\\ 3&27a+9b+3c+d&&18a+2b\\ &&37a+7b+c&&&&6a\\ 4&64a+16b+4c+d&&24a+2b\\ &&61a+9b+c\\ 5&125a+25b+5c+d \end{array}$$

Now match them up:

\begin{align*} 6a&=2\\ 12a+2b&=5\\ 7a+3b+c&=4\\ a+b+c+d&=1 \end{align*}

You have a simple system of linear equations to solve for the coefficients $a,b,c$, and $d$.

You will find much easier but somewhat less elementary approaches in the answers to this question.

Following the (extraordinary accurate) drawing I tried to draw you can show that $$\sum ^{n}_{j=1}j^{2}+\sum ^{n-1}_{k=1}T_{k}=n\cdot \dfrac {n\left( n+1\right) }{2}$$ where $\sum ^{n-1}_{k=1}T_{k}$ is the sum of the triangular numbers (the rectangles $T_1$ , $T_2$ and $T_3$). We know that $$\sum ^{n}_{k=1}T_{k}=\dfrac {1}{6}n\left( n+1\right) \left( n+2\right)$$ So $$\sum ^{n}_{i=1}J^{2}=n\cdot \dfrac {n\left( n+1\right) }{Z}-\sum ^{n-1}_{k=1}T_{k}= n\cdot \dfrac {n\left( n+1\right) }{2}-\dfrac {1}{6}n\left( n-1\right) \left( n+1\right) =\dfrac {n\left( n+1\right) \left( 2n+1\right) }{6}$$