# How to solve the differential equation?

How can the following differential equation can be solved? $$\frac{dy}{dt}=3+e^{-t} -\frac{1}{2}y$$ I proceeded by by rearranging the equation as follows $$\frac{dy}{dt}+\frac{1}{2}y=3+e^{-t}$$My idea was to make the LHS a derivatives of two variables so that it could be integrated. But apparently I could not do that. How should i proceed now?

-
If $y$ is a solution, then multiplying by $e^{\frac t2}$ we have $\dfrac{d(y(t)e^{\frac t2})}{dt} =3e^{\frac t2}+e^{-\frac t2}$. – Davide Giraudo Jul 23 '11 at 9:57
@nihilisticgeek: please see: Earl A. Coddington: An Introduction to Ordinary Differential Equations, p39. It can be very useful. – leo Jul 25 '11 at 1:07

You need to use what's called an integrating factor. Since the coefficient of $y$ is simply the constant $1/2$, the factor is simple: $\mu = e^{\int 1/2 dt} = e^{t/2}$. If you multiply both sides of the differential equation by $\mu$, you can "factor" the left-hand side as an implicit differentiation like so:

$$\mu y' + 1/2\cdot\mu y = \mu\cdot(3+e^{-t});$$ $$(\mu y)' = \mu\cdot(3+e^{-t});$$ $$(e^{t/2} u)' = 3e^{t/2}+e^{-t/2}.$$

This can be seen with the product rule and because of the fact we chose $\mu$ so that $\mu' = 1/2 \cdot\mu$.

From here you can integrate both sides and then isolate the function $y$,

$$e^{t/2} y = 6e^{t/2} -2e^{-t/2}+C;$$ $$y = 6-2e^{-t}+Ce^{-t/2}.$$

-
Thank you for your answer. But I got my final answer as $y=\frac{3}{2}-\frac{1}{2}e^{-t} +Ce^{-0.5t}$. I think i need to recheck, Thanks again. – nihilisticgeek Jul 23 '11 at 10:12
If that's what you got as a final answer, then your error was that you differentiated $3e^{t/2}+e^{-t/2}$ instead of integrated. – anon Jul 23 '11 at 10:26