# Initial Value Problem: $\frac{dy}{dx} = y\sin x - 2\sin x,\quad y(0) = 0$ [duplicate]

Possible Duplicate:
$dy/dx = y \sin x-2\sin x$, $y(0) = 0$ — Initial Value Problem

$$\frac{dy}{dx} = y\sin x - 2\sin x,\quad y(0) = 0$$

So, I get

$$\frac{1}{y-2} dy = \sin x dx.$$

Then, I integrated and got

$$\ln(y-2) =-\cos x + C.$$

Then, I did $e$^ both sides, but I end up with $\ln(-2)$ which is an error.

Can someone help me? Thank you.

-

## marked as duplicate by Henry T. Horton, Thomas, tomasz, Nate Eldredge, NorbertOct 6 '12 at 22:05

I couldn't get the answer from the responses in my previous question. I have indicated above where I am stuck. –  Ryan Oct 4 '12 at 22:34
Here is the solution. –  Mhenni Benghorbal Oct 5 '12 at 3:15

Everything is fine, except that, as differentiating $ln(-x)$ one also gets $\displaystyle\frac{-1}{-x}=\frac1x$, so it can be $ln(2-y)$ as well.

That's how is meant $\displaystyle\int\frac1xdx=ln|x|$.

-

$\dfrac{dy}{dx}=y\sin x-2\sin x$

$\dfrac{dy}{dx}=(y-2)\sin x$

$\dfrac{dy}{y-2}=\sin x~dx$

$\int\dfrac{dy}{y-2}=\int\sin x~dx$

$\ln(y-2)=-\cos x+c$

$y-2=Ce^{-\cos x}$

$y=Ce^{-\cos x}+2$

$y(0)=0$ :

$Ce^{-1}+2=0$

$C=-2e$

$\therefore y=-2ee^{-\cos x}+2=2-2e^{1-\cos x}$

-
Yes, but.. if $c\in\mathbb R$ then $C=e^c>0$, and you got $C=-2e<0$.. –  Berci Oct 5 '12 at 0:04
You don't need to worry. $e^c$ can be $<0$ , the only thing is that $c$ should be a complex number. Moreover, I consider $y=Ce^{-\cos x}+2$ for substitute $y(0)=0$ rather than consider $\ln(y-2)=-\cos x+c$ . –  doraemonpaul Oct 5 '12 at 1:10