# Evaluating $\int\frac{1}{x\sqrt{x^2+1}}dx$

I am very confused by this. I am integrating the function; $$\int\frac{1}{x\sqrt{x^2+1}}dx$$ And Wolfram alpha is telling me, the result is; $$\log{\left(\frac{x}{\sqrt{x^2+1}+1} \right)}$$ However, Wolfram Mathematica is telling me that the answer is; $$\int\frac{1}{x\sqrt{x^2+1}}dx=-\mathrm{artanh}(\sqrt{x^2+1})$$ Are these two representation equivalent?

• $\operatorname{artanh}$ has a logarithmic representation, so it is likely. – Ninad Munshi Jun 16 '20 at 6:26
• Their derivatives are equal, so the difference is a constant. log, arctanh. – Atbey Jun 16 '20 at 6:29
• You have to be careful with the definition of $\operatorname{arctanh}(x)$ The usual definition is $$\operatorname{arctanh}(x) := \frac{1}{2} \ln{\left( \frac{1+x}{1-x}\right)}$$ The problem is that this makes sense in real world if and only if the inner fraction is positive, i.e. $$\frac{1+x}{1-x} > 0 \iff -1 < x < 1$$ In your case, Wolfram Alpha tell us that $-\operatorname{arctanh}(\sqrt{x^2+1})$ is a solution, but we know that $\sqrt{x^2+1}\ge 1$ for every $x \in \mathbb R$. – Sewer Keeper Jun 16 '20 at 7:01
• @SewerKeeper If this was a part of a solution to an ODE would we rather consider the Wolfram Alpha representation as above? – MATHBOI Jun 16 '20 at 7:16
• The representation wolfram Alpha gives, i.e. $f \colon (0,+\infty) \to \mathbb R$ defined as $f(x) = \log{\left(\frac{x}{\sqrt{x^2+1}+1} \right)}$ is a primitive of the integral for every $x > 0$. The fun thing is that the function $g(x) = -\operatorname{arctanh}(\sqrt{x^2+1})$ actually is a primitive of the integrand, but its domain is $\emptyset$. – Sewer Keeper Jun 16 '20 at 7:23

As I said in the comment, the correct representation is the first one.

If we consider $$f\colon (0,+\infty) \to \mathbb R$$ defined as

$$f(x)=\log{\left(\frac{x}{\sqrt{x^2+1}+1} \right)}$$

Then $$f'(x) = \frac{1}{x\sqrt{x^2+1}}$$ for every $$x > 0$$.

The second function

$$g(x) =- \operatorname{arctanh}(\sqrt{x^2+1})$$

One explanation is that if we consider the function $$\tanh(x) = \frac{\mathrm{e}^x - \mathrm{e}^{-x}}{\mathrm{e}^x + \mathrm{e}^{-x}}$$ the image of $$\tanh$$ is the interval $$(-1,1)$$ therefore its inverse function cannot be evaluated for $$\sqrt{x^2+1}$$, because $$\sqrt{x^2+1} \ge 1$$ for every $$x \in \mathbb R$$,

• The antiderivative of a function is determined up to a indefinite constant. The constant need not to be real. Particularly for $x\in\mathbb R; x>0$: $$\log\frac{x}{\sqrt{x^2+1}+1}-\operatorname{arctanh}\sqrt{x^2+1}=i\frac\pi2.$$ In any practical application this constant will play no role. – user Jun 16 '20 at 8:02
• @user This is correct, however the original question is "Are $f$ and $g$ equivalent representations?" and imho the answer is no. The function $f$ is a well defined real function, while the function $g$ is not, so if he is solving an ODE, the function $f$ is the one who I would call a solution. – Sewer Keeper Jun 16 '20 at 8:09
• Ok. This boils down to the question "Are the antiderivatives which differ by a constant equivalent?". Let the asker decide what answer to this question suits his/her purposes. In any case I will upvote your answer for bringing the issue up to discussion. – user Jun 16 '20 at 8:16
• I would say "If $F_1$ and $F_2$ are two antiderivatives of $f(x)$ on $[a,b]$, then it does exist a costant $c \in \mathbb R$ such that $F_1(x) - F_2(x) = c$ for every $x \in [a,b]$" so the function must be 1) Defined in the same interval 2)Real. For example I don't think $\ln(-x^2)$ and $-\ln(x^2)$ are two antiderivatives of $-\frac{2}{x}$ even if $\frac{\mathrm d}{\mathrm d x} \ln(-x^2) = \frac{\mathrm d}{\mathrm d x} - \ln(x^2)$. – Sewer Keeper Jun 16 '20 at 8:26
• The question is exactly about the integration constant. Does it really need to be real? Does the constant play any role in your application (after using initial or/and boundary conditions)? – user Jun 16 '20 at 8:30

Here is the short proof of logarithmic presentation of inverse hyperbolic functions (here $$\operatorname{arctanh} x$$): $$x=\tanh y=\frac{e^{y}-e^{-y}}{e^{y}+e^{-y}}\stackrel{z=e^y}=\frac{z^2-1}{z^2+1}\\ \implies z^2=\frac{1+x}{1-x}\implies y\equiv\boxed{\operatorname{arctanh} x=\frac12\log\frac{1+x}{1-x}.}$$

• The problem is that your definition of $\operatorname{arctanh}$ makes sense if and only if $-1 < x < 1$, and we have $\sqrt{1+x^2}\ge1$ for every $x \in \mathbb R$ – Sewer Keeper Jun 16 '20 at 6:56
• I don't quite understand your point. This is not "my" definition of $\operatorname{arctanh} x$, it is the definition of the function. And if you'd like to have the real function just use: $$\operatorname{arctanh}\frac1{\sqrt{1+x^2}}=\operatorname{arctanh}\sqrt{1+x^2}+i\frac\pi2.$$ – user Jun 16 '20 at 7:42
• Yes sorry, what I mean is that there aren't any $x \in \mathbb R$ such that $\sqrt{x^2+1}$ is inside the domain of $\operatorname{arctanh}$. I think the OP refers to real functions. – Sewer Keeper Jun 16 '20 at 7:47
• As already said for definite integrals it plays no role as the constant $i\frac\pi2$ will cancel. Besides one can use the real function $\operatorname{arctanh}\frac1{\sqrt{1+x^2}}$ instead. – user Jun 16 '20 at 7:54
• In real context I honestly believe it plays a role, since one should define what it mean by $\frac{\mathrm d}{\mathrm d x} \operatorname{i}$. By the way I would say that the function $-\operatorname{arctanh}\left( \frac{1}{\sqrt{1+x^2}}\right)$ is a real solution of the problem. – Sewer Keeper Jun 16 '20 at 8:13

Here is another representation:

$$\int\frac{dx}{x\sqrt{x^2+1}} = \int\frac{dx}{x^2\sqrt{1+\frac{1}{x^2}}} = -\operatorname{arsinh}\left(\frac{1}{x}\right)+C$$

The various representations discussed on this page are not only equivalent, but all obtainable from a substitution. You can get Wolfram Alpha's answer from $$x=\tan t$$, Wolfram Mathematica's from $$u^2-x^2=1$$ & @NinadMunshi's from $$xy=1$$.