Matrix Derivative d(AXA)^(-1)/dX I am having trouble figuring out the following matrix derivative
$\frac{\partial(B X A')(AX A')^{-1}}{\partial X}$, where $X$ is square $n\times n$, A is $m\times n$, with $m<n$. and B is dimension $l\times N$.
I started with $\frac{\partial BX A'}{\partial X}(AX A')^{-1}+ (BX A')\frac{\partial (A XA)^{-1}}{\partial X}$, but I can't properly figure out the second term. 

For convenience, define $M=(AXA^T)^{-1}$, then the function can be expressed as
$$ F = BXA^TM$$
First, let's find the differentials
$$\eqalign{
  dM &= -M\,\,d(A\,X\,A^T)\,\,M \cr
     &= -MA\,\,dX\,A^TM \cr\cr
  dF &= B\,dX\,A^TM + BXA^T\,dM \cr
     &= B\,dX\,A^TM - BXA^T\,MA\,\,dX\,A^TM \cr
     &= (B-BXA^TMA)\,\,dX\,A^TM \cr
}$$
Dealing with matrix-by-matrix derivatives is hard. About the only thing you can do is to vectorize both sides of the equation using the rule $\,\,\,{\rm vec}(AXB)=(B^T\otimes A)\,{\rm vec}(X)\,\,\,$ which yields
$$\eqalign{
  df &= \big((A^TM)^T\otimes(B-BXA^TMA)\big)\,dx \cr\cr
  \frac {\partial f} {\partial x^T} &= (M^TA)\otimes(B-BXA^TMA) \cr\cr
  \frac {\partial\,{\rm vec}(F)} {\partial\,{\rm vec}(X)^T} &= (M^TA)\otimes(B-BXA^TMA) \cr
}$$
