# Nakafa Framework: LLM
URL: /en/subject/high-school/11/mathematics/matrix/cofactor-expansion-method
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/subject/high-school/11/mathematics/matrix/cofactor-expansion-method/en.mdx
Output docs content for large language models.
---
export const metadata = {
  title: "Cofactor Expansion Method",
  description: "Learn cofactor expansion to calculate matrix determinants step-by-step. Master minors, cofactors, and determinant calculation with clear examples.",
  authors: [{ name: "Nabil Akbarazzima Fatih" }],
  date: "06/05/2025",
  subject: "Matrix",
};
## What is Cofactor Expansion?
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  (i.e., the element located in the -th row and -th column) is usually written as .
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  matrix  as follows:
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:
The matrix remaining after the removal is:
Thus, the minor  is the determinant of this remaining matrix:
## Cofactor of a Matrix Element
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:
The  part in this formula determines the sign (positive or negative) of the cofactor. The rule is simple:
- 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  matrix, the sign pattern of  will look like this:
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  and the minor  that we have already calculated.
The cofactor for element  is .
Since  and , then  (even).
Now, let's try to find the cofactor for element , which is .
First, we find its minor, , by removing the first row and second column from matrix :
Then, we calculate its cofactor. For ,  and , so  (odd).
## Calculating the Determinant using Cofactor Expansion
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 -th Row:**
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 -th Column:**
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  using the cofactor expansion method:
We will perform cofactor expansion along the first row (i.e., ).
Based on the formula, the determinant of  is:
From matrix , the elements of the first row are:
- 
- 
- 
Now, we need to calculate the cofactors , , and .
1.  **Calculating ** (, so , even):
    
      
      
    
2.  **Calculating ** (, so , odd):
    
      
      
    
3.  **Calculating ** (, so , even):
    
      
      
    
After all cofactors are obtained, we substitute them back into the determinant formula:
  
  
  
  
  
So, the determinant of matrix  is .