How do I solve this ordinary differential equation: −y″−y=sin(x)? How do I find a particular solution? I'm trying to use the method of undetermined coefficients and trying to guess a solution in the form of Cxsin(x) because sin(x) is part of the homogeneous solution, but I can't get an answer. How do I go about this problem?
 A: A method to do the your particular problem is to do it using:
Undetermined Coefficients: Superposition Principle
The way to initiate your problem using this method would be using the associated homogeneous equation, and then the auxiliary equation. Then proceeding the initial problem is given as:
\begin{align}-y''-y'&=\sin(x) \\-m^2-m&=0\  \text{Associated Homogeneous} \end{align}
Then solving this would be by factoring it:
\begin{align}-m(m+1)&=0\\ m&=0,-1\end{align}
Then one can write the homogeneous solution to the problem as the following:
\begin{align*}y_h&=c_1+c_2e^{x}\end{align*}
All that would be left is to solve for the particular solution which would be as follows:
\begin{align*}y_p&=A\sin(x)+B\cos(x)\\ -y_p''-y_p'&=\sin(x) \\ (A+B)\sin(x)+(-A+B)\cos(x)&=\sin(x)\end{align*}
Here we can setup at system of equations:
\begin{align*}A+B&=1\\B-A&=0\end{align*}
From here the coefficients are pretty easy to determine:

*

*$A=\frac{1}2$

*$B=\frac{1}2$
So the general final solution to your problem is the following:
$$\displaystyle{y=c_1+c_2e^{-x}+\frac{1}2\sin(x)+\frac{1}2\cos(x)}$$
A: Annihilator Approach
Given the original ODE, as in my previous post you use a similar procedure when using the annihilator approach. $(D^2+1)$ annihilates $\sin(x)$
\begin{align*}(D^2+1)(-D^2-D)&=(D^2+1)\sin(x) \\ (-D^4-D^3-D^2-D)&=0\\ -D^3(D+1)-D(D+1)&=0\\ -D(D+1)(D^2+1)&=0\end{align*}
This mimics an auxiliary equation, except this produces the particular except with unknown coefficients.
$$y=c_1+c_2e^{-x}+c_3\sin(x)+c_4\cos(x)$$
Knowing that solving the particular coefficients would be just like above so the final general solution is known:
$$\displaystyle{y=c_1+c_2e^{-x}+\frac{1}2\sin(x)+\frac{1}2\cos(x)}$$
