Homework help with Non-homogeneous Recurrence Relations

I solved this problem but am not super confident with my methods, if someone could take a look at it and tell me if it looks okay, that would be great.

Solve the following non-homogeneous recurrence relation

$a_{n}=2a_{n-1}+(-1)^{n}$

$a_{0}=2$

Homogeneous part

$h_{n}=2h_{n-1}$

$x=2$

$h_{n}=α(2)^{n}$

Find the constant

$a_{n}=c(-1)^{n}$

$a_{n-1}=c(-1)^{n-1}$

$c(-1)^{n}=c(-1)^{n-1}+(-1)^{n}$

$c(-1)^{1}=c(-1)^{0}+(-1)^{1}$

$-c=c-1$

$2c=1$

$c=\frac{1}{2}$

Solve for α using initial condition

$a_{n}=α(2)^{n}+\frac{1}{2}(-1)^{n}$

$2=α(2)^{0}+\frac{1}{2}(-1)^{0}$

$2=2α+\frac{1}{2}$

$\frac{3}{2}=2α$

$α=\frac{3}{4}$

$a_{n}=\frac{3}{4}(2)^{n}+\frac{1}{2}(-1)^{n}$

Thanks in advance for any help!

Let us look first for a particular solution, of the form $k(-1)^n$. Substituting, we find that $k(-1)^n =2k(-1)^{n-1}+(-1)^n$. Divide by $(-1)^n$. We get $k=-2k+1$, and therefore $k=\frac{1}{3}$.
A solution of the homogeneous equation is $2^n$, so the general solution of the homogeneous equation is $A\cdot 2^n$, and therefore the general solution of the inhomogeneous equation is $$a_n=A\cdot 2^n +\frac{1}{3}(-1)^n.$$ Finally, find $A$ so that the initial condition is satisfied.
• Apart from that, the calculation of the constant was done right. There was an additional problem in meeting the initial condition, for your formula does not give $2$ at $n=0$. – André Nicolas Oct 29 '15 at 22:16
• You are welcome. You had the general structure of the procedure right, and most of the details. After one has found "the formula" it can be useful to check whether the formula gives the right answer for the first few $n$, here say $n=0$ and $n=1$. That will detect most calculational slips. – André Nicolas Oct 29 '15 at 22:31