Recurrence relation with a trigonometric nonhomogeneous part $a_n+a_{n-2}-6a_{n-3}+4a_{n-4} = 2^nn^3 + \sin\frac{2n\pi}{3}$

recurrence-relations

The first part of the question is how to solve the next relation:

$$a_n+a_{n-2}-6a_{n-3}+4a_{n-4} = 2^nn^3 + \sin\frac{2n\pi}{3}$$

the explicit exact solution of characteristic polynomial is not simple.
And trigonometric nonhomogeneous part confuses me.

The second part is how to solve all of such equations with trigonometric nonhomogeneous part.

Best Answer

Let's first consider the characteristic polynomial$$x^4+x^2-6x+4=(x-1)^2(x^2+2x+4),$$of roots$$-1\text{ (twice)},-1\pm i\sqrt{3}$$(in what follows, I rewrite the roots in polar form for convenience). So the homogeneous recurrence relation$$Xu_n:=u_n+u_{n-2}-6u_{n-3}+4u_{n-4}=0$$has general solution$$\color{blue}{A+Bn+C\left(2\exp\frac{2\pi i}{3}\right)^n+D\left(2\exp\frac{-2\pi i}{3}\right)^n.}$$We can add this to an arbitrary solution of$$Xa_n=f_n:=2^nn^3+\sin\frac{2n\pi}{3}=2^nn^3+\frac{i}{2}\exp\frac{-2in\pi}{3}-\frac{i}{2}\exp\frac{2in\pi}{3},$$so let's look for one solution. We'll take the Ansatz$$a_n=2^n(En^3+Fn^2+Gn+H)+I\exp\frac{-2in\pi}{3}+J\exp\frac{2in\pi}{3}.$$(Note in particular that this time the complex exponentials no longer have factors of $2$, so raising them to the power of $n$ gives exponential functions not seen in the blue expression above.) The rest is very tedious arithmetic in which we equate the coefficient of $2^nn^3$ to $1$, of $2^nn^2$ to $0$ etc.