# Proof that $\frac{d}{dt} \log |A(t)| = \text{Tr}\left[A(t)^{-1} \frac{d}{dt} A \right]$

For a symmetric $$n\times n$$ matrix $$A(t)$$ that depends on the variable $$t$$, I want to prove that $$\frac{d}{dt} \log |A(t)| = \text{Tr}\left[A(t)^{-1} \frac{d}{dt} A(t) \right].$$

Here, $$|A|$$ denotes the determinant of $$A$$ and $$\text{Tr}[X]$$ denotes the trace of $$X$$. How can I prove this equality?

The reason I ask this question: The equality is presented in equation C.22 of Pattern Recognition and Machine Learning of C. Bishop and the proof is left "as an exercise to the reader".

My attempt so far (to not clutter the notation, I leave out the dependency on $$t$$):

We know that $$|A|=\prod_{i=1}^n \lambda_i$$, where $$\lambda_i$$ denotes the $$i$$-th eigenvalue. Hence, we can write $$\frac{d}{dt} \log|A| =\frac{d}{dt}\log\prod_{i=1}^n\lambda_i =\frac{d}{dt}\sum_{i=1}^n\log(\lambda_i) =\sum_{i=1}^n\frac{d}{dt}\log(\lambda_i) =\sum_{i=1}^n\frac{1}{\lambda_i} \frac{d}{dt}\lambda_i.$$

The textbook further suggests to make use of the equalities $$A = \sum_{i=1}^n \lambda_i u_i u_i^T \quad \text{and} \quad A^{-1} = \sum_{i=1}^n \frac{1}{\lambda_i} u_i u_i^T,$$ where $$u_i$$ denotes the $$i$$-th eigenvector.

I do not know how to proceed from here. I also do not know if this is going into the right direction.

• is there some assumption that the determinant of $A(t)$ is positive? Commented Oct 30, 2020 at 18:59
• @angryavian I agree, otherwise $\log(|A(t)|)$ could be ill-defined. Commented Oct 30, 2020 at 19:52
• @angryavian Good point. In the appendix (where this equality is stated), it is not mentioned whether the determinant of $A(t)$ is positive. But I guess it has to be positive, otherwise it doesn't work. When they make use of the equality in the textbook itself, it seems that $A(t)$ is positive definite, so then the determinant should be positive as well.
– EdG
Commented Oct 30, 2020 at 20:11

Provided the problem is well-defined, i.e. matrix is diagonalizable, non-singular and determinant is positive, one should be able to use the orthonormality of eigenvectors, i.e.

$$\mathbf{u}^T_i.\mathbf{u}_j=\sum_s u^\left(s\right)_i u^{\left(s\right)}_j= \begin{cases} 1,\quad i=j \\ 0,\quad otherwise \end{cases}$$

Where sum over $$\dots^{\left(s\right)}$$ is over individual components of the eigen-vectors.

Now:

\begin{align} \mbox{Tr}\left(\mathbf{A^{-1}}.\frac{d}{dt}\mathbf{A}\right)=&\mbox{Tr}\left(\left[\sum_i \mathbf{u}_i.\frac{1}{\lambda_i}.\mathbf{u}_i^T\right]\:\cdot\:\frac{d}{dt}\left[\sum_j \mathbf{u}_j .\lambda_j.\mathbf{u}_j^T\right]\right) \\ =&\sum_{sp}\sum_{ij}u^{(s)}_i\lambda_i^{-1}u^{(p)}_i\cdot\left(\frac{du^{(p)}_j}{dt}\lambda_ju^{(s)}_j+u^{(p)}_j\frac{d\lambda_j}{dt} u^{(s)}_j+u^{(p)}_j \lambda_j \frac{du^{(s)}_j}{dt}\right)\\ =&\sum_i \frac{1}{\lambda_i}\cdot\frac{d\lambda_i}{dt}+\sum_p\sum_i u^{(p)}_i\frac{du^{(p)}_i}{dt}+\sum_s\sum_i u^{(s)}_i\frac{du^{(s)}_i}{dt}\\ =&\sum_i \frac{1}{\lambda_i}\cdot\frac{d\lambda_i}{dt}+2\sum_s\sum_i u^{(s)}_i\frac{du^{(s)}_i}{dt}\\ =&\sum_i \frac{1}{\lambda_i}\cdot\frac{d\lambda_i}{dt}+\frac{d}{dt}\sum_s\sum_i u^{(s)}_i u^{(s)}_i \\ =&\sum_i \frac{1}{\lambda_i}\cdot\frac{d\lambda_i}{dt} \end{align}

