Dealing with absolute values after trigonometric substitution in $\int \frac{\sqrt{1+x^2}}{x} \text{ d}x$. I was doing this integral and wondered if the signum function would be a viable method for approaching such an integral. I can't seem to find any other way to help integrate the $|\sec \theta|$ term in the numerator of the integrand.
$$ \begin{aligned} \int \dfrac{\sqrt{x^2 + 1}}{x} \text{ d}x \ \ & \overset{x=\tan \theta}= \int \dfrac{\sqrt{\sec^2 \theta} \sec^2 \theta}{\tan \theta} \text{ d}\theta \\ & \ \ = \int \dfrac{|\sec \theta| \sec^2 \theta}{\tan \theta} \text{ d}\theta \\ & \ \ = \int \dfrac{\text{sgn} (\sec \theta) \sec^3 \theta}{\tan \theta} \text{ d}\theta \\ & \ \ = \text{sgn} (\sqrt{1+x^2}) \left( - \log \left| \dfrac{\sqrt{1+x^2} + 1}{x} \right| + \sqrt{1+x^2} \right) + \mathcal{C} \end{aligned} $$
It's clear that $\text{sgn} (\sqrt{1+x^2}) = 1$ since the sign of the argument of that function is always positive and the signum function extracts the sign. So I'd leave the integral as: $$ \begin{aligned} \int \dfrac{\sqrt{x^2 + 1}}{x} \text{ d}x = \log \left| x \right| - \log \left( \sqrt{1+x^2} + 1 \right) + \sqrt{1+x^2} + \mathcal{C} \end{aligned} $$
Would that be ok?
Also, apparently Wolfram has suggested that my final result should have $x$ as opposed to $|x|$ in the argument of the first logarithm. Why is that?
Any help would be greatly appreciated!
 A: I want to share with you my method using rationalization. $$
\begin{aligned}
& \int \frac{\sqrt{x^{2}+1}}{x} d x \\
=& \int \frac{x^{2}+1}{x \sqrt{x^{2}+1}} d x \\
=& \int \frac{x^{2}+1}{x^{2}} d\left(\sqrt{x^{2}+1}\right) \\
=& \int\left(1+\frac{1}{x^{2}}\right) d\left(\sqrt{x^{2}+1}\right) \\
=& \int 1 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) \\
=& \sqrt{x^{2}+1}+\frac{1}{2} \ln \left|\frac{\sqrt{x^{2}+1}-1}{\sqrt{x^{2}+1}+1}\right|+C
\end{aligned}
$$
Wish you enjoy the solution!
A: $ x = \sinh u$ 
$$S = \int \frac{\sqrt{1+x^2}}{x}\mathbb{d}x = \int \frac{\cosh^2 u}{\sinh u }\mathbb{d}u = \int \Big\{\mathbb{csch}\ u +\sinh u \Big\}\mathbb{d}u \\
           =-\ln\Big(\mathbb{csch}\ u +\mathbb{coth}\  u\Big)+\cosh u + C\\    
$$
$$\cosh \sinh^{-1} x = \frac{1}{2}\bigg\{x+\sqrt{x^2+1} + \frac{1}{x+\sqrt{x^2+1}}\bigg\} = \sqrt{1+x^2} $$
$$S= \ln x +\sqrt{1+x^2} -\ln\Big(1+\sqrt{x^2+1}\Big)+C $$
Clearly it's simply a convenience to have $|x|$. 
A: I think you are correct. The Wolfram answer is only defined for $x>0$, whereas $\dfrac{\sqrt{x^2+1}}{x}$ has an antiderivative for $x<0$ as well.
A: To avoid absolute values
\begin{align}
\int \frac{\sqrt{1+x^2}}{x} dx
= &\int \frac x{\sqrt{1+x^2}} + \frac 1{x\sqrt{1+x^2}} \ dx\\
=&\ \sqrt{1+x^2} - \text{coth}^{-1}\sqrt{1+x^2}
\end{align}
which is valid for all domain $x$.
