How to integrate $\int_{0}^{2\pi}\frac{\mathrm dx}{(1-a\cos x)^2}$ I'm having a hard time trying to resolve this integral :
$$\int_{0}^{2\pi}\frac{\mathrm dx}{(1-a\cos x)^2}$$
where $a$ is a positive real constant.
I tried using substitution, but I'm stuck by the fact that the integral must be computed between $0$ and $2\pi$, which leads to integration between $X$ and $X$ (where $X$ can be $0$ or $1$ anything following the substitution in the boundaries).
I'm not looking for the full result if the computation is complicated, just some lead to start off...
Thanks
UPDATE : seeing the answers proposed, I checked that indeed $|a|<1$.
 A: The polar equation of an ellipse (with respect to a focus, taking the aphelion as the point associated to $\theta=0$) is
$$ \rho(\theta) = \frac{\ell}{1-e\cos\theta} $$
where, in terms of the standard parameters, $\ell$ is the semi-latus rectum $\frac{b^2}{a}$ and $e$ is the eccentricity $\frac{c}{a}$.
The area enclosed by such ellipse is $\pi a b $ or
$$ \frac{1}{2}\int_{0}^{2\pi}\frac{\ell^2}{(1-e\cos\theta)^2}\,d\theta, $$
so we get that for any $e\in[0,1)$ the following identity holds:
$$ \int_{0}^{2\pi}\frac{d\theta}{(1-e\cos\theta)^2}= \frac{2\pi a b}{\ell^2}=2\pi\left(\frac{a}{b}\right)^3=\frac{2\pi}{\left(\frac{b^2}{a^2}\right)^{3/2}}={\frac{2\pi}{(1-e^2)^{3/2}}}. $$
The same holds if, in the LHS, we replace $e$ with $-e$, since $ \rho(\theta) = \frac{\ell}{1+e\cos\theta} $ is the polar equation of the same ellipse, with the perihelion being taken as the point associated to $\theta=0$. So we get that for any $a\in(-1,1)$
$$ \int_{0}^{2\pi}\frac{d\theta}{(1-a\cos\theta)^2}= \color{blue}{\frac{2\pi}{(1-a^2)^{3/2}}}. $$
A: HINT:
Note that for $|a|<1$
$$\begin{align}
\int_0^{2\pi}\frac{1}{(1-a\cos(\theta))^2}\,d\theta&=\frac1{a^2}\int_0^{2\pi}\frac{1}{(1/a-\cos(\theta))^2}\,d\theta\\\\
&=-\frac1{a^2}\frac{d}{d(1/a)}\int_0^{2\pi}\frac{1}{1/a-\cos(\theta)}\,d\theta\tag1\\\\
&= -\frac2{a^2}\frac{d}{d(1/a)}\int_0^{\pi}\frac{1}{1/a-\cos(\theta)}\,d\theta\tag2
\end{align}$$
Now use the Weierstrass substitution to evaluate the integral on the right-hand side of $(2)$ and differentiate to obtain the coveted result.
Alternatively, one could use contour integration to evaluate the integral of interest or evaluate the integral on the right-hand side of $(1)$.
A: My goal with this answer is to give you a bunch of different really general integral formulas that you may find very useful.
$$F(a)=\int_0^{\pi}\frac{\mathrm dx}{(1+a\cos x)^2}$$
So your integral is $2F(-a)$. First off we will preform the tangent-half-angle substitution $t=\tan(x/2)$. Hence we have that 
$$F(a)=2\int_0^\infty \frac1{(1+a\frac{1-t^2}{1+t^2})^2}\frac{\mathrm dt}{1+t^2}$$
$$F(a)=2\int_0^{\infty}\frac{1+t^2}{[(1-a)t^2+a+1]^2}\mathrm dt$$
Which we can rewrite as 
$$F(a)=\frac2{1-a}\int_0^\infty\frac{\mathrm dt}{(1-a)t^2+a+1}+\frac{4a}{a-1}\int_0^{\infty}\frac{\mathrm dt}{[(1-a)t^2+a+1]^2}$$

