I am trying to simplify the following, so that I can differentiate it (with respect to X). Ideally I'll have everything in terms of (XX^T - YY^T).
\mathrm{trace}[(AX(AX)^T)((BX)(BX)^T)^{-1}] -
\mathrm{trace}[(AY(AY)^T)((BY)(BY)^T)^{-1}]
Where X and Y are 3 x N and A and B are N x N...