Integral of $\int \frac{\sqrt{x^2-1}}{x}dx$ 
Evaluate the integral of $$\int \frac{\sqrt{x^2-1}}{x}dx$$

Attempt: I've tried taking $x=\sec y$,
$$ \int \frac{\sqrt{\sec^2y-1}}{\sec y}dx $$
How to proceed further?
 A: $$\int \:\frac{\sqrt{x^2-1}}{x}dx$$
Let $u=\:\sqrt{x^2-1}$ then
$$\frac{du}{dx}=\frac{x}{\sqrt{x^2-1}}\iff dx=\frac{\sqrt{x^2-1}}{x}\:du$$
Thus
\begin{align*}
\int \:\frac{\sqrt{x^2-1}}{x}dx& =\int \:\frac{u^2}{u^2+1}du\\
&=\int \:\frac{u^2 + 1 - 1}{u^2+1 + 1 - 1}du\\
&=\int \:\left(\frac{u^2+1}{u^2+1}-\frac{1}{u^2+1}\right)du\\
&=\int \:\left(1-\frac{1}{u^2+1}\right)du\\
&=u-\arctan \left(u\right)+C\\
&=\:\sqrt{x^2-1}-\arctan \left(\:\sqrt{x^2-1}\right)+C
\end{align*}
A: The answer is $$\int \frac{\sqrt{x^{2}-1}}{x}{\rm d}x= \sqrt{x^{2}-1}-\arctan\left( \sqrt{x^{2}-1}\right)+C.$$
In the integral perform the change of variable $x=\sec u$,
\begin{align*}
\int\frac{\sqrt{x^{2}-1}}{x}{\rm d}x&= \int \frac{\sqrt{\sec^{2}u-1}}{\sec u}\tan u\sec u{\rm d}u\\
&=\int \tan u \tan u{\rm d}u\\
&=\int \tan^{2} u{\rm d}u\\
&=\int \sec^{2}u -1 {\rm d}u\\
&=\tan(u)-u+C
\end{align*}
Therefore,
\begin{align*} \int \frac{\sqrt{x^{2}-1}}{x}{\rm d}x&=\tan(u)-u+C\\ &= \tan\left( \sec^{-1}(x)\right)-\sec^{-1}(x)+C\\ &=\sqrt{x^{2}-1}-\sec^{-1}(x)+C\\ &=\boxed{\sqrt{x^{2}-1}-\arctan\left( \sqrt{x^{2}-1}\right)+C} \end{align*}
A: $$
\begin{aligned}
\int \frac{x^{2}-1}{x \sqrt{x^{2}-1}} d x &=\int \frac{x^{2}-1}{x^{2}} d \sqrt{x^{2}-1} \\
&=\int 1 d\left(\sqrt{x^{2}-1}\right)-\int \frac{d \sqrt{x^{2}-1}}{\left(\sqrt{x^{2}-1}\right)^{2}+1} \\
&=\sqrt{x^{2}-1}-\operatorname{arctan}\left(\sqrt{x^{2}-1}\right)+C
\end{aligned}
$$
A: You replaced $x=\sec(y),$ but now you must also replace $\mathrm{d}x=\sec(y)\tan(y)\,\mathrm{d}y,$ so the function being antidifferentiated becomes $\sqrt{\sec(y)^2-1}\tan(y)=\sqrt{\tan(y)^2}\tan(y)=\tan(y)^2.$ However, this substitution only gets you the antiderivative for $x\gt1.$ For $x\lt-1,$ you need a different substitution, $x=-\sec(y),$ so that the function being antidifferentiated becomes $-\tan(y)^2.$ Also, for both parts of the domain, you need different constants of antidifferentiation, since they are disconnected.
$\tan(y)^2$ and $-\tan(y)^2$ should not be difficult to antidifferentiate if you use the fact that $\tan(y)^2=\sec(y)^2-1.$
