Skip to main content
Home / Matrices / Matrix Cofactor
Calculating...
Matrix Operation

Matrix Cofactor Calculator

Calculate the cofactor matrix C where each entry C_{ij} = (-1)^{i+j} det(M_{ij}). The cofactor matrix is essential for finding inverses and adjugates.

Home Matrix Operations Matrix Cofactor
Square matrix required

Enter Matrix A

Enter the entries of your square matrix (up to 6×6). Each cofactor will be computed by removing a row and column.

Matrix A
×
Square
r1
r2
r3
r4
r5
r6
c1
c2
c3
c4
c5
c6
(max size)

Learn About Matrix Cofactor

Understanding the concepts behind the calculations.


What is a Cofactor?

A cofactor is a signed minor of a matrix. It combines the minor (determinant of a submatrix) with a sign that depends on the element's position. Cofactors are essential for computing determinants, adjugate matrices, and inverses.

Definition: The cofactor Cᵢⱼ of element aᵢⱼ in a square matrix A is:

$$ C_{ij} = (-1)^{i+j} \cdot M_{ij} $$

where Mᵢⱼ is the minor (determinant of the matrix formed by deleting row i and column j).

💡 The Sign Pattern: The factor (-1)ⁱ⁺ʲ creates a checkerboard pattern of signs:

$$ \begin{bmatrix} + & - & + & - \\\\ - & + & - & + \\\\ + & - & + & - \\\\ - & + & - & + \end{bmatrix} $$

Start with + in the top-left corner (i=1, j=1).


The Formula

Step 1: Find the Minor Mᵢⱼ

The minor is the determinant of the submatrix obtained by deleting row i and column j.

For a 3×3 matrix:

To find M₁₂ (minor of element in row 1, column 2):

$$ A = \begin{bmatrix} a_{11} & \color{red}{a_{12}} & a_{13} \\\\ a_{21} & \color{red}{a_{22}} & a_{23} \\\\ a_{31} & \color{red}{a_{32}} & a_{33} \end{bmatrix} \xrightarrow{\text{delete row 1, column 2}} M_{12} = \det\begin{bmatrix} a_{21} & a_{23} \\\\ a_{31} & a_{33} \end{bmatrix} $$

Step 2: Apply the Sign (-1)ⁱ⁺ʲ

Sign Pattern:

  • i=1, j=1 → (-1)² = +
  • i=1, j=2 → (-1)³ = -
  • i=1, j=3 → (-1)⁴ = +
  • i=2, j=1 → (-1)³ = -
  • i=2, j=2 → (-1)⁴ = +
  • i=2, j=3 → (-1)⁵ = -
$$ \text{Sign} = \begin{bmatrix} + & - & + \\\\ - & + & - \\\\ + & - & + \end{bmatrix} $$

Step 3: Combine

$$ C_{ij} = (-1)^{i+j} \cdot M_{ij} $$

How to Compute Cofactors

For a 2×2 Matrix

$$ A = \begin{bmatrix} a & b \\\\ c & d \end{bmatrix} $$
  • C₁₁ = (+) × det([d]) = d
  • C₁₂ = (-) × det([c]) = -c
  • C₂₁ = (-) × det([b]) = -b
  • C₂₂ = (+) × det([a]) = a
$$ \text{Cofactor Matrix of A} = \begin{bmatrix} d & -c \\\\ -b & a \end{bmatrix} $$

For a 3×3 Matrix

For element a₁₁ (i=1, j=1):

  • Minor M₁₁ = determinant of 2×2 matrix from rows 2,3 and columns 2,3
  • Sign = (+) because (-1)¹⁺¹ = (-1)² = +1
  • C₁₁ = (+) × M₁₁

For element a₁₂ (i=1, j=2):

  • Minor M₁₂ = determinant of 2×2 matrix from rows 2,3 and columns 1,3
  • Sign = (-) because (-1)¹⁺² = (-1)³ = -1
  • C₁₂ = (-) × M₁₂

The Cofactor Matrix

The cofactor matrix (also called the matrix of cofactors) is formed by replacing each entry aᵢⱼ with its cofactor Cᵢⱼ.

$$ \text{Cofactor}(A) = \begin{bmatrix} C_{11} & C_{12} & \cdots & C_{1n} \\\\ C_{21} & C_{22} & \cdots & C_{2n} \\\\ \vdots & \vdots & \ddots & \vdots \\\\ C_{n1} & C_{n2} & \cdots & C_{nn} \end{bmatrix} $$

Example: 2×2 Cofactor Matrix

