# Difference Equation

$y_{n+3} − 3 y_{n+1} + 2 y_n = (−2)^n$ I get the solution to be $y_n = A(-2)^n + Bn + C + \frac{1}{9}n(-2)^{n-1}$ but wolfram alpha gets $y(n) = c_1 (-2)^n+c_2+c_3 n+\frac{1}{27} 2^{n-1} e^{i \pi n} (4-3 n)$

Explanation required.

Help is much appreciated.

-

Observe that $e^{i\pi n}=\cos(\pi n)+i\sin(\pi n)=\cos(\pi n)=(-1)^n$. Hence, you have: \begin{align*} y(n)& = c_1 (-2)^n+c_2+c_3 n+\frac{1}{27} 2^{n-1} e^{i \pi n} (4-3 n) \\ & = c_1 (-2)^n+c_2+c_3 n+\frac{1}{27} (-2)^{n-1} (3n-4) \\ & = c_1 (-2)^n+c_2+c_3 n+\frac{1}{9} n (-2)^{n-1} - \frac{4}{27} (-2)^{n-1} \\ & = \left( c_1+\frac{2}{27}\right)(-2)^n+c_3 n+c_2+\frac{1}{9} n (-2)^{n-1} \end{align*} The last line is your solution.
HINT $\$ yours $\rm\: =\: \left<f_1,\:f_2,\:f_3,\:f_4\right>\: =\: \left<f_1,\:f_2,\:f_3,\:f_4+c\ f_1\right>\: =\:$ alpha, for $\rm\ c = 2/27\:.$