# Solving linear differential equations

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!

• Integrating, you have to add a constant. – mickep Aug 18 '15 at 14:19
• The problem is with the line following "Integrating both sides gives". There's a missing constant there. Recall that integrating introduces an arbitrary constant. – wltrup Aug 18 '15 at 14:20
• You're welcome but the best way to thank us is to give back to the community by writing - as an answer - your solution to the question you asked. That way, when others happen to land on this page, they'll see an answer to the question, and not just the question. You can even accept it yourself. Just make sure that it's correct, clear, and well-written (people here will help you with all of that). It's also good practice for you to learn how to communicate well technical material that you might write in the future. Win-win for everyone! – wltrup Aug 18 '15 at 14:27
• And here's a LaTeX tip. Expressions like sin, cos, tan, exp, log, ln, lim, and so on render better on screen and on paper when you use \sin, \cos, etc. Compare: $sin(t)$ (no back-slash) with $\sin(t)$ (with back-slash). – wltrup Aug 18 '15 at 14:35

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}}$$