Let A = (a_{ij}) be an n by n matrix. By deleting the ith row and the jth column, we get an n  1 by n  1 matrix A_{ij}.
The cofactor of the ijentry a_{ij} is defined as the number
C_{ij} = (1)^{i+j} detA_{ij}.
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 ith row, detA = a_{i1}C_{i1} + a_{i2}C_{i2} + ... + a_{in}C_{in}.
For any jth column, detA = a_{1j}C_{1j} + a_{2j}C_{2j} + ... + a_{nj}C_{nj}.
For a 3 by 3 matrix, the cofactor expansion along the first row is
det[  a_{11}  a_{12}  a_{13}  ] 


a_{21}  a_{22}  a_{23}  
a_{31}  a_{32}  a_{33} 
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  ] 


3  1  1  
1  3  0 
where the term a_{33}C_{33} is omitted because a_{33} = 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  ] 


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  ] 


0  2  1  2  
0  2  1  1  
2  0  1  0 