I need some help for calculating the matrix derivative of a special function. I have checked Wikipedia and Matrix Cookbook, but could not get the answer or idea. Let us define $f(X)$ as
$$f(X)=tr(diag(X,X,X) B diag(X,X,X) C)$$
where tr( ) is the trace operator, $X$ is n by n matrix, $diag(X,X,X)$ is 3n by 3n block diagonal matrix, B and C are 3n by 3n matrix
What is the derivative with respect to $X$.
Any solution, idea or reference?
Many thanks!
Henry
In terms of the $n\times n$ blocks of $B$ and $C$, this is $\sum_{ij}\operatorname{tr}XB_{ij}XC_{ji}$, so the derivative with respect to $X$ is
$$\sum_{ij}\left(B_{ij}XC_{ji}+C_{ij}XB_{ji}\right)^\top\;.$$