Skip to main content
© 2026 ePowerAI. All rights reserved.
CoursesContact
eAI
CoursesContact
Week 4: Determinants
Linear Algebra
01Week 1: Vectors and Linear Combinations
02Week 2: Linear Transformations and Matrices
03Week 3: Elimination and LU Factorization
04Week 4: Determinants
05Week 5: Vector Spaces, Independence, and Basis
06Week 6: The Four Fundamental Subspaces
07Week 7: Orthogonality and Projections
08Week 8: Least Squares and QR
09Week 9: Eigenvalues and Eigenvectors
10Week 10: Diagonalization and Markov Matrices
11Week 11: Differential Equations
12Week 12: Symmetric and Positive Definite Matrices
13Week 13: The SVD and Complex Matrices
14Week 14: The Fourier Matrix, FFT, and PCA
Week 04· Linear Algebra18 min read

Week 4: Determinants

✦Learning Outcomes
  • State and use the defining properties of the determinant
  • Compute determinants via cofactor expansion
  • Use Cramer's rule to solve small systems
  • Interpret |det(A)| as a volume scaling factor
◆Prerequisites

Background knowledge assumed:

  • Gaussian elimination and pivots

Recommended: Review Week 3: Elimination and LU Factorization before starting.

Defining Properties#

The determinant of a square matrix AAA, written det⁡(A)\det(A)det(A) or ∣A∣|A|∣A∣, is a single number that packages invertibility, orientation, and volume scaling into one scalar. You do not need a formula first: three rules completely determine det⁡\detdet on every n×nn \times nn×n matrix, and every other property (including the cofactor formula and the product of pivots) follows from them.

Rule 1 — Identity. The determinant of the identity is one:

det⁡(I)=1.\det(I) = 1.det(I)=1.

The standard basis has unit volume and the standard orientation, so the number assigned to III is 111.

Rule 2 — Row exchange. Swapping any two rows of AAA multiplies the determinant by −1-1−1:

det⁡(A with rows i and j swapped)=−det⁡(A).\det(\text{$A$ with rows $i$ and $j$ swapped}) = -\det(A).det(A with rows i and j swapped)=−det(A).

A single swap flips orientation; an even number of swaps leaves the sign unchanged, and an odd number flips it.

Rule 3 — Linearity in each row. If you fix every row except row iii, the map that sends that row to det⁡(A)\det(A)det(A) is linear. Explicitly: if row iii is a sum u+vu + vu+v, then det⁡(A)\det(A)det(A) is the sum of the two determinants obtained by putting uuu or vvv in row iii (other rows fixed). Scaling row iii by a scalar ccc multiplies det⁡(A)\det(A)det(A) by ccc.

These three rules are the whole axiomatic definition. From them you can derive further facts without a closed formula:

  • If two rows are equal, det⁡(A)=0\det(A) = 0det(A)=0 (swap them and Rule 2 says the determinant equals its own negative).
  • Adding a multiple of one row to another leaves det⁡(A)\det(A)det(A) unchanged (linearity plus the equal-row fact).
  • A zero row forces det⁡(A)=0\det(A) = 0det(A)=0 (scale that row by 000).
  • det⁡(A)=0\det(A) = 0det(A)=0 if and only if AAA is singular (not invertible) — elimination will produce a zero pivot, which we connect next.

The same three rules can be stated for columns instead of rows: the determinant is multilinear and alternating in the columns, and det⁡(I)=1\det(I) = 1det(I)=1. In practice we use whichever view is convenient.


Determinant from Pivots#

Week 3 turned AAA into an upper triangular matrix UUU by elimination. Each elementary step either leaves the determinant unchanged or multiplies it by a known factor, so you can read det⁡(A)\det(A)det(A) off the pivots.

Recall the operations and their effect on det⁡\detdet:

| Elimination step | Effect on det⁡\detdet | | --- | --- | | Subtract a multiple of one row from another | No change | | Swap two rows | Multiply by −1-1−1 | | Scale a row by ccc | Multiply by ccc (we rarely scale rows during plain elimination) |

After elimination without scaling, UUU is upper triangular with the pivots p1,p2,…,pnp_1, p_2, \ldots, p_np1​,p2​,…,pn​ on the diagonal. For a triangular matrix the determinant is the product of the diagonal entries (expand along the first column, or use multilinearity on the standard basis). Therefore

