Prove $\int_a^b \frac{1}{x}\sqrt{-(x-a)(x-b)}dx = (\frac{a+b}{2}-\sqrt{ab})\pi$ Does anyone know how to solve $$\int_a^b \frac{1}{x}\sqrt{-(x-a)(x-b)}dx$$
After trying Wolfram Alpha, I conclude that it possibly equals $(\frac{a+b}{2}-\sqrt{ab})\pi = \frac{(\sqrt{a}-\sqrt{b})^2}{2}\pi$.
The book I am reading says one can use residue theorem to quickly obtain the result, but the details are not written and I cannot figure out the solution.
P.S. One can prove from this integral that arithmetic mean $\geq$ geometric mean.

Noticing that $(x-a)(b-x)=\left(\frac{b-a}{2}\right)^2-\left(x-\frac{a+b}{2}\right)^2$, we let $x-\frac{a+b}{2}=\frac{b-a}{2} \sin \theta$ and transforms the integral into $$
\begin{aligned}I&=\left(\frac{b-a}{2}\right)^2 \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{\cos ^2 \theta}{\frac{b-a}{2} \sin \theta+\frac{a+b}{2}} d \theta \\ &=h^2 \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{\cos ^2 \theta}{h \sin \theta+k} d \theta\end{aligned}
$$
where $h=\frac{b-a}{2}$ and $k=\frac{a+b}{2}$.
$$
\begin{aligned}
\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{\cos ^2 \theta}{h \sin \theta+k} d \theta =& \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{1-\sin ^2 \theta}{h \sin \theta+k} d \theta \\
=& \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\left(-\frac{\sin \theta}{h}+\frac{k}{h^2}+\frac{1-\frac{k^2}{h^2}}{h \sin \theta+k}\right) d \theta\\
=& {\left[\frac{\cos \theta}{h}+\frac{k}{h^2} \theta\right]_{-\frac{\pi}{2}}^{\frac{\pi}{2}}+\frac{h^2-k^2}{h^2} \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{d \theta}{h \sin \theta+k} } \quad (*)\\=& \frac{k \pi}{h^2}-\frac{k^2-h^2}{h^2} \cdot\frac{\pi}{\sqrt{k^2-h^2}}\\=&\frac{\pi}{h^2}\left(k-\sqrt{k^2-h^2}\right)
\end{aligned}
$$
We now conclude that
$$\boxed{ \int_a^b \frac{1}{x} \sqrt{(x-a)(b-x)} d x=\left(\frac{a+b}{2}-\sqrt{a b}\right) \pi}$$
Note:
Please refer to the post for (*).
