Assume that $A\in\mathbb{R}^{m\times m}$ and $B\in\mathbb{R}^{n\times n}$ are two constant matrices. How can I find the partial derivative of $AXB$ with respect to $X$ in which $X\in\mathbb{R}^{m\times n}$? In fact, how to compute $$\frac{\partial(AXB)}{\partial X}.$$

I think that it is easy to see that $$\mathrm{vec}(AXB)=(B^T\otimes A)\mathrm{vec}(X),$$ where the notation $\otimes$ denotes the Kronecker product, and $\mathrm{vec}(X)$ is the vectorization of the matrix $X$. Therefore, we have $$\frac{\partial ((B^T\otimes A)\mathrm{vec}(X))}{\partial \mathrm{vec}(X)}=B^T\otimes A.$$ Here, I can not understand what is the relationship between $\frac{\partial(AXB)}{\partial X}$ and $\frac{\partial ((B^T\otimes A)\mathrm{vec}(X))}{\partial \mathrm{vec}(X)}$?

Thank you very much for the help.

  • 4
    $\begingroup$ $X\mapsto AXB$ is a linear map from $\Bbb R^{m\times n}$ to itself. $\endgroup$ – Lord Shark the Unknown Jun 4 at 4:48

When vectorizing the $m\times n$ matrix $X$, you obtain a vector $v =\mathrm{vec}(X)$ whose $i$th element is given by $v_i = X_{i\%m, i//m+1},$ where $i//m$ is the integer division and $i\%m$ is the remainder of the integer division.

Now consider what you mean by $$\frac{\partial AXB}{\partial X},$$ You are taking the derivative of an object with two indices with respect to an object with two indices, so you are looking at all terms of the form $$\frac{\partial [AXB]_{i,j}} {\partial X_{k,l}},$$ the matrix derivative vectorizes this indexing along two indices, the row is the position along $i,j$, the column is the position along $k,l$, so $$ \frac{\partial [AXB]_{i,j}} {\partial X_{k,l}}= (B\otimes A)_{m(j-1)+i, m(l-1)+k},$$ where the indexing reverses the vectorization operation.

  • $\begingroup$ Thank you so much for your help. $\endgroup$ – like_math Jun 4 at 8:22
  • 1
    $\begingroup$ I hope it's clear :) it's a way to make sense of four different integers in a way that we can use what we know about nirmal vectors and matrices $\endgroup$ – Riccardo Sven Risuleo Jun 4 at 9:38
  • $\begingroup$ Yes, it is completely right. Thanks a lot. $\endgroup$ – like_math Jun 4 at 15:35
  • $\begingroup$ Here's a way to state the result without the Kronecker product or modular arithmetic. $$\frac{\partial(AXB)_{ij}}{\partial X_{kl}} = A_{ik} B_{lj}$$ $\endgroup$ – greg Jun 4 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.