Solve the following equation: $$y''+4y=4 \cos x +3 \sin x -8$$
Development:
We have a non homogeneous linear ODE with constant coefficients. First of all, we solve the homogeneous part $$$y''+4y=0$$$ We have the characteristical polynomial: $$p(\lambda)=\lambda^2+4$$ that has roots:
- $$\lambda=\pm2i$$ complex root and its conjugate. The solution is then $$y_1(x)=\cos(2x)$$ and $$y_1(x)=\sin(2x)$$.
We look for a polynomial $$Q(D)$$ that cancels $$f(x)$$. To do this, we proceed the inverse way to the way we did it when computing the homogeneous solutions:
-
$$\cos(x)$$ comes from a complex root $$\lambda=i$$
-
$$\sin(x)$$ comes from a complex root $$\lambda=-i$$
- $$1$$ comes from a simple real root $$\lambda=0$$
Therefore the polynomial is $$Q(D)=(D+Id\cdot i)(D-Id\cdot i)(D-0)=(D^2+Id)D$$
We consider the new homogeneous problem $$Q(D)P(D)y(x)=0$$ $$$Q(D)P(D)y(x)=(D^2+Id)D(D^2+4D)y(x)=$$$ $$$=(D+Id\cdot i)(D-Id\cdot i)D(D^2-4Id)y(x)=0$$$ We see that the solutions to this problem are: $$$y^*(x)=C_1\cos(2x)+C_2\sin(2x)+C_3+C_4\sin(x)+C_5\cos(x)$$$ Now, we take the functions that are a solution of $$y^*$$, but were not of $$y_h$$, and look for a particular solution that is a linear combination of these solutions: $$$y_p(x)=A+B\cdot \cos(x)+C\cdot\sin(x)$$$ We designate this as a solution: $$$\left. \begin {array} {l} y_p''+4y_p=4\cos(x)+3\sin(x)-8 \\ y_p''+4y_p=-B\cos(x)-C\sin(x)+4A+4B\cos(x)+4C\sin(x)= \\ = 4A+3B\cos(x)+3C\sin(x)\end{array}\right\}$$$ $$$\Rightarrow \left\{ \begin {array} {c} 4A=-8 \\ 3B=4 \\ 3C=3 \end{array}\right. \Rightarrow \left\{ \begin {array} {c} A=-2 \\ B=\dfrac{4}{3} \\ C=1 \end{array}\right.$$$ Finally, we see that the general solution is: $$$y(x)=y_h(x)+y_p(x)=C_1\cos(2x)+C_2\sin(2x)+\dfrac{4}{3}\cos(x)+\sin(x)-2$$$
Solution:
$$y(x)=C_1\cos(2x)+C_2\sin(2x)+\dfrac{4}{3}\cos(x)+\sin(x)-2$$