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

This is from the problem calculating the arc length of $y=\log{x}$.
I tried $x = \sinh{t}$ or $\frac{1}{x} = \tan{t}$ but all failed.
 A: Hint (For $x > 0$) we can rewrite this as $$\int \frac{\sqrt{1 + x^2}}{x} dx.$$
The radical expression $\sqrt{1 + x^2}$ suggests using the substitution $x = \tan \theta$, $dx = \sec^2 \theta \,d\theta$ or the substitution $x = \sinh t$, $dx = \cosh t \,dt$
A: If we wish, we can avoid trigonometric or hyperbolic function substitution. For we want 
$$\int \frac{x\sqrt{x^2+1}}{x^2}\,dx.$$
Let $u^2=x^2+1$. Then $u\,du=x\,dx$, and our integral becomes
$$\int \frac{u^2}{u^2-1}\,du.$$
Note that $\frac{u^2}{u^2-1}=1+\frac{1}{u^2-1}$, and use partial fractions.
A: Integrate by parts
\begin{align}\int \sqrt{1 + \frac{1}{x^2}}\ dx
=x\sqrt{1 + \frac{1}{x^2}}+\int \frac{dx}{x^2 \sqrt{1 + \frac{1}{x^2}}}
=x\sqrt{1 + \frac{1}{x^2}}-\sinh^{-1}\frac1x
\end{align}
A: Let $x=\sinh t$, then $dx=\cosh t \, dt$
\begin{align*}
  \int \frac{\sqrt{1+x^{2}}}{x} \,dx &=
  \int \frac{\cosh t}{\sinh t} \cosh t \, dt \\ &=
  \int \frac{1+\sinh^{2} t}{\sinh t} \, dt \\ &=
  \int (\sinh t+\operatorname{csch} t) \, dt \\ &=
  \cosh t+\int \frac{dt}{2\sinh \frac{t}{2} \cosh \frac{t}{2}} \\ &=
  \cosh t+\int \frac{\operatorname{sech}^{2} \frac{t}{2} \, dt}
                    {2\tanh \frac{t}{2}} \\ &=
  \cosh t+\int \frac{d(\tanh \frac{t}{2})}
                    {\tanh \frac{t}{2}} \\ &=
  \cosh t+\ln \left| \tanh \frac{t}{2} \right|+C \\ &=
  \cosh t+\ln \left| \frac{\cosh x-1}{\sinh x} \right|+C \\ &=
  \sqrt{1+x^{2}}+\ln \left| \frac{\sqrt{1+x^{2}}-1}{x} \right|+C
\end{align*}
A: If $x>0$,
$$\begin{align*}
I&=\int \sqrt{1 + \frac1{x^2}} \, dx \\
&= \int \frac{\sqrt{x^2+1}}{x} \, dx\\
&= -\frac12 \int \frac{(1+t^2)^2}{t^2(1-t^2)}\,dt \\
&= \int \frac{(1+u^2)^2}{u(1-u^2)^2}\,du
\end{align*}$$
by either substituting
$$t=\sqrt{1+x^2}-x \implies x=\frac{1-t^2}{2t} \implies dx = -\frac{1+t^2}{2t^2}\,dt$$
or
$$u=\frac{\sqrt{x^2+1}-1}x \implies x=\frac{2u}{1-u^2} \implies dx = 2\frac{1+u^2}{(1-u^2)^2}\,du$$
