# residues and definite integrals involving sines and cosines

I'm trying to compute, for $a > 1$, $$\int_0^{\pi} \frac{d \theta}{a + \cos \theta}.$$

To start on this, I can use a change of variables $\cos \theta = \frac{z + z^{-1}}{2i}$ to obtain the integrand $\frac{2}{z^2 + 2ai z + 1}$.

My problem is what contour to use and how to account for the bounds of integration. All we had for examples were integrating from $0$ to $2 \pi$ and from $-\pi$ to $\pi$, which we use a circular contour centered at the origin.

Or am I totally wrong on this one?

-

Since $\cos(x)=\cos(-x)$, the function $\frac{1}{a+\cos\theta}$ is even and hence $$\int_0^{\pi} \frac{d \theta}{a + \cos \theta}=\frac12\int_{-\pi}^{\pi} \frac{d \theta}{a + \cos \theta}$$ And you can compute the second integral.
With the change of variable $z=e^{i\theta}$ we have: $$\int_0^{\pi}\frac{d\theta}{a+\cos \theta}=\frac{1}{2}\int_{-\pi}^\pi\frac{d\theta}{a+\cos\theta}=\int_C\frac{-idz}{z^2+2az+1}$$ where $C$ is the unit cercle, and the fraction $\displaystyle f(z)=\frac{-i}{z^2+2az+1}$ has two poles $z_1=z+\sqrt{a^2-1}\in C$ and $z_2=-a-\sqrt{a^2-1}\notin C$, so
$$\int_0^{\pi}\frac{d\theta}{a+\cos \theta}=2i\pi Res(f,z_1)=\frac{\pi}{\sqrt{a^2-1}}.$$