Linear AlgebraDeterminants

Determinants by Cofactor Expansion

Expand along any row or column.

Not started Jump to practice

In precalculus you computed $2 \times 2$ and $3 \times 3$ determinants. The determinant is a single number that tells whether a square matrix is invertible (it is exactly when $\det A \neq 0$), and, as we will see, how much the matrix stretches area or volume. Cofactor expansion computes it for any size by breaking it into smaller determinants.

For a $2 \times 2$ matrix, $\det\begin{bmatrix} a & b \\ c & d \end{bmatrix} = ad - bc$. For a larger $A$, let $A_{ij}$ be the matrix left after deleting row $i$ and column $j$. Its determinant $M_{ij} = \det A_{ij}$ is the minor, and $C_{ij} = (-1)^{i+j}M_{ij}$ is the cofactor.

Key idea

For any row $i$: $\det A$ $= a_{i1}C_{i1} + a_{i2}C_{i2} + \cdots + a_{in}C_{in}$. For any column $j$: $\det A = a_{1j}C_{1j} + \cdots + a_{nj}C_{nj}$. Every row and every column gives the same answer, so expand along the one with the most zeros.

The signs $(-1)^{i+j}$ form a checkerboard that starts with $+$ in the top-left corner: $$\begin{bmatrix} + & - & + & - \\ - & + & - & + \\ + & - & + & - \\ - & + & - & + \end{bmatrix}$$

Why it works

Where do the signs come from? The determinant changes sign when two rows (or two columns) are swapped. To bring entry $(i, j)$ to the top-left corner without disturbing the order of the other rows and columns, slide row $i$ up past $i - 1$ rows and column $j$ left past $j - 1$ columns: $(i - 1) + (j - 1)$ swaps in all, each flipping the sign. That is the factor $(-1)^{i+j}$. Expanding along the first row of the moved matrix gives $a_{ij}$ times the determinant of what is left, $M_{ij}$.

Worked example: Choosing a good row

Find $\det A$ for $A = \begin{bmatrix} 2 & -1 & 3 \\ 1 & 4 & 0 \\ -2 & 1 & 5 \end{bmatrix}$.
  1. Row 2 has a zero, so expand along it. Its signs are $-\ +\ -$.
  2. $a_{21} = 1$: $C_{21}$ $= -\begin{vmatrix} -1 & 3 \\ 1 & 5 \end{vmatrix}$ $= -\big((-1)(5) - (3)(1)\big)$ $= -(-8)$ $= 8$.
  3. $a_{22} = 4$: $C_{22}$ $= +\begin{vmatrix} 2 & 3 \\ -2 & 5 \end{vmatrix}$ $= (2)(5) - (3)(-2)$ $= 16$.
  4. $a_{23} = 0$ contributes nothing.
  5. $\det A = 1(8) + 4(16) + 0 = 72$.

Answer: $72$

Worked example: A 4 × 4 with a sparse row

Find $\det B$ for $B = \begin{bmatrix} 3 & 0 & 2 & -1 \\ 1 & 2 & 0 & 4 \\ 0 & 0 & 5 & 0 \\ 2 & 1 & 1 & 3 \end{bmatrix}$.
  1. Row 3 has only one nonzero entry, $b_{33} = 5$, with sign $(-1)^{3+3} = +$.
  2. $\det B = 5\cdot\begin{vmatrix} 3 & 0 & -1 \\ 1 & 2 & 4 \\ 2 & 1 & 3 \end{vmatrix}$ (delete row 3 and column 3).
  3. Expand the $3 \times 3$ along row 1: $3\begin{vmatrix} 2 & 4 \\ 1 & 3 \end{vmatrix} - 0 + (-1)\begin{vmatrix} 1 & 2 \\ 2 & 1 \end{vmatrix}$ $= 3(2) - (1 - 4)$ $= 6 + 3$ $= 9$.
  4. $\det B = 5 \cdot 9 = 45$.

Answer: $45$

Common mistake

Forgetting the checkerboard: adding every term with a $+$ sign. Only the positions where $i + j$ is even get $+$. Quick check: expand along a different row or column; if the two answers differ, a sign is wrong.

A useful special case: if $A$ is triangular (all zeros below or above the diagonal), expanding down the first column again and again shows that $\det A$ is the product of the diagonal entries.

For a $2 \times 2$ matrix, $ad - bc$ is the area of the parallelogram the unit square becomes (with a sign). The next topics explain this picture.
Cofactor expansion of an $n \times n$ matrix takes about $n!$ multiplications: fine for $n = 3$ or $4$, hopeless for $n = 30$. Large determinants are found by row reduction instead, as the next topic shows.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • Margalit and Rabinoff, Interactive Linear Algebra (Georgia Tech), §4.2 Cofactor Expansions
  • MIT OpenCourseWare 18.06 Linear Algebra (Gilbert Strang, Spring 2010), Lecture 19: Determinant Formulas and Cofactors
@teddyrookbook GitHub