# Derivative of a matrix using Kronecker product

I have this Equation (1) and I want derivative in respect to $\underline s$: $$diag(\underline s)\times C \times diag(\underline s)$$ that $\underline s$ is a $n \times 1$ vector and $C$ is an $n \times n$ matrix. If I open up the Equation, I can find derivative but I would like to find it with Kronecker product. I tried and reach to this: $$( E_j^T \otimes E_i^T )vec(\underline s \otimes I + I \otimes \underline s)$$ that $E_j$ is all zeros matrix except (j,j) element that is one. actually, I replaced derivative and vec operator because for its linearity. anyone can help me to devectorizing this or Find derivative in another way? Is it correct to displacement of vec and derivation? thanks.

• You might have better luck with elementwise/Hadamard $\odot$ products rather than Kronecker $\otimes$ products. \eqalign{F&={\rm Diag}(s)\cdot C\cdot{\rm Diag}(s)=C\odot ss^T\cr dF&=C\odot(s\,ds^T+ds\,s^T)} – greg Sep 10 '18 at 16:49

First write the function and its differential using a Hadamard product \eqalign{ F &= {\rm Diag}(s)\,C\,{\rm Diag}(s) = C\odot ss^T \cr dF &= C\odot ds\,s^T + C\odot s\,ds^T \cr } Define the diagonal matrix $$D_c={\rm Diag}\big({\rm vec}(C)\big)$$ and use it to vectorize the differential \eqalign{ df &= D_c\,{\rm vec}(ds\,s^T) + D_c\,{\rm vec}(s\,ds^T) \cr &= D_c\,(s\otimes I)\,ds + D_c\,(I\otimes s)\,ds \cr &= D_c\,\big(s\otimes I + I\otimes s\big)\,ds\cr } Yielding the gradient of the vectorized function as $$\frac{\partial f}{\partial s} = D_c\,\big(s\otimes I + I\otimes s\big)$$