Engineering/Mathematics/Determinants
The Determinant of a Matrix
The determinant is a function that takes a square matrix and returns a single scalar. It is defined recursively in terms of the determinants of smaller matrices, and its vanishing is exactly the condition for the matrix to be singular.
- Core level
- Stream: determinants
- Reading time 13 min
- Ref KVS-ENG-MATH-0075
- Taxonomy
- Engineering / Mathematics
- Input
- A square matrix only
- Output
- One scalar in
- Notation
- or
- Base case
- Naive cost
- terms — unusable beyond about
Overview
Unlike almost everything else in linear algebra, the determinant is not an algebraic structure. It is a function: feed it a square matrix and it returns a single number. That number carries an extraordinary amount of information about the matrix — whether it is singular, whether the associated linear system has a unique solution, how the matrix scales volume, and, once eigenvalues enter the picture, the roots of the characteristic polynomial. The economy of compressing all of that into one scalar is what has kept the determinant in the toolkit despite its computational drawbacks.
The definition given here is recursive. The determinant of a matrix is its single entry. The determinant of an matrix is an alternating sum of the entries of its first row, each multiplied by the determinant of the matrix obtained by deleting that entry's row and column. Recursion is the honest way to present the definition, because it makes both the correctness and the cost transparent, but it is not how the quantity should ever be computed at scale.
That cost is severe. A determinant of size expands into determinants of size , each of which expands into of size , and so on. Unwinding the recursion completely produces products of entries each. For that is terms; for it exceeds . Practical computation therefore abandons the definition and reaches for row reduction or an LU factorisation, which reduces the work to cubic order.
Two conventions deserve early attention. First, the determinant is defined only for square matrices; asking for the determinant of a array is a category error, not a hard computation. Second, the vertical-bar notation denotes a determinant, not an absolute value or a norm: a determinant can be negative, and over it can be complex. The context — a matrix inside the bars — disambiguates, but the notation trips readers who meet it first in a numerical setting.
Definition
SubMatrix
SMFor an matrix , the submatrix is the matrix obtained from by deleting row and column entirely. The remaining rows and columns keep their original relative order.
The subscripts on name the row and column that were removed, not an entry that was kept. This clashes with the common use of for the entry in row , column , so the two notations must not be read interchangeably.
Determinant of a Matrix
DMFor a square matrix , the determinant is the scalar defined recursively by the following two clauses.
- If is , then .
- If has size , then is the alternating sum .
Determinant of Matrices of Size Two
DMSTFor , applying the recursive definition once gives . This closed form is the practical base case for hand computation, since decomposing a matrix into two determinants serves no purpose.
Concepts
Why the definition is recursive
A determinant cannot be written as a simple formula in the entries for general without either recursion or a sum over permutations. The recursive route is chosen here because it needs no combinatorial preliminaries: every step reduces the size by one and terminates at the trivial case. The trade-off is that the recursion conceals the symmetry of the object. Nothing in the definition suggests that the first row is unimportant, yet expansion about any row or column yields the same value — a fact that has to be proved separately.
The alternating sign pattern
The signs in the definition alternate along the first row, and the sign attached to position is . Generalised to arbitrary position the sign is , which lays out as a chequerboard with in the top-left corner. The alternation is not decorative: it is what makes the determinant change sign when two rows are interchanged, and hence what makes it vanish when two rows are equal. Drop the signs and the resulting function (the permanent) loses almost every useful property.
Cost growth and why it is prohibitive
Let be the number of scalar multiplications required by the definition. Each of the terms requires one multiplication plus a determinant of size , so with . This grows faster than . Computing a determinant this way builds five submatrices, twenty submatrices and sixty submatrices. At size the operation count exceeds the number of instructions a modern processor executes in a century.
What the determinant decides
The reason the determinant survives despite that cost is the equivalence between vanishing determinant and singularity: a square matrix is singular precisely when . Every consequence follows from that. A non-zero determinant guarantees that has a unique solution for every , that exists, that the columns of are linearly independent and span , and that the rank is full. For a symbolic or parametric matrix, setting is the standard route to the critical parameter values at which the system degenerates.
The case and the inverse formula
The expression appears independently as the reciprocal factor in the closed-form inverse of a matrix: , valid exactly when . That coincidence is the smallest instance of a general pattern: the determinant sits in the denominator of the adjugate formula for the inverse in every size, which is another way of saying that a zero determinant is the obstruction to invertibility.
Division-free arithmetic
The definition uses only addition, subtraction and multiplication. No division appears anywhere. For a matrix of integers this means the determinant is an integer, computable exactly with no rounding and no rational arithmetic. That property makes the determinant attractive in exact settings — integer lattices, cryptography, computer algebra — where row reduction with its divisions would introduce fractions. It is also why fraction-free elimination algorithms are built around determinantal identities rather than around ordinary pivoting.
Evaluating a determinant from the definition
Equations
Recursive definition of the determinant
EQ-DM-01Expansion about the first row. Each is the submatrix of size obtained by deleting row and column .
Compact form of the recursion
EQ-DM-02The same statement with the sign written as a power of , together with the base case that terminates the recursion.
Determinant of a matrix of size two
EQ-DM-03The practical base case. Both notations for the determinant are shown side by side.
Determinant of a matrix of size three
EQ-DM-04The recursion unwound one level for the most common hand-computed case. Note the sign pattern across the first row.
Singularity criterion
EQ-DM-05The single most useful property of the determinant. Equivalently, characterises the non-singular, invertible, full-rank square matrices.
Inverse of a matrix of size two
EQ-DM-06Valid precisely when the determinant is non-zero. The determinant appearing in the denominator is the general pattern in miniature.
Cost of the recursive definition
EQ-DM-07Multiplication count for the naive recursion. The solution grows faster than , which is why the definition is never used computationally beyond very small sizes.
Variable Definitions
| Symbol | Name | Meaning | Domain / type |
|---|---|---|---|
| Matrix | The square matrix whose determinant is required | n x n matrix over C | |
| Size | Common row and column count of the square matrix | positive integer | |
| Entry | The scalar in row , column of | complex scalar | |
| Submatrix | The matrix left after deleting row and column from | (n-1) x (n-1) matrix | |
| Determinant | The scalar produced by the recursive definition | complex scalar | |
| Determinant (bar notation) | Alternative notation for ; not an absolute value | complex scalar | |
| Position sign | The chequerboard sign attached to position | +1 or -1 | |
| Inverse | The matrix satisfying , existing exactly when | n x n matrix |
Worked Numerical Example
Problem statement
A three-degree-of-freedom stiffness matrix arises from a chain of axial springs. Determine whether the assembled system is non-singular — that is, whether a unique displacement field exists for any applied load — by evaluating the determinant directly from the recursive definition.
State the matrix
After applying boundary conditions the reduced stiffness matrix, in consistent units, is the tridiagonal matrix below. It is square of size , so the determinant is defined.
Form the three first-row submatrices
Delete row together with column , column and column in turn. Each deletion leaves a matrix; the surviving entries keep their original order.
Evaluate the three small determinants
Apply to each. Working these three values out before assembling the sum keeps the sign bookkeeping separate from the arithmetic, which is where most hand errors occur.
Assemble with alternating signs
The signs along the first row are . Multiply each first-row entry by the determinant of its submatrix and combine.
Complete the arithmetic
The middle term carries two negatives — one from the entry and one from the alternating sign — so it enters the sum as , not . This is the single most common slip in a hand determinant.
Cross-check by a second route
The third column of contains a zero in the first position, so an expansion about that column involves only two non-trivial terms. Expanding about column gives . Agreement between two independent expansions is a strong check on the arithmetic.
Interpret the result
, so is non-singular. The reduced system therefore has exactly one displacement solution for every load vector , and the stiffness matrix is invertible.
The determinant is . Because it is non-zero, the restrained spring chain is kinematically stable: no rigid-body or mechanism motion survives the boundary conditions, and the load-displacement relationship is uniquely invertible. Had the determinant come out zero, the structure would have admitted a non-trivial displacement field under zero load — a mechanism — and no finite element solver could have returned a unique answer.
Applications & Industry Use
Detecting mechanisms and buckling loads
A zero determinant of an assembled stiffness matrix signals that the structure admits a displacement pattern requiring no load — a mechanism, or at a critical load level, a buckling mode. Linear buckling analysis is precisely the search for the load factor at which first vanishes, so the determinant is the object whose root defines the critical load.
Characteristic equation of a state-space model
The poles of a linear time-invariant system are the roots of . Stability analysis, pole placement and root-locus construction all operate on that determinant. For low-order models it is written out symbolically from the definition; for high-order models it is never formed explicitly and an eigenvalue routine is used instead.
Orientation and signed area tests
The sign of a or determinant built from difference vectors decides whether three points turn clockwise or anticlockwise, and whether a tetrahedron is correctly oriented. Mesh generation, convex hull construction and back-face culling all reduce to such tests, which are exactly the cases where the recursive definition is cheap enough to use directly.
Network solvability by inspection
For a small resistive network the nodal admittance matrix can be assembled by hand and its determinant evaluated symbolically in the component values. A zero determinant identifies component combinations for which the node voltages are indeterminate — typically a floating subnetwork with no reference path to ground.
Covariance determinants as generalised variance
The determinant of a covariance matrix is the generalised variance and appears in the normalising constant of the multivariate normal density. A determinant close to zero indicates near-perfect correlation between measured quantities, which flags a redundant instrument channel or an over-parameterised calibration model.
Invertibility over exact rings
Hill ciphers and lattice-based constructions require key matrices that are invertible over the integers modulo , which holds exactly when the determinant is a unit in that ring. Because the definition uses no division, the determinant can be evaluated exactly in modular arithmetic and used directly as the invertibility test.
Design Considerations
Never compute a large determinant from the definition
The recursion is a definition, not an algorithm. Above roughly the operation count makes it useless, and above it is intractable on any hardware. Production code computes as the product of the diagonal entries of the factor of an LU factorisation, adjusted by the sign of the row permutation, at cubic cost.
Do not use a floating-point determinant as a singularity test
A determinant is not scale-invariant: multiplying an matrix by multiplies its determinant by . A perfectly well-conditioned matrix can therefore have a determinant of order , and a badly conditioned one can have a determinant near . Judge singularity by the condition number or the smallest singular value, never by the magnitude of the determinant.
Expand about the sparsest line when working by hand
Every zero entry in the chosen row or column removes an entire subdeterminant from the calculation. For a matrix with a sparse row or column, expanding about it can halve the hand labour. This freedom is licensed by the theorem that expansion about any row or column gives the same value, so it costs nothing in rigour.
Prefer exact arithmetic for symbolic or integer input
Because the definition involves no division, an integer matrix has an integer determinant. Evaluating it in exact integer arithmetic gives a definitive zero-or-not answer, which floating point cannot supply. For parametric matrices, symbolic expansion followed by factoring is usually the fastest route to the critical parameter values.
Beware overflow in exact integer determinants
Determinants of integer matrices grow rapidly with size and entry magnitude — Hadamard's bound puts at up to the product of the row norms. A matrix of three-digit integers can have a determinant exceeding a 64-bit integer. Use arbitrary-precision integers, or compute modulo several primes and reconstruct.
Keep the two subscript conventions apart
In this context denotes a submatrix and denotes a scalar entry. Mixing them silently converts a matrix into a number in the middle of a derivation. Where both appear in the same expression, spell out at least one of them in words the first time.
Standards & Codes
Notation, interchange and numerical standards that govern how this material is written down, stored and computed in production systems.
| Reference | Title | Relevance to this topic |
|---|---|---|
ISO 80000-2 | Quantities and units — Part 2: Mathematics | Specifies with an upright operator name and the vertical-bar form as the accepted notations for a determinant, and distinguishes both from the absolute value of a scalar. |
LAPACK xGETRF | LU factorisation with partial pivoting | The reference route to a numerical determinant: factor , multiply the diagonal of , and apply the sign of the permutation . No LAPACK routine implements the recursive definition. |
IEEE 754-2019 | IEEE Standard for Floating-Point Arithmetic | Governs the overflow and underflow behaviour that makes a floating-point determinant unreliable for large sizes, and motivates the log-determinant form returned by numpy.linalg.slogdet. |
ISO/IEC 40314 | Mathematical Markup Language (MathML) Version 3.0 | Provides the semantic markup for the bracketed and bar-delimited matrix forms used throughout this page, so the notation is machine-readable and accessible. |
ISO/IEC 14882 | Programming languages — C++ | Relevant to fixed-size determinant kernels: the Eigen library's determinant() specialises to closed-form expressions for sizes up to and switches to LU above that, a pattern the standard's template machinery makes possible. |
Material Selection
For a mathematical topic, "material" is the numeric representation: the scalar field, storage format and precision the computation is built from.
| Representation | Select when | Trade-off |
|---|---|---|
| Exact machine integers | Small integer matrices where a definitive zero-or-not answer is required, such as orientation tests and modular invertibility checks. | Fast and exactly correct with no rounding, but the result overflows silently once size and entry magnitude grow; Hadamard's bound should be checked in advance. |
| Arbitrary-precision integers | Computer-algebra determinants of integer matrices of moderate size, and determinantal identities in number theory. | Cannot overflow and remains exact, but operand size grows through the computation and arithmetic slows down superlinearly. |
| Exact rational arithmetic | Parametric or symbolic matrices where the determinant is wanted as a polynomial in the parameters. | Yields a factorable expression whose roots are the critical parameter values, at the cost of expression swell that can dominate the runtime. |
| IEEE 754 binary64 | Numerical determinants of moderate size obtained via LU factorisation, for instance in a Gaussian likelihood evaluation. | Cubic cost and predictable accuracy, but the result overflows or underflows for large sizes and is meaningless as a conditioning indicator. |
| Logarithmic magnitude with a separate sign | Statistical work where only is required, as in multivariate normal log-likelihoods. | Immune to the overflow that defeats a direct binary64 determinant, but discards the magnitude itself and requires care when the determinant is exactly zero. |
| Modular arithmetic over several primes | Exact determinants of large integer matrices where arbitrary-precision arithmetic is too slow. | Each modular determinant is cheap and overflow-free, but a bound on the true determinant is needed to know how many primes suffice for reconstruction. |
Manufacturing Notes
Implementation notes — how the result is actually produced by hand, by algorithm and by library, including cost and numerical behaviour.
Operation count of the definition versus factorisation
The recursion performs more than multiplications. LU factorisation with partial pivoting computes the same value in about operations. At that is the difference between roughly operations and about . Every practical determinant routine in every serious library takes the factorisation route.
Hand procedure for sizes three and four
For size , expand about the row or column containing the most zeros and evaluate the three determinants with . For size , first use row operations to create zeros in one column — adding a multiple of one row to another leaves the determinant unchanged — then expand about that column. Reducing four subdeterminants to one is the single largest saving available by hand.
Library behaviour
numpy.linalg.det and MATLAB's det both use LU factorisation and return a floating-point value. numpy.linalg.slogdet returns the sign and the natural logarithm of the magnitude separately, which is the correct choice whenever the determinant may overflow. SymPy's Matrix.det() offers a method argument selecting Bareiss fraction-free elimination, Berkowitz or cofactor expansion, with Bareiss the default for exact input.Verifying a hand computation
Three independent checks are available. Expand about a different row or column and compare. Compute the determinant of the transpose, which must give the same value. For a matrix of small integers, confirm the result against the product of the diagonal entries after reducing to triangular form using only row-addition operations, which do not change the determinant.
Numerical stability of the definition
Beyond its cost, the recursion is numerically poor: it forms products that are then added with cancellation, so the relative error can be enormous even when the answer is not small. Factorisation-based determinants inherit the backward stability of LU with partial pivoting and are the only defensible choice in floating point.
Failure Modes & Common Mistakes
| Failure mode / mistake | Impact | Root cause | Prevention & detection |
|---|---|---|---|
| Taking the determinant of a non-square matrix | high | Applying the definition to a rectangular array, usually after an assembly step silently changed the shape. | Assert row count equals column count before calling any determinant routine; treat a shape mismatch as a modelling error, not a numerical one. |
| Dropping or misplacing the alternating sign | high | Writing with a plus sign, or letting a negative entry cancel the alternating sign twice. | Write the sign factor explicitly as a separate factor before substituting the entry value. |
| Reading as an entry | medium | Confusing the submatrix notation with the entry notation , which turns a matrix into a scalar mid-derivation. | Use for entries throughout and reserve the bare subscript for submatrices, as done consistently on this page. |
| Judging singularity from a small floating-point determinant | high | Comparing against a fixed threshold, ignoring that the determinant scales as the -th power of the matrix scale. | Use the condition number, the smallest singular value, or a rank-revealing factorisation. Reserve the determinant test for exact arithmetic. |
| Integer overflow in an exact determinant | medium | Accumulating products of large integer entries in a fixed-width type, producing a silently wrapped and completely wrong value. | Bound the result with Hadamard's inequality first, then choose arbitrary-precision integers or a multi-modular scheme accordingly. |
| Floating-point overflow or underflow | medium | Multiplying diagonal entries of an LU factor, each of magnitude far from one, so the product leaves the representable range. | Compute the sign and the logarithm of the magnitude separately using a routine such as slogdet. |
| Assuming determinants add | medium | Writing by analogy with linear operations; the determinant is not a linear function of the matrix. | Test the claim on any pair of small matrices. The determinant is multiplicative under matrix multiplication, not additive under matrix addition. |
| Attempting the recursion on a large matrix in code | low | Implementing the definition literally as a teaching exercise and then reusing it on production-sized data. | Cap the recursive implementation at a small size and dispatch to an LU-based routine above it, mirroring what established libraries do internally. |
FAQs
Why is the determinant defined only for square matrices?
The recursion removes one row and one column at each step, so it terminates in a single entry only when the row and column counts agree. More fundamentally, the properties that make the determinant useful — multiplicativity, the singularity criterion, the volume interpretation — all require a map from a space to itself, which is what a square matrix represents. For rectangular matrices the analogous quantities are the singular values.
Does the determinant depend on expanding about the first row?
No. Expansion about any row or any column produces the same value, which is a theorem rather than part of the definition. The first row is chosen in the definition only because a single fixed rule makes the recursion well defined; in practice you should expand about whichever row or column has the most zeros.
Is a matrix with a very small determinant nearly singular?
Not reliably. The determinant scales as the -th power of a uniform scaling of the matrix, so a well-conditioned matrix with small entries has a tiny determinant and a badly conditioned matrix can have a determinant near one. Near-singularity is measured by the condition number or the smallest singular value, both of which are scale-aware.
What does a negative determinant mean?
For a real matrix, the sign of the determinant records orientation: a negative value means the associated linear map reverses handedness, mapping a right-handed frame to a left-handed one. The magnitude is the volume scaling factor. Over the determinant can be any complex number and the orientation reading no longer applies.
Why not just compute the determinant to solve a linear system?
Cramer's rule expresses each unknown as a ratio of determinants, and for size two or three it is a perfectly reasonable hand method. Beyond that it is catastrophically expensive — determinants, each costing more than solving the system outright — and it is numerically inferior to Gaussian elimination even when the cost is affordable.
How is the determinant actually computed in software?
Almost universally by LU factorisation with partial pivoting. The matrix is factored as ; since has unit diagonal and is upper triangular, the determinant is the product of the diagonal entries of , multiplied by or according to the parity of the row interchanges recorded in . The total cost is cubic rather than factorial.
Is the determinant of an integer matrix always an integer?
Yes. The definition uses only multiplication, addition and subtraction, never division, so the ring of integers is closed under the operation. This is why the determinant is a natural exact invertibility test over the integers and over integers modulo , where row reduction would require inverting pivots.
References
- Beezer, R. A. A First Course in Linear Algebra, Version 0.70. University of Puget Sound, 2006. Section DM. Licensed under the GNU Free Documentation License v1.2.
- ISO 80000-2:2019, Quantities and units — Part 2: Mathematics. International Organization for Standardization.
- Anderson, E. et al. LAPACK Users' Guide, 3rd edition. Society for Industrial and Applied Mathematics, 1999.
- Higham, N. J. Accuracy and Stability of Numerical Algorithms, 2nd edition. Society for Industrial and Applied Mathematics, 2002.
- IEEE 754-2019, IEEE Standard for Floating-Point Arithmetic. Institute of Electrical and Electronics Engineers.
AI Suggested Questions
- Derive the number of scalar multiplications the recursive determinant definition performs for a matrix of size , and compare it with LU factorisation at .
- Show a well-conditioned matrix with a determinant near and a badly conditioned matrix with a determinant near , to demonstrate why determinant magnitude is not a conditioning measure.
- Explain how the alternating sign pattern in the definition produces the fact that a matrix with two equal rows has zero determinant.
- How does Bareiss fraction-free elimination compute an exact integer determinant without rational arithmetic, and what bounds the size of its intermediate values?
- Work through a symbolic determinant containing a design parameter and identify the parameter values that make the matrix singular.
- Why does the determinant equal the signed volume scaling factor of the associated linear map, and how does that follow from the recursive definition?
Related Calculators
Evaluate the determinant of a square matrix by cofactor expansion or LU factorisation, in exact or floating-point arithmetic.
Matrix Inverse CalculatorInvert a square matrix and report the determinant, with a warning when the determinant is zero or numerically negligible.
Singularity & Conditioning TestCompare the determinant, the rank and the condition number of a matrix to decide whether it is genuinely singular or merely ill conditioned.
