Let # a = arc tan 2x in Q1 or Q4#, wherein cosine is positive.
Then, #tan a = 2x, sin a = (2x)/sqrt(1+4x^2) and cos a = 1/sqrt(1+4x^2)#
Let # b = arc sin x in Q1 or Q4#, wherein cosine is positive.
Then, #sin b = x and cos b = sqrt(1-x^2)#.
Now, the given expression is
#cos(a-b)#
#=cos a cos b + sin a sin b#
#=(1/sqrt(1+4x^2))(sqrt(1-x^2))+((2x)/sqrt(1+4x^2))(x)#
#=(sqrt(1-x^2)+2x^2)/sqrt(1+4x^2)#.
See how it works.
Let #x = 1/2#. Then #a = arc sin (1/2) = pi/6 and b = arc tan 1 = pi/4#
#cos (a-b) = cos (pi/4-pi/6)=cos (pi/12) = (sqrt3 + 1 )/(2sqrt2)#
When #x = 1/2#,
#(2x^2+sqrt(1-x^2))/sqrt(1+4x^2)#
#=(1/2+sqrt3/2)/sqrt(1+1)@
#= (sqrt3 + 1 )/(2sqrt2)#