Scientia sine finibus

Linear Algebra / Unit 3, Matrices / Topic 3.4

Units and Topics

Unit 3. Matrices

3.4 Determinants

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.

1. What the Determinant Measures

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.

2. The Determinant of a 3 by 3 Matrix

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= 4add

Expanding along another row or column

The 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= −26multiply

The 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.

3. Triangular Matrices

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= 24

The same rule holds for diagonal matrices. The determinant of the identity matrix is 1.

4. Row Operations and the Determinant

The three row operations of Topic 2.2 change the determinant in simple ways.

Row operationEffect on the determinant
Exchange two rowsThe sign changes
Multiply a row by a number cThe determinant is multiplied by c
Add a multiple of one row to another rowNo 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.

5. Rules for Determinants

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 A
  • The product rule says that the volume factors of two maps multiply when one map follows the other.
  • Because det(AT) = det A, each rule about rows is also true for columns.
  • In the last rule, the factor is cⁿ and not c, because cA multiplies each of the n rows by c.
  • There is no rule for a sum. In general, det(A + B) is not equal to det A + det B.

6. A Determinant of Zero

A 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.

  • det A is not 0.
  • A has an inverse.
  • The row echelon form of A has n pivots.
  • The system Ax = b has exactly one solution for each b.
  • The only solution of Ax = 0 is x = 0.

A matrix with a determinant of 0 is the singular matrix of Topic 2.3.

7. Larger Matrices and Cramer’s Rule

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.

Cramer’s rule

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 determinants

Cramer’s rule is useful for small systems and for formulas. For larger systems, elimination is much faster.

Common Mistakes

  • Forgetting the minus sign on the middle term of the expansion along the first row.
  • Calculating det(cA) as c det A. For an n by n matrix, the factor is cⁿ.
  • Assuming that det(A + B) = det A + det B.
  • Forgetting to change the sign after a row exchange during elimination.
  • Multiplying a row by a number during elimination and not correcting for it. That operation multiplies the determinant by the same number.
  • Taking the determinant of a matrix that is not square. It is not defined.

Summary

FactStatement
MeaningThe factor by which the map changes volumes, with a sign
3 by 3a(ei − fh) − b(di − fg) + c(dh − eg)
Triangular matrixThe product of the diagonal entries
By eliminationPlus or minus the product of the pivots
Productdet(AB) = (det A)(det B)
InverseA has an inverse exactly when det A is not 0

Practice

Work each problem on paper first. Then open the answer to check your work.

1. Calculate det 120312011 by expanding along the first row.

det = 1(1 − 2) − 2(3 − 0) + 0expand along the first rowdet = −1 − 6 = −7

2. Calculate det 5002−10734.

The matrix is lower triangular, so the determinant is the product of the diagonal entries.

det = (5)(−1)(4) = −20

3. A is a 3 by 3 matrix with det A = 5. Find det(2A), det(A⁻¹), det(AT), and det(A²).

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

4. Calculate det 021110302 by elimination.

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

5. Does 123456789 have an inverse?

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.

6. Use Cramer’s rule to solve 3x + y = 7 and x + 2y = 4.

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

Python Practice

Step 1. Calculate a determinant

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

Step 2. Exchange two rows

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

Step 3. Check the product rule

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.

Step 4. Multiply a matrix by a number

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

Step 5. Recognize a singular matrix

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

Quiz

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.

2. Find the determinant of 35−202700−1.

3. A is a 3 by 3 matrix with det A = 2. Find det(3A).

4. A matrix has the determinant 5. Two of its rows are exchanged. What is the determinant of the new matrix?

5. A square matrix has the determinant 0. Which statement is true?

Next: Topic 3.5, The Trace