I've been struggling with the integral of 1/cosx
I tried integration by parts but ended up with an even more complicated integral (xtanx/cosx)
Or use the Weierstrass sub. (Also see the cosec example above it, for step-by-step.)
Don't integrate - balloontegrate!
Balloon Calculus; standard integrals, derivatives and methods
Balloon Calculus Drawing with LaTeX and Asymptote!
In terms of sines and cosines:
Now make the substitution so that and the integral becomes
Now if you make the substitution so that then the integral becomes
Now applying partial fractions: