Find the sum of the squares of the first $n$ natural numbers [closed]

Solution 1:

I like visual proofs. In the following, the first three shapes pile together $1^1$, $2^2$, $3^2$, $4^2$ little cubes:

visual sum of squares

with similar visions in:

  • Claudi Alsina and Roger Nelsen, When Less is More: Visualizing Basic Inequalities (2009)
  • Roger B. Nelsen, Proofs without words 2. More exercises in visual thinking (2000)
  • Roger B. Nelsen, Proofs without words. Exercises in visual thinking (1993)

which I discuss in Unconventional mathematics books.

The three same basic shapes, sums of squares, add up to $n(n+1)(n+\frac{1}{2})$, hence the volume (a third) you are looking for is : $$\frac{n(n+1)(2n+1)}{6}\,.$$

Last comment: $\int x^p \sim \frac{x^{p+1}}{p+1}$, hence integration "adds" a degree. The case $p=-1$ is a bit different, but I'd argue the $\log$ is dimensionless, i.e. a variant of $0$-degree polynomials. Similarly, summing $p$-powers often leads to $p+1$-power formulae.

Solution 2:

Hint

I assume you know that $\sum_{i=1}^ni=\frac{n(n+1)}2$. So, it is somewhat natural to expect $\sum_{i=1}^ni^2$ to be of the form $$f(n)=an^3+bn^2+cn+d$$ for some $a,b,c,d\in\Bbb{Q}$. (If you know calculus, this is related to the fact that $\int_0^xt^2dt=\frac{t^3}3+C$)

Now, you know $$f(0)=d=0$$ $$f(1)=a+b+c+d=1$$ $$f(2)=8a+4b+2c+d=5$$ $$f(3)=27a+9b+3c+d=14$$ In fact, these equations are enough to find $a,b,c,d$.(If you know linear algebra, this is a non-singular square matrix). You can play with these coeeficients to solve for $a,b,c,d$. When you did find $a,b,c,d$; you can prove that $f(n)$ indeed gives the some of first $n$ squares by showing $f(n)-f(n-1)=n^2$.

In fact, you can use this method to find the sum of cubes, or some of the fourth powers, or the sum of first powers, you only need to adjust the degree of the polynomial and the number of equations.

Solution 3:

Let $$B_n=1^2+2^2+..+n^2$$ $B_1=1, B_2=5, B_3=14, B_4=30, B_5=55, B_6=91$

Let $$A_n=1+2+..+n=\frac{n(n+1)}{2}$$ $$\frac{B_1}{A_1}=1, \frac{B_2}{A_2}=\frac{5}{3}, \frac{B_3}{A_3}=\frac{7}{3}, \frac{B_4}{A_4}=\frac{9}{3}, \frac{B_5}{A_5}=\frac{11}{3}, \frac{B_6}{A_6}=\frac{13}{3},..$$ Hypothesis: $$\frac{B_n}{A_n}=\frac{2n+1}3$$

It is proved by induction. Then $$B_n=A_n\frac{2n+1}{3}=\frac{n(n+1)(2n+1)}{6}$$

Which is what we wanted to prove.

Solution 4:

If we may assume to know that $$\sum_{k=1}^{n}k=\frac{n\left(n+1\right)}{2} $$ we can use the partial summation formula $$\sum_{k=1}^{n}k^{2}=\sum_{k=1}^{n}k\cdot k=n\sum_{k=1}^{n}k-\sum_{k=1}^{n-1}\left(\frac{k\left(k+1\right)}{2}\right)\left(k+1-k\right) $$ $$=\frac{n^{2}\left(n+1\right)}{2}-\frac{1}{2}\sum_{k=1}^{n-1}k^{2}-\frac{n\left(n-1\right)}{4} $$ so $$\frac{3}{2}\sum_{k=1}^{n}k^{2}=\frac{2n^{2}\left(n+1\right)-n\left(n+1\right)+2n^{2}}{4}\Rightarrow\sum_{k=1}^{n}k^{2}=\frac{n\left(n+1\right)\left(2n+1\right)}{6}.$$

Solution 5:

If you know the method of finite differences, it can also be applied to this problem. Let $f(n)=\sum_{i=1}^n i^2$:

$$ \begin{array}{c|lcr} n & 1 & 2 & 3 & 4 & 5 & 6 & 7 & ... \\ \hline f(n) & 1 & 5 & 14 & 30 & 55 & 91 & 140 & ... \\ \nabla n & & 4 & 9 & 16 & 25 & 36 & 49 & ... \\ \nabla^2n & & & 5 & 7 & 9 & 11 & 13 & ... \\ \nabla^3 n & & & & 2 & 2 & 2 & 2 & ... \\ \end{array} $$

Once we see that there are constant differences, we know that a polynomial of the order of those constant differences will satisfy our sequence of numbers. In this case, the constant $2$'s correspond to the third level of differences, and therefore a polynomial of the form $g(n)=an^3+bn^2+cn+d$ will be the solution.

Using $g(1)$, $g(2)$, $g(3)$, and $g(4)$, the system of equations

$$ \left\{ \begin{array}{c} a+b+c+d=1 \\ 8a+4b+2c+d=5 \\ 27a+9b+3c+d=14 \\ 64a+16b+4c+d=30 \end{array} \right. $$

results (the same system that has shown up in previous answers), and your favorite method to solve for $a,b,c$ and $d$ can be applied. In the end, the formula that results is $$g(n)=\frac{n^3}{3}+\frac{n^2}{2}+\frac{n}{6}$$