<s>[INST] Which of these answers is the correct indefinite integral? (Using trig-substitution or $u$-substitution give different answers) Answers obtained from two online integral calculators:

$$\begin{align}\int\dfrac{\sqrt{1 + x}}{\sqrt{1 - x}}\,\mathrm dx &= -\sqrt{\dfrac{x + 1}{1 - x}} + \sqrt{\dfrac{x + 1}{1 - x}}x - 2\arcsin\left(\dfrac1{\sqrt2}\sqrt{1 - x}\right) + C \\ 
\int\dfrac{\sqrt{1 + x}}{\sqrt{1 - x}}\,\mathrm dx &= 2\sin^{-1}\left(\dfrac{\sqrt{x + 1}}{\sqrt2}\right) - \sqrt{1 - x^2} + \text{ constant}
\end{align}$$

Answers from online calculator shown above, and my answers shown in the link:


Update:
I realized that the substitution for $\theta$ was supposed to be $\arcsin$ not $\arccos$, so the answer would have been the same as the right hand side. 
But I also noticed that using the initial substitution to plug $x$ back in the final answer will not always give the correct answer because in a similar question: 
$$\int \frac{\sqrt{x^2-1}}x dx$$
has a trig-substitution of $x = \sec\theta$, and the answer in terms of $\theta$ would be: $\tan \theta - \theta + C$. Then the final answer in terms of $x$ should be : $\sqrt{x^2-1} - \operatorname{arcsec}(x) + C$.
But online integral calculators give the answer: $\sqrt{x^2-1} - \arctan(\sqrt{x^2-1}) + C$, which doesn't match the original substitution of:
$$x = \sec\theta \to \theta = \operatorname{arcsec}(x)$$
Anyone know why the calculator gives that answer which doesn't match the original trig-substitution of $x = \sec \theta \to \theta = \operatorname{arcsec}(x)$?
 [/INST] Let
\begin{align}
  I &= \int \frac{\sqrt{1+x}}{\sqrt{1-x}}\;dx
    = \int \frac{1+x}{\sqrt{1-x^2}}\;dx
\end{align}
Left side:

Let $x = \sin\theta$, $dx = \cos\theta\;d\theta$.
  \begin{align}
  I &= \int \frac{1+\sin\theta}{\sqrt{\cos^2\theta}}\cos\theta\;d\theta  \\
    &= \int \left(1+\sin\theta \right)d\theta  \\
    &= \theta - \cos\theta + c  \\
    &= \arccos\left(\sqrt{1-x^2}\right) - \sqrt{1-x^2} + c
  \end{align}

Right side:

\begin{align}
  I &= \int \frac{1}{\sqrt{1-x^2}}\;dx + \int \frac{x}{\sqrt{1-x^2}}\;dx  \\
  u &= 1 - x^2,\;\; -\frac{1}{2}du = x\,dx  \\ \implies
  I &= \arcsin x - \frac{1}{2}\int u^{-1/2}\;du  \\
    &= \arcsin x - \sqrt{u} + c  \\
    &= \arcsin x - \sqrt{1 - x^2} + c
  \end{align}

The answers would be the exact same, if $\arccos\left(\sqrt{1-x^2}\right) = \arcsin x$. And therein lies the difference. On the "Left side", the substitution you originally made was $x = \sin\theta$. So when you replace $\theta$ you should substitute $\theta = \arcsin x$.
By the rules of trig substitution, they should be equivalent. But canonically, the arcsin function has a range of $-\pi/2$ to $\pi/2$, while the arccos function has a range of $0$ to $\pi$. So when you use $\arccos\left(\sqrt{1-x^2}\right)$, as-is you are losing the case where $-1 < x < 0$. The integral has a kink in it, but that's not what you want, seeing as how the function being integrated is continuous and differentiable at $x=0$.
You could shift arccos by an appropriate amount and use that solution, but I think it would be easier to go with arcsin here.
</s>