sin(A+B)=sinAcosB+cosAsinB and sin(A-B)=sinAcosB-cosAsinB. cos(A+B)=cosAcosB-sinAsinB and cos(A-B)=cosAcosB+sinAsinB. These are true for all A and B. So, sin(A+B)+sin(A-B)=2sinAcosB and cos(A+B)+cos(A-B)=2cosAcosB. Therefore relating A and B to x and y we get A+B=x and A-B=y. From these A=(x+y)/2 and B=(x-y)/2. We can now write sin x + sin y = 2sin1/2(x+y)cos1/2(x-y) = a and cos x + cos y = 2cos1/2(x+y)cos1/2(x-y) = b. Therefore, dividing these two we get tan1/2(x+y)=a/b.
If we square each of the original equations we get:
sin^2x+sin^2y+2sin x.sin y=a^2 and cos^2x+cos^2y+2cos x.cos y=b^2
Adding these two equations we get 2+2cos(x-y)=a^2+b^2 [sin^2+cos^2=1 for both x and y]
We can expand cos(x-y) into 2cos^2((x-y)/2)-1, so we can write 4(cos^2((x-y/2)=a^2+b^2, because the 2's cancel out.
cos^2((x-y)/2)=(a^2+b^2)/4 from which sin^2((x-y)/2)=(4-a^2-b^2)/4. Therefore tan^2((x-y)/2)=(4-a^2-b^2)/(a^2+b^2) from which tan((x-y)/2)=sqrt((4-a^2-b^2)/(a^2+b^2)).