My attempt is as follows:-
Derivative of $\sec^{-1}x$
Let $\theta=\sec^{-1}x,$ where $\theta\in [0,\pi]-{\dfrac{\pi}{2}}.$
$$\sec\theta=x.$$
Differentiating both sides with respect to $x:$
$$\sec\theta\cdot\tan\theta\cdot\dfrac{\mathrm d\theta}{\mathrm dx}=1\\ \dfrac{\mathrm d\theta}{\mathrm dx}=\dfrac{1}{x\sqrt{x^2-1}}.$$
As $\sec^{-1}x$ is a strictly increasing function, its derivative should be positive, hence we write $x$ as $|x|$ to ensure that $\dfrac{\mathrm d\theta}{\mathrm dx}$ will not be negative if $x$ is negative. But I wonder why I didn't get $\dfrac{\mathrm d\theta}{\mathrm dx}=\dfrac{1}{|x|\sqrt{x^2-1}}$ in the above calculation?
Integral of $\dfrac{1}{x\sqrt{x^2-1}}$
Case $1:x>0$
Then the integral is definitely $\sec^{-1}x.$
Case $2: x<0$
Then the integral is $-\sec^{-1}x.$
But many textbooks write that $\displaystyle\int\frac{1}{x\sqrt{x^2-1}}\,\mathrm dx=\sec^{-1}x+C.$
Shouldn't $\displaystyle\int\frac{1}{|x|\sqrt{x^2-1}}\,\mathrm dx=\sec^{-1}x+C\:?$ What am I missing here?