$$ A = \begin{bmatrix} 2 & 3 \\\\ 4 & 5 \end{bmatrix} $$
  • C₁₁ = (+) × (5) = 5
  • C₁₂ = (-) × (4) = -4
  • C₂₁ = (-) × (3) = -3
  • C₂₂ = (+) × (2) = 2
$$ \text{Cofactor}(A) = \begin{bmatrix} 5 & -4 \\\\ -3 & 2 \end{bmatrix} $$

Step-by-Step Examples

Example 1: 2×2 Matrix

Find the cofactor matrix of:

$$ A = \begin{bmatrix} 3 & 1 \\\\ 2 & 4 \end{bmatrix} $$

Step 1: Find minors and cofactors for each element:

  • C₁₁: M₁₁ = det([4]) = 4, sign (+) → C₁₁ = 4
  • C₁₂: M₁₂ = det([2]) = 2, sign (-) → C₁₂ = -2
  • C₂₁: M₂₁ = det([1]) = 1, sign (-) → C₂₁ = -1
  • C₂₂: M₂₂ = det([3]) = 3, sign (+) → C₂₂ = 3
$$ \text{Cofactor}(A) = \begin{bmatrix} 4 & -2 \\\\ -1 & 3 \end{bmatrix} $$

Example 2: 3×3 Matrix

Find the cofactor C₁₁ for:

$$ A = \begin{bmatrix} 2 & 1 & 0 \\\\ 3 & 4 & 1 \\\\ 1 & 2 & 3 \end{bmatrix} $$

Step 1: Delete row 1 and column 1:

$$ \begin{bmatrix} \color{red}{2} & \color{red}{1} & \color{red}{0} \\\\ \color{red}{3} & 4 & 1 \\\\ \color{red}{1} & 2 & 3 \end{bmatrix} \rightarrow \begin{bmatrix} 4 & 1 \\\\ 2 & 3 \end{bmatrix} $$

Step 2: Compute the minor M₁₁:

$$ M_{11} = \det\begin{bmatrix} 4 & 1 \\\\ 2 & 3 \end{bmatrix} = (4)(3) - (1)(2) = 12 - 2 = 10 $$

Step 3: Apply sign: (-1)¹⁺¹ = (-1)² = +1

$$ C_{11} = (+1) \times 10 = 10 $$

Example 3: Find C₂₃ of a 3×3 Matrix

For the same matrix, find C₂₃:

Step 1: Delete row 2 and column 3:

$$ \begin{bmatrix} 2 & 1 & \color{red}{0} \\\\ \color{red}{3} & \color{red}{4} & \color{red}{1} \\\\ 1 & 2 & \color{red}{3} \end{bmatrix} \rightarrow \begin{bmatrix} 2 & 1 \\\\ 1 & 2 \end{bmatrix} $$

Step 2: Compute minor M₂₃:

$$ M_{23} = \det\begin{bmatrix} 2 & 1 \\\\ 1 & 2 \end{bmatrix} = (2)(2) - (1)(1) = 4 - 1 = 3 $$

Step 3: Apply sign: (-1)²⁺³ = (-1)⁵ = -1

$$ C_{23} = (-1) \times 3 = -3 $$

Relationship to Determinant and Inverse

Determinant via Cofactor Expansion

The determinant can be computed by expanding along any row or column using cofactors:

$$ \det(A) = \sum_{j=1}^{n} a_{ij} \cdot C_{ij} \quad \text{(expand along row i)} $$
$$ \det(A) = \sum_{i=1}^{n} a_{ij} \cdot C_{ij} \quad \text{(expand along column j)} $$

Adjugate Matrix (Classical Adjoint)

The adjugate (or classical adjoint) is the transpose of the cofactor matrix:

$$ \operatorname{adj}(A) = [\text{Cofactor}(A)]^T $$

Matrix Inverse Formula

For an invertible matrix A, the inverse can be computed using cofactors:

$$ A^{-1} = \frac{1}{\det(A)} \cdot \operatorname{adj}(A) = \frac{1}{\det(A)} \cdot [\text{Cofactor}(A)]^T $$

Example: 2×2 Inverse using Cofactors

$$ A = \begin{bmatrix} a & b \\\\ c & d \end{bmatrix}, \quad \det(A) = ad - bc $$
$$ A^{-1} = \frac{1}{ad-bc} \begin{bmatrix} d & -b \\\\ -c & a \end{bmatrix} $$

Notice that [[d, -b], [-c, a]] is the transpose of the cofactor matrix!


Special Cases

