Home / Linear Algebra

Determinant

One number that says what a matrix does to area — and, by its sign, whether the plane got turned over on the way.

Overview

Quick Context

A matrix is a transformation of space, and the determinant measures one thing about it: how much it scales area. A determinant of 3 means every region comes out three times as large; 0.5 means everything shrinks by half; 1 means area is untouched, however much the shape has been rotated or sheared.

The sign is the second half of the story. A negative determinant means the plane was flipped over — a reflection is hiding inside the transformation.

The Matrix

2.0
1.0
1.0
1.5

columns of the matrix are where i and j land

What The Unit Square Becomes

The faint square is the original. The shaded parallelogram is its image.

The Number

det = ad − bc
2.00
Area of the image 2.00
Orientation kept
Invertible yes
Rank 2

Where It Came From

2.0
1.0
1.0
1.5

(2.0 × 1.5) − (1.0 × 1.0) = 2.00

Every area in the plane is multiplied by 2.00 — not just this square.

The Determinant: A Practical Guide

An area factor with a sign, and everything that follows from it being zero.

Reading it off the matrix

det [[a, b], [c, d]] = ad − bc

The columns of the matrix are where the basis vectors land: i goes to (a, c) and j goes to (b, d). The unit square they used to span becomes the parallelogram those two vectors span, and ad − bc is exactly its signed area. That is not a coincidence to memorise; it is the formula for the area of a parallelogram written in coordinates.

In three dimensions the same number is the volume of the image of the unit cube, and in n dimensions it is the n-dimensional volume. The mechanics get heavier; the meaning does not change.

What zero means

If the determinant is zero, the parallelogram has no area: the two columns lie on the same line, and the whole plane has been squashed onto that line. Everything that goes wrong with a singular matrix follows from this one picture.

  • No inverse. Undoing the transformation would mean recovering a 2D plane from a 1D line, and that information is gone. This is why det = 0 and "not invertible" are the same statement.
  • Rank drops. The columns are linearly dependent, so the rank falls from 2 to 1 (or to 0 if the matrix is all zeros).
  • Systems break. Ax = b has either no solution or infinitely many, never exactly one.
  • An eigenvalue is zero. The determinant is the product of the eigenvalues, so a zero determinant means at least one of them is zero — the direction that got flattened.

Near-zero is its own problem. A determinant of 0.001 is technically invertible and numerically miserable: the matrix is close to singular, and solving with it amplifies error. Practical code checks the condition number rather than testing the determinant against zero.

One number that says what a transformation does to size

The determinant of a matrix answers a single question: by what factor does this transformation scale areas? (Volumes in three dimensions, and the generalisation of volume beyond that.)

For a 2×2 matrix:

det [[a, b], [c, d]] = ad − bc

Take the unit square with corners (0,0), (1,0), (0,1), (1,1) — area 1. Apply the matrix and it becomes a parallelogram whose area is exactly |det|.

detEffect
2Areas double
1Areas preserved — rotations and reflections
0.5Areas halve
0Everything collapses onto a line or a point
−3Areas triple and orientation flips

The negative case is worth a sentence: the sign records whether the transformation turned space inside out. A reflection has a negative determinant; a rotation does not.

Zero is the case that matters

A determinant of zero means the transformation flattened the space. Two dimensions became one; a volume became a plane.

Everything else follows from that geometric fact:

  • The matrix is singular — it has no inverse, because many inputs now map to the same output and there is no way back.
  • Its columns are linearly dependent — at least one is a combination of the others.
  • The matrix is not full rank.
  • At least one eigenvalue is zero.
  • The system Ax = b has either no solution or infinitely many, never exactly one.

Those are five ways of saying the same thing, and recognising that is most of what a linear algebra course is trying to teach.

In practice, exact zeros are rare in floating point; what you meet is a determinant very close to zero, meaning a nearly singular matrix. Solutions then become extremely sensitive to small changes in the data — which is exactly what multicollinearity does to regression coefficients, making them large, unstable, and prone to flipping sign when a row is added.

Computing it, and why you usually should not

For 3×3 there is the cofactor expansion, and for larger matrices it generalises — at a cost that grows factorially. Nobody uses it beyond textbook examples.

Real implementations use LU decomposition, which is cubic rather than factorial. And for the questions people actually want answered, there is usually a better tool:

import numpy as np

np.linalg.det(A)              # the determinant itself
np.linalg.matrix_rank(A)      # better test of singularity
np.linalg.cond(A)             # how close to singular, numerically
np.linalg.slogdet(A)          # sign and log|det| - avoids overflow

slogdet matters more than it sounds. Determinants of large matrices overflow or underflow easily, and log-determinants appear directly in the log-likelihood of a multivariate normal — so statistical code uses the log version throughout.

Checking det(A) == 0 is bad practice. Use matrix_rank, or check the condition number, which tells you how nearly singular the matrix is rather than giving a yes/no answer that floating point cannot support.

Three determinants

