Concept:
This is a first-order separable differential equation.
In separable equations, we rearrange the equation such that all terms involving \(y\) are placed on one side and all terms involving \(x\) are placed on the other side.
After separation, both sides are integrated independently.
Step 1: Rearranging the differential equation.
The given equation is:
\[
(2+\sin x)\frac{dy}{dx}+(y+1)\cos x=0
\]
Move the second term to the right side:
\[
(2+\sin x)\frac{dy}{dx}=-(y+1)\cos x
\]
Now divide both sides by \((y+1)(2+\sin x)\):
\[
\frac{1}{y+1}\frac{dy}{dx}
=
-\frac{\cos x}{2+\sin x}
\]
Multiplying by \(dx\):
\[
\frac{dy}{y+1}
=
-\frac{\cos x}{2+\sin x}\,dx
\]
Thus, the variables are separated successfully.
Step 2: Integrating both sides.
Integrate both sides:
\[
\int \frac{dy}{y+1}
=
-\int \frac{\cos x}{2+\sin x}\,dx
\]
For the left side:
\[
\int \frac{dy}{y+1}
=
\ln|y+1|
\]
For the right side, use substitution:
Let
\[
u=2+\sin x
\]
Then,
\[
du=\cos x\,dx
\]
Therefore,
\[
-\int \frac{\cos x}{2+\sin x}\,dx
=
-\int \frac{du}{u}
=
-\ln|u|
\]
Substituting back:
\[
-\ln|2+\sin x|
\]
Hence,
\[
\ln|y+1|
=
-\ln|2+\sin x|+C
\]
Step 3: Simplifying the logarithmic expression.
Using the logarithmic identity:
\[
\ln a+\ln b=\ln(ab)
\]
we get:
\[
\ln|y+1|+\ln|2+\sin x|=C
\]
\[
\ln|(y+1)(2+\sin x)|=C
\]
Removing logarithm:
\[
(y+1)(2+\sin x)=K
\]
where \(K\) is a constant.
Step 4: Using the initial condition \(y(0)=1\).
Substitute \(x=0\) and \(y=1\):
\[
(1+1)(2+\sin0)=K
\]
\[
2(2+0)=K
\]
\[
K=4
\]
Therefore, the particular solution becomes:
\[
(y+1)(2+\sin x)=4
\]
Step 5: Finding \(y\left(\frac{\pi}{2}\right)\).
Substitute \(x=\frac{\pi}{2}\):
\[
(y+1)\left(2+\sin\frac{\pi}{2}\right)=4
\]
Since,
\[
\sin\frac{\pi}{2}=1
\]
we get:
\[
(y+1)(2+1)=4
\]
\[
3(y+1)=4
\]
\[
y+1=\frac{4}{3}
\]
\[
y=\frac{4}{3}-1
\]
\[
y=\frac{1}{3}
\]
Hence,
\[
y\left(\frac{\pi}{2}\right)=\frac{1}{3}
\]