Integrating $\int_a^b\left[ \left(1 - \frac{a}{x} \right)\left(\frac{b}{x}-1 \right) \right]^\frac{1}{2}dx$

Let $0<a<b$.

By rewriting a bit we get

$$I(a,b)=\int_a^b\frac{\sqrt{(x-a)(b-x)}}x~\mathrm dx$$

Completing the square gives us

$$I(a,b)=\int_a^b\frac{\sqrt{\frac14(b-a)^2-\left(x-\frac{b+a}2\right)^2}}x~\mathrm dx$$

Substitute $\displaystyle\frac{b-a}2\sin(\theta)=x-\frac{b+a}2$ to get

$$I(a,b)=\frac{(b-a)^2}2\int_{-\pi/2}^{\pi/2}\frac{\cos^2(\theta)}{(b-a)\sin(\theta)+b+a}~\mathrm d\theta$$

By manipulating symmetry,

$$I(a,b)=\frac{(b-a)^2}4\int_0^{2\pi}\frac{\cos^2(\theta)}{(b-a)\sin(\theta)+b+a}~\mathrm d\theta$$

from which one may conclude

$$I(a,b)=\frac\pi2(\sqrt b-\sqrt a)^2$$


Rescale the integration range with the following variable change and the shorthand $q$

$$u = \frac{x-a}{b-a}, \>\>\>\>\>\>q=\frac{b}{a}-1$$

to simplify the original integral

$$ I = \int_a^b \left[ \left(1 - \frac{a}{x} \right)\left(\frac{b}{x}-1 \right) \right]^{1/2} dx=aq^2\int_0^1 \frac{\sqrt{u(1-u)}}{1+qu} du\tag{1}$$

Then, let $u=\sin^2 t$ to rewrite (1) as

$$ I = 2a\int_0^{\pi/2} \frac{q^2\sin^2 t\cos^2 t}{1+q\sin^2 t}dt$$

Decompose the integrand,

$$I = 2a\int_0^{\pi/2}\left( 1+q\cos^2 t-\frac{1+q}{1+q\sin^2 t}\right) dt$$

Carry out the two integrals,

$$I_1=\int_0^{\pi/2}\left( 1+q\cos^2 t\right) dt=\frac{\pi}{2}\left(1+\frac{q}{2}\right)$$

$$I_2=\int_0^{\pi/2} \frac{1+q}{1+q\sin^2 t}dt=\int_0^{\infty} \frac{(1+q)ds}{1+(1+q)s^2 }=\frac{\pi}{2}\sqrt{1+q}$$

where $s=\tan t$ is used in evaluating $I_2$. Thus,

$$I= 2a(I_1- I_2)= \frac{\pi}{2}(b+a-2\sqrt{ab})$$