The previous method is the one usually shown in calc texts. It just uses a clever substitution to hammer it into something we can work with.
Here is another way I just thought up
\(\displaystyle \int sec(x)dx\)
\(\displaystyle \int\frac{1}{cos(x)}dx\)
Multiply top and bottom by cos(x):
\(\displaystyle =\int\frac{cos(x)}{cos^{2}(x)}dx\)
\(\displaystyle =\int\frac{cos(x)}{1-sin^{2}(x)}dx\)
Now, let \(\displaystyle u=sin(x),\;\ du=cos(x)dx\)
\(\displaystyle \int\frac{1}{1-u^{2}}du\)
\(\displaystyle \frac{1}{2}\left[\int\frac{1}{1+u}+\int\frac{1}{1-u}\right]du\)
\(\displaystyle \frac{1}{2}\left[\int\frac{1}{u+1}-\int\frac{1}{u-1}\right]du\)
\(\displaystyle =\frac{1}{2}ln(\frac{u+1}{u-1})\)
\(\displaystyle \frac{1}{2}ln(\frac{sin(x)+1}{sin(x)-1})\)
Here, I thought I was stuck. But hammering away at the identity, it does indeed work.
Continuing:
\(\displaystyle \frac{sin(x)+1}{sin(x)-1}\cdot\frac{sin(x)+1}{sin(x)+1}=\frac{(sin(x)+1)^{2}}{sin^{2}(x)-1}=\frac{(sin(x)+1)^{2}}{-cos^{2}(x)}\)
Because of the absolute value, we can shed the negative in the denominator in \(\displaystyle -cos^{2}(x)\) and write:
\(\displaystyle \frac{1}{2}ln\left(\frac{(sin(x)+1)^{2}}{cos^{2}(x)}\right)\)
Property of logs:
\(\displaystyle =ln\left(\frac{sin(x)+1}{cos(x)}\right)=ln(tan(x)+sec(x))\)
Is that acceptable, SK?.
I was thinkin', perhaps another way would be to note that \(\displaystyle sec(x)=\frac{2}{e^{ix}+e^{-ix}}\) and use complex integration.