Matrix TypeCofactor Properties
Diagonal Matrix The cofactor matrix is diagonal with Cᵢᵢ = product of all other diagonal entries
2×2 Matrix Cofactor matrix = [[d, -c], [-b, a]]
Identity Matrix Cofactor matrix = Identity (for n>1) or I
Singular Matrix (det=0) Cofactor matrix may still be non-zero, but adj(A) has rank 1
Upper Triangular Cofactor matrix is upper triangular (signs preserved)

Real-World Applications

📐 Mathematics

  • Determinant computation for large matrices
  • Matrix inversion via adjugate formula
  • Cramer's Rule for solving linear systems
  • Eigenvalue computation via characteristic polynomial

🔬 Engineering

  • Circuit analysis - Computing impedances
  • Structural analysis - Stiffness matrix inverses
  • Control theory - State-space calculations

🤖 Computer Science

  • Computer graphics - Transformation matrix inverses
  • Robotics - Inverse kinematics calculations
  • Cryptography - Decoding Hill cipher

📊 Economics

  • Input-output models - Leontief inverse calculations
  • Portfolio optimization - Covariance matrix inverses

Frequently Asked Questions

Q: What's the difference between a minor and a cofactor?

A: A minor Mᵢⱼ is just the determinant of the submatrix (no sign). A cofactor Cᵢⱼ is the signed minor: Cᵢⱼ = (-1)ⁱ⁺ʲ × Mᵢⱼ.

Q: Why do we need cofactors?

A: Cofactors are essential for:

  • Computing determinants of large matrices
  • Finding the adjugate matrix
  • Calculating matrix inverses
  • Solving systems via Cramer's Rule

Q: What is the adjugate matrix?

A: The adjugate (or classical adjoint) is the transpose of the cofactor matrix. It satisfies A·adj(A) = adj(A)·A = det(A)·I.

Q: Can cofactors be negative?

A: Yes! The sign pattern (-1)ⁱ⁺ʲ makes cofactors alternate between positive and negative based on position.

Q: How do cofactors help find inverses?

A: A⁻¹ = (1/det(A)) × adj(A), where adj(A) is the transpose of the cofactor matrix. This is the classic formula for matrix inversion.


Practice Problems

Beginner

  1. Find the cofactor matrix of:

    $$ A = \begin{bmatrix} 1 & 2 \\\\ 3 & 4 \end{bmatrix} $$
  2. Find C₁₂ for:

    $$ A = \begin{bmatrix} 5 & 7 \\\\ 2 & 9 \end{bmatrix} $$

Intermediate

  1. Find all cofactors for the 3×3 matrix:

    $$ A = \begin{bmatrix} 1 & 0 & 0 \\\\ 0 & 2 & 0 \\\\ 0 & 0 & 3 \end{bmatrix} $$
  2. Compute C₂₃ for:

    $$ A = \begin{bmatrix} 2 & 1 & 1 \\\\ 3 & 0 & 2 \\\\ 1 & 2 & 1 \end{bmatrix} $$
Click to reveal solutions

1. [[4, -3], [-2, 1]]

2. C₁₂ = -2

3. C₁₁ = 6, C₂₂ = 3, C₃₃ = 2, others = 0

4. C₂₃ = -3



Summary

🎯 Key Takeaways

  • Cofactor = Sign × Minor: Cᵢⱼ = (-1)ⁱ⁺ʲ × Mᵢⱼ
  • Sign Pattern: Checkerboard starting with + at (1,1)
  • Cofactor Matrix: Each entry replaced by its cofactor
  • Adjugate: Transpose of cofactor matrix
  • Inverse Formula: A⁻¹ = adj(A) / det(A)
  • Determinant Expansion: det(A) = Σ aᵢⱼ × Cᵢⱼ along any row/column

💡 Pro Tip: For 2×2 matrices, remember the shortcut: cofactor matrix = [[d, -c], [-b, a]]. For larger matrices, use the sign pattern and compute minors systematically!

Try It Yourself!

Use the calculator above to compute cofactor matrices:

  1. Enter your square matrix (2×2 or 3×3)
  2. Click "Calculate" to see:
    • Each minor computation
    • Sign application for each position
    • The complete cofactor matrix
    • The adjugate (transpose of cofactor matrix)
    • Relation to determinant and inverse (if applicable)

📐 Test these examples:

  • 2×2: [[2, 3], [4, 5]] → cofactor = [[5, -4], [-3, 2]]
  • 3×3 Identity: [[1,0,0],[0,1,0],[0,0,1]] → cofactor = Identity
  • 3×3 Diagonal: [[2,0,0],[0,3,0],[0,0,4]] → cofactor = [[12,0,0],[0,8,0],[0,0,6]]

📐 Pro Tip: The cofactor matrix is the bridge between determinants and inverses. Master cofactors, and you've mastered matrix inversion!

Press / to search operations