[Math] Gradient of the Frobenius Norm (or matrix trace) of an expression involving a matrix and its inverse

derivativesmatricesmatrix-calculusnormed-spacesscalar-fields

For real, positive definite (square) matrices $\mathbf{A}$, $\mathbf{X}$, and $\mathbf{C}$, I would like to find an expression for the following gradient:

$\nabla_\mathbf{X} || \mathbf{AX}+\mathbf{X}^{-1}\mathbf{C} ||_F$

where $|| \cdot ||_F$ represents the Frobenius norm (although if another choice of norm makes this easier, I'd be interested to know). I know that this corresponds to the trace as

$\nabla_\mathbf{X} \mathrm{Trace}\left[ \left(\mathbf{AX}+\mathbf{X}^{-1}\mathbf{C}\right)^T \left(\mathbf{AX}+\mathbf{X}^{-1}\mathbf{C}\right) \right]$

which expands to

$\nabla_\mathbf{X} \mathrm{Trace}\left[ \mathbf{XAAX} + \mathbf{CX}^{-1}\mathbf{AX} + \mathbf{XAX}^{-1}\mathbf{C}+\mathbf{C}\mathbf{X}^{-1}\mathbf{X}^{-1}\mathbf{C}\right]$

And I believe the trace of the sum is the sum of the traces, so each of these terms may be considered separately. The first and last terms seem like they could probably be evaluated in terms of (111) and (119) in the matrix cookbook, but I'm not sure about the middle two, which have both $\mathbf{X}$ and $\mathbf{X}^{-1}$. Any guidance would be appreciated.

Best Answer

For convenience, define the variable $$\eqalign{ M &= AX+X^{-1}C \cr dM &= A\,dX - X^{-1}\,dX\,X^{-1}C \cr }$$ and the function $$\eqalign{ f &= \|M\|_F^2 \,=\, M:M \cr\cr df &= 2M:dM \cr &= 2M:A\,dX - 2M:X^{-1}\,dX\,X^{-1}C \cr &= 2(A^TM - X^{-T}MC^TX^{-T}) : dX \cr }$$ where a colon is used to denote the Frobenius Inner Product.

Your question was about a slightly different, but related function $$\eqalign{ h &= f^\frac{1}{2} \cr h^2 &= f \cr 2hdh &= df \,=\, 2(A^TM - X^{-T}MC^TX^{-T}) : dX \cr\cr \frac{\partial h}{\partial X} &= \frac{A^TM - X^{-T}MC^TX^{-T}}{h} \cr }$$