I have a $3 \times 3$ matrix $\bf{A}$, and want to find the second order derivative of its determinant w.r.t the matrix itself $\frac{\partial ^2 \det({\bf{A}})}{\partial {\bf{A}} ^ 2}$. Everything I can find online has assumed ${\bf{A}}$ to be invertible. In my case, $\bf{A}$ can be singular. I started from the Jacobian formula

\begin{equation} {\bf{A}} \cdot \frac{\partial \det({\bf{A}})}{\partial {\bf{A}}} = \det(A) {\bf{I}} \end{equation} Differentiate both sides w.r.t ${\bf{A}}$, I got \begin{equation} {\bf 1} \cdot \frac{\partial \det({\bf{A}})}{\partial {\bf{A}}} + {\bf A} \cdot \frac{\partial ^2 \det({\bf{A}})}{\partial {\bf{A}} ^ 2} = \frac{\partial \det({\bf{A}})}{\partial {\bf{A}}} \cdot {\bf I} \end{equation} where I use $\bf 1$ to denote the rank 4 identity tensor.

However, when $\bf A$ is singular, this equation is also not helpful since I cannot solve $\frac{\partial ^2 \det({\bf{A}})}{\partial {\bf{A}} ^ 2}$ from it.

So, for a general $3 \times 3$ matrix $\bf A$ which is not necessarily invertible, do we have a closed form solution for $\frac{\partial ^2 \det({\bf{A}})}{\partial {\bf{A}} ^ 2}$?


2 Answers 2


$ \def\o{{\tt1}} \def\t{{\large\tau}} \def\a{\t_1} \def\b{\t_2} \def\c{\t_3} \def\k{\t_k} \def\BR#1{\Big[#1\Big]} \def\LR#1{\left(#1\right)} \def\op#1{\operatorname{#1}} \def\vc#1{\op{vec}\LR{#1}} \def\diag#1{\op{diag}\LR{#1}} \def\Diag#1{\op{Diag}\LR{#1}} \def\tr#1{\op{tr}\LR{#1}} \def\trace#1{\op{Tr}\LR{#1}} \def\frob#1{\left\| #1 \right\|_F} \def\q{\quad} \def\qq{\qquad} \def\qif{\q\iff\q} \def\qiq{\q\implies\q} \def\p{\partial} \def\grad#1#2{\frac{\p #1}{\p #2}} \def\red#1{\color{red}{#1}} \def\green#1{\color{green}{#1}} \def\RLR#1{\red{\LR{#1}}} \def\fracBR#1#2{\BR{\frac{#1}{#2}}} \def\fracLR#1#2{\LR{\frac{#1}{#2}}} \def\gradLR#1#2{\LR{\grad{#1}{#2}}} $Use a colon to denote the Frobenius product $$\eqalign{ A:B &= \sum_{i=1}^m\sum_{j=1}^n A_{ij}B_{ij} \;=\; \tr{A^TB} \\ B:B &= \frob{B}^2 \qquad \{ {\rm Frobenius\;norm} \}\\ A:B &= B:A \;=\; B^T:A^T \\ \LR{XY}:B &= X:\LR{BY^T} \;=\; Y:\LR{X^TB} \\ }$$ and write the determinant of a $(3\times 3)$ matrix in terms of the traces of its powers $$\eqalign{ \k &= \tr{A^k},\qq \det(A) = \tfrac16\LR{\a^3 - 3\a\b + 2\c} \\ }$$ In this form, the differential and gradient of the determinant are easy to calculate
(and it does not matter if $A$ is singular) $$\eqalign{ d\k &= kA^{k-\o}:dA^T \\ d\det(A) &= \tfrac16\LR{3\a^2\,d\a - 3\b\:d\a - 3\a\:d\b + 2\:d\c} \\ &= \tfrac16\BR{3\a^2\,I - 3\b I - 6\a A + 6A^2}:dA^T \\ &= \tfrac16\BR{3\LR{\a^2- \b}I - 6\a A + 6A^2}^T:dA \\ \grad{\det(A)}A &= \tfrac12\BR{\LR{\a^2- \b}I - 2\a A + 2A^2}^T {\;\;\equiv\; G} \\ \\ }$$ Similarly one can calculate the differential and gradient of $G$ $$\eqalign{ dG &= \tfrac12\BR{\LR{2\a\,d\a- d\b}I - 2\a\:dA - 2A\:d\a + 2dA\,A + 2A\,dA}^T \\ }$$ I'll leave the rest as an exercise for the reader.

  • 1
    $\begingroup$ "and write the determinant of a (3×3) matrix in terms of the traces of its powers" -- You gloss over this step as if it's trivial to show why the determinant can be written as a linear combination of traces of the first three powers of the matrix.. I suppose you use 3 because it is 3x3 but how did you get that det(A)=1/6* formula? $\endgroup$
    – Snared
    Commented May 28 at 20:32
  • $\begingroup$ By taking the trace of Newton's Identities $\endgroup$
    – greg
    Commented May 28 at 20:36

