Integration of complex functions with trig functions: $\int_0^{2 \pi} \frac{ d\theta}{5-\cos( \theta )}$ $\int_0^{2 \pi} \frac{ d\theta}{5-\cos( \theta )}$ 
How should I integrate this? Using the exponantial identities of trig? Any hints will be great...
Thank you! 
 A: $$\begin{eqnarray*}\int_{0}^{2\pi}\frac{d\theta}{5-\cos\theta}&=&2\int_{0}^{\pi}\frac{d\theta}{5-\cos\theta}=2\int_{0}^{\pi}\frac{d\theta}{5-\frac{1-\tan^2(\theta/2)}{1+\tan^2(\theta/2)}}=4\int_{0}^{\pi/2}\frac{d\theta}{5-\frac{1-\tan^2\theta}{1+\tan^2\theta}}\\&=&4\int_{0}^{+\infty}\frac{dt}{5(1+t^2)-(1-t^2)}=\int_{0}^{+\infty}\frac{dt}{1+\frac{3}{2}t^2}=\color{red}{\frac{\pi}{\sqrt{6}}}.\end{eqnarray*}$$
A: $$I=\int_0^{2\pi}\frac{d\theta}{5-\cos(\theta)}$$
let $e^{i\theta}=z$
$$I=\int_{|z|=1}\frac{1}{5-\frac{z+\frac{1}{z}}{2}}\frac{dz}{iz}$$
$$I=i\int_{|z|=1}\frac{2}{z^2-10z+1}dz$$
the root of $z^2-10z+1=0$ 
$z_1=5+2\sqrt 6$
$z_2=5-2\sqrt6$
you notice that $z_1$ outside of the unit circle
and $z_2$ inside the unit circle 
so be the residue theorem 
$$I=i\text{Res}_{z=z_2}\frac{2}{(z-z_1)(z-z_2)}=\frac{\pi}{\sqrt6}$$
A: Here's an answer using Fourier series.
First fact: if $\beta\in(-1,1)$,
$$\sum_{n=0}^{+\infty}\beta^n\cos(n\theta)=\Re\left(\frac1{1-\beta\mathrm{e}^{i\theta}}\right)=\frac{1-\beta\cos\theta}{1+\beta^2-2\beta\cos\theta}=\frac12\frac{2-2\beta\cos\theta}{1+\beta^2-2\beta\cos\theta}=\frac12\frac{\bigl(1+\beta^2-2\beta\cos\theta\bigr)+1-\beta^2}{1+\beta^2-2\beta\cos\theta}=\frac12+\frac12\frac{1-\beta^2}{1+\beta^2-2\beta\cos\theta}.$$
Now we find $\beta\in(-1,1)$ such that $1+\beta^2=10\beta$ so that the denominator is a multiple of $5-\cos\theta$:
$$\beta=5-2\sqrt6$$
fulfills this requirement. Observe that $1-\beta^2=2-10\beta$, we'll use it below.
With this value of $\beta$ we have:
$$\sum_{n=0}^{+\infty}\beta^n\cos(n\theta)=\frac12+\frac1{2\beta}\frac{1-5\beta}{5-\cos\theta}.$$
Now, integrating on a period, we clearly have:
$$1=\frac1{2\pi}\int_0^{2\pi}\left(\frac12+\frac1{2\beta}\frac{1-5\beta}{5-\cos\theta}\right)\,\mathrm{d}\theta,$$
i.e.,
$$1=\frac12+\frac{1-5\beta}{4\beta\pi}\int_0^{2\pi}\frac1{5-\cos\theta}\,\mathrm{d}\theta,$$
hence
$$\int_0^{2\pi}\frac1{5-\cos\theta}\,\mathrm{d}\theta=\frac{2\beta\pi}{1-5\beta}=\frac{\pi\sqrt6}6.$$

As a by-product, we also obtain a more general formula: for all $n\in\mathbb{N}^*$,
$$\beta^n=\frac1\pi\int_0^{2\pi}\left(\frac12+\frac1{2\beta}\frac{1-5\beta}{5-\cos\theta}\right)\cos(n\theta)\,\mathrm{d}\theta,$$
hence
$$\beta^n=\frac1{2\beta\pi}\int_0^{2\pi}\frac{1-5\beta}{5-\cos\theta}\cos(n\theta)\,\mathrm{d}\theta,$$
hence
$$\frac{2\beta^{n+1}\pi}{1-5\beta}=\int_0^{2\pi}\frac{\cos(n\theta)}{5-\cos\theta}\,\mathrm{d}\theta,$$
(and this equality also happens to be correct for $n=0$).
