Re: Differential with sin

This is a first order linear ODE, so is solved using the integrating factor method.

The integrating factor is $\displaystyle \displaystyle \begin{align*} e^{\int{1\,dx}} = e^x \end{align*}$, so multiplying both sides of the DE by the integrating factor gives

$\displaystyle \displaystyle \begin{align*} \frac{dy}{dx} + y &= \sin{(x)} \\ e^x\,\frac{dy}{dx} + e^x\,y &= e^x\sin{(x)} \\ \frac{d}{dx} \left( e^x\,y \right) &= e^x\sin{(x)} \\ e^x\,y &= \int{e^x\sin{(x)}\,dx} \end{align*}$

Now to evaluate the integral we need to use Integration by Parts.

$\displaystyle \displaystyle \begin{align*} I &= \int{e^x\sin{(x)}\,dx} \\ I &= e^x\sin{(x)} - \int{ e^x\cos{(x)}\,dx} \\ I &= e^x\sin{(x)} - \left[ e^x\cos{(x)} - \int{ -e^x\sin{(x)}\,dx } \right] \\ I &= e^x\sin{(x)} - e^x\cos{(x)} - \int{e^x\sin{(x)}\,dx} \\ I &= e^x\sin{(x)} - e^x\cos{(x)} - I \\ 2I &= e^x\sin{(x)} - e^x\cos{(x)} \\ I &= \frac{1}{2}e^x\sin{(x)} - \frac{1}{2}e^x\cos{(x)} \end{align*}$

So now going back to the DE

$\displaystyle \displaystyle \begin{align*} e^x\,y &= \frac{1}{2}e^x\sin{(x)} - \frac{1}{2}e^x\cos{(x)} + C \\ y &= \frac{1}{2}\sin{(x)} - \frac{1}{2}\cos{(x)} + C\,e^{-x} \end{align*}$

Re: Differential with sin

Ah! Now I see it. Instead of looping through integration by parts, you turn that integration back into I, and put it over on the other side. Clever. Thank you very much!