Linear Algebra / Unit 3, Matrices / Topic 3.4
Unit 3. Matrices
This topic defines the determinant of a square matrix of any size. The determinant is one number that tells how a map changes volumes and whether the matrix has an inverse.
You need Topics 1.5, 2.2, 3.2, and 3.3 for this topic.
In Topic 3.2, the determinant of a 2 by 2 matrix was ad − bc. A map changes all areas by the same factor, and the size of the determinant is that factor. The sign tells whether the map flips the plane over.
The same idea holds for a square matrix of any size. A 3 by 3 matrix changes all volumes by the same factor, and the size of its determinant is that factor. The determinant of A is written det A. Only a square matrix has a determinant.
The determinant of a 3 by 3 matrix is built from three 2 by 2 determinants.
det abcdefghi = a(ei − fh) − b(di − fg) + c(dh − eg)Each entry of the first row is multiplied by the determinant of the 2 by 2 matrix that remains when the row and the column of that entry are removed. The signs alternate: plus, minus, plus. This is called the cofactor expansion along the first row.
For example,
det 211433879 = 2(27 − 21) − 1(36 − 24) + 1(28 − 24)expand along the first row= 12 − 12 + 4multiply= 4addThe expansion can use any row or any column. The sign of each term follows a checkerboard pattern that starts with a plus sign in the upper left corner.
+−+−+−+−+Choose the row or column with the most zeros, because each zero removes a term. In the next matrix, column 2 has only one entry that is not 0. That entry is the 2 in row 3, and its sign in the pattern is minus.
det 302105421 = −2 · det 3215expand along the second column, which has two zeros= −2(15 − 2)the 2 by 2 determinant= −26multiplyThe 3 by 3 determinant is the scalar triple product from Topic 1.5. If the rows of the matrix are the vectors u, v, and w, then the determinant is u · (v × w). Its size is the volume of the box that has the three vectors as edges.
The determinant of a triangular matrix is the product of its diagonal entries. Expanding along the first column shows why: at each step, only the diagonal entry gives a term.
det 123045006 = (1)(4)(6)the product of the diagonal entries= 24The same rule holds for diagonal matrices. The determinant of the identity matrix is 1.
The three row operations of Topic 2.2 change the determinant in simple ways.
| Row operation | Effect on the determinant |
|---|---|
| Exchange two rows | The sign changes |
| Multiply a row by a number c | The determinant is multiplied by c |
| Add a multiple of one row to another row | No change |
Try it: row operations and area
The rows of a 2 by 2 matrix are the blue vector and the red vector. The shaded parallelogram has an area equal to the size of the determinant. Press a button to apply a row operation, or drag the tips of the vectors.
These rules give a fast way to calculate a determinant. Reduce the matrix to row echelon form, using only row exchanges and the operation that adds a multiple of one row to another row. The echelon form is triangular, so its determinant is the product of its pivots.
det A = ± (product of the pivots)The sign is plus for an even number of row exchanges and minus for an odd number. For the first example of Part 2, elimination needs no row exchange and gives the pivots 2, 1, and 2. Their product is 4, which agrees with the cofactor expansion.
For square matrices A and B of the same size n,
det(AB) = (det A)(det B) det(AT) = det A det(A⁻¹) = 1/det A det(cA) = cⁿ det AA determinant of 0 means that the map flattens space into a smaller number of dimensions, so that all volumes become 0. For a square matrix A of size n, the following statements are either all true or all false.
A matrix with a determinant of 0 is the singular matrix of Topic 2.3.
The cofactor expansion works for any size. The determinant of a 4 by 4 matrix is a sum of four terms, and each term contains a 3 by 3 determinant. The number of products grows very quickly: a 10 by 10 determinant needs more than 3 million products. Elimination needs only a few hundred steps for the same matrix. For this reason, determinants of large matrices are calculated by elimination.
Determinants give a formula for the solution of Ax = b when det A is not 0. To find one unknown, replace the column of that unknown by b, take the determinant, and divide by det A. For the system 2x + y = 5 and x + y = 3 from Topic 3.2,
x = det 5131/det 2111replace the column of x by bx = 2/1 = 2the two determinantsy = det 2513/det 2111replace the column of y by by = 1/1 = 1the two determinantsCramer’s rule is useful for small systems and for formulas. For larger systems, elimination is much faster.
| Fact | Statement |
|---|---|
| Meaning | The factor by which the map changes volumes, with a sign |
| 3 by 3 | a(ei − fh) − b(di − fg) + c(dh − eg) |
| Triangular matrix | The product of the diagonal entries |
| By elimination | Plus or minus the product of the pivots |
| Product | det(AB) = (det A)(det B) |
| Inverse | A has an inverse exactly when det A is not 0 |
Work each problem on paper first. Then open the answer to check your work.
det = 1(1 − 2) − 2(3 − 0) + 0expand along the first rowdet = −1 − 6 = −7
The matrix is lower triangular, so the determinant is the product of the diagonal entries.
det = (5)(−1)(4) = −20
det(2A) = 2³(5) = 40each of the 3 rows is multiplied by 2det(A⁻¹) = 1/51 divided by det Adet(AT) = 5the transpose has the same determinantdet(A²) = (det A)(det A) = 25the product rule
Exchange rows 1 and 2, which changes the sign. The matrix is now 110021302.
R₃ → R₃ − 3R₁gives the row (0, −3, 2)R₃ → R₃ + 3/2R₂gives the row (0, 0, 7/2)product of the pivots = (1)(2)(7/2) = 7det = −7one row exchange changes the sign
det = 1(45 − 48) − 2(36 − 42) + 3(32 − 35)expand along the first rowdet = −3 + 12 − 9 = 0
The determinant is 0, so the matrix has no inverse.
det A = (3)(2) − (1)(1) = 5x = det 7142/5 = 10/5 = 2replace the first column by the right sidey = det 3714/5 = 5/5 = 1replace the second column by the right side6 + 1 = 7the check in the first equation2 + 2 = 4the check in the second equation
The instruction np.linalg.det calculates the determinant of a square matrix. The code below uses the first example of Part 2.
Python
The result is very close to 4. Python calculates a determinant by elimination with decimal numbers, so the last digits can show a very small rounding error. The instruction round removes it. The second number inside round is the number of decimal places to keep.
Python
Now change the matrix to the second example of Part 2, which has the rows 3, 0, 2 and 1, 0, 5 and 4, 2, 1.
Python
From Part 4, a row exchange changes the sign of the determinant. In the next box, retype the matrix with rows 1 and 2 exchanged, and press Run.
Python
The code below calculates det(AB) and (det A)(det B) for two matrices. The @ sign multiplies two matrices, and the * sign multiplies two numbers.
Python
Both results are −28, because det A = 4 and det B = −7.
The code below prints det A and det(2A) for a 3 by 3 matrix.
Python
The results are 4 and 32. The determinant was multiplied by 2³ = 8, not by 2.
In the next box, replace the 0 with your prediction for det(3A). The code prints your prediction and then the value that Python calculates.
Python
The matrix below is the one from Practice Problem 5. Its determinant is 0, so it has no inverse.
Python
The first result may be a number such as 6.66e-16 and not exactly 0. The ending e-16 means that the number is multiplied by 10⁻¹⁶. A determinant that is this small, compared with the entries of the matrix, should be read as 0.
In the next box, change the last entry of the matrix, the 9, to a number that gives the matrix an inverse. Any number other than 9 works.
Python
This quiz has 5 questions on this topic. A question asks you either to choose one answer or to type numbers. The page grades your answers and explains each one. A number can be typed as a whole number, a decimal, a fraction such as 1/3, or a calculation such as sqrt(18)/2 or arccos(1/2). The page shows the value of a calculation next to the box. Angles in a calculation are in degrees. The Calculator button under each question opens a calculator. Your answers are saved in your browser, so they are still on the page when you come back to it.
Choose how your answers are checked
1. Find the determinant of 201130014.
det = 2(12 − 0) − 0(4 − 0) + 1(1 − 0)expand along the first rowdet = 24 + 1 = 25
2. Find the determinant of 35−202700−1.
The matrix is triangular, so its determinant is the product of the diagonal entries: (3)(2)(−1) = −6.
3. A is a 3 by 3 matrix with det A = 2. Find det(3A).
For an n by n matrix, det(cA) = cⁿ det A.3³ = 27the factor for a 3 by 3 matrix(27)(2) = 54the factor times det A
4. A matrix has the determinant 5. Two of its rows are exchanged. What is the determinant of the new matrix?
A row exchange changes the sign of the determinant and does not change its size.
5. A square matrix has the determinant 0. Which statement is true?
A square matrix has an inverse exactly when its determinant is not 0. A matrix with the determinant 0 does not have to be the zero matrix. For example, the matrix with the rows 1, 2 and 2, 4 has the determinant 0.
Next: Topic 3.5, The Trace