How to calculate the $\frac{\partial det(\mathbf X)}{\partial \mathbf X}$ and $\frac{\partial tr(\mathbf X^n)}{\partial \mathbf X}$ by using Frobenius product?i tried to begin the calculation,but i stuck here at once
$ det(\mathbf X)=I_{mn}:X$ and $ tr(\mathbf X^n)=I_{mn}:X^n$,but i don't know how to calculate it.
Let's start by finding the gradient of a small concrete example. $$\eqalign{ \phi &= {\rm tr}(X^3) = I:X^3 \cr d\phi &= I:(dX\,X\,X+X\,dX\,X+X\,X\,dX) \cr &= X^TX^T:dX + X^TX^T:dX + X^TX^T:dX \cr &= (3X^2)^T:dX \cr \frac{\partial\phi}{\partial X} &= (3X^{2})^T \cr }$$ This can be immediately extended to higher powers and scalar coefficients. $$\eqalign{ \phi &= {\rm tr}(\alpha X^k) \cr d\phi &= (n\alpha X^{k-1})^T:dX \cr \frac{\partial\phi}{\partial X} &= (k\alpha X^{k-1})^T \cr }$$ Then extended again to any function expressed as a power series. $$\eqalign{ F &= \sum_k\alpha_kX^k \implies F' &= \sum_kk\alpha_kX^{k-1} \cr \phi &= {\rm tr}(F) \cr d\phi &= (F')^T:dX \cr \frac{\partial\phi}{\partial X} &= (F')^T \cr\cr }$$ To handle the determinant, consider the following $$\eqalign{ \exp({\rm tr}(X)) &= \exp\Big(\sum_k\lambda_k\Big) = \prod_k\exp(\lambda_k) = \det(\exp(X)) \cr {\rm tr}(X) &= \log(\det(\exp(X))) \cr }$$ Now assume $X=\log(Y)$ in which case $Y=\exp(X)$ and $$ {\rm tr}(\log(Y)) = \log(\det(Y)) $$ This allows us to use the above trace-trick to find the gradient of $$\eqalign{ \phi &= \log(\det(X)) = {\rm tr}(\log(X)) \cr d\phi &= (X^{-1})^T:dX \cr \frac{\partial\phi}{\partial X} &= (X^{-1})^T \cr }$$ To find the gradient of the determinant, note that the preceding was a logarithmic derivative, so $$\eqalign{ \frac{\partial\phi}{\partial X} &= \frac{\tfrac{\partial\,\det(X)}{\partial X}}{\det(X)} \cr \frac{\partial\,\det(X)}{\partial X} &= \det(X)\,(X^{-1})^T \cr }$$