If $(2+\sin x) \frac{d y}{d x}+(y+1) \cos x=0$ and $y(0)=1$, then $y\left(\frac{\pi}{2}\right)$ is equal to
Answer & explanation
Correct answer: option 3
The given differential equation is
$(2+\sin x) \frac{d y}{d x}+(y+1) \cos x=0$
$\Rightarrow (2+\sin x) d y+(y+1) \cos x d x=0$
$\Rightarrow \frac{1}{y+1} d y+\frac{\cos x}{2+\sin x} d x=0$
Integrating both sides, we get
$\log (y+1)+\log (2+\sin x)=\log C$
$\Rightarrow (y+1)(2+\sin x)=C$ .....(i)
It is given that $y(0)=1$ i.e. $y=1$ when $x=0$. Putting $x=0, y=1$ in (i), we get
$2(2+0)=C \Rightarrow C=4$
Putting $C=4$ in (i), we obtain
$(y+1)(2+\sin x)=4$ ......(ii)
Putting $x=\frac{\pi}{2}$ in (ii), we get $y=\frac{1}{3}$.