Solve $a_n - 4a_{n-1} + 4a_{n-2} = 2^n$
given that $a_0 = 0$, and $a_1 = 3$
My Attempt:
Get the characteristic equation and solve it. For homogeneous equation
$x^2 -4x + 4 = 0$
$x = 2 $ or $ x = 2$
Hence, $a_n^h = (A+Bn)\cdot2^n $
Guess a particular solution: $n^22^nC$
$n^22^nC - 4(n-1)^22^{n-1}C + 4(n-2)^22^{n-2}C = 2^n$
$n^2C - 2(n-1)^2C + (n-2)^2C = 1$
$C= \frac12$
Hence, $a^p_n = \frac12n^22^n$
$a_n = a^p_n + a^h_n$
$a_n = (A+Bn)\cdot2^n + \frac12n^22^n$
$a_0 = 0 = A$
$a_1 = 3 = 2B + 1$
$B = 1$
Therefore, $a_n = (n+ \frac12n^2)2^n$
No, $n^22^{n^2}C$ does not work. Try with $n^22^{n}C$. Then $$2^n=a_n - 4a_{n-1} + 4a_{n-2} = n^22^{n}C-4(n-1)^22^{n-1}C+4(n-2)^22^{n-2}C=2^{n}\cdot 2C$$ which implies that $C=1/2$.
In general, if the r.h.s. is $r^n$ and $r$ is a solution of the characteristic polynomial of multiplicity $m$, then a particular solution has the form $n^m C r^n$. Note that $n^i r^n$ is a solution of the homogeneous recurrence for $0\leq i<m$.