2

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.

Ryan
  • 79

2 Answers2

0

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|$.

Berci
  • 90,745
0

$\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}$

doraemonpaul
  • 16,178
  • 3
  • 31
  • 75
  • Yes, but.. if $c\in\mathbb R$ then $C=e^c>0$, and you got $C=-2e<0$.. – Berci Oct 05 '12 at 00: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 05 '12 at 01:10