[Math] How to guess a particular solution for a non-homogeneous differential equation with purely imaginary eigenvalues.

ordinary differential equations

Take for example
$$y''+5y'+4y=e^{-x}$$
solving the characteristic we have $\lambda_1=-1,\lambda_2=-4$ thus
$$y_c=c_1e^{-x}+c_2e^{-4x}$$
in this case we can guess the particular solution to be
$$y_p=axe^{-x}$$
My question, how can we guess a particular solution of the form
$$y''+4y=\cos(2x)$$
I tried $y_p=x(c_1\cos(2x)+c_2\sin(2x))$ but it doesn't work. What is the idea behind such type of problems. If you have any reference please include it here.

Best Answer

You are correct. If we let

$$y_p(x) = x (a \cos (2 x)+b \sin (2 x))$$

Then

$$y'' + 4y = 4 b \cos (2 x)-4 a \sin (2 x) = \cos(2x)$$

This gives us $a = 0, b = 1/4$, so the final solution is

$$y(x) = y_h(x) + y_p(x) = c_1 \cos(2x) + c_2 \sin(2x) + \dfrac{1}{4} x \sin(2x)$$

Related Question