# Derivative of inner product of function of matrices

I am working on an optimization problem where I have to find derivate of $⟨F(X),WF(X)Z⟩$ with respect to X. Here $⟨,⟩$is a standard inner product (Frobenius dot product), W & Z are a constant matrix, and $f$ a function of a matrix, whose output is also a matrix. I have previously asked a slightly different version of the same question, below is the solution for it \begin{align} \phi &= \langle F,WF \rangle = \langle W,FF^T \rangle\\ \frac{\partial \phi}{\partial X} &= \langle W,dF F^T+FdF^T\rangle\\ &=\langle W+W^T,dF F^T\rangle\\ &= \langle (W+W^T)F,\frac{\partial F}{\partial X}\rangle \end{align} I am working on slightly modified problem, but I have not been able to come up with such compact answer. Here is link Derivative of inner product of matrix-valued functions of matrices to my previous question

• Thank you for your comment, I just made the changes. – Dushyant Sahoo Jan 10 '18 at 17:22
• One difficulty is that the derivative of $F$ with respect to $X$ is a 4-dimensional matrix. – Rodrigo de Azevedo Jan 10 '18 at 17:47
• I thought for simplicity, initially, $X$ can be taken a scaler. This could give a good idea how the solution behaves. – Dushyant Sahoo Jan 10 '18 at 18:06

## 2 Answers

For ease of typing, I'll use the product notation $$A:B=\langle A,B\rangle$$ Then consider the derivative with respect to a single element of the independent matrix, $X_{ij}$, which is a scalar quantity. \eqalign{ \phi &= F:WFZ \cr d\phi &= dF:WFZ + F:W\,dF\,Z \cr &= (WFZ + W^TFZ^T):dF \cr } For ease of typing (once again), I've used the notation $$dF = \frac{\partial F}{\partial X_{ij}}$$ To obtain the full matrix result, sum over all of the $\{i,j\}$ indices.

Let $D_\alpha(\epsilon)$ be the derivative of $f$ at $\alpha$. Then the derivative of the composite function $g$ at $\alpha$ as a function of $\epsilon$ ought to be $\newcommand{\ang}{\left\langle{#1}\right\rangle}\ang{D_\alpha(\epsilon),Wf(\alpha)Z}+\ang{f(\alpha),WD_\alpha(\epsilon)Z}$. By the product rule or something. Frankly I can't be bothered to put in effort, when you've already asked an almost identical question, and haven't shown any work in the question you wrote above.

• I apologize, I just modified the question to include the previous questions' solution. – Dushyant Sahoo Jan 10 '18 at 12:41