TITLE: Direct evaluation of complete elliptic integral
QUESTION [6 upvotes]: In comments to this question, @RobertIsrael asserted that, for $-1<x<1$,
$$
    \int_0^{2\pi} \frac{1-x \cos(\phi)}{\left(1 - 2 x \cos(\phi) + x^2\right)^{3/2}} \mathrm{d} \phi = \frac{4}{1-x^2} \operatorname{E}(x^2) \tag{1}
$$
where $E(m)$ is the complete elliptic integral of the second kind: $E(m) = \int_0^{\pi/2} \sqrt{1-m \sin^2(\theta)} \mathrm{d} \theta$.
It is easy to verify that the series expansion of the integrand, integrated term-wise, agrees with the series expansion of Robert's elegant answer.
I am very much interested if there is a way to directly establish $\text{eq. (1)}$ from the integral.

REPLY [5 votes]: The first step towards the goal is to perform a rational transformation. As in the previous question, using the symmetry $\phi \to (2\pi - \phi)$ and the change of variables $t = \sin^2\left(\phi/2\right)$:
$$
  \mathcal{I} =  \int_0^{2 \pi} \frac{1-x \cos(\phi)}{\left(1-2 x \cos(\phi) + x^2\right)^{3/2}} \mathrm{d} \phi = \frac{2}{(1-x)^2} \int_0^1 \frac{1+\frac{ 2 x}{1-x} t}{1+\frac{4x}{(1-x)^2} t} \frac{\mathrm{d} t}{\sqrt{ t(1-t)\left( 1+\frac{4x}{(1-x)^2} t\right)}}
$$
Now, perform a rational substitution:
$$
    t = \frac{1-x}{2} \frac{y+1}{1- x y} \qquad \text{with} \qquad \mathrm{d} t = \frac{1-x^2}{( 1-x y)^2} \frac{\mathrm{d} y}{2}
$$
which maps $0 <t<1$ into $-1<y<1$. With it:
$$
   t (1-t) \left( 1+\frac{4x}{(1-x)^2} t\right) = \frac{(1+x)^2}{4 (1-x y)^4} (1-y^2) (1- x^2 y^2)
$$
and
$$
   \frac{1+\frac{ 2 x}{1-x} t}{1+\frac{4x}{(1-x)^2} t} = \frac{1-x}{1+ x y}
$$
Combining, and using $1-x>0$ and $1-x y>0$:
$$
 \mathcal{I} = \frac{2}{1-x} \int_{-1}^1 \frac{(1-x)^2}{(1+ x y)} \frac{\mathrm{d} y}{\sqrt{(1-y^2)(1-x^2 y^2)}} = 2(1-x) \int_{-1}^1 \frac{1}{1 + x y} \frac{\mathrm{d} y}{\sqrt{(1-y^2)(1-x^2 y^2)}}
$$
The integral above is reduced to the rational form with substitution $y = \operatorname{sn}(u| x^2)$, where $\operatorname{sn}(u|m)$ stands for the Jacobi elliptic sine function. Indeed:
$$
    (1-y^2)(1-x^2 y^2) = \left( 1- \operatorname{sn}^2(u|x^2)\right)\left( 1- x^2 \operatorname{sn}^2(u|x^2)\right) = \operatorname{cn}^2(u|x^2) \operatorname{dn}^2(u|x^2)
$$
$$
  \mathrm{d} y = \operatorname{cn}(u|x^2) \operatorname{dn}(u|x^2) \mathrm{d} u
$$
The substitution maps $-1<y<1$ into $-K(x^2) < u < K(x^2)$, where $K(x^2)$ is the complete elliptic integral of the first kind, and both $\operatorname{cn}(u|x^2) > 0$ and $\operatorname{dn}(u|x^2) > \sqrt{1-x^2} > 0$ on this interval:
$$
  \mathcal{I} =  \int_{-K(x^2)}^{K(x^2)} \frac{2(1-x) \mathrm{d u}}{1 + x \operatorname{sn}(u| x^2) } = \frac{2}{1-x^2} \left. \left(\operatorname{E}\left( \operatorname{am}(u|x^2), x^2\right) + x \frac{\operatorname{cn}(u|x^2) \operatorname{dn}(u|x^2) }{1+ x \operatorname{sn}(u|x^2)} \right) \right|_{-K(x^2)}^{K(x^2)}
$$
Since $\operatorname{cn}\left( \pm K(x^2)| x^2\right) = 0$, and $\operatorname{am}(\pm K(x^2)| x^2) = \pm \frac{\pi}{2}$ we arrive at the desired result:
$$
   \mathcal{I} = \frac{4}{1-x^2} \operatorname{E}(x^2)
$$