<s>[INST] 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.
 [/INST] 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*}
</s>