# First order differential equation : $\frac{dy}{dt}+kty(t) = \frac{\sin(\pi t/10)}{\pi}$

How to solve the following first order differential equation?

$$\dfrac{dy}{dt}+kty(t) = \dfrac{\sin(\pi t/10)}{\pi}$$

-
What have you tried? Indeed, this is a very simple ODE: it's a linear one. –  Romeo Dec 21 '12 at 20:10

First note that $$\dfrac{dy}{dt} + kty = e^{-kt^2/2} \left(e^{kt^2/2} \dfrac{dy}{dt} + e^{kt^2/2}kty \right) = e^{-kt^2/2} \dfrac{d}{dt}\left(e^{kt^2/2} y\right) = \dfrac{\sin \left(\dfrac{\pi t}{10}\right)}{10}$$ Hence, we have that $$\dfrac{d}{dt}\left(e^{kt^2/2} y\right) = e^{kt^2/2} \dfrac{\sin \left(\dfrac{\pi t}{10}\right)}{10}$$ Hence, $$e^{kt^2/2}y(t) = y(0) + \dfrac1{10} \int_0^t e^{kx^2/2} \sin \left(\dfrac{\pi x}{10}\right) dx$$ $$y(t) = y(0)e^{-kt^2/2} + \dfrac{e^{-kt^2/2}}{10} \int_0^t e^{kx^2/2} \sin \left(\dfrac{\pi x}{10}\right) dx$$
You forgot the factor $e^{-k t^2/2}$. –  Robert Israel Dec 21 '12 at 20:20
Adding to @RobertIsrael's comment, the integral $$\int_0^t e^{kx^2/2} \sin \left(\dfrac{\pi x}{10}\right) dx$$ can be written in terms of error function, by replacing $\sin(\pi x/10)$, as $\dfrac{\exp(i \pi x/10) - \exp(-i \pi x/10)}{2i}$ and hence $$\int_0^t e^{kx^2/2} \sin \left(\dfrac{\pi x}{10}\right) dx = \dfrac1{2i} \int_0^t \exp(kx^2/2 + i \pi x/10) dx - \dfrac1{2i} \int_0^t \exp(kx^2/2 - i \pi x/10) dx$$ –  user17762 Dec 21 '12 at 20:34