Find the general solution for the following equation: $$\frac{dy}{dt}+2ty=\sin(t)e^{-t^2}$$ Find a solution for which $y(0)=0$
First I found the integrating factor which is $e^{t^2}$
Multiplying both sides gives $$e^{t^2}\frac{dy}{dt}+e^{t^2}2ty=e^{t^2}\sin(t)e^{-t^2}$$ which simplifies to $$\frac{d}{dt}(e^{t^2}y)=\sin(t)$$
Integrating both sides gives $$e^{t^2}y=-\cos(t)$$
Now rearranging gives $$y(t)=\frac{-\cos(t)}{e^{t^2}}$$
However this doesnt give $y(0)=0$ could anyone help as to where I have gone wrong? thanks!
Finding the integrating factor which is $e^{t^2}$
Multiplying both sides gives $$e^{t^2}\frac{dy}{dt}+e^{t^2}2ty=e^{t^2}\sin(t)\exp(-t^2)$$ which simplifies to $$\frac{d}{dt}(e^{t^2}y)=\sin(t)$$
Integrating both sides gives $$e^{t^2}y=-\cos(t)+C$$ where C is a constant.
Now rearranging gives $$y(t)=\frac{-\cos(t)+C}{e^{t^2}}$$
Setting $y(0)=0$ we get $$y(0)=\frac{-\cos(0)+C}{e^{0}}=-1+C=0$$
Therefore we can conclude that $C=1$ and $y(0)=0$ giving us $$y(t)=\frac{-\cos(t)+1}{e^{t^2}}$$