Matrix Determinant Calculator det(A)
Enter a square matrix (one row per line, numbers separated by spaces or commas). Sizes from 1×1 up to 5×5 are supported. The determinant is found by cofactor expansion along the first row.
This free matrix determinant calculator takes any square matrix from 1×1 up to 5×5 and returns its determinant instantly, tells you whether the matrix is invertible, and reveals the exact first-row expansion behind the number. Paste your matrix above, one row per line, press Calculate, and read off the result — no account, no plugins, works on your phone.
What is a determinant?
The determinant is a single number distilled from a square matrix that captures how the linear transformation the matrix represents stretches, squashes, or flips space. Geometrically, the determinant of a 2×2 matrix equals the signed area of the parallelogram spanned by its two column vectors, and the determinant of a 3×3 matrix equals the signed volume of the parallelepiped spanned by its three columns. In higher dimensions the same idea continues as a signed hyper-volume. The word “signed” matters: a negative determinant means the transformation reverses orientation, as a mirror does.
Because the determinant measures volume scaling, it answers one of the most important questions in linear algebra at a glance. When the determinant is zero, the transformation collapses space into a lower dimension — a plane flattens to a line, a cube flattens to a sheet — and that collapse cannot be undone. Such a matrix is called singular and has no inverse. When the determinant is any non-zero value, the matrix is invertible, and the linear system it defines has exactly one solution.
The one-sentence definition
The determinant is the factor by which a matrix scales area, volume, or hyper-volume; it is zero exactly when the matrix squashes space and loses invertibility, and non-zero otherwise.
How to use the matrix determinant calculator
The tool is built to be typed into, not clicked through. Enter your matrix as a block of numbers with one row on each line and the entries in a row separated by spaces or commas:
- Type your square matrix into the box — three lines of three numbers gives a 3×3 matrix, four lines of four gives a 4×4, and so on up to 5×5.
- Press Calculate det(A). The determinant appears in the highlighted box, alongside the matrix size and whether it is invertible.
- If your matrix is 2×2 or 3×3, open Show first-row expansion to see every cofactor term written out and summed.
- Use Clear to empty the box and start again.
If the input is not square — say four numbers on one line but only three on the next — the calculator refuses to guess and tells you exactly how many entries each row needs. Determinants are defined only for square matrices, so this check is not fussiness; it is the definition.
A fully worked 3×3 example
Take the matrix that loads by default:
A = [[1, 2, 3], [4, 5, 6], [7, 8, 10]].
We expand along the first row. Each of the three entries is multiplied by the determinant of its minor — the 2×2 matrix left after deleting the first row and the entry’s own column — and the signs alternate plus, minus, plus.
The minor for the entry 1 (delete row 1, column 1) is [[5, 6], [8, 10]], whose determinant is 5·10 − 6·8 = 50 − 48 = 2.
The minor for the entry 2 (delete row 1, column 2) is [[4, 6], [7, 10]], whose determinant is 4·10 − 6·7 = 40 − 42 = −2.
The minor for the entry 3 (delete row 1, column 3) is [[4, 5], [7, 8]], whose determinant is 4·8 − 5·7 = 32 − 35 = −3.
Now assemble with alternating signs:
det(A) = (+1)(1)(2) + (−1)(2)(−2) + (+1)(3)(−3) = 2 + 4 − 9 = −3.
The determinant is −3. Because it is non-zero, this matrix is invertible; the negative sign tells us the transformation also flips orientation. Enter the same matrix above and you will see the calculator reproduce this exact chain of reasoning.
Key properties of the determinant
A handful of properties make determinants far easier to work with than the recursive formula suggests, and they are worth committing to memory.
Zero means singular. A matrix has an inverse if and only if its determinant is non-zero. A determinant of exactly zero signals that the rows (or columns) are linearly dependent, the matrix is singular, and the associated system either has no solution or infinitely many — never a unique one.
Row operations have predictable effects. Swapping two rows multiplies the determinant by −1. Multiplying a single row by a scalar k multiplies the determinant by k. Adding a multiple of one row to another row — the workhorse step of Gaussian elimination — leaves the determinant completely unchanged. This last property is why reducing a matrix to triangular form and multiplying its diagonal is a fast, numerically friendly way to find a determinant.
The product rule. For any two square matrices of the same size, det(AB) = det(A)·det(B). Determinants turn the messy business of matrix multiplication into ordinary number multiplication. A neat consequence is that the determinant of an inverse is the reciprocal of the original: det(A⁻¹) = 1 / det(A), which only makes sense — and only exists — when det(A) is non-zero. Related facts follow the same spirit: a matrix and its transpose share a determinant, det(Aᵀ) = det(A), and the determinant of a triangular matrix is simply the product of its diagonal entries.
Computing determinants in Python with NumPy
By hand, determinants grow painful fast: a 5×5 expanded naively along rows involves 120 signed products. In practice you let a library do it. NumPy computes the determinant with a single call that uses fast, stable LU decomposition under the hood rather than cofactor expansion:
import numpy as np
A = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 10]])
d = np.linalg.det(A)
print(round(d, 6)) # -3.0
One caveat worth knowing: numpy.linalg.det returns a floating-point number, so a determinant that is mathematically an exact integer may print as something like -2.9999999999999996. Rounding, as above, cleans up the display. If you need to test invertibility robustly, comparing the determinant against a small tolerance — rather than against exactly zero — is safer than trusting the raw float. This calculator rounds to six decimal places for the same reason, so tiny floating-point dust never masquerades as a real value.
Trying to take the determinant of a non-square matrix (it is undefined), forgetting that the cofactor signs alternate
+ − + − across the row, and reading a near-zero floating-point result as truly non-zero are the three errors that trip people up most. Also remember that det(A + B) is not generally det(A) + det(B) — the determinant is not additive, only multiplicative.Why determinants matter in machine learning
Determinants are not just a textbook exercise; they surface in the mathematics behind real models. The multivariate Gaussian distribution — the backbone of Gaussian mixture models, Gaussian processes, and countless probabilistic methods — carries the determinant of its covariance matrix directly in its normalizing constant, where it quantifies the spread of the distribution in terms of volume. Wherever a probability density must integrate to one across many correlated dimensions, a determinant is doing the bookkeeping.
Determinants also appear through the change-of-variables formula, where the absolute value of a Jacobian determinant rescales probability density as data is transformed. This is the engine of normalizing flows, a family of generative models that build complex distributions by pushing simple ones through invertible transformations and tracking the volume change at each step. More broadly, checking that a determinant is non-zero is how you confirm a matrix is invertible before solving a linear system, inverting a covariance, or diagnosing why an optimization has become numerically unstable. Understanding the determinant gives you a fast, intuitive read on whether a transformation preserves information or destroys it.
Frequently asked questions
What does it mean when the determinant is zero?
A zero determinant means the matrix is singular: its rows or columns are linearly dependent, the transformation collapses space into a lower dimension, and no inverse exists. The linear system it defines will not have a unique solution.
Which matrices have a determinant?
Only square matrices — those with equal numbers of rows and columns. A non-square matrix has no determinant at all. This calculator accepts square sizes from 1×1 up to 5×5.
How does cofactor expansion work?
You pick a row (here, the first), and for each entry multiply it by the determinant of the smaller matrix left when its row and column are deleted, applying alternating plus and minus signs. Summing those terms gives the determinant, and the process recurses until it reaches 1×1 blocks.
Is det(AB) the same as det(A) times det(B)?
Yes. For square matrices of the same size the product rule det(AB) = det(A)·det(B) always holds, which also means the determinant of an inverse is the reciprocal of the original determinant.
Why does my determinant look like a messy decimal?
Floating-point arithmetic introduces tiny rounding errors, so an exact integer determinant can display with a trailing string of nines or zeros. Rounding to a few decimal places, as this calculator does, restores the clean value.
Related calculators
Explore the full linear algebra calculators hub, or continue with the matrix multiplication calculator and the matrix transpose calculator to round out your matrix toolkit.