Skip to main content
© 2026 ePowerAI — free, open courseware. No login required.
CoursesContact
ePOWERAI
CoursesContact
Week 4: Determinants
Linear Algebra

Foundations

  1. 01Start Here: Python and the Math the Labs Use
  1. 02Week 1: Vectors and Linear Combinations
  2. 03Week 2: Linear Transformations and Matrices
  3. 04Week 3: Elimination and LU Factorization
  4. 05Week 4: Determinants
  5. 06Week 5: Vector Spaces, Independence, and Basis
  6. 07Week 6: The Four Fundamental Subspaces
  7. 08Week 7: Orthogonality and Projections
  8. 09Week 8: Least Squares and QR
  9. 10Week 9: Eigenvalues and Eigenvectors
  10. 11Week 10: Diagonalization and Markov Matrices
  11. 12Week 11: Differential Equations
  12. 13Week 12: Symmetric and Positive Definite Matrices
  13. 14Week 13: The SVD and Complex Matrices
  14. 15Week 14: PCA, the Fourier Matrix and the FFT
Week 04· Linear Algebra7 min read

Week 4: Determinants

Learning Outcomes
  • Read det⁡A\det AdetA as the signed volume of the image of the unit cube
  • Explain why a shear keeps det⁡A\det AdetA and why a row exchange flips its sign
  • Compute det⁡A\det AdetA from the pivots and by cofactor expansion
  • Predict det⁡(kA)\det(kA)det(kA), and spot a singular matrix that has no zero row and no parallel rows
Prerequisites

Background knowledge assumed:

  • Gaussian elimination and pivots

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

You test a 3×33 \times 33×3 matrix for an inverse the quick way: look for a zero row, or two rows that are multiples. The rows (1,0,1)(1, 0, 1)(1,0,1), (0,1,−1)(0, 1, -1)(0,1,−1) and (12,12,0)(\tfrac12, \tfrac12, 0)(21​,21​,0) pass that test. The test proves nothing in three dimensions, and the picture shows why.

Before you move anything, commit to an answer.

Exercise · Multiple choice

In the scene below, keep k = 1 and set s = 1 and h = 0, the matrix above. No column is zero and no two are parallel. What is det A?

1, as at the start
0
−1
It needs cofactors
a₁a₂a₃

The unit cube, dashed, and its image under a 3 × 3 matrix A: a box on the columns a₁, a₂ and a₃. The base a₁, a₂ is shaded, and a dashed line drops from the tip of a₃ to the base plane. The slider s slides a₃ along a₁ − a₂, parallel to the base. The slider h lifts a₃ off the base, and the slider k scales all of A. s = 0, h = 1, k = 1. Columns a₁ = (1, 0, 0.5), a₂ = (0, 1, 0.5), a₃ = (0, 0, 1). The base a₁, a₂ has area 1.22, and a₃ stands 0.82 above it. det A = 1, so the box has volume 1. a₁, a₂, a₃ are right-handed, like x, y, z.

s = 0, h = 1, k = 1. Columns a₁ = (1, 0, 0.5), a₂ = (0, 1, 0.5), a₃ = (0, 0, 1). The base a₁, a₂ has area 1.22, and a₃ stands 0.82 above it. det A = 1, so the box has volume 1. a₁, a₂, a₃ are right-handed, like x, y, z.

The dashed cube is the unit cube. The shaded box is its image: corner (i,j,l)(i, j, l)(i,j,l) goes to i a1+j a2+l a3i\,a_1 + j\,a_2 + l\,a_3ia1​+ja2​+la3​, so the edges from the origin are the columns of AAA. Slide sss and watch the volume. Then lift a3a_3a3​ with hhh through 000, and scale with kkk.

Volume is base times height#

The determinant of a square matrix AAA is the signed volume of the box that AAA makes from the unit cube. The scene's columns are

a1=k (1,0,12),a2=k (0,1,12),a3=k (s,−s,h).a_1 = k\,(1, 0, \tfrac12), \qquad a_2 = k\,(0, 1, \tfrac12), \qquad a_3 = k\,(s, -s, h).a1​=k(1,0,21​),a2​=k(0,1,21​),a3​=k(s,−s,h).

