Q: How do we integrate $\int \frac{1}{x\sqrt{x^2+a^2}}\mathrm{d}x$? I would appreciate it if someone explained to me how to integrate
$$\int \frac{1}{x\sqrt{x^2+a^2}}\mathrm{d}x$$
For context, I am a physics major who is integrating an electric field expression for a straight line of charge, but I do not know the correct method to integrate such an expression.

A: Pull out an $x$ from the square root
$$\int \frac{dx}{x^2\sqrt{1+\frac{a^2}{x^2}}} = \int \frac{-1}{\sqrt{1+a^2\left(\frac{1}{x}\right)^2}}\:d\left(\frac{1}{x}\right)$$
From here the substitution becomes obvious
$$\frac{1}{x} = \frac{\sinh t}{a} \implies d\left(\frac{1}{x}\right) = \frac{\cosh t}{a}\:dt$$
which means the integral is simply
$$\int \frac{-\cosh t}{a\cosh t}\:dt = -\frac{t}{a} + C = -\sinh^{-1}\left(\frac{a}{x}\right)+C$$

A: HINT
You can either apply the substitution $x = a\sinh(u)$ or $x = a\tan(u)$. Let us stick with the first option:
\begin{align*}
\int\frac{\mathrm{d}x}{x\sqrt{x^{2}+a^{2}}} = \frac{1}{a}\int\frac{\mathrm{d}u}{\sinh(u)} = \frac{1}{a}\int\frac{\sinh(u)}{\sinh^{2}(u)}\mathrm{d}u = \frac{1}{a}\int\frac{\sinh(u)}{\cosh^{2}(u) - 1}\mathrm{d}u
\end{align*}
Then you can apply the partial fraction method to the last integral.
Can you take it from here?

A: Hint: Let $I=\int \frac{1}{x\sqrt{x^2+a^2}}\mathrm{d}x$; Substitute $x=a\tan \theta\implies dx=a\sec^2\theta d\theta$ so 
$I=\frac 1a \int \operatorname {cosec} \theta  d\theta=\frac 1a \ln|\tan \frac \theta 2|+c$ 
Can you take it from here?
