<s>[INST] Find value of integral: $I=\int_0^{2\pi}\frac{dx}{(2+\cos x)^2}$ Find value of integral: $$I_1=\int_0^{2\pi}\frac{dx}{(2+\cos x)^2}$$ and  $$I_2=\int_0^{2\pi}\frac{dx}{(2+\sin x)^2}$$
I don't know how, i need a solution, please
 [/INST] Let $\displaystyle I = \frac{\sin x}{(2+\cos x)}$
Now Diff. both side w.r. to $x$ , $\displaystyle \frac{dI}{dx} = \frac{d}{dx}\left(\frac{\sin x}{2+\cos x}\right) = \frac{(2+\cos x)\cdot \cos x-\sin x\cdot (-\sin x)}{(2+\cos x)^2}$
$\displaystyle \frac{dI}{dx} = \frac{2\cos x+1}{(2+\cos x)^2}\Rightarrow \frac{dI}{dx} =  \frac{2\cdot \left(2+\cos x\right)-3}{(2+\cos x)^2} = \frac{2}{2+\cos x}-3\cdot \frac{1}{(2+\cos x)^2}$
Now Integrate both side w. r. to $x$
$\displaystyle \int \frac{dI}{dx}dx = 2\int\frac{1}{(2+\cos x)}dx - 3\int\frac{1}{(2+\cos x)^2}dx$
So $\displaystyle \int\frac{1}{(2+\cos x)^2}dx = \frac{2}{3}\int\frac{1}{(2+\cos x)}dx-\frac{1}{3}\cdot I$
Now Put $\displaystyle \cos x = \frac{1-\tan^2 \frac{x}{2}}{1+\tan^2 \frac{x}{2}}$
$\displaystyle \int\frac{1}{(2+\cos x)^2}dx = \frac{2}{3}\int\frac{1+\tan^2 \frac{x}{2}}{2+2\tan^2 \frac{x}{2}+1-\tan^2 \frac{x}{2}}dx-\frac{1}{3}\cdot \frac{\sin x}{2+\cos x}+\mathbb{C}$
$\displaystyle = \frac{2}{3}\int\frac{\sec^2 \frac{x}{2}}{3+\tan^2 \frac{x}{2}}dx-\frac{1}{3}\cdot \frac{\sin x}{2+\cos x}+\mathbb{C}$
Let $\displaystyle \tan \frac{x}{2} = t$ and $\sec^2\frac{x}{2}dx = 2dt$
$\displaystyle = \frac{4}{3}\int \frac{1}{t^2+\left(\sqrt{3}\right)^2}dt-\frac{1}{3}\cdot \frac{\sin x}{2+\cos x}+\mathbb{C}$
$\displaystyle \int\frac{1}{(2+\cos x)^2}dx = \frac{4}{3}\cdot \frac{1}{\sqrt{3}}\cdot \tan^{-1}\left(\frac{\tan \frac{x}{2}}{\sqrt{3}}\right)-\frac{1}{3}\cdot \frac{\sin x}{2+\cos x}+\mathbb{C}$
Yes  Mrnhan $\displaystyle \tan \frac{x}{2}$ is not defined at $\displaystyle x = \pi$
Thanks  Alraxite.
</s>