28. Cofactor expansion

28. Cofactor expansion

Recall that the determinant of a 3-by-3 matrix M = M_{1 1} , M_{1 2} , M_{1 3} ; M_{2 1} , M_{2 2} , M_{2 3} ; M_{3 1} , M_{3 2} , M_{3 3} is M_{1 1} M_{2 2} M_{3 3} minus M_{1 1} M_{2 3} M_{3 2} minus M_{1 2} M_{2 1} M_{3 3} + M_{1 2} M_{2 3} M_{3 1} + M_{1 3} M_{2 1} M_{3 2} minus M_{1 3} M_{2 2} M_{3 1}. We can group these into three sets of terms according to the factor M_{1 k}: those which contain a factor of M_{1 1}, those with an M_{1 2} and those with an M_{1 3}: M_{1 1} (M_{2 2} M_{3 3} minus M_{2 3} M_{3 2}) minus M_{1 2} (M_{2 1} M_{3 3} minus M_{2 3} M_{3 1}) + M_{1 3} (M_{2 1} M_{3 2} minus M_{2 2} M_{3 1}). Note that the terms in brackets are themselves determinants of 2-by-2 submatrices: M_{1 1} times det of the 2-by-2 matrix M_{2 2} , M_{2 3} ; M_{3 2} , M_{3 3}; minus M_{1 2} times det of the 2-by-2 matrix M_{2 1}, M_{2 3}; M_{3 1} , M_{3 3} + M_{1 3} times det of the 2-by-2 matrix M_{2 1} , M_{2 2} ; M_{3 1} , M_{3 2}. When we group our determinant according to the choice of the factor M_{1 k}, the expansion we get is: det M = M_{1 1} times det C_{1 1} minus M_{1 2} times det C_{1 2} + M_{1 3} times det C_{1 3} minus dot dot dot plus or minus M_{1 3} times 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_{1 2} = M_{2 1}, M_{2 3}; M_{3 1}, M_{3 3}.

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 equals plus or minus M_{i 1} det C_{i 1} minus or plus M_{i 2} det C_{i 2} plus or minus dot dot dot, 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 = plus or minus M_{1 j} det C_{1 j} minus or plus M_{2 j} det C_{2 j} plus or minus dot dot dot, where the signs alternate.

Signs

The sign you put in front of M_{i j} det C_{i j} is the i jth entry of this matrix: plus, minus, plus, minus etc on the top row; minus, plus, minus, plus etc on the second row; plus, minus, plus minus etc on the third row, etc For example, expanding a 3-by-3 matrix down column 2 would give minus M_{1 2} det C_{1 2} + M_{2 2} det C_{2 2} minus M_{3 2} det C_{3 2}

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 the 3-by-3 matrix A = 1, 2, 3; 4, 5, 6; 7, 8, 9 using the cofactor expansion along the first row: det A = 1 times det of 5, 6; 8, 9, minus 2 times det of 4, 6; 7, 9, plus 3 times det of 4, 5; 7, 8 which equals 5 times 9 minus 6 times 8 minus 2 times (4 times 9 minus 6 times 7), plus 3 times (4 times 8 minus 5 times 7) which equals 45 minus 48 minus 2 times (36 minus 42) plus 3 times (32 minus 35) which equals minus 3 + 12 minus 9 which equals zero.

Example:

Just for comparison, let's expand down the first column (I said row in the video): det A equals 1 times det of 5, 6; 8, 9 minus 4 times det of 2, 3; 8, 9, + 7 times det of 2, 3; 5, 6 which equals minus 3 minus 4 lots of (18 minus 24), plus 7 lots of (12 minus 15) which equals minus 3 + 24 minus 21 which equals zero Which, reassuringly, gives the same answer.

Example:

Let's calculate the determinant of the 4-by-4 matrix B = 1, 1, 2, 3; 0, 0, 4, 5; minus 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 equals minus det 0, 4, 5; minus 1, 1, 1; 0, 2, 3, minus twice the determinant of 1, 2, 3; 0, 4, 5; 0, 2, 3 (care with signs!). For the first 3-by-3 submatrix (C_{1 2}) we have (expanding down the first column): det of 0, 4, 5; minus 1, 1, 1; 0, 2, 3 equals minus minus (4 times 3 minus 5 times 2), which equals 2 For the second, we get (expanding down the first column): det of 1, 2, 3; 0, 4, 5; 0, 2, 3 equals 4 times 4 minus 5 times 2, which equals 2, so overall we get det B = minus 1 times 2 minus 2 times 2, which equals minus 6.

Example:

As a final sanity check, let's compute this again using row operations. If we do R_3 maps to 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 with R_3 and then R_3 with 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 maps to R_4 minus 2 R_3 yields: 1, 1, 2, 3; 0, 3, 3, 4; 0, 0, 2, 3; 0, 0, 0, minus 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 equals 1 times 3 times 2 times minus 1, which equals minus 6, which agrees with the previous example.