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, Norbert Oct 6 '12 at 22:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ I couldn't get the answer from the responses in my previous question. I have indicated above where I am stuck. $\endgroup$ – Ryan Oct 4 '12 at 22:34
  • $\begingroup$ Here is the solution. $\endgroup$ – 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$ :



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

  • $\begingroup$ Yes, but.. if $c\in\mathbb R$ then $C=e^c>0$, and you got $C=-2e<0$.. $\endgroup$ – Berci Oct 5 '12 at 0:04
  • $\begingroup$ 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$ . $\endgroup$ – doraemonpaul Oct 5 '12 at 1:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.