Skip to content
AI.info

Mathematical foundations

Determinants, Volume, and Change of Coordinates

Interpret determinants as signed volume change, connect singularity to collapsed dimensions, and use Jacobian determinants correctly in transformed densities.

By the end you can

Comparison

Determinant, rank, and condition number

These three summaries answer different questions, and they do not substitute for one another. The man who introduced the third of them said so first. Turing's 1948 paper on rounding-off errors in matrix processes defines an M-condition number and an N-condition number, then separates both from the determinant. Ed Bueler's page-by-page reading of that paper records the argument: “He states that determinant is not a good measure of conditioning, giving four 3 × 3 matrices with very different condition numbers and the same determinant.” Nick Higham gives the same attribution from outside: Turing “suggests using these condition numbers to measure the ill conditioning of a matrix with respect to linear systems, using a statistical argument to make the connection.”

Two numerical-computing vendors now print that warning in their own reference documentation, with numbers attached. MATLAB's `det` page carries a Limitations section: “Avoid using det to examine if a matrix is singular because of the following limitations. Use cond or rcond instead.” It adds that “The magnitude of the determinant is typically unrelated to the condition number of a matrix.” The examples do the arguing. A = eye(10)*0.0001 has det(A) = 1.0000e-40 while cond(A) = 1. A 17x17 matrix that is exactly singular returns det(A) = 2.6698e+10. MathWorks says it outright in the “Determine if Matrix Is Singular” example: “The determinant of a matrix can be arbitrarily close to zero without conveying information about singularity.” NumPy shows the other end of the same failure. np.linalg.det(np.eye(500)*0.1) returns 0.0 for a perfectly conditioned invertible matrix, while np.linalg.slogdet on that same array returns (1, -1151.2925464970228).

1.0000e-40 at condition number 1, and 2.6698e+10 for a matrix that is exactly singular. The magnitude is not the diagnostic; it is a product, and the three columns below measure three different things.

FigureComparison · 3 columns

Determinant

Measures signed volume scaling.

  • Defined for square matrices
  • Zero detects singularity
  • Magnitude depends strongly on dimension and units
  • Poor general measure of numerical difficulty

Rank

Counts independent input-output directions.

  • Applies to rectangular matrices
  • Detects exact dimensional collapse
  • Can be numerically ambiguous near tolerance
  • Does not quantify anisotropy

Condition number

Measures sensitivity of a problem to perturbations.

  • Depends on a norm
  • Can be large with nonzero determinant
  • Guides numerical reliability
  • Does not by itself describe statistical identifiability

A determinant records oriented volume change

The determinant of a square linear transformation measures how signed volume changes. Its magnitude gives the scale factor. Its sign records whether orientation is preserved or flipped. A zero determinant means that at least one dimension collapses. The transformation maps a region into a lower-dimensional set and cannot have a two-sided inverse. Reading it this way is more useful than memorizing cofactor expansions, especially in probability transformations, normalizing flows, and numerical diagnostics.

Deformable medical image registration turns that reading into a count. VoxelMorph judges a warp by the sign of its Jacobian determinant, voxel by voxel: “We count all non-background voxels for which |J phi(p)| <= 0, where the deformation is not diffeomorphic”. The brain volumes it works on hold 5.2 million voxels each. Its Results section reports that “We find that all methods result in deformations with small islands of such voxels, but are diffeomorphic at the vast majority of voxels (99.4% - 99.9%).” VoxelMorph (MSE) produced 9,606 such voxels, 0.184% of the volume. The Learn2Reg challenge scores submissions on the same quantity — “standard deviation and extreme values of Jacobian determinant to promote plausible deformations” — and for LUMIR 2024 measures “Deformation Smoothness: Quantified by non-diffeomorphic volumes (NDV), addressing inherent errors in finite difference-based Jacobian approximation.” A collapsed or reversed local volume is not an abstraction there. It is a number in a table.

Determinants are older than matrix algebra. Seki Takakazu was working with them in Japan in 1683. Leibniz described the vanishing condition in a 1693 letter to de l’Hôpital. The volume idea was in use long before anyone named a rectangular array.

The determinant summarizes volume change, not overall matrix quality.

Why densities need a Jacobian determinant

When a transformation stretches a small region, probability density must decrease so that total probability remains one. When the region contracts, density increases. For an invertible differentiable map z = f(x), the absolute Jacobian determinant tracks local volume change. The change-of-variables formula compensates for that distortion. The absolute value is required because probability mass is nonnegative even when the transformation reverses orientation.

Generative models pay this cost on every training step. Real NVP, published at ICLR in 2017, was built so the Jacobian is triangular, and the paper says why: “As computing the Jacobian determinant of the transformation is crucial to effectively train using this principle, this work exploits the simple observation that the determinant of a triangular matrix can be efficiently computed as the product of its diagonal terms.” A 2021 review of normalizing flows in the Journal of Machine Learning Research reads the correction term the same way: “The absolute Jacobian determinant |detJT (u)| quantifies the relative change of volume of a small neighbourhood around u due to T.”

Glow puts a price on the alternative. Its invertible 1x1 convolution has a c x c weight matrix W, and “The cost of computing or differentiating det(W) is O(c3)”. Kingma and Dhariwal removed that cost by never treating W as a free matrix: “This cost of computing det(W) can be reduced from O(c3) to O(c) by parameterizing W directly in its LU decomposition”, as W = PL(U + diag(s)), “where P is a permutation matrix, L is a lower triangular matrix with ones on the diagonal, U is an upper triangular matrix with zeros on the diagonal, and s is a vector.” The log-determinant is then log | det(W)| = sum(log |s|). That is one pass over c numbers instead of a cubic factorization. The 2021 review records the same construction from outside the original authors: “the absolute determinant of W can be computed in O(D) time”, and “Linear flows based on the PLU decomposition have been proposed by e.g. Oliva et al. (2018); Kingma and Dhariwal (2018).” Cheap volume tracking is what makes an exact likelihood affordable.

