(1-tan^2 x) / (1+tan^2 x) = cos 2x
(1-tan^2 (pi/8)) / (1+tan^2 (pi/8)) = cos (pi/4)
(1-tan^2 (pi/8)) / (1+tan^2 (pi/8)) = 1/rt2
rt2 . (1-tan^2 (pi/8)) = (1+tan^2 (pi/8))
rt2 - rt2 . tan^2 (pi/8)= 1+tan^2 (pi/8)
tan^2 (pi/8) (1+rt2) = rt2 - 1
tan^2 (pi/8) = (rt2 - 1)/(1+rt2)
tan^2 (pi/8) = (rt2 - 1)(1-rt2)/(1+rt2)(1-rt2)
tan^2 (pi/8) = (rt2-2+rt2-1)/(-1)
tan^2 (pi/8) = (2rt2-3)/(-1)
tan^2 (pi/8) = (3 - 2rt2)