Evaluate $\int_0^{2\pi} \frac{\cos 2x}{1-2a\cos x+a^2} $ with $a^2<1$ How do I compute the integration for $a^2<1$,
$$\int_0^{2\pi} \dfrac{\cos 2x}{1-2a\cos x+a^2}dx=? $$
I think that:
$$\cos2x =\dfrac{e^{i2x}+e^{-2ix}}{2},
\qquad\cos x =\dfrac{e^{ix}+e^{-ix}}{2}$$
But I cannot. Please help me.

One can factorise the denominator:
$$ 1-2a\cos{x}+a^2 = (e^{ix}-a)(e^{-ix}-a). $$
Then using partial fractions gives
$$ \frac{1}{2}\frac{e^{2ix}+e^{-2ix}}{(e^{ix}-a)(e^{-ix}-a)} = -\frac{a^2+1}{2 a^2} + \frac{a^4+1}{2 a (a^2-1)}\left( -\frac{1}{e^{i x}-a}-\frac{1}{1-a e^{i x}} \right)-\frac{e^{i x}+e^{-i x}}{2 a} $$
Now, since $a^2<1$, the remaining fractions can be expanded in a power series such as $\sum_{k=0}^{\infty} (ae^{ix})^n $. But
$$ \int_0^{2\pi} e^{inx} \, dx = \begin{cases} 2\pi & n=0 \\ 0 & n \neq 0 \end{cases}, $$
so only the constant terms contribute, and hence the integral is
$$ 2\pi \left( -\frac{a^2+1}{2 a^2} + \frac{a^4+1}{2 a (a^2-1)}\left( \frac{1}{a}-1 \right) \right) = \frac{2\pi a^2}{1-a^2}. $$

It may be easier to use the formula
$$ \frac{1-a^2}{1-2a\cos{x}+a^2} = 1+2\sum_{k=0}^{\infty} a^k\cos{kx} $$
for $\lvert a \rvert <1$.
