Firstly, use the trigonometric formula tan2x = sec2x - 1, which you can easily derive from sin2x + cos2x =1, by dividing both sides by cos2x and re-arranging. Now, you should remember that differentiating tan x gives sec2x. Therefore, the opposite is true for integration, integrating sec2x gives tan x. Also, differentiating x gives 1, hence, integrating 1 gives x. With this knowledge you can express tan2x as sec2x - 1 and integrate it to give tan x -x +C.