I'm trying to take the derivative of a 4th order equation with respect to a matrix. It has the following form
$$\frac{\displaystyle \partial \bf a^T X^T X X^T X b}{\displaystyle \partial \bf X} = \Large ?$$
$\bf a$ and $\bf b$ are vectors and $\bf X$ is a matrix so, in effect, it's the derivative of a scalar with respect to a matrix.
I found the basic derivatives in Matrix Calculus on Wikipedia and I found the second order derivative in The Matrix Cookbook. This gives me the solution for the second order case
$$\frac{\displaystyle \partial \bf a^T X^T X b}{\displaystyle \partial \bf X} = \bf X (ab^T+ba^T)$$
I wonder if there is a similar solution for the 4th order case?
For convenience, define a new matrix variable $$\eqalign{ M &= X^TX = M^T \cr }$$ Write the function in terms of the Frobenius (:) Inner Product and this new variable. Now finding the differential and gradient is straighforward. $$\eqalign{ f &= ab^T:MM^T \cr\cr df &= ab^T:(dM\,M^T+M\,dM^T) \cr &= ab^T:2\,{\rm sym}(dM\,M^T) \cr &= 2\,{\rm sym}(ab^T):dM\,M^T \cr &= (ab^T+ba^T):dM\,M^T \cr &= (ab^T+ba^T)M:dM \cr &= (ab^T+ba^T)M:2\,{\rm sym}(X^TdX) \cr &= \Big(M(ab^T+ba^T)+(ab^T+ba^T)M\Big):X^TdX \cr &= \Big(XM(ab^T+ba^T)+X(ab^T+ba^T)M\Big):dX \cr\cr \frac{\partial f}{\partial X} &= XM(ab^T+ba^T)+X(ab^T+ba^T)M\cr &= XX^TX(ab^T+ba^T)+X(ab^T+ba^T)X^TX\cr\cr }$$