Computing the integral $\int \frac{dx}{x\sqrt {x^2+1}}$

I've got an indefinite integral:

$$\int \frac{dx}{x\sqrt {x^2+1}}$$

Using trig substitution this is what I've got

Let $x = \tan{z}$ so $\mathrm dx = \sec^2{z}$

\begin{align} \\ \int \frac{1}{\tan{z} \sqrt{\tan^2{z} + 1}}\sec^2{z}\;\mathrm dz &= \int \frac{1}{\tan{z}\sqrt{\sec^2{z}}} \sec^2{z}\;\mathrm dz \\ &= \int \frac{1}{\tan{z}\sec{z}}\sec^2{z} \;\mathrm dz \\ &= \int\frac{1}{\tan{z}}\sec{z} \;\mathrm dz \\ &= \int \frac{\sec{z}}{\tan{z}}\;\mathrm dz \\ &= \int \csc{z} \;\mathrm dz \\ &= -\log{\left(\big|\csc{z} + \cot{z}\,\big|\right)} + C \\ \end{align}

So now my questions are:

1. Is this correct?
2. Should I give it back to the $x$, considering that $z=\arctan{x}$

I'll be glad if someone can help me.

• You mean to have $\sqrt{x^2 + 1}$ in the denominator of the integrand? Commented Mar 28, 2018 at 1:09
• @KajHansen Indeed, I'm not pretty good with Tex yet, allow me. Commented Mar 28, 2018 at 1:11

Yes, this is correct, and yes you should write it back in terms of $$x$$, as the original problem has the integration variable as $$x$$.

I, personally, would have gone with substituting $$\sqrt{x^2+1}$$ like so:

$$u = \sqrt{x^2+1}\quad x^2= u^2 - 1\quad\mathrm du = {x\over u}\mathrm dx\quad \mathrm dx={u\over x}\mathrm du$$

Then:

$$\require{cancel}\int {\mathrm dx\over x\sqrt{x^2+1}} = \int\frac 1{x\cancel{u}} {\cancel{u}\over x}\mathrm du = \int\frac {1}{x^2} \mathrm du = \int \frac 1{u^2-1}\mathrm du$$

Then finish using fraction decomposition.

$$\displaystyle \int \frac{d x}{x \sqrt{x^{2}+1}} =\int \frac{1}{x^{2}} d\left(\sqrt{x^{2}+1}\right) =\int \frac{1}{\left(\sqrt{x^{2}+1}\right)^{2}-1}d\left(\sqrt{x^{2}+1}\right)=\frac{1}{2} \ln \left| \frac{\sqrt{x^{2}+1}-1}{\sqrt{x^{2}+1}+1}\right|+C$$