### Computation of Determinant

##### 2. Cofactor expansion

Let A = (aij) be an n by n matrix. By deleting the i-th row and the j-th column, we get an n - 1 by n - 1 matrix Aij.

The cofactor of the ij-entry aij is defined as the number

Cij = (-1)i+j detAij.

The cofactor expansion means the following method for computing the determinant. The proof will be given here, after the rigorous definition of determinants. The key feature is that the computation of the determinant of an n by n matrix becomes the computation of the determinants of n n - 1 by n - 1 matrices.

For any i-th row, detA = ai1Ci1 + ai2Ci2 + ... + ainCin.

For any j-th column, detA = a1jC1j + a2jC2j + ... + anjCnj.

For a 3 by 3 matrix, the cofactor expansion along the first row is

det[ a11 a12 a13 ]
 = a11det[ a22 a23 ] - a12det[ a21 a23 ] + a13det[ a21 a22 ] a32 a33 a31 a33 a31 a32
a21 a22 a23
a31 a32 a33

where the darker row indicates the row along which the cofactors are expanded, and the negative sign for the second 2 by 2 determinant is due to (-1)1+2 = -1. You are encouraged to compare both sides by using the usual formulae for 2 by 2 and 3 by 3 determinants.

Example In an earlier example, we computed the determinant of

 A = [ 1 -1 1 ] 3 1 -1 1 3 0

by direct computation and row/column operations. Now we apply the cofactor expansion along the third row

det[ 1 -1 1 ]
 = 1×(-1)3+1det[ -1 1 ] + 3×(-1)3+2det[ 1 1 ] = 1×0 - 3×(-4) = 12, 1 -1 3 -1
3 1 -1
1 3 0

where the term a33C33 is omitted because a33 = 0. We see that cofactor expansion along the rows or columns with maximal number of zeros is often more efficient.

We may also compute the determinant by column expansion. Again we prefer expanding along the third column because it contains zero.

det[ 1 -1 1 ]
 = 1×(-1)1+3det[ 3 1 ] + (-1)×(-1)2+3det[ 1 -1 ] = 1×8 - (-1)×4 = 12. 1 3 1 3
3 1 -1
1 3 0

Example To compute a 4 by 4 determinant, we use the cofactor expansion to reduce the computation to several 3 by 3 determinants.

det[ 2 1 4 2 ]
 = 2det[ 2 1 2 ] - 2det[ 1 4 2 ] = 2×2 - 2×7 = -10. 2 1 1 2 1 2 0 1 0 2 1 1
0 2 1 2
0 2 1 1
2 0 1 0