Find the solution to the following non-homogenous recurrence relation: Find the solution to the following non-homogenous recurrence relation:
$a_{n+2} + a_{n+1} - 2a_n = n$ for $a_0 = 1$, $a_1 = -2$
I have found the homogenous part with the characteristic polynomial is
$a_n = C_1(-2)^n + C_2$ but don't know how to find the non-homogenous part?
Thanks in advance. 

Here is a solution using generating functions. Put $$A(z) = \sum_{n\ge 0} a_n z^n$$
and multiply the recurrence
$$a_{n+2}+a_{n+1}-2a_n = n$$
by $z^{n+2}$ and sum over $n\ge 0$ to get
$$\sum_{n\ge 0} a_{n+2} z^{n+2} 
+ \sum_{n\ge 0} a_{n+1} z^{n+2}
- 2\sum_{n\ge 0} a_n z^{n+2}  = \sum_{n\ge 0} n z^{n+2}.$$
This gives
$$A(z) - a_1 z - a_0 
+ z (A(z) - a_0) -  2 z^2 A(z) = \sum_{n\ge 1} n z^{n+2}.$$
Further simplification yields
$$ A(z) ( 1 + z - 2 z^2)  - (a_0+a_1) z - a_0 = z^3 \sum_{n\ge 1} n z^{n-1}
= z^3 \frac{1}{(1-z)^2}.$$
Solve this for $A(z)$ and subsitute the values $a_0 = 1$ and $a_1 = -2$ to get
$$ A(z) =-{\frac {7}{9}}\, \left( -1+z \right) ^{-2}-{\frac {13}{27}}\, \left( -1+z \right)
^{-1}+{\frac {26}{27}}\, \left( 2\,z+1 \right) ^{-1}-1/3\, \left( -1+z \right) ^{-3
}.$$
Now we can read off the coefficients, which are
$$ -\frac{7}{9} (n+1) + \frac{13}{27} + \frac{26}{27} (-2)^n +
\frac{1}{3} \frac{1}{2} (n+1)(n+2)$$
which gives
$$a_n = \frac{26}{27} (-2)^n + \frac{1}{6} n^2 - \frac{5}{18} n + \frac{1}{27}.$$
