TITLE: Evaluate integral $\int_0^\frac{\pi}{2} \ln\left(\frac{1+a\cos x}{1-a\cos x}\right) \frac{\mathrm{d} x}{\cos x}$ for $\left|a\right|<1$
QUESTION [9 upvotes]: Question: Evaluate the following definite integral:
  $$
I=
\int_{0}^{\pi/2}
\ln\left(1 + a\cos\left(x\right) \over 1 - a\cos\left(x\right)\right)\,
{{\rm d}x \over \cos\left(x\right)}\qquad
\mbox{where}\qquad\left\vert\,a\,\right\vert < 1
$$

This is left as an exercise in my textbook. The book says that I should use the method of "differentiating parameters" by using the provided Leibniz Formula (?):

Prerequisite: Function $f(x,y)$ and its partial derivative $f_x(x,y)$ are both continuous on region $R=[a,b]\times[c,d]$. Function $\alpha(x)$ and $\beta(x)$ are both differentiable on intervl $[a,b]$ while
  $$ c \le \alpha(x) \le d,\quad c \le \beta(x) \le d \quad (a\le x\le b),$$
Conclusion: The Function $\displaystyle\Phi(x)=\int_{\alpha(x)}^{\beta(x)} f(x,y) \,\mathrm d y$ is differentiable on interval $[a,b]$, and
  $$\begin{align}
  \Phi^\prime(x) &= \frac{\mathrm d}{\mathrm d x} \int_{\alpha(x)}^{\beta(x)} f(x,y) \,\mathrm d y \\
   &= \int_{\alpha(x)}^{\beta(x)} f_x(x,y) \,\mathrm d y + f\left[x,\beta(x)\right]\beta^\prime(x)-f\left[x,\alpha(x)\right]\alpha^\prime(x).
  \end{align}$$

First, I'd like to ask: What is the correct name of this theorem?
Next, here's my (failed?) attempts at solving the question.
Following one of the textbook examples on the same topic, I tried:
$$ \begin{align}
I&=\int_0^\frac{\pi}{2} \left[\ln(1+y)\right]_{-a \cos x}^{a \cos x} \frac{\mathrm d x}{\cos x} \\
\\
&= \int_0^\frac{\pi}{2} \int_{-a \cos x}^{a \cos x} \frac{\mathrm d y}{1+y} \frac{\mathrm d x}{\cos x}. \\
&=\int_{-a}^{a} \frac{1}{1+y} \int_{0}^{\arccos\left|y/a\right|}\,\mathrm d x \mathrm d y \\
&=\int_{-a}^{a} \left.\left[\ln\left|\tan x + \sec x\right|\right]\right|_0^{\arccos(y/a)}
\end{align}
$$
And I don't know what to do next.
Also I tried to substitute $u=a \cos x$ but I don't know how to proceed.
Please help me with this (non-homework) problem by giving hints or solution, It's been a week since I first tried this problem. Thanks for helping!
P.S.: My MathJax doesn't render (or it may need hours of time), and I don't get preview for writing questions/answers. I'm relying on LaTeX now. How can I fix this problem? It used to work. I'm using IE 9.

REPLY [15 votes]: This is so called Leibniz integral rule. Using it you can easily compute this integral
$$
\frac{d I}{d a}
=\frac{d}{da}\int\limits_{0}^{\pi/2}\ln\frac{1+a\cos x}{1-a\cos x}\frac{dx}{\cos x}
=\int\limits_{0}^{\pi/2}\frac{d}{da}\ln\frac{1+a\cos x}{1-a\cos x}\frac{dx}{\cos x}
=\int\limits_{0}^{\pi/2}\frac{2dx}{1-a^2\cos^2 x}
$$
$$
\frac{d I}{d a}=\int\limits_{0}^{\pi/2}\frac{2d(\tan x)}{(1-a^2)+\tan^2 x}
=\int\limits_{0}^{+\infty}\frac{2dt}{(1-a^2)+t^2}
$$
$$
\frac{d I}{d a}=2\frac{1}{\sqrt{1-a^2}}\arctan\frac{t}{\sqrt{1-a^2}}\Biggl|_0^\infty
=\frac{\pi}{\sqrt{1-a^2}}
$$
Since $I(0)=0$ we get
$$
I(\alpha)=I(0)+\int\limits_0^{\alpha}\frac{dI}{da}da
=\pi\int\limits_0^{\alpha}\frac{1}{\sqrt{1-a^2}}da
=\pi\arcsin a\Biggl|_0^\alpha
=\pi\arcsin\alpha
$$