how to solve this recursive relation please help me solve this recursive relation : 
$$a_n-2a_{n-1}+a_{n-2} = n-2,$$ $$ a_0 = 1, a_1 = 2, n\geq 2$$
looks like non homogenous function but I can't reach to answer.
 A: Two things to recognize:
$$
a_n - 2a_{n-1} + a_{n-2} = \Delta^2 a $$
(the second difference operator), and the equation is linear in $a$ so that you can add separate answers for $n$ and $-2$ on the right.
Also, summation behaves like integration, using "rising powers" instead of just powers (see Concrete Mathematics by Knuth et al). Then:
$$
\Delta^2 a = n \Longrightarrow a_n = \frac{n^{\overline 3} }{6}
= \frac{n(n+1)(n+2)}{6}
$$
$$
\Delta^2 a = -2 \Longrightarrow a_n = -2\frac{n^{\overline 2} }{6}
= -n(n+1)
$$
Finally,  $\Delta^2 (\alpha n + \beta) = 0$.
So the solution will be of the form 
$$
a_n = \frac{n^3-3n^2-4n}{6} + \alpha n + \beta$$
(The $4n$ term could be absorbed into $\alpha n$.)
Use $a_0 = 1$ to find $\beta = 1$, and then use $a_1 = 2$ to find $\alpha$. The answer is
$$
a_n = \frac{n^3-3n^2+8n+6}{6}
$$
A: Let $y_n=a_n-a_{n-1}$, then $y_n-y_{n-1}=n-2$ and $y_1=1$. You can get 
$$
\sum_{k=2}^n y_k-y_{k-1}=\sum_{k=2}^n (k-2)=\frac{(n-2)(n-3)}{2}=y_n-y_1.
$$
Thus, you can solve $y_n$, use the same trick to solve $a_n$.
