<s>[INST] Calculation of $\int_{0}^{\pi}\frac{1}{(5+4\cos x)^2}dx$ Calculation of $\displaystyle \int_{0}^{\pi}\frac{1}{(5+4\cos x)^2}dx$
$\bf{My\; Try}::$ Using $\displaystyle \cos x = \frac{1-\tan^2 \frac{x}{2}}{1+\tan^2 \frac{x}{2}}$
Let $\displaystyle I = \int_{0}^{\pi}\frac{1}{\left(5+\frac{4-4\tan^2 \frac{x}{2}}{1+\tan^2 \frac{x}{2}}\right)^2}dx = \int_{0}^{\pi}\frac{1+\tan^2 \frac{x}{2}}{\left(9+\tan^2 \frac{x}{2}\right)^2}dx$
$\displaystyle I = \int_{0}^{\pi}\frac{\sec^2 \frac{x}{2}}{\left(9+\tan^2 \frac{x}{2}\right)^2}dx$
Now Let $\tan \frac{x}{2} = t$ and $\sec^2 \frac{x}{2}dx = 2dt$
$\displaystyle I = 2\int_{0}^{\infty}\frac{1}{(9+t^2)^2dt}$
Now I did not understand how can i solve after that
Help Required
Thanks
 [/INST] After setting
$$
t=\tan\frac{x}{2},
$$
we get
\begin{eqnarray}
I:&=&\int_0^\pi\frac{1}{(5+4\cos x)^2}\,dx=\int_0^\infty\frac{2}{1+t^2}\cdot\left(\frac{1+t^2}{9+t^2}\right)^2\,dt=2\int_0^\infty\frac{1+t^2}{(9+t^2)^2}\,dt\\
&=&2\int_0^\infty\frac{9+t^2-8}{(9+t^2)^2}\,dt=2\int_0^\infty\frac{1}{9+t^2}\,dt-16\int_0^\infty\frac{1}{(9+t^2)^2}\,dt\\
&=&\frac23\arctan\frac{t}{9}\Big|_0^\infty-16\int_0^\infty\frac{1}{(9+t^2)^2}\,dt=\frac\pi3-16\int_0^\infty\frac{1}{(9+t^2)^2}\,dt\\
&=&\frac\pi3-8\int_{-\infty}^\infty\frac{1}{(9+x^2)^2}\,dx=:\frac\pi3-8J.
\end{eqnarray}
Since the function
$$
f:\mathbb{C}\setminus\{3i\} \to \mathbb{C},\ z\mapsto \frac{1}{(9+z^2)^2}
$$
is holomorphic, we have thanks to the Residue Theorem:
$$
\int_{-r}^rf(x)\,dx+ir\int_0^\pi e^{it}f(re^{it})\,dt=2\pi i\text{Res}\left(f,3i\right)=2\pi i\cdot\frac{-i}{3\cdot36}=\frac{\pi}{54} \quad \forall r>3.
$$
Since
$$
\left|ir\int_0^\pi e^{it}f(re^{it})\,dt\right|\le \int_0^\pi\frac{r}{(r^2-9)^2}\,dt=\frac{\pi r}{(r^2-9)^2} \to 0 \text{ as } r \to \infty,
$$
we have
$$
J=\lim_{r\to \infty}\int_{-r}^rf(x)\,dx=\frac{\pi}{54}.
$$
Hence
$$
I=\frac\pi3-\frac{8\pi}{54}=\frac{5\pi}{27}.
$$
</s>