<s>[INST] What is the general solution of the linear difference equation $y_{n+3}-4y_{n+2}+5y_{n+1}-2y_n=2^n$ What is the general solution to the linear difference equation:
$$y_{n+3}-4y_{n+2}+5y_{n+1}-2y_n=2^n$$
I followed the instructions given in this video. And I got the following for the homogeneous part I got:
$$y_n^c = A+Bn+C2^n$$
for the particular part I got
$$y_n^p = C_02^n$$
, putting this in the initial equation I got $C_0*0=1$, so no solution. What should I do now? Or did I do something wrong somewhere?
 [/INST] The characteristic polynomial is
$ m^3 - 4 m^2 + 5 m - 2 = (m-1)^2 (m-2) $
And the annihilator of the driving term is $(m-2)$, hence
$ (m-1)^2 (m-2)^2 (y) = 0 $
The general solution is
$ y_n = A + B n + C (2)^n + D n (2)^n $
The particular solution is $ y_p = D n (2)^n $
Plug this in the original difference equation,
$  D (n+3) 2^{n+3} - 4 D (n+2) 2^{n+2} + 5 D (n+1) 2^{n+1} - 2 D n (2)^n = 2^n $
From which it follows that
$ D ( 8 n + 24 - 16 n - 32 + 10 n + 10 - 2 n ) = 1 $
$ D = \dfrac{1}{2} $
So a particular solution is $ y_p =  \dfrac{1}{2} n (2)^n $
Now the general solution is the sum of a particular solution and the homogenous solution
$y_n= y_p + y_h =  \dfrac{1}{2} n (2)^n + A + B n + C (2)^n$
The constants $A,B,C$ can be determined in a straight forward manner using the initial conditions $y_0, y_1, y_2 $  or $ y_1, y_2, y_3 $, by building a $3 \times 3 $ linear system in $A, B,C$ which can be solved using Gauss-Jordan elimination.  Explicity, we have
$ \begin{bmatrix} 1 && 1 && 2 \\ 1 && 2 && 4 \\ 1 && 3 && 8 \end{bmatrix} \begin{bmatrix} A \\ B \\ C \end{bmatrix} = \begin{bmatrix} y_1 - 1 \\ y_2 - 4 \\ y_3 - 12  \end{bmatrix} $
</s>