Example of contour integration Could someone help me evaluate the following integral with contour integration ?
$$\int_{0}^{2\pi}\frac{d\theta}{(a+b\cos\theta)^2}.$$
Constraints are: $a>b>0$.

Using the parametrization $z = e^{i\theta}$, $0 \le \theta \le 2\pi$ for the unit circle, we can write the integral as the contour integral
$$\oint_{|z| = 1} \dfrac{1}{\left(a + b\frac{z + z^{-1}}{2}\right)^2} \frac{dz}{iz},$$
which can be rewritten
$$\oint_{|z| = 1} \dfrac{4z}{i(bz^2 + 2az + b)^2}\, dz,$$
or
$$\frac{4}{ib^2}\oint \frac{z}{(z^2 + \frac{2a}{b}z + 1)^2}\, dz.$$
The roots of $z^2 + 2(a/b)z + 1$ are 
$$z_0 = \frac{-a-\sqrt{a^2 - b^2}}{b}\quad \text{and} \quad z_1 = \frac{-a + \sqrt{a^2 - b^2}}{b}.$$
The point $z_0$ lies outside the circle since 
$$|z_0| = \frac{a + \sqrt{a^2 - b^2}}{b} > \frac{a}{b} > 1.$$ 
So $z_1$ lies inside the circle (shown by computation or by use of the fact $z_0z_1 = 1$ and $|z_0| > 1$). Hence, the function $z/(z - z_0)^2$ is analytic inside and on $|z| = 1$. Since $z^2 + 2(b/a)z + 1 = (z - z_0)(z - z_1)$, it follows from Cauchy's differentiation formula that
\begin{align}\frac{4}{ib^2}\oint_{|z| = 1} \frac{z}{(z + \frac{2b}{a}z + 1)^2}\, dz&= \frac{4}{ib^2} \cdot 2\pi i \frac{d}{dz}\bigg|_{z = z_1} \frac{z}{(z - z_0)^2}\\
&= \frac{8\pi}{b^2} \cdot \frac{-(z_1 + z_0)}{(z_1 - z_0)^3}\\
&= \frac{8\pi}{b^2} \cdot \dfrac{\frac{2a}{b}}{\frac{8(a^2 - b^2)\sqrt{a^2 - b^2}}{b^3}}\\
&= \frac{2\pi a}{(a^2 - b^2)\sqrt{a^2 - b^2}}.
\end{align}
