Solution:
We use integration by parts:
∫f(x)g(x)dx=f(x)∫g(x)dx−∫[f′(x)∫g(x)dx]dx
Take x as the first function and sec2x as the second function.
∫xsec2xdx=xtanx−∫1⋅tanxdx
Since ∫tanxdx=log∣secx∣=−log∣cosx∣,
∫xsec2xdx=xtanx−log∣secx∣+C
Therefore,
∫xsec2xdx=xtanx+log∣cosx∣+C