cosx = 2cos^2(x/2) - 1