Using the fact that $\sin (A+B)=\sin A \cos B+\cos A \sin B$ and the differentiation, obtain the sum formula for cosines.
$\sin (A+B)=\sin A \cos B+\cos A \sin B$
Differentiating both sides with respect to x, we obtain
$\frac{d}{d x}[\sin (A+B)]=\frac{d}{d x}(\sin A \cos B)+\frac{d}{d x}(\cos A \sin B)$
$\begin{aligned} \Rightarrow \cos (A+B) \cdot \frac{d}{d x}(A+B)=& \cos B \cdot \frac{d}{d x}(\sin A)+\sin A \cdot \frac{d}{d x}(\cos B) \\ &+\sin B \cdot \frac{d}{d x}(\cos A)+\cos A \cdot \frac{d}{d x}(\sin B) \end{aligned}$
$\begin{aligned} \Rightarrow \cos (A+B) \cdot \frac{d}{d x}(A+B)=& \cos B \cdot \cos A \frac{d A}{d x}+\sin A(-\sin B) \frac{d B}{d x} \\ &+\sin B(-\sin A) \cdot \frac{d A}{d x}+\cos A \cos B \frac{d B}{d x} \end{aligned}$
$\Rightarrow \cos (A+B) \cdot\left[\frac{d A}{d x}+\frac{d B}{d x}\right]=(\cos A \cos B-\sin A \sin B) \cdot\left[\frac{d A}{d x}+\frac{d B}{d x}\right]$
$\therefore \cos (A+B)=\cos A \cos B-\sin A \sin B$