I need to solve the following recurrence relation:
$a_n=3a_{n-1}-2a_{n-2}+2^n$
For the homonogenous part, it's quite simple and I get:
$a_n^h=\lambda_1+\lambda_22^n$
The nonhomonogenous part is where I get lost. Since one of the solutions from the equation (that I got from Euler's substutution) turns out to be $2$, I need to use the following substitution for $a_n$ :
$a_n=A2^nn^m$
Which means I get:
$An^m2^n-3A(n-1)^m2^{n-1}+2A(n-2)^m2^{n-2}=2^n$
I can easily reduce this to:
$An^m-3A(n-1)^m2^{-1}+A(n-2)^m2^{-1}=1$
But I'm not sure how to continue here. I'd be grateful if anyone could help me point me to the right direction. I'm not sure how to factor $n^m$.
EDIT:
The solution (thank you for helping!):
$a_n=\lambda_1+\lambda_2*2^n+2*n*2^n$