Matrix product $C=AX$ - What is $\frac{dC}{dX}$?

57 Views Asked by At

I haven't found a simple explanation of this anywhere.

I have the following matrix product,

enter image description here enter image description here

to give $C$,

enter image description here

I need to compute $\frac{dC}{dB}$. I handcomputed the jacobian and it looks like this,

enter image description here

How can I compute the above jacobian in a tensorized way? Is there a nice series of transposes, or matrix multiplications that can result in the above matrix quickly?

1

There are 1 best solutions below

0
On

Vectorize the matrix equation, then find its differential and gradient. $$\eqalign{ C &= AB = ABI \cr {\rm vec}(C) &= (I^T\otimes A)\,{\rm vec}(B) \cr {\rm vec}(dC) &= (I\otimes A)\,{\rm vec}(dB) \cr \frac{\partial\,{\rm vec}(C)}{\partial\,{\rm vec}(B)} &= (I\otimes A) \cr }$$ Applying the same process to a slightly different equation yields $$\eqalign{ F &= BA^T = IBA^T \cr {\rm vec}(F) &= (A\otimes I)\,{\rm vec}(B) \cr {\rm vec}(dF) &= (A\otimes I)\,{\rm vec}(dB) \cr \frac{\partial\,{\rm vec}(F)}{\partial\,{\rm vec}(B)} &= (A\otimes I) \cr }$$ which is the gradient that you calculated.