# How to solve $y''+4y'+5y=\sin x$?

Solve $y''+4y'+5y=\sin x$.

The solution to the homogenous equation is: $$y_h(x)=c_1e^{-2x}\cos x+c_2e^{-2x}\sin x$$ Using undetermined coefficients method we can guess that the particular solution will be of form: $$y_p(x)=a\cos x+b\sin x$$ But $\cos x$ already appears in the homogenous solution so shouldn't the particular solution be $y_p(x)=x(a\cos x+b\sin x)$?

Apparently, not as the solution from Wolfram Alpha doesn't multiply the particular solution by $x$. But why?

• $\cos x$ doesn't appear in the solution to the homogeneous part alone. It does not solve the homogeneous equation. – user296602 Aug 14 '17 at 5:21
• In the CF, there's a term $e^{-2x}\cos x$. That's not the same as $\cos(x)$. The key thing here is that when you plug $A\cos(x)+B\sin(x)$ into $y^{\prime\prime}+4y^\prime+5y$, it doesn't give zero. That means there'll be terms involving $\sin(x)$ and $\cos(x)$ left over, and you can compare coefficients with $\cos(x)$ to find $A$ and $B$. If you want practice with this type of question, there's an ODE example generator here: dr-mikes-maths.com/ode-examples.html – Michael Hartley Aug 14 '17 at 5:26