Sum of $1^2 + 2^2 + ... +n^2$ I'm trying to prove that:
$1^2 + 2^2 + 3^2 + ...+ n^2 = \frac{n(n+1)(2n+1)}{6}$
Defining the upper left side of the equation as $a_n$ I get:
$a_n - a_{n-1} = n^2$
Then, from the homogeneous eguation:
$a_n = C$
but while predicting the nonhomogeneous part as:
$a_n = xn^2 + yn + z$
and putting in into $a_n - a_{n-1} = n^2$ I get:
$2xn + y - 1 = n^2$
but it is not even close to giving me a right answer. What am I doing wrong?
 A: I'm not familiar with your terminology of homogeneous and nonhomogeneous parts, so I can't answer exactly what's wrong with your approach, except for saying that when your sequence looks like $\sum p(k)$ for a polynomial $p$ of degree $d$, then you should expect your sequence to be given by a polynomial of degree $d+1$.
The reason is probably easier to appreciate when $d$ is small. For example suppose $a_n=\sum_{k=1}^n1$. Obviously $a_n$ is just $n$, which is a polynomial of degree $1$. Each additional summand has degree $0$ (it is the constant $1$), but since we are taking the cumulative sum of all the summands, the result ends up with something that grows faster and has degree $1$. Similarly, if $a_n=\sum_{k=1}^nk$, then $a_n=n(n+1)/2$ is given by a quadratic polynomial. This is because each successive summand is linear, which makes the growth rate of $a_n$ faster than that and in particular becomes a quadratic.
So for your case $$a_n=\sum_{k=1}^nk^2,$$ you should be expecting a cubic polynomial as the resulting closed form expression for $a_n$. So let $a_n=c_0+c_1n+c_2n^2+c_3n^3$, and then go from there.
