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!