<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] 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]$$
</s>