Evaluate the integral $\int \sqrt{(x-a)(b-x)}$ I'm trying to figure out how to evaluate the following integral:
$$\int \sqrt{(x-a)(b-x)} \, dx $$
I've tried various trig substitutions, but can't seem to get anywhere.  This is an exercise in Apostol's Calculus Volume 1 (Section 6.22, Exercise 46). The solution provided in the text is 
$$\frac{1}{4} |b-a|(b-a) \arcsin \sqrt{\frac{x-a}{b-a}} + \frac{1}{4} \sqrt{(x-a)(b-x)} (2x-(a+b)) + C.$$
 A: Notice, $$\int \sqrt{(x-a)(b-x)}\ dx$$ $$=\int\sqrt{(a+b)x-x^2-ab}\ dx$$
$$=\int \sqrt{\left(\frac{a+b}{2}\right)^2-\left(x-\frac{a+b}{2}\right)^2-ab}\ dx$$
$$=\int \sqrt{\left(\frac{a+b}{2}\right)^2-\left(x-\frac{a+b}{2}\right)^2-ab}\ dx$$
$$=\int \sqrt{\left(\frac{\sqrt{a^2+b^2}}{2}\right)^2-\left(x-\frac{a+b}{2}\right)^2}\ dx$$
substituting  $\left(x-\frac{a+b}{2}\right)=t$, one should get
$$=\frac{1}{2}\left[\left(x-\frac{a+b}{2}\right)\sqrt{\left(\frac{\sqrt{a^2+b^2}}{2}\right)^2-\left(x-\frac{a+b}{2}\right)^2}+\frac{a^2+b^2}{4}\sin^{-1}\left(\frac{\left(x-\frac{a+b}{2}\right)}{\frac{\sqrt{a^2+b^2}}{2}}\right)\right]$$
$$=\frac{1}{2}\left[\left(x-\frac{a+b}{2}\right)\sqrt{(x-a)(b-x)}+\frac{a^2+b^2}{4}\sin^{-1}\left(\frac{2x-a-b}{\sqrt{a^2+b^2}}\right)\right]$$
A: $$\sqrt{(x-a)(b-x)} = \sqrt{\left(\frac{a+b}{2}\right)^2 - ab - \left(x^2 - (a+b)x + \left(\frac{a+b}{2}\right)^2 \right)}$$
$\left(\frac{a+b}{2}\right)^2 - ab = \left(\frac{a-b}{2}\right)^2 $, call it $k^2$ for some $k$. The remaining term is $\left(x - \frac{a+b}{2}\right)^2$, and you may make the substitution $ u = x - \frac{a+b}{2}$. Consequently you get
$$\int \sqrt{k^2 - u^2} \mathrm{d}u$$
which can be solved with the substitution $u = k \sin \theta$.
