I'm having trouble trying to solve this differential equation: $\frac{dy}{dt} - y = 1 + \cos t$
So far, I've decided:
$\mu(t) = e^{-1\int dt} = e^{-t}$
Which leads me to this:
$e^{-t}\frac{dy}{dt} - e^{-t}y = e^{-t} (1+\cos t)$
$e^{-t}\frac{dy}{dt} - e^{-t}y = e^{-t} + e^{-t}\cos t$
When I begin to integrate the right-hand side, I get:
$e^{-t}y = \int e^{-t}dt + \int e^{-t} \cos t\, dt$
$e^{-t}y = -e^{-t}dt + \int e^{-t} \cos t\, dt$
I'm having trouble integrating the $\int e^{-t} \cos t\, dt$ portion, which makes me think that I'm doing something wrong solving this equation. It seems like integrating it using integration by parts would just lead to an infinite loop of cosine & sine functions.
Am I approaching solving this differential equation incorrectly?
$$ I = \int \mathrm{e}^{-t}\cos t dt = -\mathrm{e}^{-t}\cos(t) - \int \mathrm{e}^{-t}\sin t dt $$
Applying integration by parts again we find $$ \int \mathrm{e}^{-t}\sin t dt = -\mathrm{e}^{-t}\sin t + \int \mathrm{e}^{-t}\cos t\mathrm{e}^{-t}\cos t $$ Putting it all together we find $$ I = \int \mathrm{e}^{-t}\cos t dt = -\mathrm{e}^{-t}\cos(t) - \left[-\mathrm{e}^{-t}\sin t + \int \mathrm{e}^{-t}\cos t\mathrm{e}^{-t}\cos t\right] =-\mathrm{e}^{-t}\cos(t) +\mathrm{e}^{-t}\sin - \int \mathrm{e}^{-t}\cos t dt $$ but the right is just $$ I = \int \mathrm{e}^{-t}\cos t dt = =-\mathrm{e}^{-t}\cos(t) +\mathrm{e}^{-t}\sin t - I $$ re-arrange to find $$ 2I = \mathrm{e}^{-t}(\sin t - \cos t) $$ or $$ I = \frac{1}{2}\mathrm{e}^{-t}(\sin t - \cos t) = \int \mathrm{e}^{-t}\cos t dt $$