Inhomogenous recursion solution question

18 Views Asked by At

I currently trying to learn how to solve inhomogeneous recursions, and I'm currently stuck on the problem below, with following questions.

Im trying to solve $$a_{n+2}=3a_{n+1}-2a_{n}+2^n+n \ \forall n \geq 0$$

I began by solving the homogenous part

$$a_{n+2}=3a_{n+1}-2a_{n} \forall n \geq 0$$

$$\Longleftrightarrow a_{n}=3a_{n-1}-2a_{n-2} \forall n \geq 2$$

Characteristic equations gives me $$r^2-3r+2=0 = (r-1)(r-2)$$

General solution will therefore be $$a_n=C_1(2)^n+C_2(1)^n$$

Now I want to solve for inhomogeneous part ($2^n+n)$:

I begin by splitting the inhomogeneous solution into 2 where $u_{p1}$ corresponds to $2^n$ and $u_{p2}$ corresponds to $n$.

Solving for $u_{p1}$ gives me a solution of form $C_3*n*2^n$.

Substituting this into the solution $$2a_n=3a_{n+1}-a_{n+2}+2^n$$

$$\Rightarrow 2(C_3*n*2^n)=3(C_3*(n+1)*2^{n+1})-(C_3*(n+2)*2^{n+2}) + 2^n$$

From here I want all the $n$ to cancel out to be able to get $C_3$ but the I does not. Would anyone like to give me hint on how to solve it, or where my solution is wrong? :)