# Derivative $\frac{\partial}{\partial X^H} |Tr(X X^\top)|^2$

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!

• Taking the derivative with respect to $X^*$ is meaningless. The derivative of $f$ with respect to $X$ makes sense. – copper.hat Jan 30 '17 at 17:18
• @copper.hat thanks, and why is that in terms of mathematical terms? – Jeff Faraci Jan 30 '17 at 17:19
• Why is what? The derivative of a function is defined in terms of the function's parameters. – copper.hat Jan 30 '17 at 17:20
• @copper.hat so is the derivative zero? This is from a math class so I'm not entirely sure it's 'meaningless ' however it may be zero indeed. – Jeff Faraci Jan 30 '17 at 17:20
• What derivative? The derivative of $f$ is not zero. – copper.hat Jan 30 '17 at 17:21

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.
• Thanks so much this is very helpful. I understand what you did in terms of the second line. I just want to make sure I'm clear on something since I initially thought the derivative was zero; but this derivative was non zero because of the complex conjugate term. However if the function was squared only and not complex square, the derivative would be zero right? What I mean is: $$\frac{\partial}{\partial x^H} (Tr(X X^\top))^2=0$$ Since the function is purely now only depending on $X,X^\top$. I really appreciate your help on multiple occasions. Thank you. – Jeff Faraci Jan 31 '17 at 10:23
• @Integrals That's right, the gradient wrt $X^H$ is zero if there's no dependence on $X^*$ or $X^H$. – greg Jan 31 '17 at 15:00
• Is the gradient wrt $X^H$ always equal to the gradient wrt $X^*$ ? where * is complex conjugation. Thanks – Jeff Faraci Feb 4 '17 at 17:35
• @Integrals If the differential wrt $X^H$ is $$df=G:dX^H$$ then you are free to transpose both factors in the Frobenius product to obtain $$df=G^T:dX^*$$ So it appears that the gradients in question are transposes of each other. Only in the case that $G$ is symmetric are they equal. – greg Feb 4 '17 at 23:48