Source codeVideos

Command Palette

Search for a command to run...

Matrix

Cofactor Expansion Method

What is Cofactor Expansion?

The cofactor expansion method is one way to calculate the determinant of a square matrix, especially for matrices larger than 2×22 \times 2.

This method works by breaking down the calculation of a large matrix's determinant into a sum of the products of the matrix elements with their respective cofactors, which involves the determinants of smaller matrices.

Minor of a Matrix Element

Each element in a square matrix has what is called a "minor". The minor of an element aija_{ij} (i.e., the element located in the ii-th row and jj-th column) is usually written as MijM_{ij}.

To determine the minor MijM_{ij}, we need to remove (cross out) the entire ii-th row and the entire jj-th column from the original matrix. The determinant of the remaining sub-matrix is what is called the minor MijM_{ij}.

Finding the Minor

Suppose we have a 3×33 \times 3 matrix AA as follows:

A=[a11a12a13a21a22a23a31a32a33]A = \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{bmatrix}

If we want to find the minor of the element a22a_{22} (i.e., M22M_{22}), we remove the second row and second column from matrix AA:

Imagine we cross it out like this:

A=[a11a12a13a21a22a23a31a32a33]A = \begin{bmatrix} a_{11} & \cancel{a_{12}} & a_{13} \\ \cancel{a_{21}} & \cancel{a_{22}} & \cancel{a_{23}} \\ a_{31} & \cancel{a_{32}} & a_{33} \end{bmatrix}

The matrix remaining after the removal is:

[a11a13a31a33]\begin{bmatrix} a_{11} & a_{13} \\ a_{31} & a_{33} \end{bmatrix}

Thus, the minor M22M_{22} is the determinant of this remaining matrix:

M22=det(a11a13a31a33)=(a11×a33)(a13×a31)M_{22} = \det \begin{pmatrix} a_{11} & a_{13} \\ a_{31} & a_{33} \end{pmatrix} = (a_{11} \times a_{33}) - (a_{13} \times a_{31})

Cofactor of a Matrix Element

After understanding what a minor is, the next step is to understand the "cofactor". The cofactor of an element aija_{ij}, usually denoted as kijk_{ij} or CijC_{ij}, is calculated using its minor with the formula:

kij=(1)i+jMijk_{ij} = (-1)^{i+j} M_{ij}

The (1)i+j(-1)^{i+j} part in this formula determines the sign (positive or negative) of the cofactor. The rule is simple:

  • If the sum i+ji+j is an even number, then (1)i+j=1(-1)^{i+j} = 1. This means kij=Mijk_{ij} = M_{ij} (the cofactor is equal to its minor).
  • If the sum i+ji+j is an odd number, then (1)i+j=1(-1)^{i+j} = -1. This means kij=Mijk_{ij} = -M_{ij} (the cofactor is the negative of its minor).

For a 3×33 \times 3 matrix, the sign pattern of (1)i+j(-1)^{i+j} will look like this:

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

This sign indicates whether the cofactor will be equal to its minor (sign ++) or the negative of its minor (sign -).

Finding the Cofactor

Let's continue with the example of matrix AA and the minor M22M_{22} that we have already calculated.

The cofactor for element a22a_{22} is k22k_{22}.

Since i=2i=2 and j=2j=2, then i+j=2+2=4i+j = 2+2 = 4 (even).

k22=(1)2+2M22=(1)M22=M22k_{22} = (-1)^{2+2} M_{22} = (1) M_{22} = M_{22}

Now, let's try to find the cofactor for element a12a_{12}, which is k12k_{12}.

First, we find its minor, M12M_{12}, by removing the first row and second column from matrix AA:

M12=det(a21a23a31a33)=(a21×a33)(a23×a31)M_{12} = \det \begin{pmatrix} a_{21} & a_{23} \\ a_{31} & a_{33} \end{pmatrix} = (a_{21} \times a_{33}) - (a_{23} \times a_{31})

Then, we calculate its cofactor. For a12a_{12}, i=1i=1 and j=2j=2, so i+j=1+2=3i+j = 1+2 = 3 (odd).

k12=(1)1+2M12=(1)M12=M12k_{12} = (-1)^{1+2} M_{12} = (-1) M_{12} = -M_{12}

Calculating the Determinant using Cofactor Expansion

