I am having problem with:
$$ \frac{\delta AX^{-1}B}{\delta X} = \space ? $$
What I did is the following:
$$ I = XX^{-1} $$ $$ \frac{\delta AXX^{-1}B}{\delta X}=A \frac{\delta X}{\delta X}X^{-1}B + AX \frac{\delta X^{-1}}{\delta X}B $$ $$ AX \frac{\delta X^{-1}}{\delta X}B = -A\frac{\delta X}{\delta X}X^{-1}B $$ $$ (A) (AX)^{-1} AX \frac{\delta X^{-1}}{\delta X}B = -(A)(AX)^{-1}A \frac{\delta X}{\delta X}X^{-1}B $$ $$ A \frac{\delta X^{-1}}{\delta X}B = -AX^{-1} \frac{\delta X}{\delta X}X^{-1}B $$ $$ \frac{\delta AX^{-1}B}{\delta X} = -AX^{-1}X^{-1}B $$
But in the Matrix Cookbook the result for inverse of a trace is:
$$ \frac{\delta tr(AX^{-1}B)}{\delta X} = -(X^{-1}BAX^{-1}){T} $$
From which I conclude that it should be
$$ \frac{\delta AX^{-1}B}{\delta X} = -X^{-1}BAX^{-1} $$
And I cannot find the reason why the BA is inside and switched places and please do not use frobenious product for solution.
Alternative to greg's fourth-order tensor, one can vectorize and exploit Kronecker products.
Using differential result of greg's solution, that is, \begin{align} dY = -\underbrace{AX^{-1}}_{:=\color{blue}{\widetilde{A}}} \ \color{red}{dX} \ \underbrace{X^{-1}B}_{:=\color{green}{\widetilde{B}}} := -\color{blue}{\widetilde{A}} \ \color{red}{dX} \ \color{green}{\widetilde{B}}, \end{align} we now vectorize both sides such that \begin{align} \operatorname{vec}\left(dY\right) = -\operatorname{vec}\left(\color{blue}{\widetilde{A}} \ \color{red}{dX} \ \color{green}{\widetilde{B}}\right) = -\left(\color{green}{\widetilde{B}}^T \otimes \color{blue}{\widetilde{A}}\right) \operatorname{vec}\left(\color{red}{dX}\right). \end{align}
Then, the gradient can be written as \begin{align} \frac{\partial y}{\partial x} = -\left(\color{green}{\widetilde{B}}^T \otimes \color{blue}{\widetilde{A}}\right) . \end{align}