Finding indefinite integral $$\int\frac{\sqrt{a-x}}{\sqrt{a}-\sqrt{x}}\, dx$$
Can someone give a hint as to how to break this apart into a do-able integral?
Just spent ages trying to substitute $\sqrt{a-x}$ and $\sqrt{x}$ as $u$, without success.
Advice/help much appreciated.
 A: Hint:
Use the change variable $x=a\cos^2 t$
Added 
We have $dx=-2a \cos t\sin t dt$ so
$$\int\frac{\sqrt{a-x}}{\sqrt{a}-\sqrt{x}}\, dx=-2a\int\frac{\sin^2t\cos t }{1-\cos t}dt=-2a\int\cos t dt-a\int(1+\cos 2t)dt=\cdots$$
A: Note that $$\frac{{\sqrt {a - x} }}{{\sqrt a  - \sqrt x }} = \frac{{\sqrt {a - x} }}{{a - x}}\left( {\sqrt a  + \sqrt x } \right) = \frac{{\sqrt a  + \sqrt x }}{\sqrt{a - x}}$$
This allows to get an easy integral in the first summand. For the second one, we make a series of elementary yet (maybe) non-obvious manipulations
 $$\begin{align}
  \int {\sqrt {\frac{x}{{a - x}}} dx}  &\mathop  = \limits^{\left( 1 \right)}  \int {\sqrt {\frac{a}{u} - 1} \left( { - du} \right)}  \\
   &\mathop  = \limits^{\left( 2 \right)} \int {w\frac{{2wa}}{{{{\left( {{w^2} + 1} \right)}^2}}}dw}  \\
   &\mathop  = \limits^{\left( 3 \right)}  - \frac{{aw}}{{1 + {w^2}}} + a\int {\frac{{dw}}{{{w^2} + 1}}}  \\ 
    &\mathop  = \limits^{\left( 4 \right)} - \frac{{aw}}{{1 + {w^2}}} + a\arctan w\end{align} $$
Explanation
$(1)$ Make $u=a-x$
$(2)$ Make $w^2=\dfrac ua-1$
$(3)$ Integrate by parts with $f=w,g'=\dfrac{2w}{(1+w^2)^2}$
$(4)$ Use the usual trigonometric integral $(\tan^{-1}x)'=(1+x^2)^{-1}$
The above gives $$\int {\sqrt {\frac{x}{{a - x}}} dx}  = a\arctan \sqrt {\frac{x}{{a - x}}}  - \sqrt {x\left( {a - x} \right)}  + C$$
