# $y' + 2y = \sin(\omega t)$

So I have $y' + 2y = \sin(\omega t)$.

Since $\sin(\omega t) = \operatorname{Im}(e^{i\omega t})$ I can solve the equation as far as to $$y = \operatorname{Im}(\frac1{i\omega + 2}e^{i\omega t}) = \operatorname{Im}\left(\frac{2-i\omega}{\omega^2 + 2}\cdot(\cos(\omega t) + i\cdot \sin(\omega t))\right).$$

Now in my book they take it one step further, like this: $y = \frac 1{\omega^2 + 2}(2\sin(\omega t) - \omega \cos(\omega t))$.

That last step then becomes the final answer to the question, but I honestly cannot understand how they do that last jump. How do they remove the $\operatorname{Im}()$ thing and how does it affect the equation?

$$\frac{2-i\omega}{\omega^2+2}(\cos \omega t + i \sin \omega t) = \frac{1}{\omega^2+2}(2\cos \omega t + 2i \sin \omega t -i\omega \cos\omega t + \omega \sin\omega t),$$ so the imaginary part is indeed $$\frac{1}{\omega^2+2}(2 \sin \omega t -\omega \cos\omega t).$$
$$\frac{2-i\omega}{\omega^2 + 2}\cdot (\cos{\omega t} + i\cdot \sin{\omega t})= {1\over \omega^2+2}\left[2\cos{\omega t}+\omega\sin{\omega t}+i\left(2\sin{\omega t}-\omega\cos{\omega t}\right)\right]$$
The imaginary part of $a+i\cdot b$ is $b$ and this gives the result.