Example 1. Find the indefinite integral

$$
\int \frac{\sin x}{2+\sin x} d x
$$
## Solution.

1. Let's make the substitution $t=\operatorname{tg}(x / 2)$.

Substituting into the integrand,

$$
\sin x=\frac{2 t}{1+t^{2}}, \quad d x=\frac{2}{1+t^{2}} d t
$$

we get

$$
\frac{\sin x}{2+\sin x} d x=\frac{\frac{2 t}{1+t^{2}}}{2+\frac{2 t}{1+t^{2}}} \frac{2}{1+t^{2}} d t=\frac{2 t}{\left(t^{2}+t+1\right)\left(t^{2}+1\right)} d t
$$

2. Applying the formula for substitution in an indefinite integral,

$$
\int \frac{\sin x}{2+\sin x} d x=\int \frac{2 t}{\left(t^{2}+t+1\right)\left(t^{2}+1\right)} d t
$$

3. We compute the antiderivative of the rational function in $t$:

$$
\int \frac{2 t}{\left(t^{2}+t+1\right)\left(t^{2}+1\right)} d t=2 \operatorname{arctg} t-\frac{4}{\sqrt{3}} \operatorname{arctg} \frac{2 t+1}{\sqrt{3}}+C
$$

Returning to the variable $x$ by substituting $t=\operatorname{tg}(x / 2)$:

$$
\int \frac{\sin x}{2+\sin x} d x=x-\frac{4}{\sqrt{3}} \operatorname{arctg} \frac{2 \operatorname{tg}(x / 2)+1}{\sqrt{3}}+C
$$

Answer. $\int \frac{\sin x}{2+\sin x} d x=x-\frac{4}{\sqrt{3}} \operatorname{arctg} \frac{2 \operatorname{tg}(x / 2)+1}{\sqrt{3}}+C$