Originally Posted by

**Random Variable** Not quite.

$\displaystyle a_{n} = -2a_{n-1} + n + 2 $

First find the solution to the homogeneous recursion

$\displaystyle a^{h}_{n} = -2a_{n-1} $

The characteristic equation of which is r+2=0, which has root r=-2 (multiplicity 1)

so $\displaystyle a^{h}_{n} = A (-2)^{n} $

Now we need a particular solution. For this problem we look for a solution of the form $\displaystyle a^{p}_{n} = Bn + C $

plugging it into the recursion we get $\displaystyle Bn + C = -2( B(n-1) + C)+ n + 2 $

$\displaystyle Bn + C = -2Bn + 2B - 2C + n + 2 $

equating like terms we get

B = -2B + 1

C = 2B -2C + 2

so B = $\displaystyle 1 \over 3$, and C = $\displaystyle 8 \over 9 $

so the general solution is $\displaystyle a^{h}_{n} + a^{p}_{n} = A(-2^{n}) + \frac {n}{3} + \frac {8}{9} $

If the problem had an intial condition, we could solve for A.