You test a matrix for an inverse the quick way: look for a zero row, or two rows that are multiples. The rows , and pass that test. The test proves nothing in three dimensions, and the picture shows why.
Before you move anything, commit to an answer.
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?
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.
The dashed cube is the unit cube. The shaded box is its image: corner goes to , so the edges from the origin are the columns of . Slide and watch the volume. Then lift with through , and scale with .
Volume is base times height#
The determinant of a square matrix is the signed volume of the box that makes from the unit cube. The scene's columns are
A box's volume is its base area times its height. The cross product is normal to the base, and its length is the base area. The height is the part of along that normal. So
At , , with length , and
The shear cancels. The slider moves along , which lies in the base. The box leans, but the caption keeps area and height for every . Adding a multiple of one column to another never changes .
Flat without parallel columns. At , 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 row 1 row 2.
The sign is a side. For , is on the other side of the base. The box is a mirror image of a right-handed box, is negative, and the volume is .
Scale is cubed. The slider multiplies every column by , the base area by and the height by . So , and at the caption prints , not .
A linear map multiplies the volume of every region by . That is why a change of variables in an integral carries a Jacobian determinant.
Three rules define it#
Three rules fix on every matrix, and each is a fact about volume.
- . The unit cube has volume .
- A row exchange multiplies by . Swapping two edges mirrors the box.
- is linear in each row. Stretching one edge by stretches the volume by .
Two equal rows give , so . Subtracting a multiple of one row from another adds a determinant with two equal rows, which is : the shear again. Since , every rule also holds for columns.
Determinant from pivots#
Elimination uses only shears and row exchanges, so is the product of the pivots, negated for an odd number of exchanges. Take the scene at , :
The pivots are , and , so . At the last row becomes : a zero pivot, a flat box and no inverse. is invertible exactly when .
Cofactor expansion#
The cofactor expansion writes as a sum over one row. The minor is the determinant without row and column , the cofactor is , and
Expand the same matrix along row 1:
Expansion costs about products, so use elimination for a large matrix. Use expansion for small matrices and for formulas, such as the characteristic polynomial in Week 9.
Knowledge Check#
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?
Browser lab: the box in NumPy#
Compute the scene's determinant three ways: NumPy's LU, cofactor expansion and the triple product.
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: , , , and . The flat box at has rank . Match each row to the caption at the same setting.
Key takeaways#
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 .
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.