Math Core

Lesson 3.1 · Determinants

Introduction to determinants

Every square matrix has a single number attached to it, called its determinant, that tells you two things at once: whether the matrix is invertible, and by how much the linear transformation x↦Ax\mathbf{x} \mapsto A\mathbf{x} stretches area or volume. This lesson defines the determinant and shows you how to compute it efficiently by cofactor expansion.

The 2×22 \times 2 determinant

You met the number ad−bcad - bc when you inverted a 2×22 \times 2 matrix: A=[abcd]A = \begin{bmatrix} a & b \\ c & d \end{bmatrix} is invertible exactly when ad−bc≠0ad - bc \neq 0. That number is the determinant.

Definition

Determinant of a 2 × 2 matrix

det⁡A=∣abcd∣=ad−bc.\det A = \begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc.

Vertical bars around an array of numbers mean "the determinant of this matrix," not absolute value.

There is a picture behind the formula. The columns of AA are where the transformation sends e1\mathbf{e}_1 and e2\mathbf{e}_2, so the unit square is carried to the parallelogram spanned by the two columns. For A=[3112]A = \begin{bmatrix} 3 & 1 \\ 1 & 2 \end{bmatrix}, the columns are (3,1)(3, 1) and (1,2)(1, 2), and

∣3112∣=3(2)−1(1)=5.\begin{vmatrix} 3 & 1 \\ 1 & 2 \end{vmatrix} = 3(2) - 1(1) = 5.
The unit square (dashed) is carried to the parallelogram spanned by the columns (3, 1) and (1, 2). Its area is 5.Open in grapher →

The parallelogram has area 55, exactly the determinant. You will prove this in general later in the unit; for now, keep the idea in mind: the determinant measures how the transformation scales area, and its sign records whether orientation is flipped. A determinant of 00 means the square is flattened onto a line, which is exactly when AA fails to be invertible.

Minors and cofactors

For larger matrices, the determinant is defined recursively: an n×nn \times n determinant is built out of (n−1)×(n−1)(n-1) \times (n-1) determinants.

Definition

Minor and cofactor

For an n×nn \times n matrix AA, let AijA_{ij} be the (n−1)×(n−1)(n-1) \times (n-1) submatrix you get by deleting row ii and column jj. Its determinant, det⁡Aij\det A_{ij}, is the (i,j)(i, j) minor. The (i,j)(i, j) cofactor is

Cij=(−1)i+jdet⁡Aij.C_{ij} = (-1)^{i+j} \det A_{ij}.

The factor (−1)i+j(-1)^{i+j} follows a checkerboard pattern that starts with ++ in the top-left corner:

[+−+−−+−++−+−−+−+]\begin{bmatrix} + & - & + & - \\ - & + & - & + \\ + & - & + & - \\ - & + & - & + \end{bmatrix}

So a cofactor is just a minor with a sign attached. You don't need to compute (−1)i+j(-1)^{i+j} each time; read the sign off the checkerboard.

Cofactor expansion

Cofactor expansion

For an n×nn \times n matrix AA with n≥2n \ge 2, you can compute det⁡A\det A by expanding across any row ii:

det⁡A=ai1Ci1+ai2Ci2+⋯+ainCin,\det A = a_{i1}C_{i1} + a_{i2}C_{i2} + \cdots + a_{in}C_{in},

or down any column jj:

det⁡A=a1jC1j+a2jC2j+⋯+anjCnj.\det A = a_{1j}C_{1j} + a_{2j}C_{2j} + \cdots + a_{nj}C_{nj}.

Every row and every column gives the same answer.

The usual definition expands across the first row; the fact that every other row and column gives the same number is a theorem (its proof is a careful bookkeeping argument you can find in any linear algebra text). The practical payoff is huge: you get to choose the row or column, so choose the one with the most zeros. Each zero entry kills an entire term, and you never have to compute that cofactor.

Worked example: A 3 × 3 determinant

Compute det⁡A\det A for A=[13−24052−16]A = \begin{bmatrix} 1 & 3 & -2 \\ 4 & 0 & 5 \\ 2 & -1 & 6 \end{bmatrix}.

Expand across row 1. The signs are +,−,++, -, +:

det⁡A=1∣05−16∣−3∣4526∣+(−2)∣402−1∣=1(0+5)−3(24−10)−2(−4−0)=5−42+8=−29.\begin{aligned} \det A &= 1\begin{vmatrix} 0 & 5 \\ -1 & 6 \end{vmatrix} - 3\begin{vmatrix} 4 & 5 \\ 2 & 6 \end{vmatrix} + (-2)\begin{vmatrix} 4 & 0 \\ 2 & -1 \end{vmatrix} \\ &= 1(0 + 5) - 3(24 - 10) - 2(-4 - 0) \\ &= 5 - 42 + 8 = -29. \end{aligned}

Check by expanding down column 2, which has a zero. The signs in column 2 are −,+,−-, +, -:

det⁡A=−3∣4526∣+0−(−1)∣1−245∣=−3(14)+(5+8)=−42+13=−29.\begin{aligned} \det A &= -3\begin{vmatrix} 4 & 5 \\ 2 & 6 \end{vmatrix} + 0 - (-1)\begin{vmatrix} 1 & -2 \\ 4 & 5 \end{vmatrix} \\ &= -3(14) + (5 + 8) = -42 + 13 = -29. \end{aligned}

