Matrix Determinant Calculator
Enter your matrix values and choose the size (2x2, 3x3, or 4x4) to compute the determinant instantly. You also get the trace (sum of the diagonal), the rank, and an invertibility check. The "Show your work" panel walks through cofactor expansion step by step using your exact numbers, so you can follow every multiplication and sign.
Formula
Worked example
For A = [[2,1,0],[1,3,1],[0,1,2]]: expanding along row 1 gives 2*(3*2 - 1*1) - 1*(1*2 - 1*0) + 0*(...) = 2*(6-1) - 1*(2-0) = 10 - 2 = 8.
What is a matrix determinant?
The determinant is a single scalar number associated with a square matrix. It captures fundamental geometric and algebraic information about the matrix: the absolute value of the determinant is the scale factor by which the corresponding linear transformation stretches or compresses area (for 2x2 matrices) or volume (for 3x3 matrices). A determinant of zero means the transformation collapses space into a lower dimension, which is why those matrices have no inverse. Positive determinants preserve orientation (like a rotation), while negative determinants reverse it (like a reflection). In practical applications, determinants appear in Cramer's rule for solving linear systems, in computing the inverse of a matrix, in eigenvalue problems, and in multivariate calculus (the Jacobian determinant).
How to calculate the determinant: cofactor expansion
The most general method for hand calculation is cofactor (Laplace) expansion. Pick any row or column, then for each entry multiply it by its cofactor (the determinant of the submatrix obtained by deleting that entry's row and column, multiplied by the sign (-1)^(i+j)). Sum those products to get the determinant. For a 2x2 matrix [[a,b],[c,d]] the formula reduces to det = a*d - b*c, a single step. For a 3x3 matrix expanding along row 1 gives three 2x2 minors. For larger matrices the recursion continues, though in practice row reduction (Gaussian elimination) is faster for matrices bigger than 3x3. This calculator shows cofactor expansion for 2x2 and 3x3, and uses elimination internally for 4x4.
Trace, rank, and invertibility
This calculator also reports two companion properties. The trace is the sum of the main diagonal entries (top-left to bottom-right). It is always equal to the sum of the matrix's eigenvalues, which makes it useful in many theoretical contexts without solving a characteristic polynomial. The rank is the number of linearly independent rows or columns. A full-rank square matrix (rank equals its size) is always invertible, and its determinant is always non-zero. If any row is a linear combination of other rows, or if any two rows are proportional, the rank drops below the matrix size and the determinant is zero. Checking invertibility is as simple as asking whether det(A) is non-zero: if yes, you can compute A^-1 using the adjugate (matrix of cofactors, transposed) divided by the determinant.
Tips for entering your matrix
Select the matrix size first: choosing 2x2 shows four cells, 3x3 shows nine, and 4x4 shows sixteen. Enter each entry row by row. The cells are grouped by row and labeled with their position. Leave a cell at its default (0) if that entry is zero. The result updates immediately as you type. If all entries in one row are zero, or if one row is a multiple of another, the determinant will be zero and the matrix will be flagged as singular. For a quick sanity check on a 2x2 matrix, multiply the top-left by the bottom-right and subtract the product of the other two diagonal entries.
Key determinant properties
| Property | Formula | Meaning |
|---|---|---|
| Invertibility | det(A) != 0 | Matrix has an inverse |
| Singular | det(A) = 0 | Matrix has no inverse; rows are dependent |
| Product rule | det(AB) = det(A) * det(B) | Determinant distributes over products |
| Transpose | det(A^T) = det(A) | Transposing does not change the determinant |
| Scalar multiple | det(kA) = k^n * det(A) | Scaling by k multiplies det by k^n |
| Row swap | det changes sign | Swapping any two rows negates the determinant |
| Identity | det(I) = 1 | The identity matrix has determinant 1 |
| Triangular | det = product of diagonal | Works for upper or lower triangular matrices |
These identities hold for any square matrices A and B of the same size.
Frequently asked questions
What does a determinant of zero mean?
A determinant of zero means the matrix is singular: it has no inverse and its rows (or columns) are linearly dependent. At least one row can be expressed as a linear combination of the others. Geometrically, the transformation maps the entire space onto a lower-dimensional subspace, collapsing area or volume to zero. Systems of linear equations with a singular coefficient matrix either have no solution or infinitely many.
Can I compute the determinant of a non-square matrix?
No. The determinant is only defined for square matrices (same number of rows and columns). For a rectangular matrix you can compute its rank, but not a determinant. If you need a scalar measure of a rectangular matrix, look at the singular values instead.
What is cofactor expansion and why does it work?
Cofactor expansion (Laplace expansion) rewrites an n x n determinant as a signed sum of (n-1) x (n-1) determinants. The sign for the entry in row i and column j is (-1)^(i+j). It works because of the multilinear, alternating properties of the determinant: it is linear in each row separately, and it changes sign when two rows are swapped. These two axioms uniquely determine the determinant, and expansion is one way to compute it from them.
How does the determinant relate to the matrix inverse?
For a square matrix A, the inverse is A^-1 = adj(A) / det(A), where adj(A) is the adjugate (the transpose of the cofactor matrix). This formula shows directly why det(A) = 0 makes the inverse undefined: you cannot divide by zero. For 2x2 matrices the formula becomes [[d,-b],[-c,a]] / (ad-bc), which is easy to apply by hand.
Does the determinant change if I swap two rows?
Yes: swapping any two rows negates the determinant. If you swap twice you are back to the original value. This property is used in Gaussian elimination: every row swap during elimination is tracked as a sign change, and the final determinant of the upper-triangular form is the product of the pivots, adjusted for the number of swaps.
What is the difference between the determinant and the trace?
Both are scalar invariants of a square matrix, but they capture different things. The trace is the sum of the diagonal entries and equals the sum of all eigenvalues. The determinant equals the product of all eigenvalues. Together they form the coefficients of the characteristic polynomial for 2x2 matrices: the polynomial is x^2 - trace*x + det. Neither one alone fully describes the matrix, but together they give partial information about its eigenstructure.