Thanks to the idea provided by @grey. I worked this problem out and decided to post the solution here. I'm going to use indicies with Einstein's summation convention, which I'm more familiar with. Then dot product is expressed by $\vec{a} \cdot \vec{b} = a_i b_i$; ${\bf A} \cdot \vec{b} = A_{ij} b_j$; ${\bf A}^T \cdot \vec{b} = A_{ji} b_j$. The Frobenius product is expressed as ${\bf A : B} = A_{ij} B_{ij}$. Derivatives are expressed as $\frac{\partial c}{\partial {\bf A}} = \frac{\partial c}{\partial A_{ij}}$. Trace is expressed as $tr({\bf A}) = A_{ii}$


$$\begin{align} r_1 &= A_{aa} \\ r_2 &= A_{ab}A_{ba} \\ r_3 &= A_{ab}A_{bc}A_{ca} \end{align}$$


$$\begin{align} &\frac{\partial r_1}{\partial A_{ij}} = \frac{\partial A_{aa}}{\partial A_{ij}} = \delta_{ia} \delta_{ja} = \delta_{ij} \\ &\frac{\partial r_2}{\partial A_{ij}} = \delta_{ai} \delta_{bj} A_{ba} + A_{ab} \delta_{bi} \delta_{aj} = 2A_{ji} \\ &\frac{\partial r_3}{\partial A_{ij}} = \delta_{ai} \delta_{bj} A_{bc} A_{ca} + A_{ab} \delta_{bi} \delta_{cj} A_{ca} + A_{ab} A_{bc} \delta_{ci} \delta_{aj} = 3A_{jm} A_{mi} \end{align}$$


\begin{equation} \tag{1} \label{eq:1} \det({\bf A}) = \frac{1}{6} (r_1^3 - 3 r_1 r_2 + 2 r_3) \end{equation}

Eq. \eqref{eq:1} can be easily verified by considering $r_1 = \lambda_1 + \lambda_2 + \lambda_3$, $r_2 = \lambda_1^2 + \lambda_2^2 + \lambda_3^2$, $r_3 = \lambda_1^3 + \lambda_2^3 + \lambda_3^3$, and $\det({\bf A}) = \lambda_1 \lambda_2 \lambda_3$, where $\lambda_1$, $\lambda_2$, and $\lambda_3$ are the three eigenvalues of $\bf A$.

Then, differentiate \eqref{eq:1} w.r.t $\bf A$: \begin{equation} \label{eq:2} \tag{2} \frac{\partial \det({\bf A})}{\partial A_{ij}} = \frac{1}{2} \left [(r_1^2 - r_2) \delta_{ij} - 2 r_1 A_{ji} + 2 A_{jm} A_{mi}\right ] \end{equation}

Further differentiate \eqref{eq:2} w.r.t $\bf A$:

$$\begin{align} \frac{\partial^2 \det({\bf A})}{\partial A_{ij} \partial A_{kl}} &= \frac{1}{2} \left[\left(2 r_1 \frac{\partial r_1}{\partial A_{kl}} - \frac{\partial r_2}{\partial A_{kl}}\right) \delta_{ij} - 2 \frac{\partial r_1}{\partial A_{kl}} A_{ji} - 2 r_1 \frac{\partial A_{ji}}{\partial A_{kl}} + 2 \frac{\partial A_{jm}}{\partial A_{kl}} A_{mi} + 2 A_{jm} \frac{\partial A_{mi}}{\partial A_{kl}} \right] \\ \\ & = r_1 (\delta_{ij} \delta_{kl} - \delta_{il}\delta_{jk}) - \delta_{ij} A_{lk} - A_{ji} \delta_{kl} + A_{li} \delta_{jk} + \delta_{il} A_{jk} \label{eq:3} \tag{3} \end{align}$$

BTW, does anyone has an idea how to express \eqref{eq:3} in tensor forms (without indices)?

  • $\begingroup$ Famously, there are three isotropic 4th order tensors $\def\P#1{\left(#1\right)}\def\c{\cdot}\def\s{\sigma} \{\s_1,\,\s_2,\,\s_3\}$ with which you can write Equation 3 as $${ r_1\P{\s_3-\s_2}-\P{A^T\c\s_3+\s_3\c A^T} + \s_2:\P{A\c\s_1+\s_1\c A^T} }$$ $\endgroup$
    – greg
    Commented May 29 at 14:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .