(sina+sinb)^2+(cosa+cosb) ^2 = sin^2(a) + sin^2(b) + 2sin(a)sin(b) + cos^2(a) + cos^2(b) + 2cos(a)cos(b) = (sin^2(a) + cos^2(a)) + (sin^2(b) + cos^2(b)) + 2(sin(a)sin(b) + cos(a)cos(b)) = 1 + 1 +2cos(a-b) = 2 + 2cos(a-b) = 2(1 + cos(a-b)) = 4(1 + cos(a-b)) / 2 = 4cos^2((a-b)/2)