Skip to content
mlmentorship

Determinant and volume

The determinant of a matrix is the signed volume scaling factor of the linear map. Zero determinant means the map collapses dimensions.

Published · 8 min read ·Core ·Foundation
Reading depth

Summary

A determinant gives the signed area or volume scale of a linear map. Its magnitude measures the scale. Its sign records orientation.

Start with a unit square. Send its horizontal edge to and its vertical edge to . What area does the square occupy now? What happens if you exchange the two arrows?

Geometric interpretation

Each column is the image of one basis vector. The two arrows bound the image of the square. Follow their order in the first two panels. Then compare their span in the last panel.

Learning objective

Swapping columns reverses orientation without changing absolute area

Column vectors sweep a signed areaVectors (2,0) and (1,2) span area 4. Swapping their order flips the determinant to -4 without changing the polygon.Same floor. Opposite traversal order.det +4det -4Both polygons contain four squareunits.Order changes orientation, notunsigned area.
Derivation
Three ordered column pairs with positive, negative, and zero determinant The first panel shows columns a one equals two comma one half and a two equals one half comma one and one quarter, spanning a parallelogram of area two and one quarter in counterclockwise order, so the determinant is positive two and one quarter. The second panel uses the exact same parallelogram but swaps the column order: a one now points to one half comma one and one quarter and a two points to two comma one half. Its area remains two and one quarter, but the order is clockwise, so the determinant is negative two and one quarter. The third panel has columns b one equals two comma one and b two equals one comma one half. The second is half the first, so both arrows lie on one line, the parallelogram collapses to a segment, and the determinant is zero. 1 · Positive: area 2.25, orientation preserved a₁ = (2, 0.5) a₂ = (0.5, 1.25) counterclockwise det[a₁ a₂] = +2.25 density = 4/9 2 · Swap columns: same area, opposite sign a₁ = (0.5, 1.25) a₂ = (2, 0.5) clockwise det[a₁ a₂] = −2.25 3 · Dependent columns: one direction is lost b₁ = (2, 1) b₂ = (1, 0.5) = ½b₁ collapsed segment det[b₁ b₂] = 0 area = 0 not invertible
Read it this way: swapping the arrows changes their order but leaves the filled region unchanged. Only the determinant sign changes. In the last panel, both arrows lie on one line. There is no two-dimensional area.
Check: Why does swapping columns change the determinant sign but not the transformed density?
Read it this way: Vectors (2,0) and (1,2) span area 4. Swapping their order flips the determinant to -4 without changing the polygon.
Does reversing the column order change the floor area?

Original coordinate construction checked against MIT OpenCourseWare 18.06, the Deep Learning linear algebra chapter, and the open Interactive Linear Algebra determinant text.

Work the area

The columns give

The four corners become , , and . The filled region has area .

You can check that area by sliding each vertical slice downward by . The slide preserves every slice’s height and width. The arrows become and . The base is now horizontal: base times height gives .

Change of variables (probability)

Put uniform probability density on the original unit square. The image has times the area, so its density must fall to . The total mass stays .

For this map, and

Thus inside the image and zero outside it.

More generally, let on a region where has a differentiable inverse. Assume its Jacobian is nonsingular there. Then

Here is the inverse map’s Jacobian. The absolute value keeps probability density nonnegative, including when the map reverses orientation.

Normalizing flows use maps whose Jacobian determinants are cheap to compute. For a triangular Jacobian, multiply its diagonal entries. If several regular inverse branches reach the same output, add their density contributions. The single-inverse formula alone does not handle that case.

Change the map

Exchange the columns

New task: keep the filled region but exchange the two basis images.

Picture and change: the second panel exchanges the arrows. The ordered area becomes . Its magnitude remains , so the transformed density remains .

Check: a negative density would expose a missing absolute value.

Use when: tracking orientation or transporting probability mass requires the correct sign convention.

Double every coordinate

New task: replace with .

Picture and change: both edge lengths double. In two dimensions, area grows by . Thus , and the uniform density becomes . In three dimensions, doubling every coordinate multiplies volume by .

Check: doubling only one column multiplies the determinant by two. Doubling the whole matrix multiplies it by in dimensions.

Use when: every coordinate unit changes, rather than one basis image alone.

Properties

For square matrices :

  • . Composing maps multiplies their signed volume scales.
  • .
  • when is invertible.
  • .
  • , counting multiplicity. Real matrices can have complex eigenvalues.
  • For a triangular matrix, .
  • For an orthogonal matrix , . Rotations and reflections preserve volume magnitude.

In exact arithmetic, these statements are equivalent:

The last panel uses . Its second column is half its first. The image lies on a line, and . There is no ordinary two-dimensional inverse-density formula for this collapsed map.

Try a different transformation

A reflection is followed by axis scalings of three and two. Find the determinant and the image density of a unit-density square.

Check your answer

The determinant is . The image density is on its support. The reflection changes orientation. The scale magnitudes multiply the area by six.

Computing determinants

MethodCostWhen
LU decompositionGeneral-purpose; standard library default
Triangular: product of diagWhen matrix is already triangular
Eigendecomposition: If you need eigenvalues anyway
Log-determinant for PD matricesvia CholeskyWhen you only need (e.g., Gaussian log-likelihood)

For a general matrix, use a signed log-determinant. Track row-pivot signs and the signs of the LU diagonal entries. Sum for the log-magnitude. For a positive-definite matrix with , compute . An explicit determinant can overflow or underflow.

Common pitfalls

  • Using as a proxy for matrix “size.” A nearly singular matrix can have huge entries but tiny .
  • Computing for invertibility tests. Numerically unstable; use rank or condition number instead.
  • Forgetting the absolute value in change-of-variables formulas. Densities are non-negative; the Jacobian determinant can be negative.