This can be done with integration by substitution. If we let u=tanx then du/dx=sec^2(X). If we substitute U into the integrand we get it being u(sec^2(X))dx. rearranging the du/dx equation to make dx the subject and we get dx=1/(sec^2(x)) du and so subbing this into the equation we see the sec^2(x) cancel. This leaves the integral of udu, which gives 1/2(u^2) + c, which is (1/2)tan^2(x) + c when subbing u=tan(x) back in.