<s>[INST] Integrate $\int\frac{dx}{x\sqrt{x^2+1}}$ I would like to ask for some help regarding the following indefinite integral, tried integration by parts and trigonometric substitution which both brought me to $\int\frac{\sec\theta}{\tan\theta}d\theta$, and from this point it is messy to integrate by parts, any help would be appreciated.
$$\int\frac{dx}{x\sqrt{x^2+1}}$$
 [/INST] $\displaystyle\int\frac{dx}{x\sqrt{x^{2}+1}}$
$\displaystyle z^{2}=x^{2}+1\Rightarrow 2zdz=2xdx\Rightarrow xzdz=x^{2}dx=
(z^{2}-1)dx$
$\displaystyle\Rightarrow \frac{dz}{z^{2}-1}=\frac{dx}{xz}$
$\displaystyle\int\frac{dx}{x\sqrt{x^{2}+1}}=\int\frac{dz}{z^{2}-1}=\frac{1}{2}\int(\frac{1}{z-1}-\frac{1}{z+1})dz$
$\displaystyle\int\frac{dx}{x\sqrt{x^{2}+1}}=\frac{1}{2}ln\left| \frac{\sqrt{x^{2}+1}-1}{\sqrt{x^{2}+1}+1} \right|+c$
</s>