How to Calculate a Matrix Determinant: Linear Algebra Guide
The determinant tells you whether a matrix is invertible and how it scales area or volume. This guide covers 2x2 and 3x3 by hand, cofactor expansion, row reduction for larger matrices, what a negative or zero determinant means geometrically, and the properties that let you skip most of the work.
How to Calculate a Matrix Determinant
The determinant is a single number computed from a square matrix. Two things make it worth knowing:
- It tells you whether the matrix is invertible. A determinant of zero means no inverse exists — and the associated system of equations has either no solution or infinitely many.
- It measures how the matrix scales space. A determinant of 3 means the transformation triples areas (in 2D) or volumes (in 3D).
Everything below is machinery for computing it.
2×2 matrices
For
A = \beginpmatrix a & b \\ c & d \endpmatrix
the determinant is:
\det(A) = ad - bc
Example.
\beginpmatrix 4 & 7 \\ 2 & 6 \endpmatrix arrow (4)(6) - (7)(2) = 24 - 14 = 10
What that number means
Take the two rows as vectors: (4, 7) and (2, 6). They span a parallelogram, and its area is exactly |\det| = 10.
If the determinant were zero, the two vectors would be parallel — the parallelogram collapses to a line with zero area. That is the geometric reason a zero determinant means no inverse: the transformation squashes the plane onto a line, destroying information that cannot be recovered.
3×3 matrices
For
A = \beginpmatrix a & b & c \\ d & e & f \\ g & h & i \endpmatrix
expand along the first row:
\det(A) = a(ei - fh) - b(di - fg) + c(dh - eg)
Each term is an entry multiplied by the determinant of the 2×2 matrix left when you delete that entry's row and column. Note the alternating signs: +, −, +.
Example.
\beginpmatrix 2 & -3 & 1 \\ 4 & 0 & 5 \\ -1 & 6 & 2 \endpmatrix
= 2(0 · 2 - 5 · 6) - (-3)(4 · 2 - 5 · (-1)) + 1(4 · 6 - 0 · (-1)) = 2(0 - 30) + 3(8 + 5) + 1(24 - 0) = -60 + 39 + 24 = 3
The sign pattern
For any size, the cofactor sign at row i, column j is (-1)^i+j, giving a checkerboard:
\beginpmatrix + & - & + \\ - & + & - \\ + & - & + \endpmatrix
Forgetting these signs is the most common source of wrong answers.
Expand along the easiest row or column
You may expand along any row or column, and the answer is identical. So pick the one with the most zeros — each zero kills an entire term.
Example.
\beginpmatrix 3 & 0 & 0 \\ 7 & 2 & -1 \\ 4 & 5 & 6 \endpmatrix
Expanding along the first row, two of the three terms vanish immediately:
\det = 3(2 · 6 - (-1) · 5) - 0 + 0 = 3(12 + 5) = 51
One 2×2 determinant instead of three. Always scan for the row or column with the most zeros before starting.
Larger matrices: row reduction
Cofactor expansion becomes impractical fast — an n × n determinant costs roughly n! operations. A 10×10 matrix would need over 3.6 million terms.
Row reduction is the practical method, and it relies on three rules:
- Adding a multiple of one row to another leaves the determinant unchanged.
- Swapping two rows multiplies the determinant by −1.
- Multiplying a row by k multiplies the determinant by k.
Reduce to upper triangular form, then the determinant is simply the product of the diagonal entries — adjusted for any row swaps.
Example.
\beginpmatrix 2 & 4 & 1 \\ 1 & 3 & 2 \\ 3 & 1 & 4 \endpmatrix
R_2 arrow R_2 - (1)/(2)R_1 gives row (0, 1, 1.5). R_3 arrow R_3 - (3)/(2)R_1 gives row (0, -5, 2.5). R_3 arrow R_3 + 5R_2 gives row (0, 0, 10).
Upper triangular, no swaps:
\det = 2 × 1 × 10 = 20
This costs on the order of n^3 operations rather than n! — which is why every numerical library uses it.
Properties that save work
These let you avoid computing anything at all in many cases.
Triangular matrices. If all entries above or below the diagonal are zero, the determinant is the product of the diagonal. Diagonal matrices likewise.
A row or column of zeros. Determinant is zero.
Two identical rows or columns. Determinant is zero — they are linearly dependent.
One row a multiple of another. Determinant is zero, for the same reason.
Transpose. \det(A^T) = \det(A). This is why rows and columns are interchangeable in expansion.
Products. \det(AB) = \det(A)\det(B). Remarkably clean, and not at all obvious.
Inverse. \det(A^-1) = 1/\det(A), which immediately shows why a zero determinant has no inverse.
Scalar multiplication. For an n × n matrix, \det(kA) = k^n \det(A) — the k applies to every one of the n rows.
Reading the sign and magnitude
Magnitude is the scaling factor. |\det| = 5 means areas or volumes are multiplied by 5.
Sign indicates orientation. A negative determinant means the transformation flips orientation — a reflection. In 2D it turns anticlockwise into clockwise; in 3D it turns a right-handed coordinate system into a left-handed one.
Zero means collapse. The transformation squashes space into a lower dimension: a plane onto a line, or 3D space onto a plane. Information is lost and cannot be recovered, which is exactly what non-invertibility means.
Where determinants get used
Solving linear systems. Cramer's rule expresses each unknown as a ratio of determinants. Elegant, but computationally poor for anything beyond 3×3 — Gaussian elimination is far faster.
Testing invertibility. \det(A) ≠ 0 is equivalent to: the matrix is invertible, its rows are linearly independent, and the system Ax = b has exactly one solution.
Eigenvalues. Found by solving \det(A - \lambda I) = 0, the characteristic equation. This is where determinants earn their keep in physics and engineering.
Change of variables in integration. The Jacobian determinant is the scaling factor when transforming coordinates — it is why dx\,dy becomes r\,dr\,dθ in polar coordinates, since the Jacobian of that transformation is exactly r.
Cross products and volumes. The scalar triple product \mathbfa · (\mathbfb × \mathbfc) is the determinant of the matrix formed by the three vectors, and equals the volume of the parallelepiped they span.
Common mistakes
Dropping the alternating signs in cofactor expansion. The minus on the second term is not optional.
Trying to take the determinant of a non-square matrix. It is only defined for square matrices.
Assuming \det(A + B) = \det(A) + \det(B). This is false. Determinants are multiplicative, not additive — only \det(AB) = \det(A)\det(B) holds.
Forgetting the sign flip on row swaps during reduction.
Forgetting the exponent in \det(kA) = k^n\det(A). Doubling every entry of a 3×3 matrix multiplies the determinant by 8, not 2.
Using cofactor expansion on large matrices. Reduce first.
Frequently asked questions
What does a determinant of 1 mean? The transformation preserves area or volume exactly. Rotations have determinant 1 — they move things without stretching or reflecting.
Can a determinant be negative? Yes, and it indicates a reflection. Only the magnitude gives the scaling factor; the sign gives orientation.
Why is a zero determinant so important? It signals that the matrix collapses space onto a lower dimension. It has no inverse, its rows are linearly dependent, and Ax = b has either no solution or infinitely many — never exactly one.
What is the fastest way to compute a large determinant? LU decomposition, which is row reduction organised efficiently. Every numerical library uses it. Complexity is O(n^3) against O(n!) for cofactor expansion.
Is the determinant the same as the trace? No. The trace is the sum of the diagonal entries; the determinant is a far more complex function of all entries. Both are related to eigenvalues — the trace is their sum, the determinant their product.
Do determinants exist for non-square matrices? No. Determinant is defined only for square matrices. Related concepts such as the pseudo-determinant or singular values serve similar purposes for rectangular matrices.
Summary
For 2×2 use ad - bc. For 3×3 expand along whichever row or column has the most zeros, minding the alternating signs. For anything larger, row-reduce to triangular form and multiply the diagonal, tracking sign flips from swaps.
The number itself has a clean meaning: magnitude is how much the transformation scales area or volume, sign is whether it flips orientation, and zero means it collapses space and cannot be undone.
Compute determinants of any size with our Matrix Determinant Calculator.