Both expansions agree: det⁡A=−29\det A = -29.

Common mistake

The most common error is dropping the checkerboard sign. The sign belongs to the position, not to the entry. In the check above, the entry −1-1 sits in position (3,2)(3, 2), which carries a −- sign, so the term is −(−1)det⁡A32-(-1)\det A_{32}, which is positive.

Using zeros to your advantage

A cofactor expansion of an n×nn \times n matrix produces nn determinants of size n−1n - 1. Expanding all the way down with no zeros takes on the order of n!n! multiplications, which is hopeless for large nn. With zeros, though, whole branches disappear.

Worked example: A 4 × 4 determinant with a sparse column

Compute det⁡B\det B for B=[205130−1400201763]B = \begin{bmatrix} 2 & 0 & 5 & 1 \\ 3 & 0 & -1 & 4 \\ 0 & 0 & 2 & 0 \\ 1 & 7 & 6 & 3 \end{bmatrix}.

Column 2 has only one nonzero entry, the 77 in position (4,2)(4, 2). Its sign is (−1)4+2=+(-1)^{4+2} = +. Delete row 4 and column 2:

det⁡B=7∣2513−14020∣.\det B = 7\begin{vmatrix} 2 & 5 & 1 \\ 3 & -1 & 4 \\ 0 & 2 & 0 \end{vmatrix}.

In the 3×33 \times 3 determinant, row 3 has one nonzero entry, the 22 in position (3,2)(3, 2), with sign −-:

∣2513−14020∣=−2∣2134∣=−2(8−3)=−10.\begin{vmatrix} 2 & 5 & 1 \\ 3 & -1 & 4 \\ 0 & 2 & 0 \end{vmatrix} = -2\begin{vmatrix} 2 & 1 \\ 3 & 4 \end{vmatrix} = -2(8 - 3) = -10.

So det⁡B=7(−10)=−70\det B = 7(-10) = -70.

Triangular matrices

Push the zero idea to the extreme. A matrix is upper triangular if every entry below the main diagonal is 00, and lower triangular if every entry above it is 00. Expand an upper triangular matrix down its first column: only the top entry a11a_{11} survives, and what's left is again upper triangular. Repeat, and you get a clean result.

Triangular matrices

If AA is triangular (upper or lower), then det⁡A\det A is the product of the entries on the main diagonal:

det⁡A=a11a22⋯ann.\det A = a_{11}a_{22}\cdots a_{nn}.

Worked example: Reading off a triangular determinant

Compute det⁡[31020−2410057000−1]\det \begin{bmatrix} 3 & 1 & 0 & 2 \\ 0 & -2 & 4 & 1 \\ 0 & 0 & 5 & 7 \\ 0 & 0 & 0 & -1 \end{bmatrix}.

The matrix is upper triangular, so multiply the diagonal: 3(−2)(5)(−1)=303(-2)(5)(-1) = 30. The entries above the diagonal don't matter at all.

This fact is the seed of the fast method in the next lesson: row reduce a matrix to triangular form, keep track of how each row operation changes the determinant, and then multiply down the diagonal.

Tip

Two quick checks before you expand anything. If a matrix has a row or column of all zeros, its determinant is 00 (expand along that row). If it is triangular, just multiply the diagonal.

Practice

Practice 1

Compute ∣3−254∣\begin{vmatrix} 3 & -2 \\ 5 & 4 \end{vmatrix}.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 2

Compute det⁡A\det A for A=[210−134502]A = \begin{bmatrix} 2 & 1 & 0 \\ -1 & 3 & 4 \\ 5 & 0 & 2 \end{bmatrix}.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 3

Let A=[1420−35617]A = \begin{bmatrix} 1 & 4 & 2 \\ 0 & -3 & 5 \\ 6 & 1 & 7 \end{bmatrix}. Find the cofactor C23C_{23}.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 4

Compute the determinant of the lower triangular matrix

[200007−1000343001191082652].\begin{bmatrix} 2 & 0 & 0 & 0 & 0 \\ 7 & -1 & 0 & 0 & 0 \\ 3 & 4 & 3 & 0 & 0 \\ 1 & 1 & 9 & 1 & 0 \\ 8 & 2 & 6 & 5 & 2 \end{bmatrix}.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 5

Compute det⁡[102034−1200502013]\det \begin{bmatrix} 1 & 0 & 2 & 0 \\ 3 & 4 & -1 & 2 \\ 0 & 0 & 5 & 0 \\ 2 & 0 & 1 & 3 \end{bmatrix}.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 6

Find all values of kk for which [k23k−1]\begin{bmatrix} k & 2 \\ 3 & k - 1 \end{bmatrix} is not invertible.

Separate answers with commas, e.g. 2, -5

Practice 7

You need det⁡A\det A for A=[49−3605002817−1302]A = \begin{bmatrix} 4 & 9 & -3 & 6 \\ 0 & 5 & 0 & 0 \\ 2 & 8 & 1 & 7 \\ -1 & 3 & 0 & 2 \end{bmatrix}. Which expansion requires computing the fewest cofactors?