Is there some trick to evaluating the following integral [duplicate]

This question already has an answer here:

I have been staring at this integral for a while and I don't quite know how to take the first step. Is there some trick that I have to use to manipulate the function first?

Integral in question:

$$\int^{2\pi}_0 \frac{dx}{a + \cos x}$$

Any help/hints/insights is deeply appreciated.

marked as duplicate by kennytm, Community♦Mar 21 '17 at 3:45

• @kennytm, I think from the tags the OP is interested in a complex analysis approach. – Zaid Alyafeai Mar 21 '17 at 3:33
• Note the on the unit circle we have $z+z^{-1} =2 \cos(\theta)$ – Zaid Alyafeai Mar 21 '17 at 3:34
• – kennytm Mar 21 '17 at 3:40

$$\int_{|z|=1}\frac{\frac{dz}{iz}}{a+\left(z+z^{-1} \right)/2} = -2i\int_{|z|=1}\frac{dz}{z^2+2az+1}$$
Now you need to look at the roots of $z^2+2az+1 =0$ and some conditions on $a$ to see if the poles lie inside the circle or outside.
A possible way to do this: Let $t= tan(x/2)$ and the integral will be transformed to $2 \int \frac{dt}{((a-1)t^2+(a+1))}$. Then use the Newton-Leibniz formula with a careful discussion at $x= \pi$