<s>[INST] Find $\int \sqrt{a- x \over x} dx$. 
$$ \int \sqrt{a- x \over x} dx$$


Substituting $u = \sqrt{a - x}$, 
$$\int \sqrt{a- x \over x} dx = -2\int {u^2 \over \sqrt{a - u^2}} du$$ 
Now, for $\sqrt{a}\sin t = u$,
$$-2\int {a\sin^2 t \over \sqrt{a} \cos t} \ \  dt \ \  \sqrt{a }\cos t = -a\int(1 - \cos 2t) dt = a(t - \cos t \sin t)  + C$$ 
Substituting for $\displaystyle  t = \arcsin\left({u\over \sqrt{a}}\right) =\arcsin\left({\sqrt{a - x}\over \sqrt{a}}\right) $ I get the answer as 
$$\bbox[7px,Border:2px solid black]{a\left(\sqrt{x\over a} \sqrt{a -x \over a}- \arcsin\sqrt{a -x \over a}\right) + C}$$,
But the given answer is $\displaystyle {a\left(\sqrt{x\over a} \sqrt{a -x \over a}+ \arcsin\sqrt{x  \over a}\right) + C}$
I am sure that $\displaystyle \arcsin\sqrt{x  \over a} \ne - \arcsin\sqrt{a -x \over a}$.
Where did I got wrong ?
 [/INST] You didn't go wrong - actually, we have that 
$$\arcsin\sqrt{x  \over a} = \frac{\pi}{2} - \arcsin\sqrt{a -x \over a}$$
as $$\left(\sqrt{x  \over a} \right)^2 + \left(\sqrt{a -x \over a} \right)^2=1.$$
</s>