Solving the integral $\int\frac{1}{\sqrt{x^2+1}}\,dx$ I need to solve
$$\int\frac{1}{\sqrt{x^2+1}}$$
but I'm nowhere near the solution. I tried substituting 
$u = x^2 + 1$ 
such that $dx = \frac{1}{2x}$
yielding
$$\int u^{-1/2} du = \frac{1}{2x}\frac{u^{1/2}}{1/2}=\frac{\sqrt{u}}{x} =\frac{\sqrt{x^2+1}}{x}$$
but this is nothing near the solution of
$$\int\frac{1}{\sqrt{x^2+1}} = ln|\sqrt{x^2+1}+x|+C$$

Hint: Substituting $$x=\tan(t)$$ then we get $$x^2+1=\tan^2(t)+1=\frac{\sin^2(t)+\cos^2(t)}{\cos^2(t)}=\frac{1}{\cos^2(t)}$$
and $$dx=(\tan^2(t)+1)dt$$
