<s>[INST] How to solve $y'' + y = -2\sin(x)$? I don't know how to find the particular solution of  $$y'' +  y = -2\sin(x)$$
I started with $$y'' +  y = 0$$ to find the homogeneous form $$A\cos(x)+B\sin(x)$$
But now i am stuck.
 [/INST] You need to find the particular solution.
Let $y_{p}=x(a\cos x+b\sin x)$.
\begin{align*}
  y'_{p} &= a\cos x+b\sin x+x(-a\sin x+b\cos x) \\
  y''_{p} &= 2(-a\sin x+b\cos x)-x(a\cos x+b\sin x) \\
  y''_{p}+y_{p} &= 2(-a\sin x+b\cos x) \\
  -2\sin x &= 2(-a\sin x+b\cos x) \\
  (a,b) &= (1,0) \\
  y(x) &= A\cos x+B\sin x+x\cos x
\end{align*}

Further points to be noticed
Note that $-2\sin x$ is one of the possibilities of the general solution $A\cos x+B\sin x$, the form $y_{p}=a\cos x+b\sin x$ always makes the LHS of the ODE to be zero. It's simpler to try the form of $x(a\cos x+b\sin x)$ and we found that it's doable.  It's in fact a resonance term.

</s>