# General solution of a differential equation nonhomogeneous

I need to find the general solution of a differential equation

The equation is $$\frac{dy}{dt} + 2ty = \sin(t)\exp(-t^2)$$ Any tips on how to begin or full answers?

if $y'+py=q$ then $u=e^{\int p}$ is a integrating factor.
In that case,$u=e^{t^2}$ since $p=2t$. so we have,
$$(yu)'=sin(t).exp(-t^2).exp(t^2)$$
$$(yu)'=sin(t)\implies yu=-cos(t)+c$$ $$y=(-cos(t)+c)exp(-t^2)$$ $$=-cos(t)e^{-t^2}+ce^{-t^2}$$
The first order linear ODE can be solved by using integrating factor. The integration factor is $$e^{\ \large\int2t\ dt}=e^{\ \large t^2+C}=e^{\ \large t^2}e^{C}=Ae^{\ \large t^2}.$$ Multiply the ODE by the integration factor, yield \begin{align} \frac{dy}{dt}\ Ae^{\ \large t^2}+ 2ty\ Ae^{\ \large t^2}&= \sin t\ e^{\ -\large t^2}\ Ae^{\ \large t^2}\\ \frac{dy}{dt}\ e^{\ \large t^2}+ 2ty\ e^{\ \large t^2}&= \sin t\\ \frac{d}{dt}\left(y\ e^{\ \large t^2}\right)&= \sin t\\ d\left(y\ e^{\ \large t^2}\right)&= \sin t\ dt\\ \int\ d\left(y\ e^{\ \large t^2}\right)&=\int\sin t\ dt\\ y\ e^{\ \large t^2}&=-\cos t+C\\ y(t)&=e^{-\ \large t^2}(-\cos t+C)\\ &=Ce^{\ -\large t^2}-e^{\ -\large t^2}\cos t. \end{align}