Dodgson condensation

In mathematics, Dodgson condensation is a method of computing the determinants of square matrices. It is named for its inventor, Charles Dodgson (better known as Lewis Carroll). The method in the case of an n × n matrix is to construct an (n − 1) × (n − 1) matrix, an (n − 2) × (n − 2), and so on, finishing with a 1 × 1 matrix, which has one entry, the determinant of the original matrix.

General method

This algorithm can be described in the following four steps:

1. Let A be the given n × n matrix. Arrange A so that no zeros occur in its interior. An explicit definition of interior would be all ai,j with $i,j\ne1,n$. One can do this using any operation that one could normally perform without changing the value of the determinant, such as adding a multiple of one row to another.
2. Create an (n − 1) × (n − 1) matrix B, consisting of the determinants of every 2 × 2 submatrix of A. Explicitly, we write $b_{i,j}=\begin{vmatrix} a_{i, j} & a_{i, j + 1} \\ a_{i + 1, j} & a_{i + 1, j + 1} \end{vmatrix}.$
3. Using this (n − 1) × (n − 1) matrix, perform step 2 to obtain an (n − 2) × (n − 2) matrix C. Divide each term in C by the corresponding term in the interior of A so $c_{i,j}=\begin{vmatrix} b_{i, j} & b_{i, j + 1} \\ b_{i + 1, j} & b_{i + 1, j + 1} \end{vmatrix} / a_{i + 1, j + 1}$.
4. Let A = B, and B = C. Repeat step 3 as necessary until the 1 × 1 matrix is found; its only entry is the determinant.

Examples

Without zeros

One wishes to find

$\begin{vmatrix} -2 & -1 & -1 & -4 \\ -1 & -2 & -1 & -6 \\ -1 & -1 & 2 & 4 \\ 2 & 1 & -3 & -8 \end{vmatrix}.$

We make a matrix of its 2 × 2 submatrices.

$\begin{bmatrix} \begin{vmatrix} -2 & -1 \\ -1 & -2 \end{vmatrix} & \begin{vmatrix} -1 & -1 \\ -2 & -1 \end{vmatrix} & \begin{vmatrix} -1 & -4 \\ -1 & -6 \end{vmatrix} \\ \\ \begin{vmatrix} -1 & -2 \\ -1 & -1 \end{vmatrix} & \begin{vmatrix} -2 & -1 \\ -1 & 2 \end{vmatrix} & \begin{vmatrix} -1 & -6 \\ 2 & 4 \end{vmatrix} \\ \\ \begin{vmatrix} -1 & -1 \\ 2 & 1 \end{vmatrix} & \begin{vmatrix} -1 & 2 \\ 1 & -3 \end{vmatrix} & \begin{vmatrix} 2 & 4 \\ -3 & -8 \end{vmatrix} \end{bmatrix} = \begin{bmatrix} 3 & -1 & 2 \\ -1 & -5 & 8 \\ 1 & 1 & -4 \end{bmatrix}.$

We then find another matrix of determinants:

$\begin{bmatrix} \begin{vmatrix} 3 & -1 \\ -1 & -5 \end{vmatrix} & \begin{vmatrix} -1 & 2 \\ -5 & 8 \end{vmatrix} \\ \\ \begin{vmatrix} -1 & -5 \\ 1 & 1 \end{vmatrix} & \begin{vmatrix} -5 & 8 \\ 1 & -4 \end{vmatrix} \end{bmatrix} = \begin{bmatrix} -16 & 2 \\ 4 & 12 \end{bmatrix}.$

We must then divide each element by the corresponding element of our original matrix. The interior of the original matrix is $\begin{bmatrix} -2 & -1 \\ -1 & 2 \end{bmatrix}$, so after dividing we get $\begin{bmatrix} 8 & -2 \\ -4 & 6 \end{bmatrix}$. The process must be repeated to arrive at a 1 × 1 matrix. $\begin{bmatrix} \begin{vmatrix} 8 & -2 \\ -4 & 6 \end{vmatrix} \end{bmatrix} = \begin{bmatrix} 40 \end{bmatrix}.$ We divide by the interior of our 3 × 3 matrix, which is just -5, giving us $\begin{bmatrix} -8 \end{bmatrix}$. -8 is indeed the determinant of the original matrix.

With zeros

Simply writing out the matrices:

$\begin{bmatrix} 2 & -1 & 2 & 1 & -3 \\ 1 & 2 & 1 & -1 & 2 \\ 1 & -1 & -2 & -1 & -1 \\ 2 & 1 & -1 & -2 & -1 \\ 1 & -2 & -1 & -1 & 2 \end{bmatrix} \to \begin{bmatrix} 5 & -5 & -3 & -1 \\ -3 & -3 & -3 & 3 \\ 3 & 3 & 3 & -1 \\ -5 & -3 & -1 & -5 \end{bmatrix} \to \begin{bmatrix} -30 & 6 & -12 \\ 0 & 0 & 6 \\ 6 & -6 & 8 \end{bmatrix}.$

Here we run into trouble. If we continue the process, we will eventually be dividing by 0. We can perform four row exchanges on the initial matrix to preserve the determinant and repeat the process, with most of the determinants precalculated:

