Cofactor Expansion Calculator
This calculator finds the determinant of a 2x2 or 3x3 matrix using cofactor expansion, also called Laplace expansion, a standard linear algebra method for matrices too large for simple cross-multiplication. Determinants matter because they show whether a matrix is invertible, are needed to solve systems of equations, and underpin techniques such as finding the adjugate and the matrix inverse. To use it, choose your matrix size, pick which row or column to expand along (the answer is identical whichever you choose), and enter the values into the matrix grid. The calculator multiplies each element in your chosen row or column by its cofactor, the signed minor formed by deleting that element's row and column, and sums the results. Your results show the determinant itself, whether the matrix is singular or invertible (a zero determinant means singular, with no inverse), and how many non-zero terms contributed to the sum. Below the results you get full step-by-step working showing each element, its sign, minor and cofactor, plus a complete cofactor table for the whole matrix. This makes it useful for checking homework, verifying hand calculations, or building intuition for how expansion by minors works before you tackle larger matrices with methods such as row reduction. Choosing a row or column with zeros speeds up the working, since a zero element contributes nothing to the total.
1. Matrix Size and Expansion
2. Enter Matrix Values
Step-by-Step Working
Enter matrix values above to see working.
Cofactor Table
Enter matrix values above to see the cofactor table.
How Cofactor Expansion Works
Cofactor expansion (also called Laplace expansion) is a recursive method for computing the determinant of a square matrix. You pick any single row or column, then express the determinant as a weighted sum of smaller determinants (minors) from the remaining rows and columns.
The Formula
For an n x n matrix A, expanding along row i:
det(A) = ai1 Ci1 + ai2 Ci2 + ... + ain Cin
where the cofactor Cij = (-1)i+j Mij and Mij is the minor (the determinant of the submatrix obtained by deleting row i and column j).
The sign pattern (-1)i+j produces a checkerboard of plus and minus across the matrix:
| Position | 2x2 signs | 3x3 signs |
|---|---|---|
| Row 1 | + - | + - + |
| Row 2 | - + | - + - |
| Row 3 | - | + - + |
2x2 Determinant
For a 2x2 matrix [a b; c d], the determinant is simply ad - bc. Cofactor expansion along row 1 gives: det = a * (+1) * d + b * (-1) * c = ad - bc.
3x3 Worked Example (Default Values)
For the matrix A with row 1 = [1, 2, 3], row 2 = [0, 4, 5], row 3 = [1, 0, 6], expanding along row 1:
- a11 = 1, sign = +1, minor M11 = det[4,5;0,6] = 24 - 0 = 24, term = 1 * 24 = 24
- a12 = 2, sign = -1, minor M12 = det[0,5;1,6] = 0 - 5 = -5, term = 2 * -1 * (-5) = 10
- a13 = 3, sign = +1, minor M13 = det[0,4;1,0] = 0 - 4 = -4, term = 3 * (-4) = -12
- det(A) = 24 + 10 + (-12) = 22
Choosing the Best Row or Column
Any row or column gives the same answer. Picking the row or column with the most zeros reduces the number of minor computations needed. For example, if row 2 contains two zeros, only one 2x2 minor needs to be calculated. This is why cofactor expansion is particularly efficient when a matrix is already in a sparse or triangular form.
Relationship to Matrix Inverse
The cofactor matrix (where each entry is replaced by its cofactor Cij) is the foundation of the adjugate matrix (transpose of the cofactor matrix). The matrix inverse is then: A-1 = (1/det(A)) * adj(A). This relationship is only valid when det(A) is not zero. A matrix with det = 0 is singular and has no inverse.
Related Calculators
- Maths and Stats Calculators: all maths tools on this site.
- Matrix Determinant Calculator: general determinant finder for 2x2, 3x3, and larger matrices.
- 3x3 Determinant Calculator: dedicated 3x3 determinant tool.
- Matrix Inverse Calculator: find the inverse of a square matrix.
- Adjoint Matrix Calculator: compute the classical adjoint (adjugate) from cofactors.
Method: Laplace expansion by cofactors. For each element in the chosen row or column, the cofactor is Cij = (-1)i+j * det(Mij), where Mij is the (n-1) x (n-1) minor submatrix. The determinant equals the dot product of the selected row/column with its cofactors. Reference: Anton, H. and Rorres, C., Elementary Linear Algebra; Strang, G., Introduction to Linear Algebra.
This calculator supports 2x2 and 3x3 matrices. All entries are treated as real numbers. Results may show floating-point rounding for non-integer inputs; if your inputs are integers the determinant will always be an exact integer.