2cos^2x-1=(1-tan^2x)/(1 + tan^2x)
Convert tanx to sinx/cosx, and remember that sin^2x = 1 - cos^2x. It works out nicely.