Let t = tan(a/2)
sina = (2t)/(1+t^2)
cosa = (1-t^2)/(1+t^2)
=> tan a = (2t)/(1-t^2)
LHS:
= ( (1-t^2)/(2t) - (2t)/(1-t^2) ) / ((1-t^2)/(2t) + (2t)/(1-t^2))
= (1-t^2)/(1+t^2)
= cos a
= RHS
=> (cot(a/2) - tan(a/2) ) / (cot(a/2) + tan(a/2) ) = cos a
let theta = a/2 => 2theta = a
Hence (cot(theta) - tan(theta) ) / (cot(theta) + tan(theta) ) = cos 2theta
This idea of using t= tan(theta/2) can be used for a great amount of problems similar to this one, and even for integrals like int 1/(1+sintheta) d theta where its called weirstrass substitution