Matrix derivative rule for the product of two matrices How to derive the matrix derivative of $AB$ (product of two matrices, where $A \in \mathbb{R}^{m\times n}$ and $B \in \mathbb{R}^{n\times r}$), like
$$\frac{\partial AB}{\partial A}$$
and
$$\frac{\partial AB}{\partial B}$$

Let $\phi((A,B))$ and note that
$\phi((A+ \alpha, B+ \beta ) ) = \phi((A,B)) + \alpha B + A \beta + \alpha \beta$,
from which we have
$D \phi((A,B)) ((\alpha, \beta)) = \alpha B + A \beta$.
