2
$\begingroup$

I want to compute the derivative of the matrix $ diag(x)M $ with respect to $ x $, where $ x \in \mathbb{C}^{n \times 1} $ and $ M \in \mathbb{C}^{n \times m} $. This is how I have approached it, but I have not been successful.

First, $$ Y = diag(x) $$

Then, $$ Z = Y M $$

The differential of $ Z $ is $$ dZ = dY M $$

If I am not mistaken $ dY = (I_{n \times n} \otimes 1_{n \times 1}) dx $. So $$ dZ = (I_{n \times n} \otimes 1_{n \times 1}) (dx) M $$

But the dimensions do not make much sense in this last expression. Would you please help me to find the right way?

$\endgroup$
1
$\begingroup$

The mixed vec-diag expression can rearranged using the formula $${\rm vec}\Big(A\,{\rm Diag}(b)\,C\Big) = \Big((C^T\otimes 1_a)\odot(1_c\otimes A)\Big)\,b$$ In this case the variables of interest are $(A=I_n,\,\,C=M,\,\,b=dx),\,$ therefore $$\eqalign{ {\rm vec}(dZ) &= {\rm vec}\Big(I_n\,\,{\rm Diag}(dx)\,\,M\Big) \cr dz &= \Big((M^T\otimes 1_n)\odot(1_m\otimes I_n)\Big)\,dx \cr \frac{\partial z}{\partial x} &= (M^T\otimes 1_n)\odot(1_m\otimes I_n) \cr }$$

$\endgroup$
  • $\begingroup$ Perfect! Thank you greg! $\endgroup$ – Dunkel Apr 28 at 20:40

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.