How a matrix changes area
A matrix maps the plane to itself (lesson 3.2.2). Its first column is where lands and its second is where lands. So the unit square, with corners , , and , lands on the parallelogram whose sides are the two columns.
Take
The square lands on the parallelogram with sides and . Its fourth corner is .
To find its area, draw the box around it, 4 wide and 3 tall, and cut away the six pieces outside it:
| piece | area |
|---|---|
| the box, 4 by 3 | 12 |
| two triangles along the long sides | |
| two triangles along the short sides | |
| two corner squares | |
| the parallelogram |
The matrix sends the unit square to a parallelogram with sides its columns. The box around it has area 12, the six pieces outside it 7, so the parallelogram has area 5.
Every grid square lands on a copy of this parallelogram, so multiplies every area by 5. A triangle of area 2 lands on one of area 10.
The same counting with letters gives the area for any matrix. It is , the number lesson 3.2.3 divides by to find the inverse. For , .
Rule: Determinant of a 2 × 2 matrix
The determinant is the signed area of the parallelogram the unit square lands on. The map multiplies every area by , so the determinant is a ratio: area out per unit of area in.
When the entries are plain numbers, so is the determinant. If every entry is in dollars, is in dollars squared, so changing the units changes it; case study 3.4.3 shows why that matters.
Area can stay the same while the shape changes. The stretch turns the square into a 2 by 0.5 rectangle: . The shear leans it over with the same base and height: .
Try it
det2 is the rule. The second line is the box count, and np.linalg.det agrees: round(…, 10) hides rounding in the last digit.
The last line maps the four corners of the unit square, stored as columns. They land on , , and .
The sign: flipped or not
Swap the columns of and the parallelogram is the same shape, yet . The sign records the orientation: the direction you turn to go from the first column to the second.
For the unit square, turning from to is anticlockwise. Under , turning from to is anticlockwise too, and . With the columns swapped, the turn from to is clockwise: the plane has been flipped over, as in a mirror.
| matrix | what happens to the unit square | |
|---|---|---|
| 5 | area times 5, not flipped | |
| with its columns swapped | area times 5, flipped | |
| stretch, | 1 | a 2 by 0.5 rectangle |
| quarter turn, | 1 | turned, not flipped |
| reflection, | flipped, same size | |
| 0 | flattened onto a line |
The last row is lesson 3.2.3's singular matrix . Its second column, , is twice its first, , so the square is squashed onto a line and has no area left.
Rule: What the sign says
The change in area is in every case. A negative determinant is not a negative area: it is a positive area, flipped.
The explorer starts on , the "Flatten" matrix, with its square squashed flat. Raise from 1 to 1.5 and the square opens to area 0.5; lower it to 0.5 and the determinant is , a flip. Then try the reflection and the quarter turn.
Explore
Pick a matrix or set its entries. Its first column is where e₁ lands and its second where e₂ lands; the whole grid follows. Then drag the probe x and look for directions that A only stretches.
- Matrix
- Columns
- Ae₁ = (1, 0.5), Ae₂ = (2, 1)
- det A
- 1 × 1 − 2 × 0.5 = 0: the plane is flattened onto a line (or a point), so A has no inverse.
- Probe
- Ax = (5, 2.5): a different direction.
- Eigenvalues
- λ = 2 and 0
Try it
Each line prints a matrix of the table and its determinant.
Adding 0.0 turns a -0.0 into 0.0, as in lesson 3.2.3.
Three by three: the volume of a box
A matrix maps space to itself. The unit cube, with edges , and , lands on a slanted box whose edges are the three columns. The determinant is the signed volume of that box.
Take
Its first two columns, and , lie flat on the floor, where the third component is 0. They span a parallelogram of area . The third column, , rises to height 2, so the box has volume .
sends the unit cube to a slanted box with edges its columns. Its floor has area 4 and its height is 2, so its volume is 8.
Most boxes do not sit so neatly on the floor. For any matrix, the determinant is built from ones.
Write for the entry in row and column . Its minor is the determinant of what is left after deleting row and column .
Rule: Cofactor expansion along row 1
Each entry of the first row times its minor, with signs , , . A signed minor is called a cofactor. The result is the signed volume of the box the unit cube lands on.
Take
| entry | sign | minor | term |
|---|---|---|---|
| 2 | 16 | ||
| 1 | 1 | ||
| 3 |
So . The middle term is subtracted, and its minor is negative, so it adds 1.
Any row or column works, with the signs of a checkerboard:
Row 2 of is , with signs , , . Its minors are and , and the 0 saves working out . So again.
Expand along the row or column with the most zeros.
For , the first column has two zeros: . is upper triangular, with zeros below the diagonal, and its determinant is the product of the diagonal, .
As in the plane, a negative determinant means the map turns space into its mirror image. The volume is still .
Try it
det3 is the expansion along row 1. The loop prints each entry of row 1 of with its minor: np.delete removes row 1, then column .
np.linalg.det(C) printed 4.999999999999998 when this lesson was written; the last digits can differ on another computer. Rounding fixes that.
Determinant 0: no inverse
A determinant is 0 exactly when the box is flat: the columns lie in one plane, or on one line. Then some column is a combination of the others, and the columns are called dependent (lesson 3.5.1 studies this). Elimination finds fewer than pivots, so the rank is below (lesson 3.3.2).
A flattened space cannot be unflattened, so has no inverse: it is singular, as lesson 3.2.3 called . The inverse formula of lesson 3.2.3 divides by , which is 0 here.
Rule: The invertibility test
For a square matrix, four statements go together: , independent columns, rank , and exactly one solution of for every . When , has no solution or infinitely many.
A example:
Its third column is the sum of the first two, so the box is flat. Along row 1, the minors are , 17 and 17, and . Its rank is 2.
On a computer, np.linalg.det(S) prints a tiny number, here , not 0; the exact digits depend on the computer's maths library. As lesson 3.3.2 found for rank, rounding hides zeros: elimination in decimals leaves a tiny number where a 0 pivot should be. Ask np.linalg.matrix_rank instead, which allows for rounding.
Try it
The first line checks : determinant 0, rank 1. The second checks that column 3 of is column 1 plus column 2.
The determinant of is printed to two significant figures, since its digits are rounding noise. matrix_rank says 2.
Rules for products, transposes and rows
Doing one map after another multiplies their area factors: the product is ", then " (lesson 3.2.2). So .
With as above, , and , . Both and have determinant 15, although (lesson 3.2.1). There is no rule for sums: has determinant 17, not .
Two more rules follow. undoes , so it divides every area by : . And : rows and columns play the same part, so each rule for rows below holds for columns too.
Row operations (lesson 3.3.1) change the determinant in set ways. Starting from , with :
| change to | new |
|---|---|
| swap rows 1 and 3 | |
| multiply row 2 by 3 | 15 |
| subtract 2 × row 3 from row 1 | 5 |
| multiply every entry by 2 |
Multiplying every entry by 2 multiplies each of the 3 rows by 2, so the determinant grows by . In the box picture, every edge doubles and the volume grows 8 times.
Rule: Determinant rules
For an matrix. A row swap flips the sign, and multiplying one row by multiplies the determinant by . Adding a multiple of one row to another changes nothing.
Try it
det rounds NumPy's answer. The first line prints , , and .
C[[2, 1, 0]] lists the rows of in the order 3, 2, 1, which swaps rows 1 and 3. .copy() keeps unchanged.
How a computer finds a determinant
Elimination (lesson 3.3.1) uses only swaps and "add a multiple of one row to another". The second kind leaves the determinant alone, and each swap flips its sign. Elimination ends at a triangular matrix, whose determinant is the product of its diagonal, the pivots.
For : subtract row 1 from row 3, giving . Then add row 2, giving . The pivots are 2, 4 and 0.625, and .
np.linalg.det works this way, in decimals, which is where its rounding comes from. A small determinant alone does not mean a matrix is nearly singular. Take , where is the identity: its determinant is , yet its columns point along the three axes and its rank is 3.
Try it
The two row operations on , then the product of the pivots.
The last line is the determinant and rank of .
Case study 3.4.3 uses determinants to spot redundant assets, and lesson 3.6.1 finds eigenvalues by solving .
Common mistakes
- Multiply along the diagonals. , not .
- The sign is orientation, not negative area. A determinant of means area times 5, flipped. The area is .
- Mind the cofactor signs. Along row 1 they are , , ; along row 2, , , . Forgetting the minus on the middle term is the usual slip.
- Scaling a matrix scales its determinant by . for a matrix, not . Scaling one row multiplies by once.
- There is no rule for sums. is not ; only products split.
- Only square matrices have determinants. A matrix has a rank but no determinant.
- Do not test
det == 0on a computer. Rounding leaves tiny numbers such as ; usematrix_rank. And a tiny determinant can come from small units, as for .
Determinants
0 of 12 correct
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
How to type answers
- Powers with
^:x^7,2^(1/3),a^-2. - Multiply with
*or by writing side by side:3x^2,2(x+1). ln(x)is the natural log,log(x, 2)is log base 2,eis Euler's number,sqrt(x)is a square root.sin(x),cos(x)andtan(x)take radians; writepifor π andsin(x)^2for sin²x.- Your first answer to each question is saved: it counts towards your score and brings the question back for review.
- Exact answers like
ln(20)/ln(3)are best. Decimals need about 4 significant figures.
Summary card
- : the signed area of the parallelogram the unit square lands on. The map multiplies every area by .
- The sign is orientation: positive keeps it, negative flips the plane over, 0 flattens it.
- : expand along a row, , with checkerboard signs; the result is the signed volume of the box the unit cube lands on. A triangular matrix has the product of its diagonal.
- exactly when the columns are dependent, the rank is below and has no inverse: is singular.
- , , , . A row swap flips the sign; scaling a row scales the determinant; adding a multiple of a row changes nothing.
np.linalg.deteliminates in decimals, so a 0 can print as ; test withmatrix_rank.