# How to compute the summation of this sequence

The sequence is $$\sum_{i=1}^n i^2$$ I used to know how to do this, but I just forget.

-

Hint: Try to find a cubic polynomial $P$ such that $P(n)-P(n-1)=n^2$ for each $n\ge 1$.
There is a closed form formula for these kinds of things: $$\sum_{i=1}^n i^2 = \frac{1}{6} n (n+1) (2 n+1)$$
We can get a telescoping series using the information below. $$(k+1)^3-k^3=3k^2+3k+1$$ Thus our series is: $$\sum_{k=1}^n{(k+1)^3-k^3}=\sum_{k=1}^n{3k^2+3k+1}=(n+1)^3-1^3=(n+1)^3-1$$ We can distribute the sigma since it is a linear operator: $$\sum_{k=1}^n{3k^2}+\sum_{k=1}^n{3k}+\sum_{k=1}^n{1}=(n+1)^3-1$$ $$3\sum_{k=1}^n{k^2}+3\sum_{k=1}^n{k}+n=(n+1)^3-1$$ $$3\sum_{k=1}^n{k^2}+3\frac{n(n+1)}{2}=(n+1)^3-1-n$$ $$3\sum_{k=1}^n{k^2}=(n+1)^3-1-n-3\frac{n(n+1)}{2}$$ $$3\sum_{k=1}^n{k^2}=n^3+3n^2+2n+-\frac{3}{2}n^2-\frac{3}{2}n=n^3+\frac{3}{2}n^2+\frac{1}{2}n$$ $$\sum_{k=1}^n{k^2}=\frac{2}{6}n^3+\frac{3}{6}n^2+\frac{1}{6}n=\frac{1}{6}(2n^3+3n^2+n)$$ $$\sum_{k=1}^n{k^2}=\frac{1}{6}n(2n^2+3n+1)=\frac{n(n+1)(2n+1)}{6}$$