TITLE: How to solve the differential equation?
QUESTION [5 upvotes]: 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?
Your help is much appreciated.Thankyou.

REPLY [4 votes]: 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}. $$