# Multiple cases within an integral after a $u$-substitution

The problem asks to solve this indefinite intregral: $$I=\int{\frac{dx}{x\sqrt{x^2+1}}}$$ I did the following substitution (using $$t$$ as substitute value): $$x^2+1=t\implies x=\pm\sqrt{t-1}$$ $$2xdx=dt\implies dx=\frac{dt}{2\sqrt{t-1}}$$ From here I separated two cases and did some basic integration to get the following:

1. $$x<0$$ $$I=-\int{\frac{dt}{2(t-1)\sqrt{t}}}=-\frac{1}{2}\ln\left|\frac{1+\sqrt{x^2+1}}{1-\sqrt{x^2+1}}\right|+C_1$$
2. $$x>0$$ $$I=\int{\dfrac{dt}{2(t-1)\sqrt{t}}}=\dfrac{1}{2}\ln\left|\dfrac{1-\sqrt{x^2+1}}{1+\sqrt{x^2+1}}\right|+C_2$$

Is this the correct solution the given indefinite integral?

Here is the correct procedure to evaluate with $$x^2+1=t$$, $$2xdx=dt$$

\begin{align} \int{\frac{dx}{x\sqrt{x^2+1}}}=& \ \frac12\int{\frac{2x dx}{x^2\sqrt{x^2+1}}}=\frac12\int \frac{dt}{(t-1)\sqrt t}\\ =&\ \frac{1}{2}\ln{\frac{\sqrt{t}-1}{\sqrt{t}+1}} =\frac{1}{2}\ln{\frac{\sqrt{x^2+1}-1}{\sqrt{x^2+1}+1}} \end{align} which is valid for both $$x<0$$ and $$x>0$$.

• Why does doing it the way I did it give me the wrong solution? Mar 12, 2023 at 21:43
• @bb_823 - you should have the expression $dx=\pm\frac{dt}{2\sqrt{t-1}}$ instead Mar 12, 2023 at 21:50
• well that is what pretty much what I have, just seems like i forgot to write it. Wouldn't having that give me the solution that I got? Mar 12, 2023 at 21:59
• @bb_823 - then $\pm$ would cancel out $\pm$ from $x=\pm \sqrt{t-1}$, which leads to the same result for either case Mar 12, 2023 at 22:03
• @bb_823 Examining your two missteps carefully, and at the risk of belabouring the obvious: $(\pm^2=+),$ while $(\pm\times+=\pm).$ Mar 13, 2023 at 7:25

\begin{aligned} \int \frac{d x}{x \sqrt{x^2+1}} & =\int \frac{1}{x^2} d\left(\sqrt{x^2+1}\right) \\ & =\int \frac{1}{\left(\sqrt{x^2+1}\right)^2-1} d\left(\sqrt{x^2+1}\right) \\ & =\frac{1}{2} \ln \left|\frac{\sqrt{x^2+1}-1}{\sqrt{x^2+1}+1}\right|+C \end{aligned}

• cool approach. just corrected the differential in the second step. +1 Mar 17, 2023 at 18:28

When you see some $$\sqrt{\cdots}\$$ in an integral it is often interesting to substitute that (not always but there are many times this will lead to a simplification).

The inner of the integral being odd, anti-derivative will be even and the change $$u=\sqrt{x^2+1}$$ is bijective on $$x>0,u>1$$.

$$u^2=x^2+1$$ gives $$2udu=2xdx\iff \dfrac{dx}x=\dfrac{udu}{x^2}=\dfrac{udu}{u^2-1}$$

Therefore $$\displaystyle\int\dfrac{dx}{x\sqrt{x^2+1}}=\int\dfrac{du}{u^2-1}=-\operatorname{arctanh}(u)+C=-\operatorname{arctanh}\left(\dfrac 1{\sqrt{x^2+1}}\right)+C$$

You can have a different $$C$$ for $$x<0$$ and $$x>0$$ though.

What is wrong with $$x=\tan\theta$$ substitution? Then $$I=\int\csc\theta\,d\theta=-\ln|\csc\theta+\cot\theta|+c=-\ln\frac{\sqrt{x^2+1}+1}{|x|}+c.$$

The negative-$$x$$ postion of your solution is incorrect. If you are comfortable with hyperbolic functions, then using the substitution $$\displaystyle u=\frac1x$$ and noting that $$\operatorname{arccosech}$$ is an odd function:

\begin{align}\int\frac{\mathrm dx}{x\sqrt{x^2+1}} &= \int\frac{-|u|}{u\sqrt{1+u^2}}\,\mathrm du\\ &= \begin{cases} \operatorname{arcsinh} u+C_1, &u<0;\\ -\operatorname{arcsinh} u+C_2, &u>0\end{cases}\\ &= \begin{cases} \operatorname{arccosech}x+C_1, &x<0;\\ -\operatorname{arccosech}x+C_2, &x>0\end{cases}\\ &= \begin{cases} -\operatorname{arccosech}(-x)+C_1, &x<0;\\ -\operatorname{arccosech}x+C_2, &x>0\end{cases}\\ &= \begin{cases} \color{red}{-\operatorname{arccosech}|x|}+C_1, &x<0;\\ -\operatorname{arccosech}|x|+C_2, &x>0.\end{cases} \end{align}

Addendum (noting that $$\operatorname{arccosech} x\equiv\ln\left(\frac1x+\frac1{|x|}\sqrt{x^2+1}\right)$$)

$$= \begin{cases} -\ln\left(\frac1{|x|}+\frac1{|x|}\sqrt{x^2+1}\right)+C_1, &x<0;\\ -\ln\left(\frac1{|x|}+\frac1{|x|}\sqrt{x^2+1}\right)+C_2, &x>0\end{cases}\\ = \begin{cases} \color{red}{-\ln\left(\frac{1+\sqrt{x^2+1}}{|x|}\right)}+C_1, &x<0;\\ -\ln\left(\frac{1+\sqrt{x^2+1}}{|x|}\right)+C_2 &x>0,\end{cases}$$ exhibiting two independent parameters to caputure the complete set of antiderivatives.

P.S. Note that all the solutions currently on this page (Quanto's, zwim's, Bob's, mine; each using a different substitution) are equivalent to one another.

• I am fine with hyperbolic function, but the solution in the form of $ln$ is preferable. Mar 12, 2023 at 21:45