Since

$$\sum_i \sum_s u^{(s)}_i u^{(s)}_i = \sum_i 1=\mbox{number of components}=\mbox{const}$$

Which, I think, was what you were after

• In the last sentence, you mean $\sum_i \sum_s u_i^s u_i^s = \sum_i 1$? (note the $\sum_s$)
– EdG
Commented Oct 30, 2020 at 22:09
• Very nice proof! Thanks!
– EdG
Commented Oct 30, 2020 at 22:11
• @EdG. Glad it helps. Regarding the earlier comment. Yes, you are correct :-)
– Cryo
Commented Oct 30, 2020 at 22:13

$$\newcommand{\Tr}{\mathrm{Tr}}$$ $$\newcommand{\adj}{\mathrm{adj}}$$

In fact, the equality holds as long as $$\det(A(t)) > 0$$ (the symmetry condition is not needed).

The key identity we need is that for any $$A(t)$$ ($$\det(A(t))$$ may equal to $$0$$): \begin{align*} \frac{d(\det(A(t)))}{dt} = \sum_{i = 1}^n\sum_{j = 1}^n \frac{d a_{ij}(t)}{dt}A_{ij}(t) = \Tr\left(\frac{d(A(t))}{dt}\mathrm{adj}(A(t))\right), \tag{1} \end{align*} where \begin{align*} \adj(A(t)) = \begin{pmatrix} A_{11}(t) & A_{21}(t) & \cdots & A_{n1}(t) \\ A_{12}(t) & A_{22}(t) & \cdots & A_{n2}(t) \\ \vdots & \vdots & \ddots & \vdots \\ A_{1n}(t) & A_{2n}(t) & \cdots & A_{nn}(t) \end{pmatrix} \end{align*} is the adjugate matrix of $$A(t)$$ thus it satisfies \begin{align*} A(t)\adj(A(t)) = \det(A(t))I_{(n)}. \end{align*}

When $$\det(A(t)) > 0$$ hence $$A(t)$$ is invertible, $$\adj(A(t)) = \det(A(t))A(t)^{-1}$$, whence by the chain rule we have \begin{align*} \frac{d\log(\det(A(t)))}{dt} &= \frac{1}{\det(A(t))}\frac{d(\det(A(t)))}{dt} = \frac{1}{\det(A(t))}\Tr\left(\frac{d(A(t))}{dt}\mathrm{adj}(A(t))\right) \\ &= \frac{1}{\det(A(t))}\Tr\left(\frac{d(A(t))}{dt}\det(A(t))A(t)^{-1}\right) = \Tr\left(\frac{d(A(t))}{dt}A(t)^{-1}\right). \end{align*}

The proof of the first equality in $$(1)$$ is subtle and quite lengthy. If you are interested, I may post it as an appendix.

• Thanks a lot for your proof (+1)! Am I correct in saying that following (the proof of) Jacobi's formula (en.wikipedia.org/wiki/Jacobi%27s_formula), I should be able to prove the "key identify" in (1)? If so, then there is no need to add it here as an appendix :)
– EdG
Commented Oct 30, 2020 at 22:15
• @EdG Yes, correct! In fact, I do not know (1) has a big name associated with it. I learned it from a linear algebra exercise. Commented Oct 30, 2020 at 22:27
• Completely forgot about (1). Thanks Zhanxiong. @EdG, here's a proof of (1) using Levi-Civita symbols if you want physicsforums.com/threads/…
– Cryo
Commented Oct 30, 2020 at 22:36

