The matrix derivative of Hadamard product $\partial/\partial X tr(A\odot X)$?

828 Views Asked by At

I'm looking for the closed solution $\dfrac{\partial}{\partial X} tr(A\odot X)$. What I got is the diagonal matrix with entries $A_{ii}$. Is that correct?

And one more question. What would be $\dfrac{\partial}{\partial X} tr((A\odot X)^T (A\odot X))$? When calculating this, do I simply use the definition?

2

There are 2 best solutions below

3
On BEST ANSWER

Replace the trace with a Frobenius product, and recall that the Frobenius (:) and Hadamard ($\circ$) products are mutually commutative, i.e. $$\eqalign{ C:A\circ B & =A\circ B:C \cr &= A:B\circ C \cr &= A:C\circ B \cr\cr }$$

Then the first function, differential, and gradient are $$\eqalign{ f &= {\rm tr}(A\circ X) = I:A\circ X = I\circ A:X \cr\cr df &= I\circ A:dX \cr\cr \frac{\partial f}{\partial X} &= I\circ A = {\rm Diag}(A) \cr\cr }$$ Applying this same technique to your second function yields $$\eqalign{ f &= A\circ X:A\circ X \cr\cr df &= 2\,A\circ X:A\circ dX \cr &= 2\,A\circ A\circ X:dX \cr\cr \frac{\partial f}{\partial X} &= 2\,A\circ A\circ X \cr\cr }$$

0
On

Is it possible that most college students do not know the concept of derivative (or differential) of a function ? It is as if Bolt runs 100 meters in wooden clogs...

@ julypraise , if you ask for a formula in matrix cookbook, then certainly, you did not understand the Hans' answer.

Let $f:X\in M_n\rightarrow tr(A\circ X),g:X\in M_n\rightarrow tr((A\circ X)^T(A\circ X))$. Since $f$ is linear, $Df_X:H\in M_n\rightarrow tr(A\circ H)$. On the other hand, $Dg_X:H\rightarrow 2tr((A\circ H)^T(A\circ X))$.