Example 1. Calculate the definite integral

$$
\int_{0}^{\pi / 2} \frac{\sin x}{2+\sin x} d x
$$
Solution.

1. Since the function $\operatorname{tg}(x / 2)$ is defined on $[0, \pi / 2]$, we make the substitution

$$
t=\operatorname{tg} \frac{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. Find the new limits of integration

$$
t(0)=0, \quad t\left(\frac{\pi}{4}\right)=1
$$

3. Apply the formula for variable substitution in a definite integral

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

4. Compute the antiderivative of the rational function $t$ and apply the Newton-Leibniz formula

$$
\int_{0}^{1} \frac{2 t}{\left(t^{2}+t+1\right)\left(t^{2}+1\right)} d t=\left.2 \operatorname{arctg} t\right|_{0} ^{1}-\left.\frac{4}{\sqrt{3}} \operatorname{arctg} \frac{2 t+1}{\sqrt{3}}\right|_{0} ^{1}=\frac{\pi}{2}-\frac{2 \pi}{3 \sqrt{3}}
$$

$$
\text { Answer. } \quad \int_{0}^{\pi / 2} \frac{\sin x}{2+\sin x} d x=\frac{\pi}{2}-\frac{2 \pi}{3 \sqrt{3}} \text {. }
$$