What's the derivative of $$f(X)=\text{Tr}(YX^{-1})$$ with respect to $X$, where $X$ and $Y$ are square matrices of the same dimension?
My first attempt is to apply the chain rule as: Let $h(X)=X^{-1}$. So, $f(X)=\text{Tr}(Yh(X))$. Hence,
$$\frac{df(X)}{dX}=\frac{\partial f(x)}{\partial h(X)}\cdot\frac{\partial h(X)}{\partial X}= Y \cdot - X^{-2}=-YX^{2}$$
I'm not sure of my answer.