# Derivative of scalar functions of matrix with respect to trace

Perhaps this is easy, but I am confused about how do I systematically go about computing the following two derivatives:

$\displaystyle\frac{\partial\text{tr}(PQ^{-1})}{\partial\text{trace}(P)}$, and $\displaystyle\frac{\partial\log\text{det}(P)}{\partial\text{trace}(P)}$.

Both $P$ and $Q$ are $n\times n$ real symmetric positive definite matrices. Clearly, being derivative of a scalar w.r.t. a scalar, the answers are scalars. For the second, I know $\log\text{det}(P) = \text{trace}(\log(P))$, but not sure how to utilize it.

• The problem is these are true partial derivatives. That means they are not defined strictly by the function on the bottom, but rather by an entire coordinate system. Different choices for the other coordinates will give different values for these partial derivatives. But all we have been given here is that one coordinate is $\operatorname{tr}(P)$. We are not told what the other coordinates should be. Presumably we can treat $Q$ as a constant, but $P$ depends on $n \choose 2$ independent variables, so which ones should we pick as the other ${n \choose 2}-1$? Was there more information given? – Paul Sinclair Mar 1 '17 at 0:30
• Unfortunately, I do not have more information. You are right though that $Q$ can be treated as constant. – Abhishek Halder Mar 1 '17 at 3:10
• Then unfortunately, your question admits of no answer. The partial derivatives are not fully defined, so you cannot calculate them. If someone provides you with a calculation for them, they will either explicitly or implicitly have made an assumption about what the other coordinates are. – Paul Sinclair Mar 1 '17 at 3:40

Consider two scalar functions of the $$P$$ matrix. \eqalign{ \phi &= {\rm tr}(PQ^{-1}) &\implies d\phi = {\rm tr}(Q^{-1}\,dP) \cr \tau &= {\rm tr}(P) &\implies d\tau = {\rm tr}(dP) \cr } Writing $$dP$$ in factored form, with direction $$QX$$ and length $$d\lambda$$
(NB: $$Q$$ is constant so the direction is controlled by $$X$$ alone) $$dP = QX\,d\lambda$$ one obtains \eqalign{ d\phi &= {\rm tr}(X)\,d\lambda \cr d\tau &= {\rm tr}(QX)\,d\lambda \cr } whose ratio is \eqalign{ \frac{d\phi}{d\tau} &= \frac{{\rm tr}(X)}{{\rm tr}(QX)} \cr } \eqalign{ } The problem is this ratio cannot be a derivative because it does not approach a fixed limit.
Although the value of the ratio is immune to changes of scale (i.e. setting $$X\to\beta X$$), changing the "direction" of $$X$$ will change the value of the ratio (assuming $$Q$$ has at least two distinct eigenvalues).