Integral of $\int \frac {\sqrt {x^2 - 4}}{x} dx$ I am trying to find $$\int \frac {\sqrt {x^2 - 4}}{x} dx$$
I make $x = 2 \sec\theta$
$$\int \frac {\sqrt {4(\sec^2 \theta - 1)}}{x} dx$$
$$\int \frac {\sqrt {4\tan^2 \theta}}{x} dx$$
$$\int \frac {2\tan \theta}{x} dx$$
From here I am not too sure what to do but I know I shouldn't have x.
$$\int \frac {2\tan \theta}{2 \sec\theta} dx$$
I also know I shouldn't have dx anymore.
$$dx = 2\sec \theta \tan \theta \; \mathrm d\theta$$
$$\int \frac {2\tan \theta}{2 \sec\theta}  2\sec \theta \tan \theta \; \mathrm d\theta$$
$$\int {2\tan^2 \theta}  \; \mathrm d\theta$$
$$2\int {\tan^2 \theta}  \; \mathrm d\theta$$
I have no idea how to find the integral of $\tan^2 \theta$
So I use Wolfram Alpha:
$$\tan \theta - \theta + c$$
Now I need to replace theta with x.
$$x = 2 \sec\theta$$
With same mathmagics I produce
$$ \frac {x}{2} = \sec \theta$$
$$ \theta = \operatorname {arcsec} \left(\frac{x}{2}\right)$$
$$\tan \left(\operatorname {arcsec} \left(\frac{x}{2}\right)\right) - \left(\operatorname {arcsec} \left(\frac{x}{2}\right)\right) + c$$
This is wrong but I am not sure why.

Multiply both top and bottom by $\sqrt{x^2 - 4}$ to obtain
$$
\int\dfrac{x^2 - 4}{x\sqrt{x^2 - 4}}\,\mathrm{d}x=\int\dfrac{x}{\sqrt{x^2 - 4}} + 4\int-\dfrac{1}{x}\dfrac{1}{\sqrt{x^2\left(1 - (2/x)^2\right)}}\,\mathrm{d}x
$$
In the fisrt integral, set $u=x^2-4$ and $x\,\mathrm{d}x = \dfrac{1}{2}\,\mathrm{d}u$ to get
$$
\int\dfrac{x}{\sqrt{x^2-4}}\,\mathrm{d}x = \sqrt{x^2 - 4}+C_0.
$$
In the second, consider $x>2$:
$$
2\int-\dfrac{2}{x^2}\dfrac{\mathrm{d}x}{\sqrt{1 - (2/x)^2}}
$$
Now, set $u=\dfrac{2}{x}$ and $\mathrm{d}u = -\dfrac{2}{x^2}\,\mathrm{d}x$. Then,
$$
\begin{aligned}
2\int-\dfrac{2}{x^2}\dfrac{\mathrm{d}x}{\sqrt{1 - (2/x)^2}} &=2\int\dfrac{\mathrm{d}u}{\sqrt{1 - u^2}} \\
&=2\arcsin u + C_1
\end{aligned}
$$
Adding them up:
$$ \int\dfrac{\sqrt{x^2 - 4}}{x}\,\mathrm{d}x = \sqrt{x^2 - 4} + 2\arcsin\left(\frac{2}{x}\right) + C $$
Note that, if $x<-2$, we would obtain the integral
$$\int\dfrac{\sqrt{x^2 -4}}{x}\,\mathrm{d}x = \sqrt{x^2 - 4}-2\arcsin\left(\dfrac{2}{x}\right)+C, $$
but, since $x<-2$, $-2\arcsin\left(\dfrac{2}{x}\right)>0$, and the sign would become positive.
Therefore, we can write
$$\begin{aligned}
\int\dfrac{\sqrt{x^2 - 4}}{x}\,\mathrm{d}x &= \sqrt{x^2-4}+2\arcsin\left(\dfrac{2}{|x|}\right) + C \\&= \sqrt{x^2-4}+2\operatorname{arccsc}\left(\dfrac{|x|}{2}\right) + C
\end{aligned}
$$
Note that the arbitrary constants are not necessarily the same.
