# Ngô Quốc Anh

## November 2, 2010

### Jacobi’s formula for the differential of the determinant of matrices

Filed under: Các Bài Tập Nhỏ — Ngô Quốc Anh @ 15:34

In matrix calculus, Jacobi’s formula expresses the differential of the determinant of a matrix A in terms of the adjugate of A and the differential of A. The formula is

$\displaystyle d\, \mbox{det} (A) = \mbox{tr} (\mbox{adj}(A) \, dA)$.

It is named after the mathematician C.G.J. Jacobi.

We first prove a preliminary lemma.

Lemma. Given a pair of square matrices $A$ and $B$ of the same dimension $n$, then

$\displaystyle\sum_i \sum_j A_{ij} B_{ij} = \mbox{tr} (A^\top B)$.

Proof. The product $AB$ of the pair of matrices has components

$\displaystyle (AB)_{jk} = \sum_i A_{ji} B_{ik}$.

Replacing the matrix $A$ by its transpose $A^\top$ is equivalent to permuting the indices of its components

$\displaystyle (A^\top B)_{jk} = \sum_i A_{ij} B_{ik}$.

The result follows by taking the trace of both sides

$\displaystyle \mbox{tr} (A^\top B) = \sum_j (A^\top B)_{jj} = \sum_j \sum_i A_{ij} B_{ij} = \sum_i \sum_j A_{ij} B_{ij}$.

Theorem. It holds

$\displaystyle d \, \mbox{det} (A) = \mbox{tr} (\mbox{adj}(A) \, dA)$.

Proof. Laplace’s formula for the determinant of a matrix $A$ can be stated as

$\displaystyle\mbox{det}(A) = \sum_j A_{ij} \mbox{adj}^\top (A)_{ij}$.

Notice that the summation is performed over some arbitrary row $i$ of the matrix.

The determinant of $A$ can be considered to be a function of the elements of $A$

$\displaystyle \mbox{det}(A) = F\,(A_{11}, A_{12}, \ldots , A_{21}, A_{22}, \ldots , A_{nn})$

so that, by the chain rule its differential is

$\displaystyle d\, \mbox{det}(A) = \sum_i \sum_j {\partial F \over \partial A_{ij}} \,dA_{ij}$.

This summation is performed over all $n \times n$ elements of the matrix.

To find $\frac{\partial F}{\partial A_{ij}}$, consider that in the right side of Laplace’s formula, index $i$ can be chosen at will (in order to optimize calculations: any other choice would eventually yield the same result, but it could be much harder). In particular, it can be chosen to match the first index of $\frac{\partial}{\partial A_{ij}}$

$\displaystyle {\partial \, \mbox{det}(A) \over \partial A_{ij}} = {\partial \sum_k A_{ik} \mbox{adj}^\top(A)_{ik} \over \partial A_{ij}} = \sum_k {\partial (A_{ik} \mbox{adj}^\top(A)_{ik}) \over \partial A_{ij}}$.

Thus by product rule,

$\displaystyle {\partial \, \mbox{det}(A) \over \partial A_{ij}} = \sum_k {\partial A_{ik} \over \partial A_{ij}} \mbox{adj}^\top(A)_{ik} + \sum_k A_{ik} {\partial \, \mbox{adj}^\top(A)_{ik} \over \partial A_{ij}}$.

Now, if an element of a matrix $A_{ij}$ and a cofactor $\mbox{adj}^\top(A)_{ik}$ of element $A_{ik}$ lie on the same row (or column), then the cofactor will not be a function of $A_{ij}$, because the cofactor of $A_{ik}$ is expressed in terms of elements not in its own row (nor column). Thus,

$\displaystyle {\partial \, \mbox{adj}^\top(A)_{ik} \over \partial A_{ij}} = 0$,

so

$\displaystyle {\partial \, \mbox{det}(A) \over \partial A_{ij}} = \sum_k \mbox{adj}^\top(A)_{ik} {\partial A_{ik} \over \partial A_{ij}}$.

All the elements of $A$ are independent of each other, i.e.

$\displaystyle {\partial A_{ik} \over \partial A_{ij}} = \delta_{jk}$,

where $\delta$ is the Kronecker delta, so

$\displaystyle {\partial \, \mbox{det}(A) \over \partial A_{ij}} = \sum_k \mbox{adj}^\top(A)_{ik} \delta_{jk} = \mbox{adj}^\top(A)_{ij}$.

Therefore,

$\displaystyle d(\mbox{det}(A)) = \sum_i \sum_j \mbox{adj}^\top(A)_{ij} \,d A_{ij}$,

and applying the Lemma yields

$\displaystyle d(\mbox{det}(A)) = \mbox{tr}(\mbox{adj}(A) \,dA)$.
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 38, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://anhngq.wordpress.com/2010/11/02/jacobis-formula-for-the-differential-of-the-determinant-of-matrices/", "fetch_time": 1642739841000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2022-05/segments/1642320302723.60/warc/CC-MAIN-20220121040956-20220121070956-00302.warc.gz", "warc_record_offset": 149588805, "warc_record_length": 32148, "token_count": 1246, "char_count": 3665, "score": 4.0, "int_score": 4, "crawl": "CC-MAIN-2022-05", "snapshot_type": "latest", "language": "en", "language_score": 0.7476486563682556, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00014-of-00064.parquet"}