Integrate $\int \frac {dx}{1+\sin x}$ Integrate $\int \dfrac {dx}{1+\sin x}$
My attempt:
$$\begin{align}&=\int \dfrac {dx}{1+\sin x}\\
&=\int{\dfrac{dx}{1+\dfrac{2\tan \left( \dfrac{x}{2} \right)}{1+\tan ^2\left( \dfrac{x}{2} \right)}}}\\
&=\int{\dfrac{1+\tan ^2\left( \dfrac{x}{2} \right)}{\left( 1+\tan \left( \dfrac{x}{2} \right) \right) ^2}}\,dx\end{align}$$

$$\int\frac{1}{1+sin(x)}dx$$
Apply u-substitution:$u=tan(\frac x2)$
$$=\int \frac{2}{u^2+1+2u}$$
$$=2\int \frac{1}{u^2+1+2u}$$
$$=2\int\frac{1}{(u+1)^2}$$
Again apply u-substitution:$v=u+1$
$$=2\int\frac{1}{v^2}dv$$
$$=2\int\ v^{-2}dv$$
$$=2\frac{v^{-2+1}}{-2+1}$$
Substitute back $v=u+1,u=tan\frac {x}{2}$
$$=-\frac{2}{tan\frac x2+1}$$
$$\int\frac{1}{1+sin(x)}dx=-\frac{2}{tan\frac x2+1}+C$$
