Integral $\int_0^a \ln \left( \frac{b-\sqrt{a^2-x^2}}{b+\sqrt{a^2-x^2}} \right)dx$ Hi I am trying to calculate,
$$
\int_0^a \ln \left( \frac{b-\sqrt{a^2-x^2}}{b+\sqrt{a^2-x^2}}    \right)dx
$$
where $a,b$ are positive real constants.  I Know $\ln(xy)=\ln x +\ln y$, but I do not know how to evaluate this integral then.
I need to find a closed form for the indefinite integral 
$$
\int \ln \big(b\pm \sqrt{a^2-x^2}\big) dx
$$
so this is really the problem I am facing.  The closed form exists and is in terms of elementary functions.  Thanks!
 A: This is a possible way (I assume $a\geq 0$, $b\geq 0$):
1) substitute $x= a \sin t $.
2) integrate the resulting integral by parts to get rid of $\ln$
3) you should end up with $$-\int_0^{\pi/2}\frac{2 a^2 b \sin^2 t\,dt }{b^2 -a^2 \cos^2 t} .$$
4) it is possible to integrate the last integral  by elementary means or using the residue theorem. You should obtain $$\pi \left(\sqrt{b^2 -a^2}  -b\right).$$
Edit:
Here are the steps in a bit more detail ($0\leq a \leq b$):
1) after subsitution $x= a \sin t$ with $dx = a \cos t\, dt$ we obtain
$$ a \int_{0}^{\pi/2} \!dt\,\cos t\, \ln \left( \frac{b -a \cos t}{b+a \cos t} \right). $$
2) Integration by parts (where $\cos t$ is integrated and the rest differentiated) leads directly to
$$ a \sin t \, \ln \left( \frac{b -a \cos t}{b+a \cos t} \right) \Bigg|_{0}^{\pi/2} - a \int_0^{\pi/2}\!dt\, \sin t \frac{b+ a \cos t}{b -a \cos t} \frac{2 a b}{(b+ a \cos t)^2} \sin t\\
= - 2 a^2 b \int_0^{\pi/2}\!dt\, \frac{\sin^2 t}{b^2 -a ^2 \cos^2 t}.$$
3) Now use the substitution $s= \tan t$ with $ds = (1+s^2) dt =\cos^{-2} t\, dt$ as proposed by sos440. This leads to
$$ -2 a^2 b \int_0^{\infty}\!\frac{ds}{1+s^2}\, \frac{\sin^2 t}{b^2 -a^2\cos^2 t}
= -2 a^2 b \int_0^{\infty}\!ds\, \frac{s^2}{(1+s^2)[b^2 (1+s^2)-a^2]}.$$
4) Employing the partial fraction expansion on the last integrand, you obtain
$$ -2 b \int_0^\infty\frac{ds}{1+s^2} +  \frac{2(b^2-a^2)}{b} \int_0^\infty \frac{ds}{s^2 +1 - (a/b)^2}   .$$
Thus, we need to evaluate the integral
$$\int_0^\infty \frac{ds}{s^2+\alpha^2} 
= \alpha^{-1} \arctan(s/\alpha) \big|_{0}^{\infty} = \frac{\pi}{2\alpha},$$
and we obtain the final result (with $\alpha=1$ and $\alpha= \sqrt{1-(a/b)^2}$)
$$ -\pi b + \frac{(b^2-a^2)\pi}{b \sqrt{1-(a/b)^2}} .$$
A: It is enough to compute $\int \ln(a+\sqrt{1-x^2}) dx$.
Do a change of variables $x=\sin t$ and integrate by parts:
$$\int \ln (a+\cos t) \cos t \, dt = \ln(a+\cos t) \sin t + \int \frac{\sin^2 t}{a+\cos t} \, dt$$
Use the substitution $u = \tan t/2$ so that $\sin t = 2u/(1+u^2)$, $\cos t = (1-u^2)/(1+u^2)$ and $dt = 2/(1+u^2) du$. This is known as the Weierstrass substitution. This gives for the integral on the RHS
$$\int \frac{4u^2}{(1+u^2)^2} \frac{1}{a+(1-u^2)/(1+u^2)} \frac{2}{1+u^2}du$$
or
$$\int \frac{4u^2}{(1+u^2)^2} \frac{1}{(a-1)u^2+(a+1)} \frac{2}{1+u^2}du.$$
Now we have a giant partial fractions problem. So it's doable, but a pain. I've sort of lost interest going further, but it explains the complexity of the solution you get with wolfram alpha: https://www.wolframalpha.com/input/?i=integrate+log%28b+%2B+sqrt%28a%5E2-x%5E2%29%29+dx
