Solving a complex integral I need help solving an integral from John Conway book. 
Lets $\alpha$ complex number different from 1 find integral $$\int\frac{dx}{1-2\alpha\cos{x}+{\alpha}^2}$$ from 0 to $2\pi$ in unit circle $$(z-\alpha)^{-1}(z-\frac{1}{\alpha})^{-1}$$

Substitute: $z = e^{i x}$ then:
$$\cos x = \frac{1}{2} \left( z + \frac{1}{z} \right), \; dx = \frac{1}{i} \cdot \frac{dz}{z}$$
and we can rewrite the integral as:
$$ i \int_{|z|=1} \frac{dz}{a (z-a)(z - \frac{1}{a})}$$
There are two cases:


*

*$|a| < 1$ then only $z=a$ is a pole inside a circle and the residue is:
$${\rm res}_{z=a} \frac{1}{a (z-a)(z - \frac{1}{a})} = \lim_{z \to a} \frac{z-a}{a (z-a)(z - \frac{1}{a})} = \frac{1}{a^2 - 1}$$
hence the result is:
$$2 \pi i \cdot \frac{i}{a^2 - 1} = \frac{2 \pi}{1 - a^2}$$

*$|a| > 1$ similarly only $1/a$ lies inside the circle and the residue is:
$${\rm res}_{z=1/a} \frac{1}{a (z-a)(z - \frac{1}{a})} = \lim_{z \to 1/a} \frac{z-\frac{1}{a}}{a (z-a)(z - \frac{1}{a})} = \frac{1}{1 - a^2}$$
hence the result is:
$$2 \pi i \cdot \frac{i}{1 - a^2} = \frac{2 \pi}{a^2 - 1}$$
