product rule for matrix functions?

The product rule holds in very great generality. Let $X,Y,Z,W$ be Banach spaces with open subset $U \subset X$, and suppose $f: U \rightarrow Y$ and $g: U \rightarrow Z$ are Frechet differentiable. If $B(\cdot, \cdot): Y \times Z \rightarrow W$ is a continuous bilinear map, then for any $\xi \in X$,

$$ \frac{d}{dx}[ B(f(x), g(x))](\xi) = B(f'(x)\xi, g(x)) + B(f(x), g'(x)\xi)$$

where all the derivatives in question are Frechet derivatives. To apply to your case, we take $U = X = \mathbb{R}^{n \times n}$, $Y =Z = W = \mathbb{R}$, and $B(y,z) = yz$.


Yes, the standard product rule applies. The gradient of the product is $$f(X)\nabla_X g(X)+g(X)\nabla_X f(X).$$ The dimensions of the gradients, of course, are the same as those of $X$ itself.

You might find The Matrix Cookbook useful here.