Proof of integral involving the inverse hyperbolic secant and cosent We know that $$ \int \frac{dx}{x \sqrt{a^2 \pm x^2} } = -\frac{1}{a} \ln \frac{a+ \sqrt{a^2 \pm x^2}}{\lvert x\rvert }+C$$
I tried proving this integral setting $x = a \ \mathrm{csch} \ u $ and using substitution (and assuming that $u$ and $a$ are both greater than zero), but that got me all the right answers without the absolute value symbol at the $x$. How/why is the absolute value symbol included? It would be great if you could show the whole proof process.

Consider the addition case. First use $x = a \text{ csch} u $ and $dx = -a \text{ csch} u \text{ coth} u du$
\begin{align}
\int \frac{dx}{x\sqrt{a^2 + x^2}} &= \int \frac{-a (\text{ csch} u) (\text{ coth} u) du}{(a \text{ csch} u)(a \text{ coth} u)}\\
&= -\int \frac{1}{a} du\\
&= -\frac{1}{a}u + c\\
&= - \frac{1}{a}\text{ arcsch} \frac{x}{a} + c\\
&= -\frac{1}{a} \ln \Bigg(\frac{1}{\frac{x}{a}} + \sqrt{\frac{1}{\frac{x^2}{a^2}} + 1}\Bigg) + c\\
&= \frac{-1}{a} \ln\bigg(\frac{a}{x} + \sqrt{\frac{a^2}{x^2} + 1}  \bigg) + c\\
&= \frac{-1}{a} \ln\bigg(\frac{a}{x} + a\sqrt{\frac{1}{x^2} + \frac{1}{a^2}}\bigg)+ c\\
&= \frac{-1}{a} \ln\bigg(\frac{a}{x} + a\sqrt{\frac{a^2 + x^2}{a^2x^2}}  \bigg) + c
\end{align}
Its in that step where the absolute value is introduced, as the square root of $a^2 x^2$ will be positive.
This yields
\begin{equation}
\int \frac{dx}{x\sqrt{a^2 + x^2}} = \frac{1}{-a}\ln \bigg(\frac{a}{x} + \frac{\sqrt{a^2 + x^2}}{|x|} \bigg)
\end{equation}
You can do the same for the negative case.
