<s>[INST] 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.$$
 [/INST] $$\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$.
</s>