After using a basic trig identity, this integral becomes a simple case of integration by parts.
Note that #x/cos^2(x)=x*1/cos^2(x)=xsec^2(x)#. That means we can rewrite the integral as #intxsec^2(x)dx#. Because #x# and #sec^2(x)# are being multiplied, we use integration by parts, which tells us:
#intudv=uv-intvdu#
In other words, we make a relatively complicated integral like #intxsec^2(x)dx# simpler. The only difficulty is choosing our #u# and #dv#. In this case, #u=x# and #dv# equals everything else, namely #sec^2(x)dx# (when dealing with algebra and trig functions in integration by parts, always choose the algebraic function as your #u#). Now we find #du# and #v#:
#u=x=>(du)/dx=1=>du=dx#
#dv=sec^2(x)dx=>intdv=intsec^2(x)dx=>v=tan(x)#
We can ignore the constant of integration in this case.
Now we know #u=x#, #du=dx#, #v=tan(x)#. Plugging these in to the integration by parts formula, we have:
#intxsec^2(x)dx=xtan(x)-inttan(x)dx#
We could do #inttan(x)dx#, but that would be a waste of time because there is a far easier way: consult a table of integrals! After doing so, we find the result is either #lnabs(sec(x))# or #-lnabs(cos(x))# (both are the same thing). I'm going to use #-lnabs(cos(x))#.
#intxsec^2(x)dx=xtan(x)-(-lnabs(cosx))+C#
#=xtan(x)+lnabs(cosx)+C#
And that is our final answer.