# Nakafa Learning Content

> For AI agents: use [llms.txt](https://nakafa.com/llms.txt) for the site index. Markdown versions are available by appending `.md` to content URLs or sending `Accept: text/markdown`.

URL: https://nakafa.com/en/subjects/mathematics/matrix/cofactor-expansion-method
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/material/lesson/mathematics/matrix/cofactor-expansion-method/en.mdx

Learn cofactor expansion for matrix determinants through minors, cofactors, and clear calculation examples.

---

## 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 \times 2$$.

Visible text: The cofactor expansion method is one way to calculate the determinant of a square matrix, especially for matrices larger than .

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 $$a_{ij}$$ (i.e., the element located in the $$i$$-th row and $$j$$-th column) is usually written as $$M_{ij}$$.

Visible text: Each element in a square matrix has what is called a "minor". The minor of an element (i.e., the element located in the -th row and -th column) is usually written as .

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

Visible text: To determine the minor , we need to remove (cross out) the entire -th row and the entire -th column from the original matrix. The determinant of the remaining sub-matrix is what is called the minor .

### Finding the Minor

Suppose we have a $$3 \times 3$$ matrix $$A$$ as follows:

Visible text: Suppose we have a matrix as follows:

```math
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 $$a_{22}$$ (i.e., $$M_{22}$$), we remove the second row and second column from matrix $$A$$:

Visible text: If we want to find the minor of the element (i.e., ), we remove the second row and second column from matrix :

Imagine we cross it out like this:

```math
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:

```math
\begin{bmatrix} a_{11} & a_{13} \\ a_{31} & a_{33} \end{bmatrix}
```

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

Visible text: Thus, the minor is the determinant of this remaining matrix:

```math
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 $$a_{ij}$$, usually denoted as $$k_{ij}$$ or $$C_{ij}$$, is calculated using its minor with the formula:

Visible text: After understanding what a minor is, the next step is to understand the "cofactor". The cofactor of an element , usually denoted as or , is calculated using its minor with the formula:

```math
k_{ij} = (-1)^{i+j} M_{ij}
```

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

Visible text: The part in this formula determines the sign (positive or negative) of the cofactor. The rule is simple:

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

Visible text: - If the sum is an even number, then . This means (the cofactor is equal to its minor).
- If the sum is an odd number, then . This means (the cofactor is the negative of its minor).

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

Visible text: For a matrix, the sign pattern of will look like this:

```math
\begin{pmatrix} + & - & + \\ - & + & - \\ + & - & + \end{pmatrix}
```

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

Visible text: 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 $$A$$ and the minor $$M_{22}$$ that we have already calculated.

Visible text: Let's continue with the example of matrix and the minor that we have already calculated.

The cofactor for element $$a_{22}$$ is $$k_{22}$$.

Visible text: The cofactor for element is .

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

Visible text: Since and , then (even).

```math
k_{22} = (-1)^{2+2} M_{22} = (1) M_{22} = M_{22}
```

Now, let's try to find the cofactor for element $$a_{12}$$, which is $$k_{12}$$.

Visible text: Now, let's try to find the cofactor for element , which is .

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

Visible text: First, we find its minor, , by removing the first row and second column from matrix :

```math
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 $$a_{12}$$, $$i=1$$ and $$j=2$$, so $$i+j = 1+2 = 3$$ (odd).

Visible text: Then, we calculate its cofactor. For , and , so (odd).

```math
k_{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 $$A$$ (denoted $$\det(A)$$ or $$|A|$$) by choosing one row or one column from the matrix.

Visible text: The core of the cofactor expansion method is to calculate the determinant of matrix (denoted or ) 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 $$i$$-th Row:**

Visible text: **Formula for Cofactor Expansion Along the -th Row:**

```math
\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 $$i$$-th row. Then, for each column $$j$$ in that row, we multiply the element $$a_{ij}$$ by its cofactor $$k_{ij}$$, and sum them all.

Visible text: This means we choose the -th row. Then, for each column in that row, we multiply the element by its cofactor , and sum them all.

**Formula for Cofactor Expansion Along the $$j$$-th Column:**

Visible text: **Formula for Cofactor Expansion Along the -th Column:**

```math
\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 $$j$$-th column. Then, for each row $$i$$ in that column, we multiply the element $$a_{ij}$$ by its cofactor $$k_{ij}$$, and sum them all.

Visible text: This means we choose the -th column. Then, for each row in that column, we multiply the element by its cofactor , 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 $$P$$ using the cofactor expansion method:

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

```math
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=1$$).

Visible text: We will perform cofactor expansion along the first row (i.e., ).

Based on the formula, the determinant of $$P$$ is:

Visible text: Based on the formula, the determinant of is:

```math
\det(P) = a_{11}k_{11} + a_{12}k_{12} + a_{13}k_{13}
```

From matrix $$P$$, the elements of the first row are:

Visible text: From matrix , the elements of the first row are:

- $$a_{11} = 1$$
- $$a_{12} = 3$$
- $$a_{13} = 2$$

Visible text: - 
- 
-

Now, we need to calculate the cofactors $$k_{11}$$, $$k_{12}$$, and $$k_{13}$$.

Visible text: Now, we need to calculate the cofactors , , and .

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

    <MathContainer>
      
    
    ```math
    M_{11} = \det \begin{pmatrix} 6 & 2 \\ 9 & 4 \end{pmatrix} = (6 \times 4) - (2 \times 9) = 24 - 18 = 6
    ```

      
    
    ```math
    k_{11} = (-1)^{1+1} M_{11} = (1)(6) = 6
    ```

    </MathContainer>

2.  **Calculating $$k_{12}$$** ($$i=1, j=2$$, so $$i+j=3$$, odd):

    <MathContainer>
      
    
    ```math
    M_{12} = \det \begin{pmatrix} 2 & 2 \\ 5 & 4 \end{pmatrix} = (2 \times 4) - (2 \times 5) = 8 - 10 = -2
    ```

      
    
    ```math
    k_{12} = (-1)^{1+2} M_{12} = (-1)(-2) = 2
    ```

    </MathContainer>

3.  **Calculating $$k_{13}$$** ($$i=1, j=3$$, so $$i+j=4$$, even):

    <MathContainer>
      
    
    ```math
    M_{13} = \det \begin{pmatrix} 2 & 6 \\ 5 & 9 \end{pmatrix} = (2 \times 9) - (6 \times 5) = 18 - 30 = -12
    ```

      
    
    ```math
    k_{13} = (-1)^{1+3} M_{13} = (1)(-12) = -12
    ```

    </MathContainer>

Visible text: 1. **Calculating ** (, so , even):

 <MathContainer>
 
 

 
 

 </MathContainer>

2. **Calculating ** (, so , odd):

 <MathContainer>
 
 

 
 

 </MathContainer>

3. **Calculating ** (, so , even):

 <MathContainer>
 
 

 
 

 </MathContainer>

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

Component: MathContainer
Children:

```math
\det(P) = a_{11}k_{11} + a_{12}k_{12} + a_{13}k_{13}
```

```math
\det(P) = (1)(6) + (3)(2) + (2)(-12)
```

```math
\det(P) = 6 + 6 - 24
```

```math
\det(P) = 12 - 24
```

```math
\det(P) = -12
```

So, the determinant of matrix $$P$$ is $$-12$$.

Visible text: So, the determinant of matrix is .