# 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? Commented Mar 1, 2017 at 0:30
• Unfortunately, I do not have more information. You are right though that $Q$ can be treated as constant. Commented Mar 1, 2017 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. Commented Mar 1, 2017 at 3:40

Consider two scalar functions of the $$P$$ matrix. \eqalign{ \def\l{\lambda} \def\Q{Q^{-1}} \phi &= {\rm tr}(P\Q) &\implies d\phi = {\rm tr}(\Q\,dP) \cr \tau &= {\rm tr}(P) &\implies d\tau = {\rm tr}(dP) \cr } Separating $$\,dP\,$$ into a length $$\,d\l=\|dP\|\:$$ and a direction $$\,X = \frac{dP}{\|dP\|}$$ $$dP = X\,d\l$$ one obtains \eqalign{ d\phi &= {\rm tr}(\Q X)\,d\lambda \cr d\tau &= {\rm tr}(X)\,d\lambda \cr } whose ratio is \eqalign{ \frac{d\phi}{d\tau} &= \frac{{\rm tr}(\Q X)}{{\rm tr}(X)} \cr } But this ratio cannot be a derivative because it does not approach a fixed limit.
Changing $$X\ ($$direction of $$dP)$$ will change the value of the ratio.