Let
#tan^-1(tan(x/2) tan(y/2))=theta#
#=>tantheta=(tan(x/2) tan(y/2))#
Now
#cos2theta=(1-tan^2theta)/(1+tan^2theta)#
#=(1-tan^2(x/2)tan^2(y/2))/(1+tan^2(x/2)tan^2(y/2))#
#=(cos^2(x/2)cos^2(y/2)-sin^2(x/2)sin^2(y/2))/(cos^2(x/2)cos^2(y/2)+sin^2(x/2)sin^2(y/2)#
#=(cos(x/2+y/2)cos(x/2-y/2))/(1/4(1+cosx)(1+cosy)+1/4(1-cosx)(1-cosy))#
#=(cos(x/2+y/2)cos(x/2-y/2))/(1/4(2+2cosxcosy))#
#=(2cos(x/2+y/2)cos(x/2-y/2))/(1+cosxcosy)#
#=(cosx+cosy)/(1+cosxcosy)#
So
#2theta=cos^-1((cosx+cosy)/(1+cosxcosy))#
#=>2tan^-1(tan(x/2) tan(y/2))=cos^-1((cosx+cosy)/(1+cosx cosy))#