I'm dealing with derivatives of scalar functions of matrices and wondering if Mathematica can help me here.
The standard approach of expanding it in terms of components is cumbersome. As an motivating example, I want to minimize the following function, where $X$ is a matrix
$$f(X) = \text{tr}(X'X)$$
I can use matrix differential calculus to derive that one step of gradient descent to minimize this function is:
$$X^* = X - 2 X$$
On other hand, suppose $X$ is square, and my function is $$g(X)=\text{tr}(X^2)$$
Now, a single step of gradient descent looks as follows $$X^* = X - 2 X'$$
This can get complicated to do by hand, as an example, Exercise 1 of Magnus 9.10 asks to show that gradient descent step of the following function
$$h(X) = \det A X B$$
is the following
$$X^* = X-\det(AXB)(A'(B'X'A')^{-1}B')'$$
now take $$h^*(X) = \text{tr}(AX'BXC)$$ formula to do a single step of gradient descent is $$ \text{probably something simple} $$
Is there a way to get help deriving/checking expressions above in Mathematica?
(note, I'm using "gradient descent step" instead of "derivative" because there are multiple notations for derivative which differ in shape, but reformulating it as gradient descent removes ambiguity)
det(A) = exp(Tr(log(A)))
might be useful. $\endgroup$