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 
 A: You're almost there.  Note that with $u=\sin(t)$ and $z=\tan(t)$, we have
$$\begin{align}
-\frac12\left(\log(|u-1|)-\log(|u+1|) \right)&=\frac12\log\left(\left|\frac{1+\sin(t)}{1-\sin(t)}\right|\right)\\\\
&=\frac12\log\left(\left|\frac{(1+\sin(t))^2}{1-\sin^2(t)}\right|\right)\\\\
&=\log\left(\left|\frac{1+\sin(t)}{\cos(t)}\right|\right)\\\\
&=\log(|\sec(t)+\tan(t)|)\\\\
&=\log(|z+\sqrt{1+z^2}|)
\end{align}$$
as was to be shown!
A: A better substitution is $z=\sinh t$, $\;\mathrm d\mkern 1mu z =\cosh t\,\mathrm d\mkern 1mu t$:
$$\int\frac{\mathrm d\mkern 1mu z}{\sqrt{1+z^2}}=\int\frac{\cosh t\,\mathrm d\mkern 1mu t}{\sqrt{1+\sinh^2t}}=\int\frac{\cosh t\,\mathrm d\mkern 1mu t}{\cosh t}=t=\operatorname {argsinh}z=\ln\bigl(z+\sqrt{z^2+1}\bigr).$$
A: 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*}$$
