# Find the derivative w.r.t. matrix normal distribution pdf

We have the pdf of matrix normal distribution for the random matrix $$X$$ (https://en.wikipedia.org/wiki/Matrix_normal_distribution):

However here in my case, $$X$$ is of a parameter, say $$\theta$$. So my question is how to get the derivative of the log of this pdf with respect to $$\theta$$?. i.e.,

What's the derivative with respect to $$\theta$$ for this:

$$-\frac{1}{2}\mathrm{tr}[V^{-1}(X(\theta)-M)^TU^{-1}(X(\theta)-M)]-np/2*\mathrm{log}2\pi-n/2*\mathrm{log}|V|-p/2*\mathrm{log}|U|$$

(or)

$$-\frac{1}{2}\mathrm{tr}[V^{-1}(X(\theta)-M)^TU^{-1}(X(\theta)-M)]$$?

They are all in matrix multiplication form so I am confused. The result is used in an EM algorithm.

• How can the result not contain $\partial_{\theta}X(\theta)$ ? – Thomas Mar 29 at 8:16
• To me the result is the second, but with an overall derivative over $\theta$, which can be also brought inside the trace if desired. To simplify further I guess that one should specify the dependence on $\theta$ – Thomas Mar 29 at 8:22
• I wrote an answer showing a type of calculations that may help for this last question. Have a look to see if it is what you need... – Thomas Mar 29 at 14:50

So using the convention that repeated indexes are summed we have:

$$f(Z)=V^{-1}_{a,b}Z^+_{b,c}U^{-1}_{c,d}Z_{d,a}$$

$$\frac{\partial f(Z)}{\partial Z_{x,y}}$$

Using linearity of the derivative:

$$\frac{\partial f(Z)}{\partial Z_{x,y}}=V^{-1}_{a,b}\frac{\partial Z_{c,b}}{\partial Z_{x,y}}U^{-1}_{c,d}Z_{d,a}+V^{-1}_{a,b}Z^+_{b,c}U^{-1}_{c,d}\frac{\partial Z_{d,a}}{\partial Z_{x,y}}$$

But now:

$$\frac{\partial Z_{c,b}}{\partial Z_{x,y}}=\delta_{c,x}\delta_{b,y}$$

and similar, where $$\delta$$ is the kroenecker symbol. Therefore:

$$\frac{\partial f(Z)}{\partial Z_{x,y}}=V^{-1}_{a,y}U^{-1}_{x,d}Z_{d,a}+V^{-1}_{y,b}Z^+_{b,c}U^{-1}_{c,x}$$

and in matrix form this can be rewritten:

$$\frac{\partial f(Z)}{\partial Z}=U^{-1}ZV^{-1}+[V^{-1}Z^+U^{-1}]^+$$