Compute the integral using residues:
$$I=\int_0 ^{2\pi}\frac{dx}{(a+b\cos x)^2}$$
Resolution(book):
$I=2\pi i\sum_{|z_k|<1}res_{z=z_k}f(z)$
where $f(z)=\frac{4z}{i(bz^2+2az+b)^2}\\z_1=\frac{-a+\sqrt{a^2-b^2}}{b}\:\:\text{and}\:\:z_2=\frac{-a-\sqrt{a^2-b^2}}{b}$
In $D(0,1)$ there is only a pole of order 2:$z=z_1$
$res_{z=z_1}=\frac{4}{i}\frac{d}{dz}(\frac{z(z-z_1)^2}{b^2(z-z_1)^2(z-z_2)^2})=\frac{a}{i(a^2-b^2)^{\frac{3}{2}}}$
Then:
$I=\frac{2\pi a}{(a^2-b^2)^{\frac{3}{2}}}$
Questions:
How does the author derives the function $f(z)=\frac{4z}{i(bz^2+2az+b)^2}$? What is the technique behind it?
Thanks in advance!
Let $z=e^{ix}$ and then $dz=izdx$ and $\cos\theta=\frac12(z+\frac1z)$. So \begin{eqnarray*} I&=&\int_0 ^{2\pi}\frac{dx}{(a+b\cos x)^2}\\ &=&\int_{|z|=1}\frac{1}{(a+\frac{b}{2}(z+\frac1z))^2}\frac{dz}{iz}\\ &=&\int_{|z|=1}\frac{4z}{i(2z+b(z^2+1))^2}dz. \end{eqnarray*}