A box's volume is its base area times its height. The cross product a1×a2a_1 \times a_2a1​×a2​ is normal to the base, and its length is the base area. The height is the part of a3a_3a3​ along that normal. So

det⁡A=(a1×a2)⋅a3.\det A = (a_1 \times a_2) \cdot a_3.detA=(a1​×a2​)⋅a3​.

At k=1k = 1k=1, a1×a2=(−12,−12,1)a_1 \times a_2 = (-\tfrac12, -\tfrac12, 1)a1​×a2​=(−21​,−21​,1), with length 1.5≈1.22\sqrt{1.5} \approx 1.221.5​≈1.22, and

(a1×a2)⋅a3=−s2+s2+h=h.(a_1 \times a_2) \cdot a_3 = -\tfrac{s}{2} + \tfrac{s}{2} + h = h.(a1​×a2​)⋅a3​=−2s​+2s​+h=h.

The shear cancels. The slider sss moves a3a_3a3​ along a1−a2a_1 - a_2a1​−a2​, which lies in the base. The box leans, but the caption keeps area 1.221.221.22 and height 0.820.820.82 for every sss. Adding a multiple of one column to another never changes det⁡A\det AdetA.

Flat without parallel columns. At h=0h = 0h=0, a3=s (a1−a2)a_3 = s\,(a_1 - a_2)a3​=s(a1​−a2​) lies in the base plane, and so do all eight corners. In two dimensions a zero determinant needs two parallel columns. In three dimensions one column in the plane of the other two is enough. The rows obey the same rule: row 3 is 12\tfrac1221​ row 1 +12+ \tfrac12+21​ row 2.

The sign is a side. For h<0h < 0h<0, a3a_3a3​ is on the other side of the base. The box is a mirror image of a right-handed box, det⁡A\det AdetA is negative, and the volume is ∣det⁡A∣|\det A|∣detA∣.

Scale is cubed. The slider kkk multiplies every column by kkk, the base area by k2k^2k2 and the height by kkk. So det⁡(kA)=k3det⁡A\det(kA) = k^3 \det Adet(kA)=k3detA, and at k=2k = 2k=2 the caption prints 888, not 222.

A linear map multiplies the volume of every region by ∣det⁡A∣|\det A|∣detA∣. That is why a change of variables in an integral carries a Jacobian determinant.

Three rules define it#

Three rules fix det⁡\detdet on every n×nn \times nn×n matrix, and each is a fact about volume.

  1. det⁡I=1\det I = 1detI=1. The unit cube has volume 111.
  2. A row exchange multiplies det⁡\detdet by −1-1−1. Swapping two edges mirrors the box.
  3. det⁡\detdet is linear in each row. Stretching one edge by ccc stretches the volume by ccc.

Two equal rows give det⁡A=−det⁡A\det A = -\det AdetA=−detA, so det⁡A=0\det A = 0detA=0. Subtracting a multiple of one row from another adds a determinant with two equal rows, which is 000: the shear again. Since det⁡AT=det⁡A\det A^{\mathsf T} = \det AdetAT=detA, every rule also holds for columns.

Determinant from pivots#

Elimination uses only shears and row exchanges, so det⁡A\det AdetA is the product of the pivots, negated for an odd number of exchanges. Take the scene at s=1s = 1s=1, h=1h = 1h=1:

(10101−112121)→(10101−101212)→(10101−1001).\begin{pmatrix} 1 & 0 & 1 \\ 0 & 1 & -1 \\ \tfrac12 & \tfrac12 & 1 \end{pmatrix} \to \begin{pmatrix} 1 & 0 & 1 \\ 0 & 1 & -1 \\ 0 & \tfrac12 & \tfrac12 \end{pmatrix} \to \begin{pmatrix} 1 & 0 & 1 \\ 0 & 1 & -1 \\ 0 & 0 & 1 \end{pmatrix}.​1021​​0121​​1−11​​→​100​0121​​1−121​​​→​100​010​1−11​​.

The pivots are 111, 111 and 111, so det⁡A=1\det A = 1detA=1. At h=0h = 0h=0 the last row becomes (0,0,0)(0, 0, 0)(0,0,0): a zero pivot, a flat box and no inverse. AAA is invertible exactly when det⁡A≠0\det A \ne 0detA=0.

