Let x=π/6, 2x=π/3 and tan(π/3)=√3. cos(4x)=cos(2π/3)=-½. 1+tan2(2x)=1+3=4; 1-tan2(2x)=1-3=-2.
Therefore (1-tan2(2x))/(1+tan2(2x))=-2/4=-½=cos(4x), not 2cos(4x).
1+tan2A≡sec2A=1/cos2A (trig identity) for all angles A. Therefore the denominator becomes sec2(2x)=1/cos2(2x).
We multiply the numerator by cos2(2x) to get cos2(2x)-sin2(2x)≡cos(2×2x)=cos(4x) (trig identity: cos(2A)=cos2A-sin2(A)).
[2cos(4x)=2cos2(2x)-2sin2(2x).]