det⁡A=± (product of the pivots),\det A = \pm\,(\text{product of the pivots}),detA=±(product of the pivots),

where the sign is −1-1−1 raised to the number of row exchanges performed during elimination. Equivalently, if PA=LUPA = LUPA=LU with PPP a permutation matrix, then

det⁡(A)=det⁡(P)−1det⁡(L)det⁡(U)=det⁡(P)−1⋅1⋅∏i=1nuii,\det(A) = \det(P)^{-1} \det(L) \det(U) = \det(P)^{-1} \cdot 1 \cdot \prod_{i=1}^{n} u_{ii},det(A)=det(P)−1det(L)det(U)=det(P)−1⋅1⋅i=1∏n​uii​,

since det⁡(L)=1\det(L) = 1det(L)=1 for unit lower triangular LLL, and det⁡(P)=±1\det(P) = \pm 1det(P)=±1 according as PPP is an even or odd permutation.

Worked 2×22 \times 22×2. For A=(2143)A = \begin{pmatrix} 2 & 1 \\ 4 & 3 \end{pmatrix}A=(24​13​), elimination subtracts 222 times row 1 from row 2 (no swap) and produces pivots 222 and 111. So

det⁡(A)=2⋅1=2.\det(A) = 2 \cdot 1 = 2.det(A)=2⋅1=2.

The classical 2×22 \times 22×2 formula det⁡(abcd)=ad−bc\det\begin{pmatrix} a & b \\ c & d \end{pmatrix} = ad - bcdet(ac​bd​)=ad−bc gives 2⋅3−1⋅4=22\cdot 3 - 1\cdot 4 = 22⋅3−1⋅4=2, matching.

Zero pivot means zero determinant. If elimination cannot produce a full set of nonzero pivots (even after all useful row exchanges), some diagonal entry of UUU is zero, the product of pivots is zero, and det⁡(A)=0\det(A) = 0det(A)=0. That is the algebraic test for singularity: AAA is invertible if and only if det⁡(A)≠0\det(A) \neq 0det(A)=0.

The pivot product is the fastest way to compute a determinant by hand for small dense systems you already eliminate. The next section gives a recursive formula that does not require running elimination first.


Cofactor Expansion#

The cofactor expansion (Laplace expansion) expresses det⁡(A)\det(A)det(A) as a weighted sum of determinants of smaller matrices. Fix the first row for concreteness. For an n×nn \times nn×n matrix A=(aij)A = (a_{ij})A=(aij​),

det⁡A=∑j=1na1j C1j,\det A = \sum_{j=1}^{n} a_{1j}\, C_{1j},detA=j=1∑n​a1j​C1j​,

where the cofactor of entry a1ja_{1j}a1j​ is

C1j=(−1)1+jM1jC_{1j} = (-1)^{1+j} M_{1j}C1j​=(−1)1+jM1j​

and the minor M1jM_{1j}M1j​ is the determinant of the (n−1)×(n−1)(n-1) \times (n-1)(n−1)×(n−1) matrix obtained by deleting row 111 and column jjj of AAA. The sign pattern (−1)i+j(-1)^{i+j}(−1)i+j is the checkerboard of +++ and −-− starting with +++ in the top-left corner.

You may expand along any row iii or column jjj:

det⁡A=∑jaij Cij=∑iaij Cij,Cij=(−1)i+jMij.\det A = \sum_{j} a_{ij}\, C_{ij} = \sum_{i} a_{ij}\, C_{ij}, \quad C_{ij} = (-1)^{i+j} M_{ij}.detA=j∑​aij​Cij​=i∑​aij​Cij​,Cij​=(−1)i+jMij​.

Choose a row or column with many zeros to shorten the arithmetic.

Full 3×33 \times 33×3 example. Expand

A=(120311021)A = \begin{pmatrix} 1 & 2 & 0 \\ 3 & 1 & 1 \\ 0 & 2 & 1 \end{pmatrix}A=​130​212​011​​

along the first row:

det⁡A=a11C11+a12C12+a13C13.\det A = a_{11} C_{11} + a_{12} C_{12} + a_{13} C_{13}.detA=a11​C11​+a12​C12​+a13​C13​.

The third term is zero because a13=0a_{13} = 0a13​=0. The remaining cofactors are