$\begin{bmatrix} 1 & 2 & 1 & -1 & 2 \\ 1 & -1 & -2 & -1 & -1 \\ 2 & 1 & -1 & -2 & -1 \\ 1 & -2 & -1 & -1 & 2 \\ 2 & -1 & 2 & 1 & -3 \end{bmatrix} \to \begin{bmatrix} -3 & -3 & -3 & 3 \\ 3 & 3 & 3 & -1 \\ -5 & -3 & -1 & -5 \\ 3 & -5 & 1 & 1 \end{bmatrix} \to \begin{bmatrix} 0 & 0 & 6 \\ 6 & -6 & 8 \\ -17 & 8 & -4 \end{bmatrix} \to \begin{bmatrix} 0 & 12 \\ 18 & 40 \end{bmatrix} \to \begin{bmatrix} 36 \end{bmatrix}.$

Hence, we arrive at a determinant of 36.

Desnanot–Jacobi identity and proof of correctness of the condensation algorithm

The proof that the condensation method computes the determinant of the matrix if no divisions by zero are encountered is based on an identity known as the Desnanot–Jacobi identity or Lewis Carroll identity.

Let $M=(m_{i,j})_{i,j=1}^k$ be a square matrix, and for each $1\le i, j\le k$, denote by $M_i^j$ the matrix that results from $M$ by deleting the $i$-th row and the $j$-th column. Similarly, for $1\le i, j, p,q\le k$, denote by $M_{i,j}^{p,q}$ the matrix that results from $M$ by deleting the $i$-th and $j$-th rows and the $p$-th and $q$-th columns.

Desnanot–Jacobi identity

$\det(M) \det(M_{1,k}^{1,k}) = \det(M_1^1)\det(M_k^k) - \det(M_1^k) \det(M_k^1).$

Proof of the correctness of Dodgson condensation

Rewrite the identity as

$\det(M) = \frac{\det(M_1^1)\det(M_k^k) - \det(M_1^k) \det(M_k^1)}{\det(M_{1,k}^{1,k})}.$

Now note that by induction it follows that when applying the Dodgson condensation procedure to a square matrix $A$ of order $n$, the matrix in the $k$-th stage of the computation (where the first stage $k=1$ corresponds to the matrix $A$ itself) consists of all the connected minors of order $k$ of $A$, where a connected minor is the determinant of a connected $k\times k$ sub-block of adjacent entries of $A$. In particular, in the last stage $k=n$, one gets a matrix containing a single element equal to the unique connected minor of order $n$, namely the determinant of $A$.

Proof of the Desnanot-Jacobi identity

We follow the treatment in Bressoud's book; for an alternative combinatorial proof see the paper by Zeilberger. Denote $a_{i,j} = (-1)^{i+j} \det(M_i^j)$ (up to sign, the $(i,j)$-th minor of $M$), and define a $k\times k$ matrix $M'$ by

$M' = \begin{pmatrix} a_{1,1} & 0 & 0 & 0 & \ldots & 0 & a_{k,1} \\ a_{1,2} & 1 & 0 & 0 & \ldots & 0 & a_{k,2} \\ a_{1,3} & 0 & 1 & 0 & \ldots & 0 & a_{k,3} \\ a_{1,4} & 0 & 0 & 1 & \ldots & 0 & a_{k,4} \\ \vdots & \vdots & \vdots & \vdots & & \vdots & \vdots \\ a_{1,k-1} & 0 & 0 & 0 & \ldots & 1 & a_{k,k-1} \\ a_{1,k} & 0 & 0 & 0 & \ldots & 0 & a_{k,k} \end{pmatrix}.$

(Note that the first and last column of $M'$ are equal to those of the adjugate matrix of $A$). The identity is now obtained by computing $\det(M M')$ in two ways. First, we can directly compute the matrix product $M M'$ (using simple properties of the adjugate matrix, or alternatively using the formula for the expansion of a matrix determinant in terms of a row or a column) to arrive at

$M M' = \begin{pmatrix} \det(M) & m_{1,2} & m_{1,3} & \ldots & m_{1,k-1} & 0 \\ 0 & m_{2,2} & m_{2,3} & \ldots & m_{2,k-1} & 0 \\ 0 & m_{3,2} & m_{3,3} & \ldots & m_{3,k-1} & 0 \\ \vdots & \vdots & \vdots & & \vdots & \vdots & \vdots \\ 0 & m_{k-1,2} & m_{k-1,3} & \ldots & m_{k-1,k-1} & 0 \\ 0 & m_{k,2} & m_{k,3} & \ldots & m_{k,k-1} & \det(M) \end{pmatrix}$

where we use $m_{i,j}$ to denote the $(i,j)$-th entry of $M$. The determinant of this matrix is $\det(M)^2 \cdot \det(M_{1,k}^{1,k})$.
Second, this is equal to the product of the determinants, $\det(M) \cdot \det(M')$. But clearly
$\det(M') = a_{1,1} a_{k,k} - a_{k,1} a_{1,k} = \det(M_1^1)\det(M_k^k) - \det(M_1^k) \det(M_k^1),$
so the identity follows from equating the two expressions we obtained for $\det(M M')$ and dividing out by $\det(M)$ (this is allowed if one thinks of the identities as polynomial identities over the ring of polynomials in the $k^2$ indeterminate variables $(m_{i,j})_{i,j=1}^k$).