# 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}

## 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)$$?

• You assumed $x=sin\theta$, so $\theta = arcsin x$ – Chief VS Feb 17 '20 at 20:26
• Oh so the theta value must also match with the substitution I made for x? – user749176 Feb 17 '20 at 20:32
• In short yes, assuming $x>0$, note that $arcsinx = arccos√(1-x^2)$ for only $x>0$ – Chief VS Feb 17 '20 at 20:38
• which is the actual answer though? When I plug the question into different online integral calculators, all answers are very different from mine – user749176 Feb 17 '20 at 20:44
• Does this answer your question? Getting different answers when integrating using different techniques – Xander Henderson Feb 18 '20 at 5:01

Starting off with $$\displaystyle\int \frac{\sqrt{x^2-1}}{x}\mathrm dx$$, substitute $$x = \sec(\theta)$$ for $$\theta \in \left[0, \frac{\pi}{2}\right) \cup \left(\frac{\pi}{2}, \pi\right]$$ as usual (keep the domain in mind for later). Of course, that means $$\sqrt{x^2-1} = \sqrt{\sec^2(\theta)-1} = \sqrt{\tan^2(\theta)} = \vert \tan(\theta)\vert$$ and $$\dfrac{\mathrm dx}{\mathrm d\theta} = \sec(\theta)\tan(\theta) \iff \mathrm dx = \sec(\theta)\tan(\theta)\mathrm d\theta$$. This simplifies as follows:

$$\displaystyle\int \frac{\sqrt{x^2-1}}{x}\mathrm dx \longrightarrow \int\frac{\vert \tan(\theta)\vert}{\sec(\theta)}\sec(\theta)\tan(\theta)\mathrm d\theta = \int\vert \tan(\theta)\vert\tan(\theta)\mathrm d\theta$$

For $$\theta \in \left[0, \frac{\pi}{2}\right)$$, $$\tan(\theta) \geq 0$$, so you get

$$\int \tan^2(\theta) \mathrm d\theta = \int \left[\sec^2(\theta)-1\right] \mathrm d\theta = \tan(\theta)-\theta+C \longrightarrow \sqrt{x^2-1}-\text{arcsec}(x)+C$$

Since tangent is positive in the first quadrant, $$\tan(\theta) = \sqrt{x^2-1}$$, so the $$\theta$$ term can also be replaced with $$\arctan\left(\sqrt{x^2-1}\right)$$.

For $$\theta \in \left(\frac{\pi}{2}, \pi\right]$$, $$\tan(\theta) \leq 0$$, so you get

$$-\int \tan^2(\theta) \mathrm d\theta = -\int \left[\sec^2(\theta)-1\right] \mathrm d\theta = \theta-\tan(\theta)+C \longrightarrow \sqrt{x^2-1}+\text{arcsec}(x)+C$$

Since tangent is negative in the second quadrant, $$\tan(\theta) = \tan(\theta -\pi) = -\sqrt{x^2-1}$$ (remember that tangent takes arguments in the first and fourth quadrants), so the $$\theta$$ term can also be replaced with $$\pi-\arctan\left(\sqrt{x^2-1}\right)$$.

In both cases, the anti-derivative could be re-written as $$\sqrt{x^2-1}-\arctan\left(\sqrt{x^2-1}\right)+C$$. Basically, it just "combines" your other two anti-derivatives and expresses them as a single function rather than having one for each case.

• Would just leaving the answer as: √(x^2-1) - arcsec(x) + C , still be correct? – user749176 Feb 18 '20 at 0:09
• For indefinite integrals, we usually assume $\tan(\theta)$ is positive (at least from what I've seen), so yeah, that's fine. – KM101 Feb 18 '20 at 0:16

Now, both answers are correct. They merely look different. They differ by a constant.

Note 1...

$$-\sqrt{\frac{x+1}{1-x}}+\sqrt{\frac{x+1}{1-x}}\;x = -\sqrt{\frac{x+1}{1-x}}\;(1-x) = -\frac{\sqrt{x+1}\;(1-x)}{\sqrt{1-x}} \\= -\sqrt{x+1}\sqrt{1-x} =-\sqrt{(1+x)(1-x)} =-\sqrt{1-x^2}$$

Note 2... $$2\,\arcsin \left( \frac{\sqrt {1+x}}{\sqrt {2}} \right) =\pi-2\,\arcsin \left( \frac{\sqrt {1-x}}{\sqrt {2}} \right)$$

• For the second line of step, I multiplied top and bottom by √(1+x) in order to use the trig substitution of x = sinθ – user749176 Feb 17 '20 at 21:12
• Also those two answers are from the calculator. I was wondering if they are correct after comparing them to my answers, which are shown in the link – user749176 Feb 17 '20 at 21:27

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.

• Yes the wrong substitution of θ, seemed to cause the problem. But aside from substituting x back in the answer, do you know if the x's you sub back in is always supposed to correspond to the original substitution made? For example, see my updated question at the top to see what I mean – user749176 Feb 17 '20 at 21:41