Cofactor expansion#

The cofactor expansion writes det⁡A\det AdetA as a sum over one row. The minor MijM_{ij}Mij​ is the determinant without row iii and column jjj, the cofactor is Cij=(−1)i+jMijC_{ij} = (-1)^{i+j} M_{ij}Cij​=(−1)i+jMij​, and

det⁡A=∑jaij Cijfor any row i.\det A = \sum_{j} a_{ij}\, C_{ij} \quad \text{for any row } i.detA=j∑​aij​Cij​for any row i.

Expand the same matrix along row 1:

det⁡A=1⋅∣1−1121∣−0+1⋅∣011212∣=1.5−0.5=1.\det A = 1 \cdot \begin{vmatrix} 1 & -1 \\ \tfrac12 & 1 \end{vmatrix} - 0 + 1 \cdot \begin{vmatrix} 0 & 1 \\ \tfrac12 & \tfrac12 \end{vmatrix} = 1.5 - 0.5 = 1.detA=1⋅​121​​−11​​−0+1⋅​021​​121​​​=1.5−0.5=1.

Expansion costs about n!n!n! products, so use elimination for a large matrix. Use expansion for small matrices and for formulas, such as the characteristic polynomial det⁡(A−λI)\det(A - \lambda I)det(A−λI) in Week 9.

Knowledge Check#

Question 1 of 4

Set h = 1 and k = 1, then slide s from 0 to 1. The box leans over. What does the caption print for det A?

1 at every s
It grows to 2
It shrinks toward 0
It changes sign

Browser lab: the box in NumPy#

Compute the scene's determinant three ways: NumPy's LU, cofactor expansion and the triple product.

python · runs in browser
import numpy as np

def scene_matrix(s, h, k):
    a1 = [1, 0, 0.5]
    a2 = [0, 1, 0.5]
    a3 = [s, -s, h]
    return k * np.column_stack([a1, a2, a3])

def cofactor_det(A):
    if len(A) == 1:
        return A[0, 0]
    return sum((-1) ** j * A[0, j] * cofactor_det(np.delete(A[1:], j, axis=1))
               for j in range(len(A)))

clean = lambda x: round(float(x), 3) + 0.0

for s, h, k in [(0, 1, 1), (1, 1, 1), (1, 0, 1), (0, -0.5, 1), (0, 1, 2)]:
    A = scene_matrix(s, h, k)
    a1, a2, a3 = A.T
    print(f"s={s:>2}, h={h:>4}, k={k}:  det {clean(np.linalg.det(A)):6.3f}   "
          f"cofactor {clean(cofactor_det(A)):6.3f}   (a1 x a2).a3 {clean(np.cross(a1, a2) @ a3):6.3f}   "
          f"rank {np.linalg.matrix_rank(A)}")

The methods agree on each row: 111, 111, 000, −0.5-0.5−0.5 and 888. The flat box at h=0h = 0h=0 has rank 222. Match each row to the caption at the same setting.

Key takeaways#

det⁡A\det AdetA is the signed volume of the image of the unit cube: base area times the height of the last column. A shear keeps it. The box goes flat when one column lies in the plane of the other two. The sign tells which side of the base the last column is on, and det⁡(kA)=k3det⁡A\det(kA) = k^3 \det Adet(kA)=k3detA.

Further reading#

  • Gilbert Strang, Introduction to Linear Algebra (6th ed., Wellesley-Cambridge Press, 2023), Chapter 5. Properties, pivots, cofactors and volume.
  • Gilbert Strang, Introduction to Linear Algebra, 6th ed.: Solutions to Problem Sets, Problem Sets 5.1 and 5.3.
  • Dan Margalit and Joseph Rabinoff, Interactive Linear Algebra, Section 4.3. Base times height, and the right-hand rule.

Reading is free. PDF and ePub unlock with the newsletter. Join once and every lesson opens in this browser.

← Previous
Week 3: Elimination and LU Factorization
Next →
Week 5: Vector Spaces, Independence, and Basis
On this page
  • Volume is base times height
  • Three rules define it
  • Determinant from pivots
  • Cofactor expansion
  • Knowledge Check
  • Browser lab: the box in NumPy
  • Key takeaways
  • Further reading