Calculating integral using Cauchy's integral formula I have to evaluate  $\int _0^{2\pi} \frac {d\theta}{2+cos \theta} $ using Cauchy's integral formula. I have tried to find an $f(z)$ for $\frac1{2\pi i}\int_\gamma\frac {f(z)}{z-z_0}dz = f(z_0)$
 I think $\gamma$ should be a circle but I can't find $f(z)$ and $z_0$
 A: Use $z=e^{i\theta}_{}$, and convert integral over $\theta$ to $\oint dz$ where the contour is a unit circle around origin in complex z-plane which can be evaluated using Cauchy method.
After few simplifications you get : 
$$\int_{0}^{2\pi} d \theta \frac{1}{2+\cos\theta}=\oint_{|z|=1}^{} dz \frac{-2i}{z^2+4z+1}$$ which can be solved by Cauchy method as : 
$$\int_{0}^{2\pi} d \theta \frac{1}{2+\cos\theta}=\oint_{|z|=1}^{} dz \frac{\frac{-2i}{z+2+\sqrt{3}}}{ z+2-\sqrt{3}} $$
A: Not an answer strictly speaking, just a remark about real techniques, that turn out to be as effective as complex ones (maybe more) in this case. 
$$ \int_{0}^{2\pi}\frac{d\theta}{2+\cos\theta}=2\int_{0}^{\pi}\frac{d\theta}{2+\cos\theta} = 2\int_{0}^{\pi/2}\left(\frac{1}{2+\cos\theta}+\frac{1}{2-\cos\theta}\right)\,d\theta $$
hence:
$$ \int_{0}^{2\pi}\frac{d\theta}{2+\cos\theta}=8\int_{0}^{\pi/2}\frac{d\theta}{4-\cos^2\theta}\stackrel{\theta\mapsto\arctan t}{=} 8\int_{0}^{+\infty}\frac{dt}{-1+4(1+t^2)}=\color{blue}{\frac{2\pi}{\sqrt{3}}}. $$