A stretch, a reflection, and a matrix that flattens the plane onto a line — and what asking for the last one's inverse gets you.

example_01.pyNumPy
Output

Guided tour

  1. Start at det = 2. The default matrix doubles area: the unit square becomes a parallelogram of area 2.00, and the readout is just (2.0 × 1.5) − (1.0 × 1.0).
  2. Press Sweep d Through Zero. Entry d slides down and the parallelogram flattens. At d = 0.5 the determinant is exactly 0 and the shape collapses to a line; past it the parallelogram reopens on the other side and the badge reads flipped.
  3. Look at what flipped means. With a negative determinant, going from the image of i to the image of j turns the other way round the parallelogram. The plane has been turned over; no amount of rotating gets it back.
  4. Find the identity. Set a = 1, b = 0, c = 0, d = 1. Determinant 1, area unchanged, nothing moved at all.
  5. Shear it. From the identity, drag b up to 2. The square leans into a parallelogram but the determinant stays at exactly 1 — a shear slides area sideways without creating or destroying any of it.
  6. Scale one axis. Set a = 3 with b = 0, c = 0, d = 1: determinant 3, the square stretched into a 3×1 rectangle. The determinant does not care which direction the stretching happened in.

Properties worth knowing

PropertyStatement
Productdet(AB) = det(A) × det(B)
Transposedet(Aᵀ) = det(A)
Inversedet(A⁻¹) = 1 / det(A)
Scalingdet(kA) = kⁿ det(A) for an n×n matrix
TriangularThe product of the diagonal entries
EigenvaluesThe product of all eigenvalues
Identitydet(I) = 1

The product rule has an intuitive reading: apply one transformation that doubles areas and another that triples them, and areas are six times larger. Composition multiplies scale factors.

The eigenvalue rule connects this topic to the last one: if any eigenvalue is zero, the product is zero, so the matrix is singular. And the scaling rule surprises people — doubling every entry of a 3×3 matrix multiplies its determinant by 8, not 2, because all three dimensions are scaled.

Worth remembering

The determinant is the signed area factor of a transformation: ad − bc is the area of the parallelogram the unit square becomes, its magnitude says how much every region is scaled, and its sign says whether the plane was flipped over. Zero is the case that matters — the square has been flattened onto a line, so the columns are dependent, the rank has dropped, the inverse does not exist and Ax = b no longer has a unique solution. Determinants multiply under composition and invert under inversion, and in practice "close to zero" deserves as much suspicion as zero itself.

Where determinants appear in practice

Multivariate normal distributions. The density includes 1/√(det Σ), where Σ is the covariance matrix. The determinant measures the total spread of the distribution — a "generalised variance" — and a near-zero value means the data lies on a lower-dimensional surface, at which point the density is undefined and the model needs regularising.

Change of variables. Transforming a probability distribution requires multiplying by the absolute determinant of the Jacobian, which corrects for how the transformation stretches space. Normalising flows — a family of generative models — are designed entirely around making that determinant cheap to compute.

Detecting collinearity. A near-zero determinant of XᵀX warns that features are nearly redundant, before the regression coefficients start behaving strangely.

Geometry. The area of a triangle, the volume of a parallelepiped, and orientation tests in computational geometry are all determinants.

Questions people ask

Can non-square matrices have a determinant? No. The concept is about scaling a space to itself, which requires equal input and output dimensions.

What does a determinant of 1 mean? Areas and volumes are preserved. Rotations and shears are the typical examples.

Is a large determinant good? It carries no quality judgement — it just means the transformation expands space a lot. What matters practically is being far from zero.

How do I test for singularity in code? np.linalg.matrix_rank(A) < min(A.shape), or check np.linalg.cond(A) against a threshold. Do not compare the determinant to zero.

Why is det(AB) = det(A)det(B)? Because scale factors compose multiplicatively when transformations are applied in sequence.

Where does the log-determinant come from? From log-likelihoods of Gaussian models, where taking logs turns the product into a sum and avoids overflow.

Recap in one screen

  • The determinant is the factor by which a transformation scales area or volume.
  • A negative determinant means orientation was flipped; zero means a dimension was collapsed.
  • Zero determinant = singular = no inverse = dependent columns = a zero eigenvalue.
  • Near-zero is the practical case: unstable solutions and unreliable coefficients.
  • Use rank or the condition number to test singularity, and slogdet when the value itself is needed.

Recall check

0 of 3

Say the answer out loud before you reveal it — recalling it is what makes it stick, and rereading it is not.

  1. Without scrolling back — what is the one-line takeaway from this module?

  2. What does this module say about “Quick Context”?

  3. What does this module say about “What zero means”?

Cheat sheet

Determinant

A matrix is a transformation of space, and the determinant measures one thing about it: how much it scales area. A determinant of 3 means every region comes out three times as large; 0.5 means everything shrinks by half; 1 means area is untouched, however much the shape has been rotated or sheared.

MATHS · vizlearn.in/maths/determinant.html

About the author

Ashish Jangra builds and maintains VizLearn. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.