Nicholas Higham published a wonderful paper on the Unwinding Function \eqalign{ {\cal U}(z) &= \frac{z-\log(e^z)}{2\pi i} = \left\lceil\frac{Im(z)-\pi}{2\pi}\right\rceil \;\in\;{\mathbb Z} \\ } Using this function one can write the following identity \eqalign{ \log\det A &= {\rm tr}\log A - 2\pi i\cdot {\cal U}({\rm tr}\log A) \\ &= {\rm tr}\log A - 2n\pi i \\ } One of the many interesting properties of the unwinding function is that its derivative is zero, which leads directly to your formula, i.e. \eqalign{ \frac{d(\log\det A)}{dt} &= \frac{d({\rm tr}\log A)}{dt} \\ &= \operatorname{tr}\left(A^{-1}\frac{dA}{dt}\right) \\ } The final equality follows from the identity \eqalign{ \frac{d({\rm tr}(f(A)))}{dt} &= \operatorname{tr}\left(f'(A)\cdot\frac{dA}{dt}\right) \\ } where $$f$$ is any analytic function and $$f'$$ is its derivative.

• Thank you for your original view on this (+1). My problem is that I do not immediately see how the unwinding function leads to the identity $\log\det A = {\rm tr}\log A - 2\pi i\cdot {\cal U}({\rm tr}\log A)$. To me, it seems that you use $z={\rm tr}\log A$ and $e^z=\det A$, but I do not immediately see why that would be correct.
– EdG
Commented Nov 3, 2020 at 10:40
• Oh wait, I see that $z={\rm tr}\log A$ and $e^z=\det A$ directly follow from Jacobi's formula.
– EdG
Commented Nov 3, 2020 at 10:49
• @greg See my answer you need to use $tr(BC)=tr(CB)$ to say that $\frac{d({\rm tr}\log A)}{dt} = \operatorname{tr}\left(A^{-1}\frac{dA}{dt}\right)$ because $A(t),A(t+h),A'(t)$ don't commute Commented Nov 3, 2020 at 12:25

Suppose that there is $$B(t)$$ such that $$A(t)=e^{B(t)}.$$ Then $$\frac{d}{dt}\log |A(t)|=\frac{d}{dt}\log |e^{B(t)}|=\frac{d}{dt}\log e^{\text{Tr}B(t)}=\frac{d}{dt}\text{Tr}B(t).$$ On the other hand, $$\text{Tr}\left[A(t)^{-1} \frac{d}{dt} A(t) \right]=\text{Tr}\bigg[e^{-B(t)}e^{B(t)}B'(t)\bigg]=\text{Tr}B'(t)=\frac{d}{dt}\text{Tr}B(t).$$ So $$\frac{d}{dt}\log |A(t)|=\text{Tr}\left[A(t)^{-1} \frac{d}{dt} A(t) \right].$$

• $\frac{d}{dt}\text{Tr}B(t)=\text{Tr}B'(t)$ is clearly true by linearity of $Tr$. See my answer you need to use $tr(RS)=tr(SR)$ to say that $\frac{d({\rm tr}\log A)}{dt} = \operatorname{tr}\left(A^{-1}\frac{dA}{dt}\right)$ because $A(t),A(t+h),A'(t)$ don't commute Commented Nov 3, 2020 at 12:27
• You are right, hank you Commented Nov 3, 2020 at 15:59

From $$A(t)$$ diagonalizable and $$tr(BC)=tr(CB)$$ we have $$\log \det A(t)=tr \log A(t)$$.

Next, $$(A(t)^n)'=\sum_{k=0}^{n-1} A^k A'(t)A^{n-1-k}$$ gives that for $$f(z)=\sum_{n\ge 0} c_n z^n$$ analytic on a disk containing $$\|A(t)\|$$ then $$tr(f(A(t)))'=\sum_{n=0}^\infty c_n \sum_{k=0}^{n-1} tr(A^k A'(t)A^{n-1-k})=\sum_{n=0}^\infty c_n \sum_{k=0}^{n-1} tr(A^{n-1}A'(t))$$ $$=tr( f'(A(t)) A'(t))$$ $$f(z)=\log z$$ is not analytic on such a disk, but by analytic continuation in $$s$$ of $$tr(f(I+s(A(t)-I)))'$$ it will still hold, ie. $$tr(\log(A(t)))' = tr(A(t)^{-1}A'(t))$$

No need that the eigenvalues of $$A(t)$$ are positive, just that $$A(t)$$ is differentiable, $$\det(A(t))\ne 0$$ and our choice of $$tr \log A(t)$$ is continuous in $$t$$.

• Sorry, perhaps my lack of knowledge, but I am already lost after your first sentence. I do not see why the fact that $A(t)$ is diagonalizable and $tr(BC)=tr(CB)$ leads to $\log\det A(t)=tr \log A(t)$.
– EdG
Commented Nov 3, 2020 at 11:04
• $tr(\log(P DP^{-1}))= tr(\log(D))=\sum \log D_{ii}$ and $\log \det PDP^{-1}=\log \det D=\log \prod D_{ii}$, both are equal up to $2ik\pi$, if we choose the $2ik\pi$ such that the functions of $t$ are continuous then that constant will disappear when differentiating Commented Nov 3, 2020 at 12:14