C11=(+1) M11=det⁡(1121)=1⋅1−1⋅2=−1,C_{11} = (+1)\, M_{11} = \det\begin{pmatrix} 1 & 1 \\ 2 & 1 \end{pmatrix} = 1\cdot 1 - 1\cdot 2 = -1,C11​=(+1)M11​=det(12​11​)=1⋅1−1⋅2=−1, C12=(−1) M12=−det⁡(3101)=−(3⋅1−1⋅0)=−3.C_{12} = (-1)\, M_{12} = -\det\begin{pmatrix} 3 & 1 \\ 0 & 1 \end{pmatrix} = -(3\cdot 1 - 1\cdot 0) = -3.C12​=(−1)M12​=−det(30​11​)=−(3⋅1−1⋅0)=−3.

So

det⁡A=1⋅(−1)+2⋅(−3)+0=−1−6=−7.\det A = 1 \cdot (-1) + 2 \cdot (-3) + 0 = -1 - 6 = -7.detA=1⋅(−1)+2⋅(−3)+0=−1−6=−7.

(Equivalently, writing the expansion with the minors visible: 1⋅det⁡(1121)−2⋅det⁡(3101)+0=−1−6=−71\cdot\det\begin{pmatrix}1&1\\2&1\end{pmatrix} - 2\cdot\det\begin{pmatrix}3&1\\0&1\end{pmatrix} + 0 = -1 - 6 = -71⋅det(12​11​)−2⋅det(30​11​)+0=−1−6=−7.)

Check via pivots. Eliminate AAA without row swaps: subtract 333 times row 1 from row 2 to get (1200−51021)\begin{pmatrix} 1 & 2 & 0 \\ 0 & -5 & 1 \\ 0 & 2 & 1 \end{pmatrix}​100​2−52​011​​; then add 25\frac{2}{5}52​ times the new row 2 to row 3. The pivots are 111, −5-5−5, and 75\frac{7}{5}57​, and 1⋅(−5)⋅75=−71 \cdot (-5) \cdot \frac{7}{5} = -71⋅(−5)⋅57​=−7, matching the cofactor result.

Cofactor expansion is O(n!)O(n!)O(n!) if applied naively to large nnn; for computation prefer elimination (product of pivots). For theory and small hand calculations — and for the characteristic polynomial in Week 9 — expansion is the right tool.

Exercise · Fill in the blank

Compute det([[1,2,0],[3,1,1],[0,2,1]]) by cofactor expansion along the first row.


Cramer's Rule#

Cramer's rule solves a square system Ax=bAx = bAx=b when AAA is invertible, by writing each unknown as a ratio of two determinants. For each index iii, form the matrix AiA_iAi​ by replacing column iii of AAA with the right-hand side bbb. Then

xi=det⁡(Ai)det⁡(A).x_i = \frac{\det(A_i)}{\det(A)}.xi​=det(A)det(Ai​)​.

The formula is a direct consequence of multilinearity in the columns: the solution identity Ax=bA x = bAx=b says bbb is the linear combination x1a1+⋯+xnanx_1 a_1 + \cdots + x_n a_nx1​a1​+⋯+xn​an​ of the columns of AAA; expanding det⁡(Ai)\det(A_i)det(Ai​) and using alternating multilinear properties isolates xidet⁡(A)x_i \det(A)xi​det(A).

Worked 2×22 \times 22×2. Solve

(2143)(x1x2)=(511).\begin{pmatrix} 2 & 1 \\ 4 & 3 \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \end{pmatrix} = \begin{pmatrix} 5 \\ 11 \end{pmatrix}.(24​13​)(x1​x2​​)=(511​).

We already have det⁡(A)=2\det(A) = 2det(A)=2. Replace column 1 with bbb:

A1=(51113),det⁡(A1)=5⋅3−1⋅11=4,A_1 = \begin{pmatrix} 5 & 1 \\ 11 & 3 \end{pmatrix}, \qquad \det(A_1) = 5\cdot 3 - 1\cdot 11 = 4,A1​=(511​13​),det(A1​)=5⋅3−1⋅11=4,

so x1=4/2=2x_1 = 4/2 = 2x1​=4/2=2. Replace column 2 with bbb:

A2=(25411),det⁡(A2)=2⋅11−5⋅4=2,A_2 = \begin{pmatrix} 2 & 5 \\ 4 & 11 \end{pmatrix}, \qquad \det(A_2) = 2\cdot 11 - 5\cdot 4 = 2,A2​=(24​511​),det(A2​)=2⋅11−5⋅4=2,

so x2=2/2=1x_2 = 2/2 = 1x2​=2/2=1. Check: 2(24)+1(13)=(511)2\begin{pmatrix}2\\4\end{pmatrix} + 1\begin{pmatrix}1\\3\end{pmatrix} = \begin{pmatrix}5\\11\end{pmatrix}2(24​)+1(13​)=(511​).

When to use it. Cramer's rule is excellent for 2×22 \times 22×2 systems and for theoretical arguments that need an explicit formula for xix_ixi​. For n≥3n \ge 3n≥3 it is usually slower than elimination: you compute n+1n+1n+1 determinants instead of one factorization. If det⁡(A)=0\det(A) = 0det(A)=0, the rule does not apply — the system has either no solution or infinitely many, which Week 5 will classify by rank.


Determinant as Volume#

There is a geometric meaning that makes the algebraic rules intuitive. If the columns of an n×nn \times nn×n matrix AAA are vectors a1,…,ana_1, \ldots, a_na1​,…,an​ in Rn\mathbb{R}^nRn, they span a parallelepiped (a parallelogram when n=2n = 2n=2). The absolute value of the determinant is the volume of that solid:

∣det⁡A∣=volume of the parallelepiped spanned by the columns of A.\bigl|\det A\bigr| = \text{volume of the parallelepiped spanned by the columns of } A.​detA​=volume of the parallelepiped spanned by the columns of A.

(The same statement holds with rows instead of columns.) The sign of det⁡(A)\det(A)det(A) encodes orientation: positive means the ordered basis (a1,…,an)(a_1,\ldots,a_n)(a1​,…,an​) has the same orientation as the standard basis; negative means it is mirrored (an odd number of reflections or row/column swaps).

Unit cube. The columns of III are the standard unit vectors, which span the unit cube of volume 111, matching det⁡(I)=1\det(I) = 1det(I)=1.

Axis-aligned box. If

A=(100020003),A = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix},A=​100​020​003​​,

the columns are edge vectors of lengths 111, 222, and 333 along the coordinate axes. The box volume is 1⋅2⋅3=61 \cdot 2 \cdot 3 = 61⋅2⋅3=6, and det⁡(A)=6\det(A) = 6det(A)=6.

Linear maps scale volume. Applying AAA to any region multiplies nnn-dimensional volume by ∣det⁡(A)∣|\det(A)|∣det(A)∣. In particular, if det⁡(A)=0\det(A) = 0det(A)=0, the image of the unit cube is flattened into a lower-dimensional set of volume zero — the columns are linearly dependent, and AAA is singular. That is the geometric reason a zero determinant means “no inverse”: you cannot reverse a map that has crushed volume to zero.

This volume picture returns in change-of-variables formulas (Jacobians) and in continuous densities on configuration spaces. Algebraically, the same scalar det⁡(A)\det(A)det(A) will appear in Week 9 as the constant term structure of the characteristic polynomial det⁡(A−λI)=0\det(A - \lambda I) = 0det(A−λI)=0.


Knowledge check#

Question 1 of 3

Swapping two rows of a matrix does what to its determinant?

Flips its sign
Doubles it
Leaves it unchanged
Sets it to zero

Browser lab#

Compute a determinant, verify the row-swap sign flip, and use it as a volume.

python · runs in browser
import numpy as np

A = np.array([[1., 2., 0.],
              [3., 1., 1.],
              [0., 2., 1.]])

print("det(A) =", np.linalg.det(A))

A_swapped = A.copy()
A_swapped[[0, 1]] = A_swapped[[1, 0]]
print("det after row swap =", np.linalg.det(A_swapped))

edges = np.array([[1., 0., 0.],
                   [0., 2., 0.],
                   [0., 0., 3.]])
print("box volume via det =", abs(np.linalg.det(edges)))
← Previous
Week 3: Elimination and LU Factorization
Next →
Week 5: Vector Spaces, Independence, and Basis
On this page
  • Defining Properties
  • Determinant from Pivots
  • Cofactor Expansion
  • Cramer's Rule
  • Determinant as Volume
  • Knowledge check
  • Browser lab