Integrate $\int \sqrt{\frac{a+x}{a-x}} \ dx$

I want to integrate $$\int \sqrt{\frac{a+x}{a-x}} \ dx$$

I have no idea how to solve this. I've tried a few substitutions, for example $x = a\sin u$, $x=a\tan u$ with no luck. I've tried parts with $dv = dx, dv = \frac{dx}{\sqrt{a-x}}$; this leads nowhere.

Some help would be appreciated. Also, if there's some neat substitution I'm missing, it would be helpful if you stated why that particular substitution seems natural to use, because I find myself making "random" substitutions quite a lot.

• Hint: Substitute $u = \frac{a+x}{a-x}$ – Omnomnomnom Jun 5 '16 at 19:24
• Or set $u$ equal to the whole root expression. – Hans Lundmark Jun 5 '16 at 19:25

\begin{align} \sqrt{\frac{a+x}{a-x}}&=\frac{a+x}{\sqrt{a^2-x^2}}\\\\ &=\frac{a/|a|}{\sqrt{1-(x/a)^2}}+\frac{x}{\sqrt{a^2-x^2}} \end{align}
Use the formula for the derivative of the arcsine function for the first term and use the $u$-substitution for the second.
Hint...substitute $x=a\cos 2\theta$