<s>[INST] Differential equation $y'' - y + 2\sin(x)=0$ I need help and explanation with this differential equation. Actually I really don't know how to solve just this type of equations. So the problem: $$y'' - y + 2\sin(x)=0$$
In my opinion first of all we solve homogeneous equation $y''-y=0$ and the solution of this is $y=c_1e^x+c_2e^{-x}$. And after that to solve it with $2\sin(x)$. From this point I need help. 
 [/INST] The given differential equation is
$y'' - y + 2\sin\ x=0$
$\implies y'' - y =- 2\sin x \implies (D^2 -1)y=- 2\sin x$
where $D \equiv \frac{d}{dx} $
I think you have an idea about how to find the Complementary Function (i.e., C.F.), (for your case, which is nothing but the solution of the homogeneous differential equation $y'' - y =0$).
Here C.F. is $c_1e^{x}+c_2e^{-x}$.
Now for the Particular Integral (i.e., P.I.) there are some general rules

If $f(D)$ can be expressed as $\phi(D^2)$ and $\phi(-a^2)\neq 0$, then
$1.$ $\frac{1}{f(D)} \sin ax=\frac{1}{\phi(D^2)} \sin ax = \frac{1}{\phi(-a^2)} \sin ax$
$2.$ $\frac{1}{f(D)} \cos ax=\frac{1}{\phi(D^2)} \cos ax = \frac{1}{\phi(-a^2)} \cos ax$
Note: If $f(D)$ can be expressed as $\phi(D^2)=D^2+a^2$, then $\phi(-a^2)= 0$.
$1.$ $\frac{1}{f(D)} \sin ax =\frac{1}{\phi(D^2)} \sin ax=x\frac{1}{\phi'(D^2)} \sin ax= x \frac{1}{2D} \sin ax= -\frac{x}{2a} \cos ax$.
$2.$ $\frac{1}{f(D)} \cos ax =\frac{1}{\phi(D^2)} \cos ax=x\frac{1}{\phi'(D^2)} \cos ax=  x \frac{1}{2D} \cos ax= \frac{x}{2a} \sin ax$.
where $\phi'(D^2)\equiv\frac{d}{dD}\phi(D^2)$

So for your problem, P.I. is $\frac{1}{D^2 -1}  (-2\sin x)=-2[\frac{1}{-1^2 -1} \sin x]= \sin x$
Hence the general solution is $y=$ C.F. $+$ P.I. $ = c_1e^{x}+c_2e^{-x}+\sin\, x$
</s>