Let function $f : \mbox{GL}_n (\mathbb R) \to \mathbb R$ be defined by
$$f (\mathrm X) := \mathrm a^{\top} \mathrm X^{-1} \mathrm b$$
where $\mathrm a, \mathrm b \in \mathbb R^n$ are given. Hence, for $|h| \ll 1$,
$$\begin{array}{rl} f (\mathrm X + h \mathrm V) &= \mathrm a^{\top} (\mathrm X + h \mathrm V)^{-1} \mathrm b\\ &= \mathrm a^{\top} (\mathrm I_n + h \mathrm X^{-1} \mathrm V)^{-1} \mathrm X^{-1} \mathrm b\\ &\approx \mathrm a^{\top} (\mathrm I_n - h \mathrm X^{-1} \mathrm V) \mathrm X^{-1} \mathrm b\\ &= f (\mathrm X) - h \, \mathrm a^{\top} \mathrm X^{-1} \mathrm V \mathrm X^{-1} \mathrm b\\ &= f (\mathrm X) - h \, \mbox{tr} \left( \mathrm X^{-1} \mathrm b \mathrm a^{\top} \mathrm X^{-1} \mathrm V \right)\\ &= f (\mathrm X) + h \left\langle \color{blue}{-\mathrm X^{-\top} \mathrm a \mathrm b^{\top} \mathrm X^{-\top}} , \mathrm V \right\rangle \end{array}$$
Thus, the gradient of $f$ with respect to $\rm X$ is
$$\nabla_{\rm X} f (\mathrm X) = \color{blue}{-\mathrm X^{-\top} \mathrm a \mathrm b^{\top} \mathrm X^{-\top}}$$
matrix-calculus scalar-fields gradient