How to get the same answer for integral $\int\frac{dz}{\sqrt{1+z^2}}$ as in textbook I have some answer:
$$\int\frac{dz}{\sqrt{1+z^2}}=\ln ( z + \sqrt {1 + z^2})+C$$
But I can't get the same expression. So here what I've done and got stuck. How can I get the same answer? 
\begin{align}
& \int\frac{dz}{\sqrt{1+z^2}}=\left\{z=\tan t, \ dz=\frac{dt}{\cos^2 t} \right\} = \int\frac{dt}{\cos^2 t\sqrt{1+\tan^2 t}} \\[10pt]
= {} & \left\{\sqrt{1+\tan^2 t}=\frac{1}{\cos t}\right\}=\int\frac{\cos t \ dt}{\cos^2 t} \\[10pt]
= {} & \left\{\cos t \ dt= d\sin t, \cos^2 t=1-\sin^2 t\right\}=\int\frac{d\sin t}{1-\sin^2 t} \\[10pt]
= {} &\{\sin t=u\}=\int\frac{d u}{1-u^2}=-\int\frac{du}{u^2-1}=-\frac{1}{2} \int\left(\frac{1}{u-1}-\frac{1}{1+u}\right)\,du \\[10pt]
= {} &-\frac{1}{2}(\ln |u-1|-\ln|u+1|)+C
\end{align}
From here I don't understand how to get the answer above. Need help 

I'm not sure about how obvious this seems, but you can just make the direct substitution $z=x+\sqrt{1+x^2}$ in$$\int\frac {\mathrm dx}{\sqrt{1+x^2}}$$
Because$$\frac {\mathrm dz}{\mathrm dx}=1+\frac {x}{\sqrt{1+x^2}}=\frac {z}{\sqrt{1+x^2}}$$
This can be noted because the derivative of $\sqrt{1+x^2}$ is $x/\sqrt{1+x^2}$, and if you add one, you get$$1+\frac x{\sqrt{1+x^2}}=\frac {x+\sqrt{1+x^2}}{\sqrt{1+x^2}}$$which is just the derivative of the original function. Therefore, by substitution, we have the integral as$$\begin{align*}\int\frac {\mathrm dx}{\sqrt{1+x^2}} & =\int\frac {\mathrm dz}{\sqrt{1+x^2}}\frac {\mathrm dx}{\mathrm dz}\\ & =\int\frac {\mathrm dz}{\sqrt{1+x^2}}\frac {\sqrt{1+x^2}}{z}\\ & =\log z+C\end{align*}$$
