Understanding the cofactor expansion calculator — concept and principle
This calculator computes a determinant by cofactor (Laplace) expansion along any row or column you choose. It lists each minor, sign, cofactor and term, so you can follow or check a hand calculation, and it points out the line with the most zeros, which is easiest to expand.
How it is calculated
Minor M_ij = determinant of A with row i and column j deleted
Cofactor C_ij = (−1)^(i+j) × M_ij
Along row i: det(A) = a_i1 C_i1 + a_i2 C_i2 + … + a_in C_in
Along column j: det(A) = a_1j C_1j + a_2j C_2j + … + a_nj C_nj
- The signs form a checkerboard starting with + in the top-left corner.
The principle
A determinant is a sum over all ways of choosing one entry from each row and each column, with signs. Grouping those terms by which entry they use from one chosen row gives the expansion: each entry multiplies the determinant of what is left when its row and column are removed. The checkerboard sign records whether removing that row and column changes the parity of the arrangement. Every row and column gives the same answer, so choosing a line full of zeros saves work, since zero entries need no minor.
Worked example
Default inputs: A = [2 −1 0; 1 3 2; 0 1 4], expanded along row 1.
- Signs along row 1: + − +.
- Minors: M₁₁ = det[3 2; 1 4] = 12 − 2 = 10; M₁₂ = det[1 2; 0 4] = 4; M₁₃ = det[1 3; 0 1] = 1. So minors 10, 4, 1.
- Cofactors: 10, −4, 1.
- Terms: 2 × 10 = 20, (−1) × (−4) = 4, 0 × 1 = 0, i.e. 20, 4, 0.
- det(A) = 2·10 + (−1)·(−4) + 0·1 = 24. Suggested line: expand along row 1.
How to read the result
A determinant of 0 means the matrix is singular: its rows are linearly dependent and it has no inverse. The absolute value of the determinant is the factor by which the matrix scales areas (2 × 2) or volumes (3 × 3); a negative sign means orientation is flipped. Use expansion by hand up to 3 × 3 or 4 × 4 with zeros; for larger matrices, row reduction is much faster.
Common mistakes
- Forgetting the checkerboard signs, especially the minus in position (1, 2).
- Deleting the wrong row or column for a minor.
- Mixing up minors and cofactors.
- Expanding along a line with no zeros when a better one exists.
Frequently asked questions
What is cofactor expansion?
A way to compute a determinant as a sum of entries times their cofactors along one row or column.
Does it matter which row I choose?
No, every row and column gives the same determinant; choose the one with the most zeros.
What is the difference between a minor and a cofactor?
The cofactor is the minor multiplied by (−1)^(i+j).
Sources: D. Margalit & J. Rabinoff, Interactive Linear Algebra, §4.2 Cofactor Expansions · A. Davis, P. Zachlin et al., Coordinated Linear Algebra (University of Nebraska–Lincoln), §5.1