The core of the cofactor expansion method is to calculate the determinant of matrix AA (denoted det(A)\det(A) or A|A|) by choosing one row or one column from the matrix.

Then, each element in the chosen row or column is multiplied by its respective cofactor, and all these products are summed up.

Formula for Cofactor Expansion Along the ii-th Row:

det(A)=A=j=1naijkij=ai1ki1+ai2ki2++ainkin\det(A) = |A| = \sum_{j=1}^{n} a_{ij}k_{ij} = a_{i1}k_{i1} + a_{i2}k_{i2} + \dots + a_{in}k_{in}

This means we choose the ii-th row. Then, for each column jj in that row, we multiply the element aija_{ij} by its cofactor kijk_{ij}, and sum them all.

Formula for Cofactor Expansion Along the jj-th Column:

det(A)=A=i=1naijkij=a1jk1j+a2jk2j++anjknj\det(A) = |A| = \sum_{i=1}^{n} a_{ij}k_{ij} = a_{1j}k_{1j} + a_{2j}k_{2j} + \dots + a_{nj}k_{nj}

This means we choose the jj-th column. Then, for each row ii in that column, we multiply the element aija_{ij} by its cofactor kijk_{ij}, and sum them all.

The good news is, you can choose any row or column for the expansion, and the result will always be the same!

To simplify calculations, it is usually best to choose a row or column that contains many zero elements, as multiplication by zero will result in zero and reduce the number of terms to be calculated.

Example of Determinant Calculation

Let's calculate the determinant of the following matrix PP using the cofactor expansion method:

P=[132262594]P = \begin{bmatrix} 1 & 3 & 2 \\ 2 & 6 & 2 \\ 5 & 9 & 4 \end{bmatrix}

We will perform cofactor expansion along the first row (i.e., i=1i=1).

Based on the formula, the determinant of PP is:

det(P)=a11k11+a12k12+a13k13\det(P) = a_{11}k_{11} + a_{12}k_{12} + a_{13}k_{13}

From matrix PP, the elements of the first row are:

  • a11=1a_{11} = 1
  • a12=3a_{12} = 3
  • a13=2a_{13} = 2

Now, we need to calculate the cofactors k11k_{11}, k12k_{12}, and k13k_{13}.

  1. Calculating k11k_{11} (i=1,j=1i=1, j=1, so i+j=2i+j=2, even):

    M11=det(6294)=(6×4)(2×9)=2418=6M_{11} = \det \begin{pmatrix} 6 & 2 \\ 9 & 4 \end{pmatrix} = (6 \times 4) - (2 \times 9) = 24 - 18 = 6
    k11=(1)1+1M11=(1)(6)=6k_{11} = (-1)^{1+1} M_{11} = (1)(6) = 6
  2. Calculating k12k_{12} (i=1,j=2i=1, j=2, so i+j=3i+j=3, odd):

    M12=det(2254)=(2×4)(2×5)=810=2M_{12} = \det \begin{pmatrix} 2 & 2 \\ 5 & 4 \end{pmatrix} = (2 \times 4) - (2 \times 5) = 8 - 10 = -2
    k12=(1)1+2M12=(1)(2)=2k_{12} = (-1)^{1+2} M_{12} = (-1)(-2) = 2
  3. Calculating k13k_{13} (i=1,j=3i=1, j=3, so i+j=4i+j=4, even):

    M13=det(2659)=(2×9)(6×5)=1830=12M_{13} = \det \begin{pmatrix} 2 & 6 \\ 5 & 9 \end{pmatrix} = (2 \times 9) - (6 \times 5) = 18 - 30 = -12
    k13=(1)1+3M13=(1)(12)=12k_{13} = (-1)^{1+3} M_{13} = (1)(-12) = -12

After all cofactors are obtained, we substitute them back into the determinant formula:

det(P)=a11k11+a12k12+a13k13\det(P) = a_{11}k_{11} + a_{12}k_{12} + a_{13}k_{13}
det(P)=(1)(6)+(3)(2)+(2)(12)\det(P) = (1)(6) + (3)(2) + (2)(-12)
det(P)=6+624\det(P) = 6 + 6 - 24
det(P)=1224\det(P) = 12 - 24
det(P)=12\det(P) = -12

So, the determinant of matrix PP is 12-12.