Example

Reading a 2×2 determinant geometrically

For two column vectors in the plane, the absolute determinant is the area of the parallelogram they span. Every property below is a statement about that area, and the third one is enforced as a hard constraint by two US federal agencies.

  • Independent directions: Nonparallel columns enclose positive area and produce a nonzero determinant.
  • Dependent directions: Parallel columns enclose zero area, revealing rank loss.
  • Orientation: Swapping the two columns reverses orientation and changes only the sign — and that sign decides whether a fitted transform is a rotation or a reflection. NIST's Journal of Research published the rule flatly in 2019, in its article on the Kabsch-Umeyama algorithm: “The rigid motion phi is orientation preserving if det(U) = 1, i.e., the determinant of U equals 1”. The algorithm then branches on the sign to force a proper rotation out of an SVD: “If det(V W) > 0, then set sd = 1, else set sd = -1.” At NASA Goddard, F. Landis Markley states Wahba's problem the same way — “Find the orthogonal matrix A with determinant +1 that minimizes the loss function” — because, as his Introduction puts it, “The attitude matrix must also be proper, i.e., it must have unit determinant, so it is an element of the three-parameter group SO(3).” A reflected spacecraft attitude is not a slightly worse answer. It is a physically wrong one.
  • Scaling: Multiplying one column by three multiplies the determinant by three.
  • Shear: A shear can change coordinates dramatically while preserving determinant one.

Visual

Operations and their determinant effects

Elementary matrix operations reveal why determinant rules work. Each rule is a statement about volume rather than about entries. That is why software gets the determinant as a by-product of a factorization into such moves: NumPy computes it “via LU factorization using the LAPACK routine z/dgetrf”, and “The determinant function uses an LU decomposition” in R as well. Swap, scale, shear, compose, collapse — the five rows below are the whole rule set.

FigureProcess · 5 steps
  1. 1

    Swap two rows

    Reverse orientation, so the determinant changes sign.

  2. 2

    Scale one row by c

    Scale volume by c, so the determinant is multiplied by c.

  3. 3

    Add a multiple of one row to another

    Apply a shear, preserving volume and determinant.

  4. 4

    Multiply transformations

    Volume factors multiply: det(AB) = det(A)det(B).

  5. 5

    Collapse a direction

    Destroy volume, giving determinant zero.

Steps

Decide whether a determinant belongs in the calculation

A determinant is informative only when the question genuinely concerns a square transformation or local volume. Step four is not a stylistic preference, and Gaussian process regression is the standing example. Its log marginal likelihood carries a log|K + sigma_n^2 I| term, and that term has to be evaluated for every hyperparameter setting. Rasmussen and Williams' Gaussian Processes for Machine Learning, from 2006, never forms the determinant. The caption to Algorithm 2.1 says so: “The log determinant required in eq. (2.30) is computed from the Cholesky factor (for large n it may not be possible to represent the determinant itself).” The same caption prices the work: “The computational complexity is n3/6 for the Cholesky decomposition in line 2, and n2/2 for solving triangular systems in line 3 and (for each test case) in line 5.”

That algorithm ships. scikit-learn's GaussianProcessRegressor states that “The implementation is based on Algorithm 2.1 of [RW2006]”, exposes log_marginal_likelihood as a method, and keeps the factorization as the attribute L_, documented as “Lower-triangular Cholesky decomposition of the kernel in X_train_”. The factor, not the determinant, is the object the code holds on to.

FigureProcess · 5 steps
  1. 1. Check squareness

    A determinant is defined only for a square matrix.

  2. 2. Identify the transformation

    State which coordinates or variables are being mapped.

  3. 3. Ask about volume

    Confirm that volume scaling, singularity, or density transformation is relevant.

  4. 4. Prefer factorization

    Compute signs and log-magnitudes through LU, QR, or Cholesky when appropriate.

  5. 5. Inspect sensitivity

    Use singular values or condition numbers for numerical reliability.

Key idea

Use log-determinants with care

Products of many singular values can overflow or underflow. The standard numerical stacks have already conceded the point: they do not hand back a determinant at all. NumPy's slogdet returns a sign and a log-modulus, and says why: “If an array has a very small or very large determinant, then a call to det may overflow or underflow. This routine is more robust against such issues, because it computes the logarithm of the determinant rather than the determinant itself.” It is “computed via LU factorization using the LAPACK routine z/dgetrf.” R goes further and makes the log scale the default: “determinant is a generic function that returns separately the modulus of the determinant, optionally on the logarithm scale, and the sign of the determinant”, with the argument logarithm documented as “logical; if TRUE (default) return the logarithm of the modulus of the determinant”. Then the R documentation states the wider warning outright: “Often, computing the determinant is not what you should be doing to solve a given problem.”

A finite log-determinant does not guarantee good conditioning. One singular value can be tiny while another is huge, leaving the product moderate. The reverse also holds: np.linalg.det(np.eye(500)*0.1) returns 0.0 for a matrix that is invertible and perfectly conditioned, while slogdet on it returns (1, -1151.2925464970228). Always inspect the singular-value spectrum or condition number when sensitivity matters.

A determinant can look harmless while the underlying problem is nearly singular.

Key takeaways