Does an analytical form exist for the following integral I have an integral
$$f(n,a)=\int_0^{2\pi}\mathop{\mathrm{d}x}\frac{\cos(nx)\cos^2x}{1-a\cos^2x},$$
where $n$ is an even integer and $0<a<1$ is a real number. Does an analytical form exist for this integral?
Edit: Here is a partial answer that I discovered:
$$\int_0^{2\pi}\mathop{\mathrm{d}x}\frac{\cos(nx)}{1-a\cos^2x}=-\frac{2\pi}{\sqrt{1-a}}\left(\frac{1-\sqrt{1-a}}{\sqrt{a}}\right)^n,\qquad a<1, n>0.$$
$n$ is even.

I'm kind of surprised that this problem hasn't been attacked with a geometric series yet. Let $0<b<1$. Then
$$\sum_{k=0}^{\infty}b^ke^{ik\theta}=\sum_{k=0}^{\infty}b^k\cos k\theta+i\sum_{k=0}^{\infty}b^k\sin k\theta=\frac1{1-be^{i\theta}}=\frac{1-b\cos\theta+ib\sin\theta}{1-2b\cos\theta+b^2}$$
Taking real parts and setting $\theta=2x$,
$$\begin{align}1+\sum_{k=1}^{\infty}b^k\cos2kx&=\frac{1-b(2\cos^2x-1)}{1-2b(2\cos^2x-1)+b^2}\\
&=\frac1{1+b}+\frac{\frac{2b(1-b)}{1+b}\cos^2x}{(1+b)^2-4b\cos^2x}\end{align}$$
Then
$$\frac b{1+b}+\sum_{k=1}^{\infty}b^k\cos2kx=\frac{\frac{2b(1-b)}{(1+b)^3}\cos^2x}{1-\frac{4b}{(1+b)^2}\cos^2x}$$
Solving $a=\frac{4b}{(1+b)^2}$ for
$$b=\frac{2-a\pm\sqrt{1-a}}a=\frac{\left(1-\sqrt{1-a}\right)^2}a$$
And inserting this result for $b$ throughout,
$$\frac{1-\sqrt{1-a}}2+\sum_{k=1}^{\infty}\frac{\left(1-\sqrt{1-a}\right)^{2k}}{a^k}\cos2kx=\frac{\frac a2\sqrt{1-a}\cos^2x}{1-a\cos^2x}$$
This shows that $$f(0,a)=2\pi\frac{1-\sqrt{1-a}}{a\sqrt{1-a}}$$
And
$$f(n,a)=\frac{2\pi}{a\sqrt{1-a}}\frac{\left(1-\sqrt{1-a}\right)^n}{a^{n/2}}$$
For positive even n, in agreement with other results, but I think the tools used here are a little simpler.
