28. Cofactor expansion

28. Cofactor expansion

Recall that the determinant of a 3-by-3 matrix M = ( M 11 M 12 M 13 M 21 M 22 M 23 M 31 M 32 M 33 ) is M 11 M 22 M 33 - M 11 M 23 M 32 - M 12 M 21 M 33 + M 12 M 23 M 31 + M 13 M 21 M 32 - M 13 M 22 M 31 . We can group these into three sets of terms according to the factor M 1 k : those which contain a factor of M 11 , those with an M 12 and those with an M 13 : M 11 ( M 22 M 33 - M 23 M 32 ) - M 12 ( M 21 M 33 - M 23 M 31 ) + M 13 ( M 21 M 32 - M 22 M 31 ) . Note that the terms in brackets are themselves determinants of 2-by-2 submatrices: M 11 det ( M 22 M 23 M 32 M 33 ) - M 12 det ( M 21 M 23 M 31 M 33 ) + M 13 det ( M 21 M 22 M 31 M 32 ) . When we group our determinant according to the choice of the factor M 1 k , the expansion we get is: det ( M ) = M 11 det ( C 11 ) - M 12 det ( C 12 ) + M 13 det ( C 13 ) - ± M 1 n det ( C 1 n ) . Here:

This makes sense: if you pick M i j then you can't pick anything else from row i or from column j .

Example:

For the 3-by-3 matrix M as above, C 12 = ( M 21 M 23 M 31 M 33 ) .

More generally, we could group terms according to the choice of factor M 2 k , or M 3 k , or any other row. The result of expanding about row i would have been: det ( M ) = ± M i 1 det ( C i 1 ) M i 2 det ( C i 2 ) ± , where the signs alternate (I'll talk more about exactly which signs occur below).

Or we could group terms according to the choice of entry in column 1, or column 2, etc. The result of expanding down column j would have been det ( M ) = ± M 1 j det ( C 1 j ) M 2 j det ( C 2 j ) ± where the signs alternate.

Signs

The sign you put in front of M i j det ( C i j ) is the i j th entry of this matrix: ( + - + - - + - + + - + - - + - + ) For example, expanding a 3-by-3 matrix down column 2 would give - M 12 det ( C 12 ) + M 22 det ( C 22 ) - M 32 det ( C 32 ) .

Examples

Rather than prove any of these formulae, which would be painful for everybody, let's do some examples.

Example:

Let's compute the determinant of A = ( 1 2 3 4 5 6 7 8 9 ) using the cofactor expansion along the first row: det ( A ) = 1 × det ( 5 6 8 9 ) - 2 det ( 4 6 7 9 ) + 3 det ( 4 5 7 8 ) = 5 × 9 - 6 × 8 - 2 ( 4 × 9 - 6 × 7 ) + 3 ( 4 × 8 - 5 × 7 ) = 45 - 48 - 2 ( 36 - 42 ) + 3 ( 32 - 35 ) = - 3 + 12 - 9 = 0 .

Example:

Just for comparison, let's expand down the first column (I said row in the video): det ( A ) = 1 det ( 5 6 8 9 ) - 4 det ( 2 3 8 9 ) + 7 det ( 2 3 5 6 ) = - 3 - 4 ( 18 - 24 ) + 7 ( 12 - 15 ) = - 3 + 24 - 21 = 0 . Which, reassuringly, gives the same answer.

Example:

Let's calculate the determinant of B = ( 1 1 2 3 0 0 4 5 - 1 2 1 1 0 0 2 3 ) Expanding along the top row would give us four terms to calculate. If instead we expand around the first or second columns or the second or fourth rows, then we only have two terms to calculate. Let's do the second column (because the signs will be more fun that way).

We get: det ( B ) = - 1 det ( 0 4 5 - 1 1 1 0 2 3 ) - 2 det ( 1 2 3 0 4 5 0 2 3 ) (care with signs!). For the first 3-by-3 submatrix ( C 12 ) we have (expanding down the first column): det ( 0 4 5 - 1 1 1 0 2 3 ) = - ( - 1 ) ( 4 × 3 - 5 × 2 ) = 2 For the second, we get (expanding down the first column): det ( 1 2 3 0 4 5 0 2 3 ) = 4 × 3 - 5 × 2 = 2 , so overall we get det ( B ) = - 1 × 2 - 2 × 2 = - 6 .

Example:

As a final sanity check, let's compute this again using row operations. If we do R 3 R 3 + R 1 , then B becomes ( 1 1 2 3 0 0 4 5 0 3 3 4 0 0 2 3 ) . Now we switch R 2 R 3 and then R 3 R 4 (so the original row 2 ends up at the bottom) to get: ( 1 1 2 3 0 3 3 4 0 0 2 3 0 0 4 5 ) . Finally R 4 R 4 - 2 R 3 yields: ( 1 1 2 3 0 3 3 4 0 0 2 3 0 0 0 - 1 ) . This is in echelon form. We did two row-switches, so the determinant changed sign twice (i.e. didn't change sign overall), so that det ( B ) is just the product of the diagonal entries in this echelon matrix. In other words, det ( B ) = 1 × 3 × 2 × ( - 1 ) = - 6 , which agrees with the previous example.