Indefinite integral of secant cubed $\int \sec^3 x\>dx$ I need to calculate the following indefinite integral:
$$I=\int \frac{1}{\cos^3(x)}dx$$
I know what the result is (from Mathematica):
$$I=\tanh^{-1}(\tan(x/2))+(1/2)\sec(x)\tan(x)$$
but I don't know how to integrate it myself. I have been trying some substitutions to no avail. 
Equivalently, I need to know how to compute:
$$I=\int \sqrt{1+z^2}dz$$
which follows after making the change of variables $z=\tan x$.

It appears that Mathematica is using the "universal change" for trigonometric integrals $\tan(x/2)=t$:
http://en.wikibooks.org/wiki/Calculus/Integration_techniques/Tangent_Half_Angle.
