Addaly is in open beta. Things will change, and AI answers can be wrong — check anything that matters.

The Maths You Actually Need

Eight ideas that carry almost all the weight in machine learning.

Lesson 14 of 768 min

The determinant, and what it says about collapse

One number for a whole transformation

The determinant of a square matrix is a single number, and it has a clean geometric meaning: it is the factor by which the transformation multiplies area, or volume, or the higher-dimensional equivalent.

Take the unit square with corners at (0,0), (1,0), (0,1), (1,1) — area 1. Apply

A = [ 3  0 ]
    [ 0  2 ]

It becomes a rectangle 3 wide and 2 tall, area 6. And det(A) = 3*2 − 0*0 = 6. The number is the area scaling, exactly.

Now a shear:

B = [ 1  1 ]     det = 1*1 - 1*0 = 1
    [ 0  1 ]

The square becomes a slanted parallelogram — different shape, same area. The determinant says 1, and it is right.

Zero means collapse

The case that matters is det = 0.

C = [ 1  2 ]     det = 1*4 - 2*2 = 0
    [ 2  4 ]

The unit square is squashed onto a line segment. A line has zero area, so the scaling factor is zero. That is the geometric version of the fact from the previous lesson: this matrix destroys a dimension, and destroyed dimensions cannot be recovered. Determinant zero, no inverse, information gone. They are three statements of one thing.

Negative determinants are also meaningful: they say the transformation flipped orientation, turning a left-handed arrangement into a right-handed one, like a mirror. det = −2 means area doubled and the space was reflected.

Computing it, and why you usually should not by hand

For a 2×2, ad − bc. For a 3×3 there is a longer formula. For anything larger, do not use the recursive cofactor expansion you may have been taught — it costs on the order of n! operations, which for a 20×20 matrix is more arithmetic than the age of the universe permits. Real implementations use LU decomposition and cost about n^3, the same as a matrix multiplication.

And even then, the determinant itself is a poor thing to compute. Multiply a 100×100 matrix's entries by 2 and its determinant multiplies by 2^100, about 1.3 × 10^30. Determinants overflow and underflow floating-point range almost immediately at realistic sizes, which is why any library that needs one offers slogdet — the sign and the logarithm of the absolute determinant, computed as a sum of logs rather than a product.

python
import numpy as np
sign, logdet = np.linalg.slogdet(A)   # stable; det(A) = sign * exp(logdet)

Where it appears in machine learning

The determinant is not a daily tool, but it sits under three things you may meet.

Normalising flows. These are generative models built from invertible transformations. To know the probability density after a transformation you must correct for how much the transformation squeezed or stretched the space, and that correction is exactly the log absolute determinant of the Jacobian. The entire architectural game in that field — coupling layers, autoregressive flows — is about designing transformations powerful enough to be useful whose Jacobian determinant is cheap to compute, usually by making the Jacobian triangular so the determinant is just the product of the diagonal.

Multivariate Gaussians. The density of a multivariate normal contains a det(Σ)^(-1/2) term. Fitting one requires the log determinant of the covariance, computed via Cholesky in every serious implementation.

Diagnosing collapse. If a covariance matrix has a determinant of effectively zero, your features are linearly dependent — one is a combination of the others — and any method that inverts that covariance will fail. Checking the log determinant, or better the singular values, tells you before the failure.

What it does not tell you

The determinant is one number summarising an entire transformation, so it hides almost everything. A matrix that stretches by 100 in one direction and squashes by 100 in another has determinant 1, exactly like the identity, while being wildly ill-conditioned and dangerous to work with. Two matrices with the same determinant can behave nothing alike.

This is the honest limit: the determinant answers "did total volume change" and nothing else. The question you usually want answered is "what happens in each direction", and for that you need the singular values, which are the subject of a later lesson in this module. The determinant is their product. Knowing a product tells you very little about its factors, and here that gap is the whole story.

The rule to keep

Determinant zero means a dimension was flattened. Determinant far from zero tells you almost nothing useful on its own, and if you find yourself needing its actual value, reach for slogdet rather than det.

The one thing to keep

The determinant is the factor by which a transformation multiplies volume, so a determinant of zero means dimensions were flattened away and nothing downstream can restore them.

Before you move on

Two 512x512 weight matrices both have determinant 1.0. What can you conclude about how they behave?

Pick the one you would defend. Nobody sees your answer.

No ads. No data sale. No public scores on people. Ever.

© 2026 Addaly