I'm having trouble understanding how to calculate the first order derivative of matrix, and was wondering if anyone could help me.
The function with respect to P is
f(P)=Tr($XPAP^TPA^TP^TX^T$)=$||XPAP^T||^2_F$
where Tr is the trace, $A$ and $X$ are matrix.
The derivative of Tr(AP) is $A^T$, but how to calculate the derivative of f(P) which contains the fourth power of P?
Apologises for the poor wording of this question!
Thank you in advance!
First, introduce a new matrix variable $$\eqalign{ M &= XPAP^T \quad\implies\quad dM = (X\,dP\,AP^T &+\;\;\; XPA\;dP^T) }$$ Then, calculate the differential of the function $$\eqalign{ f &= M:M \\ df &= 2M:dM \\ &= 2(XPAP^T) : (X\,dP\,AP^T &+\;\;\; XPA\;dP^T) \\ &= (2XPAP^T) : (X\,dP\,AP^T) &+\;\;\; (2PA^TP^TX^T):(dP\,A^TP^TX^T) \\ &= (2X^TXPAP^TPA^T):dP &+\;\;\; (2PA^TP^TX^TXPA):dP \\ &= \Big(2X^TXPAP^TPA^T &+\;\;\; 2PA^TP^TX^TXPA\Big):dP \\ }$$ From this result, the gradient can be identified as $$\eqalign{ \frac{\partial f}{\partial P} &= 2X^TXPAP^TPA^T \;+\; 2P\,A^TP^TX^TXPA \qquad \qquad \qquad \qquad \quad\;\; \\\\ }$$ NB: $\;$In the above derivation, a colon denotes the double-dot product