Help evaluating $ \int \frac {\sqrt{x^2-1}}x \ dx$ Before anything, I'd like to clarify that I have no background in calculus (I'm still in school). I only try to learn calculus as a hobby. Please be gentle.
I'm trying to evaluate the aforementioned integral but the answer I got doesn't seem to match with 3 sources different sources that I found online. My process was to substitute in $x = \sec u, \ dx = \tan u\sec u\, du$. This led me to the answer $\tan (\mathrm{arcsec}\ x) - \mathrm{arcsec}\ x$. However after trying to check my answer I saw that WolframAlpha says it's $\arctan \left(\frac 1{\sqrt{x^2-1}}\right) + \sqrt{x^2-1}$, Symbolab says it's $-\arctan (\sqrt{x^2-1}) +  \sqrt{x^2-1}$, and this video says it's $-\mathrm{arcsec} \,x + \sqrt{x^2-1}$.
I plotted all four results on a graph. Symbolab and WolframAlpha only differ by a constant so I assume that both of them have the correct result whereas the video and I have the wrong ones. Also it can be seen that all the results are the same on the positive side of the x axis but things break down on the negative side.
My final questions are: 


*

*Where did the video creator and I go wrong?

*What is happening on the negative x axis?


EDIT: It seems this post might be a duplicate of this one. I hope this post doesn't get removed because I believe what I asked is a bit different from what was asked there. EDIT 2: Upon further inspection, I guess it's reasonable for this post to be removed.
 A: *

*With $\tan t=\sqrt{\sec^2t-1}$ your answer is
$$\tan (\mathrm{arcsec}\ x) - \mathrm{arcsec}\ x=- \mathrm{arcsec}\ x+ \sqrt{x^2-1}+\color{blue}{C}=-\arctan \sqrt{x^2-1} + \sqrt{x^2-1}+\color{blue}{C}$$

*From $\arctan\dfrac1t=\dfrac{\pi}{2}-\arctan t$ we have
$$\arctan \left(\frac 1{\sqrt{x^2-1}}\right) + \sqrt{x^2-1}+\color{blue}{C}=-\arctan \sqrt{x^2-1} + \sqrt{x^2-1}+\color{blue}{C}+\dfrac{\pi}{2}$$

*I didn't see the video, but $-\mathrm{arcsec} (\sqrt{x^2-1}) + \sqrt{x^2-1}$ is wrong.



Edit:


*

*For $x>0$, $\mathrm{arcsec}\ x=\arctan \sqrt{x^2-1}$.

*For $x<0$, $\mathrm{arcsec}\ x=\color{red}{-}\arctan \sqrt{x^2-1}\color{red}{+\pi}$. This caused your graph be negative with a $\color{red}{\pi}$ shift.

A: This is a good question, and ultimately it's about a subtle point in trigonometry more than calculus.
As you already know, the occurrence of the expression $\sqrt{x^2 - 1}$ suggests the substitution $$x = \sec \theta, \qquad dx = \sec \theta \tan \theta \,d\theta. $$
Here's the first subtlety: There are many values of $\theta$ satisfying $x = \sec \theta$ for any $x \in (-\infty, -1] \cup [1, \infty)$, but we can force a unique choice by requiring $\theta \in [0, \pi] - \{\frac{\pi}{2}\}$. This is how $\operatorname{arcsec}$ is usually defined---it is the inverse of the restriction of $\sec$ to that set, and so by definition $\theta = \operatorname{arcsec} x$.
Now, in the computation, the video uses (and presumably you used) a reference triangle to show that $\sqrt{x^2 - 1} = \tan \theta$. And indeed, this is true for the angles that can occur in the reference triangle, namely those in $[0, \frac{\pi}{2})$, for which $\tan \theta$ is always positive. But in general $\sqrt{x^2 - 1} = \sqrt{\sec^2 \theta - 1} = |\tan \theta|$, and we cannot ignore the absolute value for negative values of $\tan \theta$, which occur for the possible values $\theta \in (\frac{\pi}{2}, \pi]$.
So, if we restrict the integrand to positive $x$, then $\theta \in [0, \frac{\pi}{2})$, so $\tan \theta \geq 0$ and $\sqrt{x^2 - 1} = \tan \theta$, so our integral is
$$\int \frac{\sqrt{x^2 - 1} \,dx}{x} = \int \frac{\tan \theta \cdot \sec \theta \tan \theta \,d\theta}{\sec \theta} = \int \tan^2 \theta \,d\theta = \tan \theta - \theta + C .$$ Substituting back gives
$$\sqrt{x^2 - 1} - \operatorname{arcsec} x + C ,$$
as expected.
On the other hand, if we restrict the integrand to negative $x$, then $\theta \in (\frac{\pi}{2}, \pi]$, so $\tan \theta \leq 0$ and thus $\sqrt{x^2 - 1} = -\tan \theta$, so the integral is
$$\int \frac{\sqrt{x^2 - 1} \,dx}{x} = \int \frac{-\tan \theta \cdot \sec \theta \tan \theta \,d\theta}{\sec \theta} = -\int \tan^2 \theta \,d\theta = -\tan \theta + \theta + C' ,$$
and substituting back now gives
$$\sqrt{x^2 - 1} + \operatorname{arcsec} x + C' .$$
We can unify these answers and reconcile them with the correct answers given in the question: Carefully unwinding definitions gives that for $x \geq 1$, $\operatorname{arcsec} x = \arctan \sqrt{x^2 - 1}$ but that for $x \leq -1$, $\operatorname{arcsec} x = \pi - \arctan \sqrt{x^2 - 1}$, so by absorbing $\pi$ into the constant we can write the antiderivative for both positive and negative $x$ simultaneously as
$$\boxed{\sqrt{x^2 - 1} - \arctan \sqrt{x^2 - 1} + C} .$$
The appearance of the term $\arctan \frac{1}{\sqrt{x^2 - 1}}$ in one of the answers arises from the identity $\arctan u + \arctan \frac{1}{u} = \pm \pi$, where the sign $\pm$ is the sign of $u$.
A: Let $x=\sqrt{u^2+1}$. We have
$$\int\frac{\sqrt{x^2-1}}{x}dx=\int\frac{u}{\sqrt{u^2+1}}\frac{u}{\sqrt{u^2+1}}du=\int\left(1-\frac1{u^2+1}\right)du=u-\arctan u+C.$$

Note that $-\arctan u$ and $\arctan\dfrac1u$ only differ by a constant.