Next we consider the very general integral 
$$I(m;a,b)=\int_0^\infty \frac{\mathrm dx}{(ax^2+b)^{m+1}}$$
First we integrate by parts with $\mathrm dv=\mathrm dx$ to produce 
$$I(m;a,b)=\frac{x}{(ax^2+b)^{m+1}}\bigg|_0^{\infty}+2(m+1)\int_0^\infty\frac{ax^2}{(ax^2+b)^{m+2}}\mathrm dx$$
$$I(m;a,b)=2(m+1)\int_0^\infty\frac{ax^2+b-b}{(ax^2+b)^{m+2}}\mathrm dx$$
$$I(m;a,b)=2(m+1)I(m;a,b)-2(m+1)bI(m+1;a,b)$$
Then solving for $I(m+1;a,b)$ and replacing $m+1$ with $m$,
$$I(m;a,b)=\frac{2m-1}{2bm}I(m-1;a,b)$$
And for the base case:
$$I(0;a,b)=\int_0^{\infty}\frac{\mathrm dx}{ax^2+b}$$
The Trig sub $x=\sqrt{\frac{b}a}\tan u$ gives 
$$I(0;a,b)=\frac\pi{2\sqrt{ab}}$$
Which is a special case of 
$$\int_{x_1}^{x_2}\frac{\mathrm dx}{ax^2+bx+c}=\frac2{\sqrt{4ac-b^2}}\arctan\frac{2ax+b}{\sqrt{4ac-b^2}}\bigg|_{x_1}^{x_2}$$
Anyway, the recurrence has the solution 
$$I(m;a,b)=\frac\pi{2^{2m+1}b^m\sqrt{ab}}{2m\choose m}$$
Which we will apply very shortly!

Recalling the definition of $I(m;a,b)$, we have that 
$$F(a)=\frac2{1-a}I(0;1-a,1+a)+\frac{4a}{a-1}I(1;1-a,1+a)$$
$$F(a)=\frac\pi{(1-a^2)^{3/2}}$$
And since your integral is given by $2F(-a)$,
$$\int_0^{2\pi}\frac{\mathrm dx}{(1-a\cos x)^2}=\frac{2\pi}{(1-a^2)^{3/2}}$$

ADDENDUM
Consider the integral 
$$C(n;a)=\int_0^\pi \frac{\mathrm dx}{(1+a\cos x)^n}$$
Starting with $t=\tan\frac{x}2$,
$$C(n;a)=2\int_0^\infty \frac1{\left[1+a\frac{1-t^2}{1+t^2}\right]^n}\frac{\mathrm dt}{1+t^2}$$
$$C(n;a)=2\int_0^\infty \frac{\left(t^2+1\right)^{n-1}}{\left[(1-a)t^2+1+a\right]^n}\mathrm dt$$
Then using the binomial theorem,
$$C(n;a)=2\sum_{k=0}^{n-1}{n-1\choose k}\int_0^\infty\frac{x^{2k}}{\left[(1-a)x^2+1+a\right]^n}\mathrm dx$$
$$C(n;a)=\frac2{(1-a)^n}\sum_{k=0}^{n-1}{n-1\choose k}\int_0^\infty\frac{x^{2k}}{\left[x^2+\frac{1+a}{1-a}\right]^n}\mathrm dx$$
We then recall the integral due to my collaborator @DavidG, 
$$\int_0^\infty\frac{x^{q}}{\left[x^w+b\right]^p}\mathrm dx=\frac{b^{\frac{1+q}{w}-p}}{w}\frac{\Gamma\left(p-\frac{1+q}{w}\right)\Gamma\left(\frac{1+q}{w}\right)}{\Gamma\left(p\right)}$$
Here $\Gamma(s)$ is the Gamma function. So with $w=2$, $b=\frac{1+a}{1-a}$, $p=n$, and $q=2k$,
$$C(n;a)=\frac1{(1-a)^n}\sum_{k=0}^{n-1}{n-1\choose k}\left(\frac{1+a}{1-a}\right)^{\frac{2k+1}{2}-n}\frac{\Gamma\left(n-\frac{2k+1}{2}\right)\Gamma\left(\frac{2k+1}{2}\right)}{\Gamma\left(n\right)}$$
$$C(n;a)=\frac1{(1-a)^n}\sum_{k=0}^{n-1}\left(\frac{1+a}{1-a}\right)^{\frac{2k+1}{2}-n}\frac{\Gamma\left(n-\frac{2k+1}{2}\right)\Gamma\left(\frac{2k+1}{2}\right)}{k!\Gamma(n-k)}$$
