<s>[INST] How to solve $\int \frac{dx}{\sqrt{1+x}-\sqrt{1-x}}$? 
How can i evaluate the following integral $$\int \frac{dx}{\sqrt{1+x}-\sqrt{1-x}}=?$$

This is taken from a definite integral where $x$ varies from $0$ to $1$.
My attempt:
multiplied by conjugate
$$\int \frac{dx}{\sqrt{1+x}-\sqrt{1-x}}=\int \frac{(\sqrt{1+x}+\sqrt{1-x})dx}{(\sqrt{1+x}-\sqrt{1-x})(\sqrt{1+x}+\sqrt{1-x})}$$
$$=\int \frac{(\sqrt{1+x}+\sqrt{1-x})dx}{1+x-1+x}$$
$$=\int \frac{(\sqrt{1+x}+\sqrt{1-x})dx}{2x}$$

*

*if i use $x=\sin^2\theta$
$$\int \frac{(\sqrt{1+\sin^2\theta}+\cos\theta)}{2\sin^2\theta}\sin2\theta\ d\theta=\int (\sqrt{1+\sin^2\theta}+\cos\theta)\cot\theta d\theta$$

*if i use $x=\tan^2\theta$
$$\int \frac{(\sec\theta-\sqrt{1-\tan^2\theta})}{2\tan^2\theta}2\tan\theta\sec^2\theta d\theta\ d\theta=\int \frac{(\sec\theta-\sqrt{1-\tan^2\theta})}{\sin\theta\cos\theta} d\theta$$
Should I use substitution $x=\sin^2\theta$ or $x=\tan^2\theta$?. I can't decide which substitution will work further. Please help me solve this integration.
Thanks
 [/INST] $\begin{aligned} I &:= \int \frac{d x}{\sqrt{1+x}-\sqrt{1-x}}=\int \frac{\sqrt{1+x}+\sqrt{1-x}}{2 x} d x =\frac{1}{2}\left[ \underbrace{\int \frac{\sqrt{1+x}}{x}-d x}_{J}+\underbrace{\int \frac{\sqrt{1-x}}{x} d x}_{K}\right] \end{aligned}$
$$
\begin{aligned}
J &=\int \frac{\sqrt{1+x}}{x} d x \\
&=\int \frac{1+x}{x \sqrt{1+x}} d x \\
&=\int \frac{1+x}{x} d (\sqrt{1+x}) \\
&=\int\left(\frac{1}{x}+1\right) d(\sqrt{1+x}) \\
&=\int \frac{d (\sqrt{1+x})}{(\sqrt{1+x})^{2}-1}+\sqrt{1+x} \\
&=\frac{1}{2} \ln \left|\frac{\sqrt{1+x}-1}{\sqrt{1+x}+1}\right|+\sqrt{1+x}+c_{1}
\end{aligned}
$$$$
K \stackrel{x\mapsto -x}{=} \sqrt{1-x}+\frac{1}{2} \ln \left|\frac{\sqrt{1-x}-1}{\sqrt{1-x}+1}\right|+c_{2}
$$
Now we can conclude that $$
I=\sqrt{1-x}+\sqrt{1+x}+\frac{1}{2} \ln \left| \frac{(\sqrt{1+x}-1)(\sqrt{1-x}-1)}{(\sqrt{1+x}+1)(\sqrt{1-x}+1)}\right|+C
$$
</s>