Hi I am trying to take a derivative of a matrix trace and am having some trouble. The function is given by
$$ f(X) = |Tr(X X^\top)|^2 $$ where $X$ is a complex matrix and $X^\top$ is the real transpose. I want to take the derivative wrt $X^H$ where $X^H$ is the hermitian transpose of $X$. Thus I have $$ \frac{\partial}{\partial X^H} |Tr(X X^\top)|^2=0? $$ Is this zero since $f(X)$ does not depend on $X^H$? If not zero, how can we differentiate this? I thought naively at first its zero, however I can write $f(X)$ as $$ \frac{\partial}{\partial X^H} \left( Tr(X X^\top) \overline{Tr(X X^\top)}\right)=? $$ where the bar denotes complex conjugation. (Note, this is the same as for a complex number $z \overline{z}=|z|^2$.) When I write it like this, I think that the complex conjugation may act on the trace and make one of the $X$ become $X^H$ which would then result in a non-zero derivative. Is this wrong?
Note: I'm not sure if it will help but a similar derivative is given by $$ \frac{\partial}{\partial X^H} \left(Tr(X X^H)\right)^2=2 Tr( X X^H) \frac{\partial}{\partial X^H} Tr( X X^H) = 2 Tr( X X^H) X $$
Thanks!
Write the function in terms of the Frobenius product, then find its differential and its gradients $$\eqalign{ f &= (X:X)^*\,(X:X) \cr &= (X^H:X^H)\,(X:X) \cr\cr df &= 2(X^H:X^H)X:dX + 2(X:X)X^H:dX^H \cr\cr \frac{\partial f}{\partial X^H} &= 2(X:X)X^H, \,\,\,\,\,\,\,\,\,\,\,\, \frac{\partial f}{\partial X} = 2(X^H:X^H)X \cr\cr }$$
I used the fact that $(X^*:X^* = X^H:X^H)$ on line 2, since transposing both operands in a Frobenius product leaves it unchanged.