<s>[INST] Simplify trigonometric expression $\frac{1 - \cos A + \cos B - \cos(A + B)}{1 + \cos A - \cos B - \cos(A + B)}$ 
Simplify
  $$\frac{1 - \cos A + \cos B - \cos(A + B)}{1 + \cos A - \cos B - \cos(A + B)}$$

How can I simplify this trigonometric expression? 
Can you explain it if possible?
 [/INST] Apply the identities 
$$\cos A -\cos B =-2\sin\frac{A-B}2\sin\frac{A+B}2,\>\>\>\>\>\cos(A + B) = 1-2\sin^2\frac{A + B}2$$
to simplify
$$\frac{1 - \cos A + \cos B - \cos(A + B)}{1 + \cos A - \cos B -  \cos(A + B)}$$
$$=\frac{1 + 2\sin\frac{A-B}2\sin\frac{A+B}2- (1-2\sin^2\frac{A + B}2)}{1 -2\sin\frac{A-B}2\sin\frac{A+B}2 - (1-2\sin^2\frac{A + B}2)}$$
$$=\frac{2\sin\frac{A+B}2(\sin\frac{A-B}2+\sin\frac{A+B}2)}{2\sin\frac{A+B}2(-\sin\frac{A-B}2+\sin\frac{A+B}2)}=\frac{2\sin \frac A2\cos\frac B2}{2\cos\frac A2\sin\frac B2}=\frac{\tan \frac A2}{\tan \frac B2}$$
</s>