Cofactor Expansion

How do you find the determinant of a 3x3 matrix without memorizing a complex formula? Cofactor expansion provides a systematic method to calculate the determinant of any square matrix.

Identifying the Minor: A Smaller Determinant

Minor
The minor MijM_{ij} of an element aija_{ij} in a matrix is the determinant of the submatrix formed by deleting the ii-th row and jj-th column of the original matrix.
Example: For a matrix
A=(123456789)A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix}
, the minor M11M_{11} (for element 1) is the determinant of the submatrix formed by removing row 1 and column 1:
M11=det(5689)=(5×9)(6×8)=4548=3M_{11} = \det\begin{pmatrix} 5 & 6 \\ 8 & 9 \end{pmatrix} = (5 \times 9) - (6 \times 8) = 45 - 48 = -3
.

The Cofactor: Minor with a Sign

Cofactor
The cofactor CijC_{ij} of an element aija_{ij} is the minor MijM_{ij} multiplied by (1)i+j(-1)^{i+j}. This term determines the sign of the minor in the expansion.
Example: Using the previous matrix
A=(123456789)A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix}
, we found M11=3M_{11} = -3. The cofactor C11C_{11} is calculated as C11=(1)1+1×M11=(1)2×(3)=1×(3)=3C_{11} = (-1)^{1+1} \times M_{11} = (-1)^2 \times (-3) = 1 \times (-3) = -3. For M12M_{12}, if it were 5, C12=(1)1+2×5=1×5=5C_{12} = (-1)^{1+2} \times 5 = -1 \times 5 = -5.
📌 Cofactor Sign Pattern

The (1)i+j(-1)^{i+j} term creates an alternating sign pattern across the matrix, often called the 'checkerboard pattern':

(+++++)\begin{pmatrix} + & - & + \\ - & + & - \\ + & - & + \end{pmatrix}

The Cofactor Expansion Formula

📐 Determinant by Cofactor Expansion

The determinant of an n×nn \times n matrix AA can be found by expanding along any row ii or any column jj.

Expansion along row ii:

det(A)=ai1Ci1+ai2Ci2++ainCin=j=1naijCij\det(A) = a_{i1}C_{i1} + a_{i2}C_{i2} + \dots + a_{in}C_{in} = \sum_{j=1}^{n} a_{ij}C_{ij}

Expansion along column jj:

det(A)=a1jC1j+a2jC2j++anjCnj=i=1naijCij\det(A) = a_{1j}C_{1j} + a_{2j}C_{2j} + \dots + a_{nj}C_{nj} = \sum_{i=1}^{n} a_{ij}C_{ij}

Step-by-Step: Calculating a 3x3 Determinant

Calculating $\det(A)$ for $A = \begin{pmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 1 & 0 & 6 \end{pmatrix}$
1
Choose a Row or Column
For simplicity, we will expand along the first row. The elements are a11=1a_{11}=1, a12=2a_{12}=2, and a13=3a_{13}=3.
2
Calculate C11C_{11} for a11=1a_{11}=1
The minor M11M_{11} is the determinant of the submatrix after removing row 1 and column 1:
det(4506)=(4×6)(5×0)=240=24\det\begin{pmatrix} 4 & 5 \\ 0 & 6 \end{pmatrix} = (4 \times 6) - (5 \times 0) = 24 - 0 = 24
The cofactor C11=(1)1+1×M11=1×24=24C_{11} = (-1)^{1+1} \times M_{11} = 1 \times 24 = 24. The term for the determinant is a11C11=1×24=24a_{11}C_{11} = 1 \times 24 = 24.
3
Calculate C12C_{12} for a12=2a_{12}=2
The minor M12M_{12} is the determinant of the submatrix after removing row 1 and column 2:
det(0516)=(0×6)(5×1)=05=5\det\begin{pmatrix} 0 & 5 \\ 1 & 6 \end{pmatrix} = (0 \times 6) - (5 \times 1) = 0 - 5 = -5
The cofactor C12=(1)1+2×M12=1×(5)=5C_{12} = (-1)^{1+2} \times M_{12} = -1 \times (-5) = 5. The term for the determinant is a12C12=2×5=10a_{12}C_{12} = 2 \times 5 = 10.
4
Calculate C13C_{13} for a13=3a_{13}=3
The minor M13M_{13} is the determinant of the submatrix after removing row 1 and column 3:
det(0410)=(0×0)(4×1)=04=4\det\begin{pmatrix} 0 & 4 \\ 1 & 0 \end{pmatrix} = (0 \times 0) - (4 \times 1) = 0 - 4 = -4
The cofactor C13=(1)1+3×M13=1×(4)=4C_{13} = (-1)^{1+3} \times M_{13} = 1 \times (-4) = -4. The term for the determinant is a13C13=3×(4)=12a_{13}C_{13} = 3 \times (-4) = -12.
5
Sum the Terms
Add the calculated terms to find the determinant:
det(A)=(a11C11)+(a12C12)+(a13C13)=24+10+(12)=3412=22\det(A) = (a_{11}C_{11}) + (a_{12}C_{12}) + (a_{13}C_{13}) = 24 + 10 + (-12) = 34 - 12 = 22
Thus, the determinant of matrix AA is 22.
Check Your Understanding
For a 4×44 \times 4 matrix, what is the sign of the cofactor C23C_{23}?

Cofactor Expansion in Python

pythonCalculating a 3x3 Determinant with Cofactor Expansion
Try It Yourself
Modify the determinant_3x3_cofactor function to expand along the second column instead of the first row. Verify that it produces the same determinant for matrix_A.
python

Strategic Expansion: Choosing Your Row or Column

While cofactor expansion works for any row or column, a smart choice can significantly reduce the number of calculations. If a matrix has a row or column containing many zero elements, expanding along that row or column simplifies the process. Any term aijCija_{ij}C_{ij} where aij=0a_{ij}=0 will automatically be zero, eliminating the need to calculate its corresponding minor and cofactor. This strategy is particularly useful for larger matrices or those with sparse structures.

Key Takeaways
  • Cofactor expansion offers a systematic, recursive method to calculate the determinant of any square matrix.

  • A minor MijM_{ij} is the determinant of the submatrix formed by removing row ii and column jj.

  • A cofactor CijC_{ij} is the minor MijM_{ij} multiplied by (1)i+j(-1)^{i+j}, which follows a checkerboard sign pattern.

  • The determinant is the sum of products of elements and their cofactors along any chosen row or column: det(A)=aijCij\det(A) = \sum a_{ij}C_{ij}.

  • Strategically choosing a row or column with many zero elements simplifies calculations, as terms with zero elements do not contribute to the sum.

← All lessons in Determinant of a Matrix

Ready to keep this from fading?

Bitelrn turns lessons like this into a full course — quizzes, a knowledge map, and spaced review.

Get started free