Module contents
Lesson 6 of 25Review 70 min

Determinants: signed volume

Interpret the determinant as a signed volume scale, characterize it axiomatically, derive the product rule and compute it stably with LU and logarithms. Explain why determinant size does not measure proximity to singularity, and connect it to Gaussian densities, normalizing flows and log-determinant derivatives.

After this lesson you can

  • Interpret the determinant as oriented volume and reason about its sign.
  • Deduce determinant properties from multilinearity and alternation.
  • Prove det(AB) = det(A) det(B) using elementary matrices.
  • Compute determinants and log determinants stably from an LU factorization.
  • Explain why a small determinant does not imply a matrix is close to singular.

Before you start

Motivation: three questions, one number

A square matrix A∈Rn×n\mat{A} \in \R^{n\times n} is a linear map from Rn\R^n to itself, and raises three seemingly independent questions:

  1. How much does it change volumes? The unit cube becomes a parallelepiped. What is its volume?
  2. Does it preserve orientation? Or does it flip space, like a mirror turning a right hand into a left hand?
  3. Can it be undone? Does the inverse A−1\mat{A}\inv exist?

The determinant answers all three with one number: ∣det⁡A∣\abs{\det\mat{A}} is the volume multiplier, its sign says whether orientation is preserved, and det⁡A≠0\det\mat{A} \neq 0 if and only if A\mat{A} is invertible. It is no accident that one number summarizes so much: a map collapsing space to lower dimension leaves zero volume and cannot be undone, and changing from preserved to reversed orientation requires passing through that collapse.

Probabilistic models encounter it constantly, usually as a logarithm:

  • The multivariate Gaussian. The density of N(μ,Σ)\Normal(\vb{\mu}, \mat{\Sigma}) at Rd\R^d is
p(x)=exp⁡ ⁣(−12(x−μ)⊤Σ−1(x−μ))(2π)ddet⁡Σ.p(\vb{x}) = \frac{\exp\!\big(-\tfrac{1}{2}(\vb{x}-\vb{\mu})\T\mat{\Sigma}\inv(\vb{x}-\vb{\mu})\big)}{\sqrt{(2\pi)^d \det\mat{\Sigma}}}.

Factor (det⁡Σ)−1/2(\det\mat{\Sigma})^{-1/2} corrects volume. If x=μ+Lz\vb{x} = \vb{\mu} + \mat{L}\vb{z} with z∼N(0,I)\vb{z} \sim \Normal(\vb{0}, \mat{I}) and Σ=LL⊤\mat{\Sigma} = \mat{L}\mat{L}\T, the point cloud of z\vb{z} occupies ∣det⁡L∣=det⁡Σ\abs{\det\mat{L}} = \sqrt{\det\mat{\Sigma}} times more volume, and density falls proportionally (see the full multivariate Gaussian definition).

  • Normalizing flows. A generative model transforming data into noise via a differentiable bijection z=f(x)\vb{z} = f(\vb{x}) obtains exact likelihood using log⁡pX(x)=log⁡pZ(f(x))+log⁡∣det⁡Jf(x)∣\log p_X(\vb{x}) = \log p_Z(f(\vb{x})) + \log\abs{\det \mat{J}_f(\vb{x})}. Much of architecture design makes that determinant cheap (normalizing flows).
  • Gaussian processes. Fitting kernel hyperparameters maximizes log⁡p(y)=−12y⊤K−1y−12log⁡det⁡K−n2log⁡2π\log p(\vb{y}) = -\tfrac12\vb{y}\T\mat{K}\inv\vb{y} - \tfrac12\log\det\mat{K} - \tfrac n2\log 2\pi, the marginal likelihood. With a few hundred points det⁡K\det\mat{K} no longer fits in a floating-point number; its logarithm does.
  • Training any such model requires differentiating log⁡∣det⁡A∣\log\abs{\det\mat{A}} with respect to A\mat{A}. Result A−⊤\mat{A}^{-\top} follows in this lesson from the cofactor formula.

This review has two goals: understand the determinant as oriented volume, from which all its properties follow, and calculate it well, which in practice means computing its logarithm from a factorization. One warning matters from the start: determinant does not measure how close a matrix is to singular.

Intuition: the area scale factor

Start in the plane. Columns of A=[a11a12a21a22]\mat{A} = \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22}\end{bmatrix} are basis images a1=Ae1\vb{a}_1 = \mat{A}\vb{e}_1 and a2=Ae2\vb{a}_2 = \mat{A}\vb{e}_2, so the unit square with vertices 0,e1,e1+e2,e2\vb{0}, \vb{e}_1, \vb{e}_1 + \vb{e}_2, \vb{e}_2 maps to the parallelogram with vertices 0,a1,a1+a2,a2\vb{0}, \vb{a}_1, \vb{a}_1 + \vb{a}_2, \vb{a}_2. What is its area?

Base times height, calculated in a way that later generalizes. If a11≠0a_{11} \neq 0, apply vertical shear (x,y)↦(x, y−mx)(x, y) \mapsto (x,\, y - m x) with m=a21/a11m = a_{21}/a_{11} to the plane. It slides each vertical segment along its line without stretching, so by Cavalieri’s principle it changes no figure’s area. It maps a1=(a11,a21)\vb{a}_1 = (a_{11}, a_{21}) to (a11,0)(a_{11}, 0) on axis xx, and a2=(a12,a22)\vb{a}_2 = (a_{12}, a_{22}) to (a12, a22−ma12)(a_{12},\, a_{22} - m a_{12}). The transformed parallelogram has base ∣a11∣\abs{a_{11}} on the axis and height ∣a22−ma12∣\abs{a_{22} - m a_{12}}:

aˊrea=∣a11∣ ∣ a22−a21a11 a12∣=∣a11a22−a12a21∣.\begin{aligned} \text{área} &= \abs{a_{11}}\,\Big|\,a_{22} - \frac{a_{21}}{a_{11}}\,a_{12}\Big| \\ &= \abs{a_{11}a_{22} - a_{12}a_{21}}. \end{aligned}

If a11=0a_{11} = 0, base a1=(0,a21)\vb{a}_1 = (0, a_{21}) is already vertical, height is horizontal distance ∣a12∣\abs{a_{12}}, and area is ∣a12a21∣\abs{a_{12}a_{21}}, as the same formula gives. The shear is exactly the first step of Gaussian elimination: subtract mm times row 1 from row 2. You will return to it when calculating determinants.

The number without absolute value, a11a22−a12a21a_{11}a_{22} - a_{12}a_{21}, is the determinant of A\mat{A}, and its sign has meaning: positive when the shortest rotation from a1\vb{a}_1 to a2\vb{a}_2 is counterclockwise, like that from e1\vb{e}_1 to e2\vb{e}_2, and negative when clockwise. Try it.

InteractiveSigned area
h+2.50
det A−8−6−4−202468+2.50
det⁡A=a11a22−a12a21=(2.00)(1.50)−(0.50)(1.00)=2.50\det\mat{A} = a_{11}a_{22} - a_{12}a_{21} = (2.00)(1.50) - (0.50)(1.00) = 2.50
Matrix A=[ a1    a2 ]\mat{A} = [\,\vb{a}_1\;\; \vb{a}_2\,]
det⁡A\det \mat{A}+2.50
Area =∣det⁡A∣= \abs{\det \mat{A}}2.50
Base × height2.24 × 1.12
Rotation a1→a2\vb{a}_1 \to \vb{a}_2counterclockwise (+)
Drag the tips of a1\vb{a}_1 and a2\vb{a}_2. The parallelogram area is ∣det⁡A∣\abs{\det\mat{A}} and its color shows sign: red if the short rotation from a1\vb{a}_1 to a2\vb{a}_2 is counterclockwise, blue if clockwise. Move a2\vb{a}_2 to the other side of the dashed line of a1\vb{a}_1 and watch the parallelogram flatten and flip. Then enable shear and slide one column parallel to the other: does the determinant change?

What you should have seen:

  • The sign changes only when crossing the line of a1\vb{a}_1. On the line the parallelogram is a segment and det⁡A=0\det\mat{A} = 0: columns are dependent and A\mat{A} collapses the plane to a line. Changing sign continuously requires passing through this collapse.
  • Shears change nothing. Sliding a2\vb{a}_2 parallel to a1\vb{a}_1 changes neither base nor height. In formulas, det⁡[a1    a2+c a1]=det⁡[a1    a2]\det[\vb{a}_1\;\; \vb{a}_2 + c\,\vb{a}_1] = \det[\vb{a}_1\;\; \vb{a}_2].
  • Swapping columns changes sign while preserving area: rotation from a2\vb{a}_2 to a1\vb{a}_1 reverses. Negating one column also reverses orientation.
  • Signed base times height. With a1\vb{a}_1 fixed, det⁡A=∥a1∥⋅h±\det\mat{A} = \norm{\vb{a}_1}\cdot h_\pm, where h±h_\pm is the distance of a2\vb{a}_2 from the line of a1\vb{a}_1, positive on its left. This signed distance is a linear function of a2\vb{a}_2: its dot product with the unit vector perpendicular to a1\vb{a}_1. That is why determinant is linear in each column.

The unit square is not special. A linear map takes a square of side ε\varepsilon with vertex p\vb{p} to parallelogram Ap+ε A([0,1]2)\mat{A}\vb{p} + \varepsilon\,\mat{A}([0,1]^2), a translated and reduced copy of the previous one, of area ∣det⁡A∣ ε2\abs{\det\mat{A}}\,\varepsilon^2. Approximate any region RR by squares on increasingly fine grids; each scales by the same factor and

aˊrea(A(R))=∣det⁡A∣  aˊrea(R).\text{área}\big(\mat{A}(R)\big) = \abs{\det\mat{A}}\;\text{área}(R).

The unit disk, for example, becomes an ellipse of area π∣det⁡A∣\pi\abs{\det\mat{A}}; the lab checks this by Monte Carlo.

In three dimensions and beyond

In Rn\R^n columns of A\mat{A} generate parallelepiped P(a1,…,an)={t1a1+⋯+tnan:0≤tj≤1}\mathcal{P}(\vb{a}_1, \dots, \vb{a}_n) = \{t_1\vb{a}_1 + \cdots + t_n\vb{a}_n : 0 \le t_j \le 1\}, the image of unit cube [0,1]n[0, 1]^n. Its volume is ∣det⁡A∣\abs{\det\mat{A}}, and the sign of det⁡A\det\mat{A} again describes orientation: in R3\R^3 positive if (a1,a2,a3)(\vb{a}_1, \vb{a}_2, \vb{a}_3) is a right-handed triple, like (e1,e2,e3)(\vb{e}_1, \vb{e}_2, \vb{e}_3) (right-hand thumb, index and middle finger), negative if left-handed. See it before formalizing.

InteractiveThe cube and its image
  • unit cube (volume 1)
  • image, det⁡>0\det > 0
  • image, det⁡<0\det < 0
  • uniform points
The same 600 points now occupy a volume 2.4842.484: their density has been divided by ∣det⁡A∣\abs{\det \mat{A}}.
Matrix A=[ a1  a2  a3 ]\mat{A} = [\,\vb{a}_1\;\vb{a}_2\;\vb{a}_3\,]
0.00
Show
det⁡A\det \mat{A}+2.484
Volume =∣det⁡A∣= \abs{\det \mat{A}}2.484
Orientationpreserved
Points per unit³600 → 242
The 600 uniform unit-cube points map under A\mat{A} to the parallelepiped generated by its columns, of volume ∣det⁡A∣\abs{\det\mat{A}}. Move λ\lambda from 0 to 1: the third column approaches the plane of the others, determinant decreases linearly and the solid flattens at λ=1\lambda = 1. Go beyond 1 and watch the color. “Cube” and “Its image under A\mat{A}” show transition (1−s)I+sA(1-s)\mat{I} + s\mat{A}: try reflection and observe the midpoint.

Three observations the rest of the lesson turns into theorems:

  • Determinant is linear in each column. Replacing a3\vb{a}_3 with (1−λ)a3+λp(1-\lambda)\vb{a}_3 + \lambda\vb{p}, with p\vb{p} in the plane of a1\vb{a}_1 and a2\vb{a}_2, changes signed volume to (1−λ)det⁡A(1-\lambda)\det\mat{A}: a line in λ\lambda crossing zero and continuing to the other side.
  • Zero volume is equivalent to noninvertibility. At λ=1\lambda = 1 all 600 points fall onto a plane and distinct points reach the same location: x\vb{x} cannot be recovered from Ax\mat{A}\vb{x}.
  • Density is divided by ∣det⁡A∣\abs{\det\mat{A}}. The same points occupy ∣det⁡A∣\abs{\det\mat{A}} times more volume. If x\vb{x} has density pXp_X and A\mat{A} is invertible, y=Ax\vb{y} = \mat{A}\vb{x} has density pY(y)=pX(A−1y)/∣det⁡A∣p_Y(\vb{y}) = p_X(\mat{A}\inv\vb{y})/\abs{\det\mat{A}}: the linear case of the density change-of-variables formula used in normalizing flows.

Three axioms determine everything

What properties does signed parallelepiped volume D(a1,…,an)D(\vb{a}_1, \dots, \vb{a}_n) have as a function of its edges? Those just observed:

  • It scales with each edge. Doubling an edge doubles volume, and negating it reverses orientation. Addition is respected too: with other edges fixed, volume is the unchanged base times signed height of the moving edge, and that height is a linear function of it.
  • Swapping two edges reverses orientation. (e2,e1)(\vb{e}_2, \vb{e}_1) rotates opposite to (e1,e2)(\vb{e}_1, \vb{e}_2).
  • The unit cube has volume 1.

Remarkably, these three properties suffice: no other function satisfies them.

Everything else follows. The first two consequences appeared in the interactive; prove them yourself.

ProofIdentical columns and shears
Prove: If DD satisfies the three axioms: (a) when two columns of A\mat{A} are identical, D(A)=0D(\mat{A}) = 0; (b) adding a multiple of one column to another does not change D(A)D(\mat{A}).
0
Use only multilinearity, antisymmetry (swapping two columns changes the sign) and D(I)=1D(\mat{I}) = 1.

Step 1 of 4. Suppose columns ii and jj, with i≠ji \neq j, are identical. What does antisymmetry say?

Proof

1. Some column is a combination of the others, ak=∑j≠kcjaj\vb{a}_k = \sum_{j \neq k} c_j\vb{a}_j. By linearity in column kk, D(A)=∑j≠kcj D(a1,…,aj,…,an)D(\mat{A}) = \sum_{j \neq k} c_j\, D(\vb{a}_1, \dots, \vb{a}_j, \dots, \vb{a}_n), where in summand jj column aj\vb{a}_j occupies position kk. Each summand has two identical columns, at positions jj and kk, and is 0.

2. Let U\mat{U} be upper triangular. If some ukk=0u_{kk} = 0, the first kk columns are zero from row kk onward: kk vectors in the subspace spanned by e1,…,ek−1\vb{e}_1, \dots, \vb{e}_{k-1} of dimension k−1k - 1, hence dependent and D(U)=0=∏jujjD(\mat{U}) = 0 = \prod_j u_{jj}. If all ujju_{jj} are nonzero, traverse columns left to right and subtract from column jj multiples of earlier columns (already reduced to uiieiu_{ii}\vb{e}_i) to zero entries above its diagonal. By exercise part (b), DD is unchanged and we reach diag⁡(u11,…,unn)\diag(u_{11}, \dots, u_{nn}). Linearity pulls each ujju_{jj} out: D(U)=u11⋯unn D(I)=∏jujjD(\mat{U}) = u_{11}\cdots u_{nn}\, D(\mat{I}) = \prod_j u_{jj}. For lower triangular matrices do the same right to left.

∎

Leibniz’s formula and uniqueness

Multilinearity fully expands D(A)D(\mat{A}). Try predicting each step before revealing it.

aj=∑i=1naij ei\vb{a}_j = \sum_{i=1}^{n} a_{ij}\,\vb{e}_i
Each column written in the standard basis.
1/5

The last step uses the sign of a permutation, sgn⁡(σ)=(−1)k\sgn(\sigma) = (-1)^k with kk the number of inversions of σ\sigma, well defined even though a permutation may be written as a product of transpositions in many ways.

Proof

Uniqueness. The derivation above used only the axioms, so any DD satisfying them is this formula.

Existence (outline). Check that the formula satisfies the axioms. It is multilinear because each term contains exactly one factor from each column. It is normalized because at I\mat{I} only the identity term survives. It is alternating: if A′\mat{A}' is A\mat{A} with columns kk and ll swapped and τ\tau is the transposition (k  l)(k\;l), the term for σ\sigma in det⁡A′\det\mat{A}' is the term for σ∘τ\sigma\circ\tau in det⁡A\det\mat{A} with sign reversed, because sgn⁡(σ∘τ)=−sgn⁡(σ)\sgn(\sigma\circ\tau) = -\sgn(\sigma). Since σ↦σ∘τ\sigma \mapsto \sigma\circ\tau is a bijection of SnS_n, det⁡A′=−det⁡A\det\mat{A}' = -\det\mat{A}.

∎

For n=2n = 2 there are two permutations, identity and swap, giving a11a22−a21a12a_{11}a_{22} - a_{21}a_{12}: the signed area from the start. For n=3n = 3 there are six terms, three even and three odd (Sarrus’s rule):

det⁡A=a11a22a33+a21a32a13+a31a12a23−a31a22a13−a11a32a23−a21a12a33.\begin{aligned} \det\mat{A} = {} & a_{11}a_{22}a_{33} + a_{21}a_{32}a_{13} \\ & + a_{31}a_{12}a_{23} - a_{31}a_{22}a_{13} \\ & - a_{11}a_{32}a_{23} - a_{21}a_{12}a_{33}. \end{aligned}

For general nn there are n!n! terms with nn factors. The formula gives an explicit definition and a tool for proofs; as an algorithm, as you will see, it is useless.

The product rule

If B\mat{B} multiplies areas by ∣det⁡B∣\abs{\det\mat{B}} and then A\mat{A} multiplies them by ∣det⁡A∣\abs{\det\mat{A}}, the composition AB\mat{A}\mat{B} should multiply them by the product. The key is that A\mat{A} scales any region by the same factor, including one already deformed by B\mat{B}.

InteractiveAreas multiply
Initial area
1.000
×∣det⁡B∣\times\abs{\det \mat{B}}
after B\mat{B}
1.200
×∣det⁡A∣\times\abs{\det \mat{A}}
after A\mat{A}
1.800
Gray dashed outline: the shape in previous stages. Fill: orientation preserved.
Apply B\mat{B} first
Apply A\mat{A} next
after A
Product (the right-hand factor acts first)
Shape
det⁡B\det \mat{B}+1.20
det⁡A\det \mat{A}+1.50
det⁡(AB)\det(\mat{A}\mat{B}), calculated+1.80
det⁡A⋅det⁡B\det \mat{A} \cdot \det \mat{B}+1.80
Area of the shape now1.800
Play the animation: first B\mat{B} acts and area changes from 1 to ∣det⁡B∣\abs{\det\mat{B}}; then A\mat{A} acts, multiplying the area of any figure by ∣det⁡A∣\abs{\det\mat{A}}, including one already deformed by B\mat{B}. Change the product to BA\mat{B}\mat{A} and enable comparison: the final shapes differ but their areas are equal. Also try ‘Two reflections’, which compose to give a rotation.

The proof uses the elementary matrices of Gaussian elimination. Multiplication on the left performs row operations; on the right, the same matrices perform analogous column operations: M(I+c eiej⊤)=M+c (Mei)ej⊤\mat{M}(\mat{I} + c\,\vb{e}_i\vb{e}_j\T) = \mat{M} + c\,(\mat{M}\vb{e}_i)\vb{e}_j\T adds to column jj of M\mat{M} column ii multiplied by cc.

Proof

There are three types of elementary matrix; in each case compare the effect on columns with the determinant of E\mat{E}:

  • Swap columns ii and jj: det⁡(ME)=−det⁡M\det(\mat{M}\mat{E}) = -\det\mat{M} by antisymmetry, and det⁡E=−det⁡I=−1\det\mat{E} = -\det\mat{I} = -1.
  • Scale column ii by c≠0c \neq 0: det⁡(ME)=cdet⁡M\det(\mat{M}\mat{E}) = c\det\mat{M} by linearity, and det⁡E=c\det\mat{E} = c because E\mat{E} is diagonal.
  • Add to column jj cc times column ii: det⁡(ME)=det⁡M\det(\mat{M}\mat{E}) = \det\mat{M} by the previous exercise, and det⁡E=1\det\mat{E} = 1 because E\mat{E} is triangular with ones on the diagonal.
∎

Recall also from elimination that an invertible matrix reduces to I\mat{I} using elementary operations, Ek⋯E1B=I\mat{E}_k\cdots\mat{E}_1\mat{B} = \mat{I}, and is therefore a product of elementary matrices, B=E1−1⋯Ek−1\mat{B} = \mat{E}_1\inv\cdots\mat{E}_k\inv, since the inverse of an elementary matrix is another of the same type. You now have everything you need.

ProofThe product rule, step by step
Prove: For all A,B∈Rn×n\mat{A}, \mat{B} \in \R^{n\times n}, det⁡(AB)=det⁡(A)det⁡(B)\det(\mat{A}\mat{B}) = \det(\mat{A})\det(\mat{B}).
0
You have the lemma det⁡(ME)=det⁡(M)det⁡(E)\det(\mat{M}\mat{E}) = \det(\mat{M})\det(\mat{E}) for all M\mat{M} and elementary E\mat{E}, the fact that every invertible matrix is a product of elementary matrices, and that the determinant of a matrix with dependent columns is 0.

Step 1 of 4. Why split into two cases according to B\mat{B}?

The product rule has many immediate consequences:

  • det⁡(A−1)=1/det⁡A\det(\mat{A}\inv) = 1/\det\mat{A}, from det⁡(A)det⁡(A−1)=det⁡I=1\det(\mat{A})\det(\mat{A}\inv) = \det\mat{I} = 1.
  • det⁡(AB)=det⁡(BA)\det(\mat{A}\mat{B}) = \det(\mat{B}\mat{A}) even if AB≠BA\mat{A}\mat{B} \neq \mat{B}\mat{A}, as seen in the interactive.
  • The determinant is basis-independent. Similar matrices have the same determinant: det⁡(P−1AP)=det⁡(P)−1det⁡(A)det⁡(P)=det⁡A\det(\mat{P}\inv\mat{A}\mat{P}) = \det(\mat{P})\inv\det(\mat{A})\det(\mat{P}) = \det\mat{A}. Thus it makes sense to speak of the determinant of a linear map T:V→VT: V \to V, just as of its trace.
  • det⁡(c A)=cndet⁡A\det(c\,\mat{A}) = c^n\det\mat{A}. This follows not from the product rule but multilinearity: cc multiplies each of the nn columns.

One property remains hidden in the interactive: it treats rows like columns.

Proof

By Leibniz’s formula, det⁡A⊤=∑σsgn⁡(σ)∏jaj σ(j)\det\mat{A}\T = \sum_{\sigma} \sgn(\sigma)\prod_j a_{j\,\sigma(j)}. Changing the product index to i=σ(j)i = \sigma(j) gives ∏jaj σ(j)=∏iaσ−1(i) i\prod_j a_{j\,\sigma(j)} = \prod_i a_{\sigma\inv(i)\,i}. Since σ↦σ−1\sigma \mapsto \sigma\inv is a bijection of SnS_n and sgn⁡(σ−1)=sgn⁡(σ)\sgn(\sigma\inv) = \sgn(\sigma), the sum is exactly that for det⁡A\det\mat{A}.

∎

Consequently, everything said about columns holds for rows: swapping two rows changes the sign, adding a multiple of another row leaves the determinant unchanged, and a zero row makes it zero. These are exactly the Gaussian elimination operations. Another consequence: if Q\mat{Q} is orthogonal, Q⊤Q=I\mat{Q}\T\mat{Q} = \mat{I} gives (det⁡Q)2=1(\det\mat{Q})^2 = 1, and det⁡Q=±1\det\mat{Q} = \pm 1. Orthogonal matrices preserve volumes, and the sign distinguishes rotations (+1+1) from those involving a reflection (−1-1), such as Householder reflections.

Proof

(i) ⇒ (ii): det⁡(A)det⁡(A−1)=1\det(\mat{A})\det(\mat{A}\inv) = 1. (ii) ⇒ (iii): if the rank were less than nn, the columns would be dependent and det⁡A=0\det\mat{A} = 0. (iii) ⇔ (iv) by the rank-nullity theorem, and (iii) and (iv) together say A\mat{A} is surjective and injective, i.e. (i).

∎

Calculation: pivots, not permutations

Leibniz’s formula has n!n! terms of nn factors. Cofactor expansion, seen in the next section, merely groups them differently and has the same order of cost. With n=10n = 10 there are 3.63.6 million terms; with n=20n = 20, 20!≈2.4×101820! \approx 2.4 \times 10^{18}, and at one billion terms per second it would take about 77 years. Even a small model’s covariance matrix has nn in the hundreds.

Gaussian elimination solves the problem. LU factorization with partial pivoting gives PA=LU\mat{P}\mat{A} = \mat{L}\mat{U}, where P\mat{P} is a permutation matrix, L\mat{L} is lower triangular with ones on its diagonal, and U\mat{U} is upper triangular. Since det⁡L=1\det\mat{L} = 1 and det⁡U=∏kukk\det\mat{U} = \prod_k u_{kk}, the product rule gives

det⁡(P)det⁡(A)=u11u22⋯unn.\det(\mat{P})\det(\mat{A}) = u_{11}u_{22}\cdots u_{nn}.

If elimination made ss row swaps, P\mat{P} is a product of ss transpositions and det⁡P=(−1)s\det\mat{P} = (-1)^s, which is its own inverse. Hence

det⁡A=(−1)s u11u22⋯unn,\det\mat{A} = (-1)^s\, u_{11}u_{22}\cdots u_{nn},

the product of pivots with the sign from swaps, at a cost of about 23n3\tfrac{2}{3}n^3 operations: with n=1000n = 1000, fewer than 10910^9, a fraction of a second. Geometrically, elimination simply repeats the shear from the beginning.

InteractiveElimination as shearing
Step 0. The parallelogram of the columns of A\mat{A}, with area ∣det⁡A∣\abs{\det \mat{A}}. Press play.
det⁡A=(−1)1 u11u22=−(2.00)(1.75)=−3.50\det\mat{A} = (-1)^1\,u_{11}u_{22} = -(2.00)(1.75) = -3.50
Matrix A\mat{A}
A
A=[1.002.002.000.50]\mat{A} = \begin{bmatrix} 1.00 & 2.00 \\ 2.00 & 0.50 \end{bmatrix}
det⁡\det of the current shape−3.50
Area =∣det⁡∣= \abs{\det}3.50
Swaps ss1
Each Gaussian elimination step acts on the parallelogram of columns. Swapping rows reflects it across y=xy = x: area stays the same but sign changes. Subtracting a multiple of the first row from the second shears it vertically: vertical fill lines slide without stretching, area is preserved and the first column falls on the xx axis. Finally area is base times height, ∣u11u22∣\abs{u_{11}u_{22}}. Disable pivoting and compare the sign of u22u_{22}.

The log-determinant

Computing determinants accurately has a second difficulty: the number itself. A float64 represents magnitudes up to about 1.8×103081.8 \times 10^{308}, and the smallest normal numbers are around 2.2×10−3082.2 \times 10^{-308} (below these are subnormal numbers with decreasing precision, down to about 5×10−3245 \times 10^{-324}; see floating-point representation). A product of hundreds of pivots easily escapes that range: det⁡(0.1 I400)=10−400\det(0.1\,\mat{I}_{400}) = 10^{-400} rounds to 00 and det⁡(10 I400)\det(10\,\mat{I}_{400}) to ∞\infty, even for these innocuous matrices. Hence we work with the log-determinant:

log⁡∣det⁡A∣=∑k=1nlog⁡∣ukk∣,signo⁡(det⁡A)=(−1)s∏k=1nsgn⁡(ukk).\begin{aligned} \log\abs{\det\mat{A}} &= \sum_{k=1}^{n} \log\abs{u_{kk}}, \\ \operatorname{signo}(\det\mat{A}) &= (-1)^s \prod_{k=1}^{n} \sgn(u_{kk}). \end{aligned}

This is what np.linalg.slogdet returns, and what Gaussian density, Gaussian-process likelihood and flow likelihood need, since they use only log⁡∣det⁡∣\log\abs{\det}. When the matrix is symmetric positive definite, such as a covariance or kernel matrix, Cholesky factorization Σ=LL⊤\mat{\Sigma} = \mat{L}\mat{L}\T is even better: no pivoting, half the cost, and log⁡det⁡Σ=2∑klog⁡Lkk\log\det\mat{\Sigma} = 2\sum_k \log L_{kk}.

Cofactors, adjugate and Cramer’s rule

Explicit determinant and inverse formulas are useful for reasoning and differentiation rather than computation. The minor MijM_{ij} is the determinant of matrix (n−1)×(n−1)(n-1)\times(n-1) obtained by removing from A\mat{A} row ii and column jj; the cofactor is Cij=(−1)i+jMijC_{ij} = (-1)^{i+j}M_{ij}.

Proof

Write column jj as aj=∑iaijei\vb{a}_j = \sum_i a_{ij}\vb{e}_i. By linearity in that column, det⁡A=∑iaijdet⁡A(i,j)\det\mat{A} = \sum_i a_{ij}\det\mat{A}^{(i,j)}, where A(i,j)\mat{A}^{(i,j)} is A\mat{A} with column jj replaced by ei\vb{e}_i. Move that column to the first position with j−1j - 1 adjacent column swaps, and row ii to the first position with i−1i - 1 adjacent row swaps: the sign changes by (−1)i+j(-1)^{i+j}, leaving a matrix whose first column is e1\vb{e}_1 and whose lower-right block is the submatrix of MijM_{ij}, with rows and columns in the same order. Subtracting multiples of the first column from the others zeros the rest of the first row, and the function taking a matrix N\mat{N} of size n−1n-1 to the determinant of [10⊤0N]\begin{bmatrix} 1 & \vb{0}\T \\ \vb{0} & \mat{N}\end{bmatrix} satisfies all three axioms, so it is det⁡N\det\mat{N}. Hence det⁡A(i,j)=(−1)i+jMij=Cij\det\mat{A}^{(i,j)} = (-1)^{i+j}M_{ij} = C_{ij}. Row expansion follows by applying this to A⊤\mat{A}\T.

∎
Proof

Entry (i,k)(i, k) of Aadj⁡(A)\mat{A}\operatorname{adj}(\mat{A}) is ∑jaijCkj\sum_j a_{ij}C_{kj}: the row kk expansion of the determinant of the matrix obtained by replacing row kk of A\mat{A} with its row ii. If i=ki = k, that matrix is A\mat{A} and the sum is det⁡A\det\mat{A}. If i≠ki \neq k, it has two identical rows and the sum is 0. For adj⁡(A)A\operatorname{adj}(\mat{A})\mat{A} reason similarly using columns.

∎

For n=2n = 2 this is the familiar formula: [abcd]−1=1ad−bc[d−b−ca]\begin{bmatrix} a & b \\ c & d\end{bmatrix}\inv = \dfrac{1}{ad - bc}\begin{bmatrix} d & -b \\ -c & a\end{bmatrix}.

Proof

Since b=∑jxjaj\vb{b} = \sum_j x_j\vb{a}_j, linearity in column ii gives det⁡Ai(b)=∑jxjdet⁡(a1,…,aj,…,an)\det\mat{A}_i(\vb{b}) = \sum_j x_j\det(\vb{a}_1, \dots, \vb{a}_j, \dots, \vb{a}_n), with aj\vb{a}_j in position ii. All terms with j≠ij \neq i have two identical columns; what remains is xidet⁡Ax_i\det\mat{A}.

∎

What they are for. These formulas say that the entries of A−1\mat{A}\inv and of the solution of Ax=b\mat{A}\vb{x} = \vb{b} are quotients of polynomials in the entries of A\mat{A}, so they depend continuously and differentiably on those entries while det⁡A≠0\det\mat{A} \neq 0. They also give the determinant’s derivative. In the row ii expansion, det⁡A=∑kaikCik\det\mat{A} = \sum_k a_{ik}C_{ik}, no cofactor CikC_{ik} depends on row ii, hence ∂det⁡A/∂aij=Cij\partial\det\mat{A}/\partial a_{ij} = C_{ij}. Since the cofactor matrix is adj⁡(A)⊤=det⁡(A) A−⊤\operatorname{adj}(\mat{A})\T = \det(\mat{A})\,\mat{A}^{-\top}:

∂det⁡A∂A=det⁡(A) A−⊤,∂log⁡∣det⁡A∣∂A=A−⊤.\begin{aligned} \frac{\partial \det\mat{A}}{\partial\mat{A}} &= \det(\mat{A})\,\mat{A}^{-\top}, \\[4pt] \frac{\partial \log\abs{\det\mat{A}}}{\partial\mat{A}} &= \mat{A}^{-\top}. \end{aligned}

This is Jacobi’s formula,  ⁣ddet⁡A=tr⁡(adj⁡(A)  ⁣dA)\dd\det\mat{A} = \tr\big(\operatorname{adj}(\mat{A})\,\dd\mat{A}\big), generalized in matrix calculus (inverse and log-determinant derivatives) and used by autograd when training a flow or Gaussian-process hyperparameters. The absolute value is no obstacle: the derivative of log⁡∣x∣\log\abs{x} is 1/x1/x even for negative xx.

Why they are not used for computation. Cofactor expansion has factorial cost. Cramer’s rule needs n+1n + 1 determinants: even using LU this takes on the order of n4n^4 operations versus 23n3\tfrac23 n^3 for one factorization and its two substitutions, and accumulates more rounding error. The adjugate inverse has the same problem. For 2×22\times 2 and 3×33\times 3 matrices, however, closed formulas are entirely reasonable and used daily in graphics and robotics.

The determinant as local volume scaling

Maps of practical interest are nonlinear, but look linear up close. If f:Rn→Rnf: \R^n \to \R^n is differentiable at x0\vb{x}_0, then f(x0+h)=f(x0)+Jf(x0) h+o(∥h∥)f(\vb{x}_0 + \vb{h}) = f(\vb{x}_0) + \mat{J}_f(\vb{x}_0)\,\vb{h} + o(\norm{\vb{h}}), where Jf\mat{J}_f is the Jacobian matrix. A small cube QQ with side ε\varepsilon around x0\vb{x}_0 transforms almost into a parallelepiped, the image of QQ under the linear part, with volume approximately ∣det⁡Jf(x0)∣ εn\abs{\det\mat{J}_f(\vb{x}_0)}\,\varepsilon^n. The Jacobian determinant is the local volume scaling factor.

InteractiveDeterminant as local scaling
  • square QQ and its exact image f(Q)f(Q)
  • linear approximation f(x0)+Jf(x0)(Q−x0)f(\vb{x}_0) + \mat{J}_f(\vb{x}_0)(Q - \vb{x}_0)
Input: coordinates (r,θ)(r, \theta)
Output: image under ff
area(f(Q))≈∣det⁡Jf(x0)∣ ε2=1.400×0.2500\text{area}(f(Q)) \approx \abs{\det \mat{J}_f(\vb{x}_0)}\,\varepsilon^2 = 1.400 \times 0.2500, with relative error vanishing as we reduce ε\varepsilon.
0.50
f(r,θ)=(rcos⁡θ,  rsin⁡θ)f(r, \theta) = (r\cos\theta,\; r\sin\theta)
x0\vb{x}_0(1.40, 0.60)
det⁡Jf(x0)\det \mat{J}_f(\vb{x}_0)+1.400
area(f(Q))/area(Q)\text{area}(f(Q)) / \text{area}(Q)1.400
Relative difference0.01 %
det⁡Jf=r\det \mat{J}_f = r
Here the ratio equals r0r_0 exactly for every ε\varepsilon: det⁡Jf=r\det \mat{J}_f = r is linear and its mean over QQ equals its central value. For the coupling map, this holds only in the limit.
A small square QQ of side ε\varepsilon around x0\vb{x}_0 and its exact image under a nonlinear map ff, alongside the dashed linear approximation f(x0)+Jf(x0)(x−x0)f(\vb{x}_0) + \mat{J}_f(\vb{x}_0)(\vb{x} - \vb{x}_0). Compare the area ratio with ∣det⁡Jf(x0)∣\abs{\det\mat{J}_f(\vb{x}_0)}. In polar coordinates, move x0\vb{x}_0 toward r=0r = 0. With the coupling layer, reduce ε\varepsilon and watch the difference disappear. The swirl twists shapes substantially: does any area change?

Summing over an increasingly fine grid of small cubes gives the change-of-variables formula, which you will formalize in calculus (change of variables): if ff is a differentiable bijection with differentiable inverse from UU to f(U)f(U),

∫f(U)g(y)  ⁣dy=∫Ug(f(x)) ∣det⁡Jf(x)∣  ⁣dx.\begin{aligned} \int_{f(U)} & g(\vb{y})\,\dd\vb{y} \\ &= \int_U g\big(f(\vb{x})\big)\,\abs{\det\mat{J}_f(\vb{x})}\,\dd\vb{x}. \end{aligned}

The classic example is polar coordinates, f(r,θ)=(rcos⁡θ,rsin⁡θ)f(r, \theta) = (r\cos\theta, r\sin\theta), with

Jf=[cos⁡θ−rsin⁡θsin⁡θrcos⁡θ],\mat{J}_f = \begin{bmatrix} \cos\theta & -r\sin\theta \\ \sin\theta & r\cos\theta \end{bmatrix},

and det⁡Jf=rcos⁡2θ+rsin⁡2θ=r\det\mat{J}_f = r\cos^2\theta + r\sin^2\theta = r: this yields the  ⁣dx  ⁣dy=r  ⁣dr  ⁣dθ\dd x\,\dd y = r\,\dd r\,\dd\theta used to calculate the Gaussian integral. For probability densities, if ff is such a bijection and y=f(x)\vb{y} = f(\vb{x}), the probability mass of each small cube is preserved and pY(f(x)) ∣det⁡Jf(x)∣=pX(x)p_Y(f(\vb{x}))\,\abs{\det\mat{J}_f(\vb{x})} = p_X(\vb{x}), that is,

log⁡pX(x)=log⁡pY(f(x))+log⁡∣det⁡Jf(x)∣.\begin{aligned} \log p_X(\vb{x}) &= \log p_Y\big(f(\vb{x})\big) \\ &\quad + \log\abs{\det\mat{J}_f(\vb{x})}. \end{aligned}

If f=fK∘⋯∘f1f = f_K\circ\cdots\circ f_1, the chain rule makes Jf\mat{J}_f a product of Jacobians and the product rule turns its log-determinant into a sum: log⁡∣det⁡Jf∣=∑klog⁡∣det⁡Jfk∣\log\abs{\det\mat{J}_f} = \sum_k \log\abs{\det\mat{J}_{f_k}}, each evaluated at its intermediate point (log-determinants in composed transformations). A normalizing flow stacks dozens of such layers; the problem is that a general determinant of d×dd\times d costs O(d3)\bigO(d^3). RealNVP’s affine coupling layer (Dinh, Sohl-Dickstein and Bengio, 2016) avoids this: split x=(x1,x2)\vb{x} = (\vb{x}_1, \vb{x}_2) and leave x1\vb{x}_1 unchanged while transforming x2↦x2⊙es(x1)+t(x1)\vb{x}_2 \mapsto \vb{x}_2 \odot e^{s(\vb{x}_1)} + t(\vb{x}_1). Its Jacobian is block triangular, with I\mat{I} and diag⁡(es(x1))\diag(e^{s(\vb{x}_1)}) on the diagonal, so log⁡∣det⁡J∣=∑isi(x1)\log\abs{\det\mat{J}} = \sum_i s_i(\vb{x}_1): linear cost, while ss and tt may be arbitrary neural networks. It is the third map in the interactive.

Cross product in ℝ³

In R3\R^3 the determinant also produces a vector. This section writes the dot product as u⋅v=u⊤v\vb{u}\cdot\vb{v} = \vb{u}\T\vb{v}, the usual notation in this context.

The key identity follows by examining that expansion: the dot product with w\vb{w} replaces the formal row (e1,e2,e3)(\vb{e}_1, \vb{e}_2, \vb{e}_3) by (w1,w2,w3)(w_1, w_2, w_3). Thus w⋅(u×v)\vb{w}\cdot(\vb{u}\times\vb{v}) is the determinant of the matrix with rows w,u,v\vb{w}, \vb{u}, \vb{v}; by transposition it is also the determinant of the matrix with columns [w  u  v][\vb{w}\;\vb{u}\;\vb{v}]; and since moving from (w,u,v)(\vb{w}, \vb{u}, \vb{v}) to (u,v,w)(\vb{u}, \vb{v}, \vb{w}) is an even cyclic permutation of three elements,

det⁡[u  v  w]=u⋅(v×w)=v⋅(w×u)=w⋅(u×v).\begin{aligned} \det[\vb{u}\;\vb{v}\;\vb{w}] &= \vb{u}\cdot(\vb{v}\times\vb{w}) \\ &= \vb{v}\cdot(\vb{w}\times\vb{u}) = \vb{w}\cdot(\vb{u}\times\vb{v}). \end{aligned}

The scalar triple product is the signed volume of the parallelepiped. The full geometry of the cross product follows.

Proof

1. u⋅(u×v)=det⁡[u  u  v]=0\vb{u}\cdot(\vb{u}\times\vb{v}) = \det[\vb{u}\;\vb{u}\;\vb{v}] = 0 because two columns are identical, and likewise for v\vb{v}.

3. With w=u×v\vb{w} = \vb{u}\times\vb{v}, det⁡[u  v  u×v]=(u×v)⋅(u×v)=∥u×v∥2≥0\det[\vb{u}\;\vb{v}\;\vb{u}\times\vb{v}] = (\vb{u}\times\vb{v})\cdot(\vb{u}\times\vb{v}) = \norm{\vb{u}\times\vb{v}}^2 \ge 0, which is positive if u×v≠0\vb{u}\times\vb{v} \neq \vb{0}; this holds for independent u,v\vb{u}, \vb{v} by item 4.

4. If dependent, det⁡[u  v  w]=0\det[\vb{u}\;\vb{v}\;\vb{w}] = 0 for all w\vb{w}, hence w⋅(u×v)=0\vb{w}\cdot(\vb{u}\times\vb{v}) = 0 for all w\vb{w} and u×v=0\vb{u}\times\vb{v} = \vb{0}. If independent, add an w\vb{w} to form a basis: det⁡[u  v  w]≠0\det[\vb{u}\;\vb{v}\;\vb{w}] \neq 0 and, by the identity above, u×v≠0\vb{u}\times\vb{v} \neq \vb{0}.

2. If dependent, both quantities are 0. Otherwise, let n=(u×v)/∥u×v∥\vb{n} = (\vb{u}\times\vb{v})/\norm{\vb{u}\times\vb{v}}. By the identity, det⁡[u  v  n]=n⋅(u×v)=∥u×v∥\det[\vb{u}\;\vb{v}\;\vb{n}] = \vb{n}\cdot(\vb{u}\times\vb{v}) = \norm{\vb{u}\times\vb{v}}. Now take an orthogonal matrix Q=[q1  q2  n]\mat{Q} = [\vb{q}_1\;\vb{q}_2\;\vb{n}], with q1,q2\vb{q}_1, \vb{q}_2 an orthonormal basis for the plane of u\vb{u} and v\vb{v}: in that basis, u=Q(u1′,u2′,0)\vb{u} = \mat{Q}(u'_1, u'_2, 0), v=Q(v1′,v2′,0)\vb{v} = \mat{Q}(v'_1, v'_2, 0) and n=Qe3\vb{n} = \mat{Q}\vb{e}_3, so det⁡[u  v  n]=det⁡(Q) (u1′v2′−u2′v1′)\det[\vb{u}\;\vb{v}\;\vb{n}] = \det(\mat{Q})\,(u'_1v'_2 - u'_2v'_1), with det⁡Q=±1\det\mat{Q} = \pm 1. The last factor is the signed area of the parallelogram measured in its plane, which Q\mat{Q} does not distort. Taking absolute values, ∥u×v∥\norm{\vb{u}\times\vb{v}} is that area.

∎
InteractiveCross product and scalar triple product
  • parallelogram of u,v\vb{u}, \vb{v}
  • u×v\vb{u}\times\vb{v}
Vector to edit
2.00
0.40
0.00
u×v\vb{u}\times\vb{v}(0.12, −0.60, 2.96)
∥u×v∥\norm{\vb{u}\times\vb{v}}3.023
Area ∥u∥∥v∥sin⁡θ\norm{\vb{u}}\norm{\vb{v}}\sin\theta3.023
Dot product with u\vb{u} and v\vb{v}0.000, 0.000
u×v\vb{u}\times\vb{v}, in magenta, is perpendicular to u\vb{u} and v\vb{v}, has magnitude equal to the area of the yellow parallelogram, and points toward the side from which rotation from u\vb{u} to v\vb{v} looks counterclockwise. Swap u\vb{u} and v\vb{v}, or make them parallel. Then enable w\vb{w}: the parallelepiped has signed volume w⋅(u×v)=det⁡[u  v  w]\vb{w}\cdot(\vb{u}\times\vb{v}) = \det[\vb{u}\;\vb{v}\;\vb{w}], base area times height hh. Move w\vb{w} to the other side of the plane.

The algebra also follows from the formal determinant. The cross product is bilinear and anticommutative, u×v=−v×u\vb{u}\times\vb{v} = -\vb{v}\times\vb{u} (swap two rows), and e1×e2=e3\vb{e}_1\times\vb{e}_2 = \vb{e}_3, e2×e3=e1\vb{e}_2\times\vb{e}_3 = \vb{e}_1, e3×e1=e2\vb{e}_3\times\vb{e}_1 = \vb{e}_2. It is not associative: (e1×e1)×e2=0(\vb{e}_1\times\vb{e}_1)\times\vb{e}_2 = \vb{0}, whereas e1×(e1×e2)=e1×e3=−e2\vb{e}_1\times(\vb{e}_1\times\vb{e}_2) = \vb{e}_1\times\vb{e}_3 = -\vb{e}_2. It satisfies Lagrange’s identity, ∥u×v∥2=∥u∥2∥v∥2−(u⋅v)2\norm{\vb{u}\times\vb{v}}^2 = \norm{\vb{u}}^2\norm{\vb{v}}^2 - (\vb{u}\cdot\vb{v})^2, which with u⋅v=∥u∥∥v∥cos⁡θ\vb{u}\cdot\vb{v} = \norm{\vb{u}}\norm{\vb{v}}\cos\theta again gives ∥u×v∥=∥u∥∥v∥sin⁡θ\norm{\vb{u}\times\vb{v}} = \norm{\vb{u}}\norm{\vb{v}}\sin\theta.

It appears throughout three-dimensional geometry: a mesh triangle’s normal is (q−p)×(r−p)(\vb{q}-\vb{p})\times(\vb{r}-\vb{p}), the torque of a force is r×F\vb{r}\times\vb{F}, and the velocity of a point on a solid rotating with angular velocity ω\vb{\omega} is ω×r\vb{\omega}\times\vb{r}, a foundation of robot kinematics. In the plane its counterpart is the determinant 2×22\times 2 itself: the sign of det⁡[b−a    c−a]\det[\vb{b}-\vb{a}\;\; \vb{c}-\vb{a}] tells whether c\vb{c} lies left or right of the line from a\vb{a} to b\vb{b}, the orientation test underlying computational geometry algorithms; the polygon area formula sums determinants 12det⁡[pk  pk+1]\tfrac12\det[\vb{p}_k\;\vb{p}_{k+1}] of successive vertices.

What the determinant does not measure

It is tempting to read a small ∣det⁡A∣\abs{\det\mat{A}} as “A\mat{A} is close to singular”. This fails in both directions.

  • Tiny determinant, perfect matrix. A=0.1 I100\mat{A} = 0.1\,\mat{I}_{100} has det⁡A=10−100\det\mat{A} = 10^{-100}. But A−1=10 I\mat{A}\inv = 10\,\mat{I}, solving Ax=b\mat{A}\vb{x} = \vb{b} divides each component by 0.10.1 and loses no digits.
  • Determinant 1, nearly singular matrix. The shear [1t01]\begin{bmatrix} 1 & t \\ 0 & 1\end{bmatrix} has determinant 1 for every tt, and with t=1000t = 1000 a perturbation of size 10−310^{-3} makes it singular. Worse, the triangular matrix of size nn with ones on the diagonal and −1-1 in every entry above it has determinant 1 for every nn, and with n=60n = 60 is numerically singular.

The explanation lies in singular values, which you will study with the SVD: A=UΣV⊤\mat{A} = \mat{U}\mat{\Sigma}\mat{V}\T with orthogonal U,V\mat{U}, \mat{V} gives ∣det⁡A∣=σ1σ2⋯σn\abs{\det\mat{A}} = \sigma_1\sigma_2\cdots\sigma_n. The spectral-norm distance from A\mat{A} to the nearest singular matrix is σn\sigma_n (Eckart–Young theorem), and relatively σn/σ1=1/κ(A)\sigma_n/\sigma_1 = 1/\kappa(\mat{A}), with κ\kappa the condition number. The determinant mixes size and shape: multiplying A\mat{A} by cc multiplies det⁡A\det\mat{A} by cnc^n and leaves κ\kappa unchanged. In high dimension, cnc^n is astronomical or tiny for almost any cc other than 1.

InteractiveThe determinant does not measure closeness to singularity
  • unit disk
  • its image
  • minor semiaxis, σmin⁡\sigma_{\min}
  • image under nearest singular matrix
P=0.50 I\mat{P} = 0.50\,\mat{I}: small but round
Q=[110.0001]\mat{Q} = \left[\begin{smallmatrix} 1 & 10.00 \\ 0 & 1 \end{smallmatrix}\right]: area 1, but flattened
P\mat{P}Q\mat{Q}
Determinant (in R100\R^{100} for P\mat{P})7.9 · 10⁻³¹1
Minimum singular value σmin⁡\sigma_{\min}0.5000.099
Maximum singular value σmax⁡\sigma_{\max}0.50010.10
Condition number κ=σmax⁡/σmin⁡\kappa = \sigma_{\max}/\sigma_{\min}1102.0
Relative distance to nearest singular matrix, 1/κ1/\kappa10.010
0.50
100
10.00
det⁡P≈7.9×10−31\det \mat{P} \approx 7.9 \times 10^{-31} and det⁡Q=1\det\mat{Q} = 1, but Q\mat{Q} is nearly singular: a perturbation of size σmin⁡=0.099\sigma_{\min} = 0.099 makes it singular, whereas P\mat{P} needs one of size c=0.50c = 0.50.
On the left, P=c I\mat{P} = c\,\mat{I}; on the right, shear Q\mat{Q} with determinant 1. The dashed segment through each figure is the disk's image under the nearest singular matrix, which flattens it onto its major axis; the relative distance is 1/κ1/\kappa. Reduce cc, increase nn and increase tt: which is close to singular?
[ ]Determinant 1, ill-conditioned matrix; tiny determinant, healthy matrixBrowser
import numpy as np

print(" n   det(U_n)   σ_min(U_n)    κ(U_n)       det(0.1 I_n)")
for n in [5, 10, 20, 30, 60]:
    U = np.eye(n) - np.triu(np.ones((n, n)), 1)   # 1 en la diagonal, −1 por encima
    s = np.linalg.svd(U, compute_uv=False)
    print(f"{n:2d}   {np.linalg.det(U):6.3f}   {s[-1]:.3e}   {s[0] / s[-1]:.3e}   {0.1 ** n:.0e}")

# y el determinante de una matriz singular, en coma flotante, casi nunca es exactamente 0
rng = np.random.default_rng(1)
R1 = np.outer(rng.standard_normal(4), rng.standard_normal(4))   # rango 1
print("\ndet de una matriz 4×4 de rango 1:", np.linalg.det(R1), "  rango numérico:", np.linalg.matrix_rank(R1))

To decide whether a matrix is invertible in practice, inspect κ\kappa (with np.linalg.cond) or the numerical rank with tolerance relative to σ1\sigma_1, not whether its determinant is small or exactly zero.

Implementation from scratch

The cells share a session: run them in order. The first implements the definition directly, with permutations and cofactors.

[ ]Leibniz and cofactors, from the definitionBrowser
import numpy as np
from itertools import permutations

def sgn(p):
    """Signo de una permutación de (0, ..., n-1): (-1) elevado al número de inversiones."""
    inv = sum(1 for i in range(len(p)) for j in range(i + 1, len(p)) if p[i] > p[j])
    return -1 if inv % 2 else 1

def det_leibniz(A):
    """Suma de los n! términos sgn(σ) a[σ(0),0] a[σ(1),1] ... a[σ(n-1),n-1]."""
    n = len(A)
    total = 0.0
    for p in permutations(range(n)):
        term = float(sgn(p))
        for j in range(n):
            term *= A[p[j]][j]
        total += term
    return total

def det_cofactor(A):
    """Desarrollo por la primera columna, recursivo: la misma suma de n! términos, agrupada."""
    n = len(A)
    if n == 1:
        return A[0][0]
    total = 0.0
    for i in range(n):
        menor = [fila[1:] for k, fila in enumerate(A) if k != i]  # sin la fila i ni la columna 0
        total += (-1) ** i * A[i][0] * det_cofactor(menor)
    return total

rng = np.random.default_rng(0)
A = rng.standard_normal((6, 6))
print(f"Leibniz (720 términos): {det_leibniz(A.tolist()):+.12f}")
print(f"cofactores:             {det_cofactor(A.tolist()):+.12f}")
print(f"np.linalg.det:          {np.linalg.det(A):+.12f}")

Now for cost. Each extra nn multiplies the number of recursive calls by nn, so measured times let us predict the next ones.

[ ]Timing factorial costBrowser
import math, time

tiempos = {}
for n in [7, 8, 9]:
    M = rng.standard_normal((n, n)).tolist()
    t0 = time.perf_counter()
    det_cofactor(M)
    tiempos[n] = time.perf_counter() - t0
    extra = f"   ({tiempos[n] / tiempos[n - 1]:.1f} veces el de n = {n - 1})" if n > 7 else ""
    print(f"n = {n}: {tiempos[n]:6.3f} s{extra}")

# el tiempo crece como n!: cada n más lo multiplica por n. Extrapolamos desde n = 9.
for n in [10, 12, 15, 20]:
    seg = tiempos[9] * math.factorial(n) / math.factorial(9)
    print(f"n = {n}: unos {seg:.1e} s = {seg / 3600:.1e} h = {seg / 3.156e7:.1e} años")

The prediction for n=10n = 10 is a few seconds. The next cell checks it; it is excluded from automated tests precisely because it takes time.

[ ]Check the prediction for n = 10 (takes a few seconds)Browser
M = rng.standard_normal((10, 10)).tolist()
t0 = time.perf_counter()
det_cofactor(M)
print(f"n = 10 medido: {time.perf_counter() - t0:.1f} s   predicción: {tiempos[9] * 10:.1f} s")

With n=20n = 20, extrapolation gives tens or hundreds of thousands of years depending on the machine. The alternative is LU with partial pivoting, keeping track of swaps.

[ ]LU with partial pivoting: det and slogdetBrowser
def lu_pivot(A):
    """PA = LU con pivoteo parcial. Devuelve perm (P como vector de índices), L, U y el número de intercambios."""
    U = np.array(A, dtype=float)
    n = U.shape[0]
    L = np.eye(n)
    perm = np.arange(n)
    swaps = 0
    for k in range(n - 1):
        p = k + int(np.argmax(np.abs(U[k:, k])))  # fila del pivote: el mayor en valor absoluto
        if p != k:
            U[[k, p], k:] = U[[p, k], k:]
            L[[k, p], :k] = L[[p, k], :k]
            perm[[k, p]] = perm[[p, k]]
            swaps += 1
        if U[k, k] == 0.0:  # columna nula desde la diagonal: no hay nada que eliminar
            continue
        m = U[k + 1:, k] / U[k, k]  # multiplicadores
        L[k + 1:, k] = m
        U[k + 1:, k:] -= np.outer(m, U[k, k:])
    return perm, L, np.triu(U), swaps

def det_lu(A):
    _, _, U, s = lu_pivot(A)
    return (-1) ** s * np.prod(np.diag(U))

def slogdet_lu(A):
    """(signo, log|det A|) sin formar el producto de los pivotes."""
    _, _, U, s = lu_pivot(A)
    d = np.diag(U)
    if np.any(d == 0):
        return 0.0, -np.inf
    signo = (-1) ** s * np.prod(np.sign(d))
    return float(signo), float(np.sum(np.log(np.abs(d))))

A = np.array([[0.0, 2.0, 1.0],
              [1.0, 1.0, 0.0],
              [3.0, 0.0, 4.0]])
perm, L, U, s = lu_pivot(A)
print("P A = L U:", np.allclose(A[perm], L @ U), "   intercambios:", s)
print("pivotes:", np.diag(U))
print(f"det por LU: {det_lu(A):+.6f}   NumPy: {np.linalg.det(A):+.6f}")
print("slogdet:", slogdet_lu(A), "  NumPy:", np.linalg.slogdet(A))

B = rng.standard_normal((200, 200))
print(f"200×200: LU propia {slogdet_lu(B)[1]:.10f}   NumPy {np.linalg.slogdet(B)[1]:.10f}")

In the example 3×33\times 3 pivoting makes two swaps, the pivots are 33, 22 and −11/6-11/6, and (−1)2⋅3⋅2⋅(−11/6)=−11(-1)^2 \cdot 3 \cdot 2 \cdot (-11/6) = -11. Now for overflow and underflow.

[ ]Overflow and underflowBrowser
with np.errstate(over="ignore", under="ignore"):
    for n in [100, 300, 400]:
        print(f"n = {n}: det(0.1 I) = {np.linalg.det(0.1 * np.eye(n)):.3e}   det(10 I) = {np.linalg.det(10 * np.eye(n)):.3e}")
    print("slogdet(0.1 I_400):", np.linalg.slogdet(0.1 * np.eye(400)))

    G = rng.standard_normal((500, 500))
    print("\ndet de una gaussiana 500×500:", np.linalg.det(G))
    s, l = slogdet_lu(G)
    print(f"slogdet propio: signo {s:+.0f}, log|det| = {l:.4f}  (|det| ≈ 10^{l / np.log(10):.1f})")
    print("slogdet NumPy: ", np.linalg.slogdet(G))

    piv = np.array([1e200, 1e200, 1e-200, 1e-200])
    print("\nproducto directo de los pivotes:", np.prod(piv))
    print("exp de la suma de logaritmos:  ", np.exp(np.sum(np.log(piv))))

The determinant of this Gaussian matrix 500×500500\times 500 is around 1056810^{568}: it does not fit in float64 and np.linalg.det returns ±∞\pm\infty, while its logarithm is a normal number. The last example is trickier: the determinant is exactly 1, but the product from left to right overflows at the second factor and never recovers.

The second lab checks that a linear map multiplies the area of any region, not just the square, by ∣det⁡A∣\abs{\det\mat{A}}. A point y\vb{y} lies in ellipse A(disco)\mat{A}(\text{disco}) if and only if ∥A−1y∥≤1\norm{\mat{A}\inv\vb{y}} \le 1, and the box [−h1,h1]×[−h2,h2][-h_1, h_1]\times[-h_2, h_2] with hih_i the norm of row ii of A\mat{A} contains it, because max⁡∥x∥≤1(Ax)i\max_{\norm{\vb{x}} \le 1} (\mat{A}\vb{x})_i is that norm.

[ ]Ellipse area by Monte CarloBrowser
import matplotlib.pyplot as plt

A = np.array([[1.6, 0.9],
              [-0.4, 1.1]])
area_teo = np.pi * abs(np.linalg.det(A))
h = np.linalg.norm(A, axis=1)          # semianchos de la caja que contiene la elipse A·(disco)
caja = 4 * h[0] * h[1]

def estimar(N, rng):
    Y = rng.uniform(-h, h, size=(N, 2))                 # puntos uniformes en la caja
    X = np.linalg.solve(A, Y.T)                         # sus preimágenes A⁻¹y
    return caja * np.mean(np.sum(X**2, axis=0) <= 1)    # y ∈ A·(disco)  ⟺  ‖A⁻¹y‖ ≤ 1

Ns = np.array([100, 300, 1_000, 3_000, 10_000, 30_000])
rmse = []
for N in Ns:
    est = np.array([estimar(N, rng) for _ in range(20)])
    rmse.append(np.sqrt(np.mean((est - area_teo) ** 2)) / area_teo)
print(f"π|det A| = {area_teo:.5f}    estimación con N = 200 000: {estimar(200_000, rng):.5f}")

fig, ax = plt.subplots(1, 2, figsize=(10, 4.2))
Y = rng.uniform(-h, h, size=(2500, 2))
dentro = np.sum(np.linalg.solve(A, Y.T) ** 2, axis=0) <= 1
ax[0].scatter(*Y[~dentro].T, s=4, color="0.75", label="fuera")
ax[0].scatter(*Y[dentro].T, s=4, label="dentro de A·(disco)")
t = np.linspace(0, 2 * np.pi, 300)
ax[0].plot(*(A @ np.vstack([np.cos(t), np.sin(t)])), color="k", lw=1.5)
ax[0].set_aspect("equal"); ax[0].legend(loc="upper right"); ax[0].set_title("2 500 puntos uniformes en la caja")
ax[1].loglog(Ns, rmse, "o-", label="error relativo (media de 20 repeticiones)")
ax[1].loglog(Ns, rmse[0] * np.sqrt(Ns[0] / Ns), "--", color="0.4", label="pendiente $-1/2$")
ax[1].set_xlabel("N"); ax[1].legend(); ax[1].set_title("El error cae como $1/\\sqrt{N}$")
plt.tight_layout(); plt.show()

Monte Carlo error falls as 1/N1/\sqrt{N}, regardless of dimension; that makes it useful for high-dimensional volumes where grids are impossible. Finally, the cross product from its definition, checking its three geometric properties.

[ ]Cross product and scalar triple productBrowser
def cruz(u, v):
    """u × v desarrollando el determinante formal por su primera fila (e1, e2, e3)."""
    return np.array([u[1] * v[2] - u[2] * v[1],
                     u[2] * v[0] - u[0] * v[2],
                     u[0] * v[1] - u[1] * v[0]])

u = np.array([2.0, 0.4, 0.0])
v = np.array([0.6, 1.6, 0.3])
w = np.array([0.4, 0.5, 1.5])
c = cruz(u, v)
print("u × v =", c, "  (NumPy:", np.cross(u, v), ")")
print("ortogonal a u y a v:", u @ c, v @ c)
cos_t = u @ v / (np.linalg.norm(u) * np.linalg.norm(v))
print(f"‖u × v‖ = {np.linalg.norm(c):.6f}   ‖u‖‖v‖ sen θ = {np.linalg.norm(u) * np.linalg.norm(v) * np.sqrt(1 - cos_t**2):.6f}")
print(f"w · (u × v) = {w @ c:.6f}   det[u v w] = {np.linalg.det(np.column_stack([u, v, w])):.6f}")
print(f"det[u v (u × v)] = {np.linalg.det(np.column_stack([u, v, c])):.6f} = ‖u × v‖² = {c @ c:.6f}")
e1, e2, e3 = np.eye(3)
print("(e1 × e1) × e2 =", cruz(cruz(e1, e1), e2), "   e1 × (e1 × e2) =", cruz(e1, cruz(e1, e2)))

The professional version

np.linalg.det and np.linalg.slogdet do the same as your code: LU with partial pivoting (LAPACK’s getrf routine) and the product, or sum of logarithms, of pivots. SciPy exposes that factorization with scipy.linalg.lu_factor, which stores L\mat{L} and U\mat{U} in one matrix and the permutation as a vector piv of successive swaps: at step ii row ii was swapped with piv[i], so the number of swaps is the number of positions with piv[i] != i.

[ ]From SciPy lu_factor to log-determinantBrowser
import scipy.linalg as sla

A = rng.standard_normal((6, 6))
lu, piv = sla.lu_factor(A)          # L y U en una sola matriz; piv[i]: fila intercambiada con la i en el paso i
s = np.count_nonzero(piv != np.arange(6))
signo = (-1) ** s * np.prod(np.sign(np.diag(lu)))
logabs = np.sum(np.log(np.abs(np.diag(lu))))
print("desde lu_factor:", signo, logabs)
print("np.linalg.slogdet:", np.linalg.slogdet(A))

G = rng.standard_normal((300, 300))
t0 = time.perf_counter(); slogdet_lu(G); t1 = time.perf_counter(); np.linalg.slogdet(G); t2 = time.perf_counter()
print(f"300×300: LU propia {1e3 * (t1 - t0):.0f} ms, LAPACK {1e3 * (t2 - t1):.0f} ms")

The typical application is high-dimensional Gaussian log-likelihood, as in a Gaussian process. The kernel matrix is symmetric positive definite, so Cholesky is used twice: for the log-determinant and to solve Kα=y\mat{K}\boldsymbol{\alpha} = \vb{y} without inverting K\mat{K}.

[ ]Gaussian log-likelihood with CholeskyBrowser
from scipy.stats import multivariate_normal

n = 200
x = np.linspace(0, 10, n)
K = np.exp(-0.5 * (x[:, None] - x[None, :]) ** 2 / 0.8**2) + 0.01 * np.eye(n)  # kernel RBF + ruido
print("det K =", np.linalg.det(K))                        # subdesbordamiento: 0.0
Lc = np.linalg.cholesky(K)                                 # K = L Lᵀ
logdet = 2 * np.sum(np.log(np.diag(Lc)))                   # det K = (∏ L_ii)²
print(f"log det K por Cholesky: {logdet:.6f}   slogdet: {np.linalg.slogdet(K)[1]:.6f}")

y = Lc @ rng.standard_normal(n)                            # una muestra de N(0, K)
alfa = sla.cho_solve((Lc, True), y)                        # K⁻¹ y sin invertir K
logp = -0.5 * y @ alfa - 0.5 * logdet - 0.5 * n * np.log(2 * np.pi)
print(f"log p(y) propio: {logp:.6f}   SciPy: {multivariate_normal(np.zeros(n), K).logpdf(y):.6f}")

With only 200 points, det⁡K\det\mat{K} is around e−823≈10−357e^{-823} \approx 10^{-357} and rounds to 0, so np.log(np.linalg.det(K)) would give −∞-\infty. Finally, Jacobi’s formula checked with finite differences: the gradient of log⁡∣det⁡A∣\log\abs{\det\mat{A}} is A−⊤\mat{A}^{-\top}, even when the determinant is negative.

[ ]The gradient of log|det A| is the inverse transposeBrowser
A = rng.standard_normal((4, 4))
eps = 1e-6
grad = np.zeros_like(A)
for i in range(4):
    for j in range(4):
        E = np.zeros_like(A); E[i, j] = eps
        grad[i, j] = (np.linalg.slogdet(A + E)[1] - np.linalg.slogdet(A - E)[1]) / (2 * eps)
print("signo de det A:", np.linalg.slogdet(A)[0])
print("máx |gradiente numérico − A^{-T}|:", np.max(np.abs(grad - np.linalg.inv(A).T)))

In PyTorch the equivalent is differentiable torch.linalg.slogdet, which produces exactly this gradient for a flow or Gaussian process trained with autograd:

import torch

A = torch.randn(512, 512, dtype=torch.float64, requires_grad=True)
sign, logabsdet = torch.linalg.slogdet(A)   # LU con pivoteo, como LAPACK
logabsdet.backward()                         # A.grad == inv(A).T
K = A.detach() @ A.detach().T + torch.eye(512, dtype=torch.float64)   # una matriz definida positiva
L = torch.linalg.cholesky(K)
logdet_K = 2 * torch.log(torch.diagonal(L)).sum()                     # igual que torch.logdet(K)
TaskFrom scratchLibrary
Determinantdet_lu: (−1)s∏kukk(-1)^s\prod_k u_{kk}np.linalg.det, torch.linalg.det
Signed log-determinantslogdet_lunp.linalg.slogdet, torch.linalg.slogdet
Factorization and signlu_pivot and its counter swapsscipy.linalg.lu_factor and vector piv
Log-determinant of a positive definite matrix2∑klog⁡Lkk2\sum_k \log L_{kk}np.linalg.cholesky, scipy.linalg.cho_factor
Cross productcruznp.cross, torch.linalg.cross

Common mistakes

Exercises

QuizWhich reverse orientation?
Which matrices have determinant −1-1?

More than one answer may be correct.

QuizWhat determinants preserve
Which equalities hold for every A,B∈Rn×n\mat{A}, \mat{B} \in \R^{n\times n} and every n≥2n \ge 2?

More than one answer may be correct.

NumericScale, invert, transpose
If A∈R5×5\mat{A} \in \R^{5\times 5} has det⁡A=3\det\mat{A} = 3, what is det⁡(2 (A−1)⊤)\det\big(2\,(\mat{A}\inv)\T\big)?
NumericPermutation sign
Pivoted factorization of A∈R3×3\mat{A} \in \R^{3\times 3} gives PA=LU\mat{P}\mat{A} = \mat{L}\mat{U}, where L\mat{L} is lower triangular with ones on the diagonal and U\mat{U} is upper triangular with diagonal (4,−0.5,1.5)(4, -0.5, 1.5). The rows of PA\mat{P}\mat{A} are rows 2, 3 and 1 of A\mat{A} in that order. What is det⁡A\det\mat{A}?
QuizA tiny determinant
The matrix A=0.1 I100\mat{A} = 0.1\,\mat{I}_{100} has det⁡A=10−100\det\mat{A} = 10^{-100}. Which statement is correct?
NumericArea of a triangle in space
Calculate the area of the triangle with vertices (1,0,0)(1, 0, 0), (0,2,0)(0, 2, 0) and (0,0,3)(0, 0, 3).
NumericVolume of a tetrahedron
Calculate the volume of the tetrahedron with vertices 0\vb{0}, u=(1,2,0)\vb{u} = (1, 2, 0), v=(0,1,3)\vb{v} = (0, 1, 3) and w=(2,0,1)\vb{w} = (2, 0, 1).
QuizCross-product properties
Which statements about the cross product in R3\R^3 hold for all vectors?

More than one answer may be correct.

NumericArea of an ellipse
Calculate the area of the ellipse {x∈R2:x⊤Mx≤1}\{\vb{x} \in \R^2 : \vb{x}\T\mat{M}\vb{x} \le 1\} with M=[2112]\mat{M} = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix}.
NumericA layer's log-determinant
A normalizing flow layer is f(x)=Lx+bf(\vb{x}) = \mat{L}\vb{x} + \vb{b}, where L∈R3×3\mat{L} \in \R^{3\times 3} is lower triangular with diagonal (2,−0.5,4)(2, -0.5, 4). If z=f(x)\vb{z} = f(\vb{x}) has density pZp_Z, then log⁡pX(x)=log⁡pZ(f(x))+c\log p_X(\vb{x}) = \log p_Z(f(\vb{x})) + c for every x\vb{x}. What is cc?
Codeslogdet with partial pivoting
Implement slogdet_lu(A) returning (signo, logabsdet) with det⁡A=signo⋅elogabsdet\det\mat{A} = \text{signo}\cdot e^{\text{logabsdet}}, using Gaussian elimination with partial pivoting. NumPy convention: if A\mat{A} is singular, return (0.0, -inf). Do not use np.linalg.det or np.linalg.slogdet. Tests include 500×500500\times 500 matrices whose determinants overflow or underflow float64, so do not multiply the pivots and vectorize each update: three Python loops would take minutes for n=500n = 500.
import numpy as np

def slogdet_lu(A):
  """Devuelve (signo, log|det A|) a partir de PA = LU con pivoteo parcial."""
  U = np.array(A, dtype=float)
  n = U.shape[0]
  signo, logabs = 1.0, 0.0
  # tu código: elimina columna a columna eligiendo como pivote el mayor |U[i, k]| con i >= k,
  # lleva la cuenta de los intercambios y acumula log|u_kk| en lugar de multiplicar los pivotes
  return signo, logabs
Shift+Enter to run

Summary

Key idea
The determinant is the signed factor by which a linear map multiplies volumes: positive if it preserves orientation, negative if it reverses it and zero if it collapses space and cannot be undone. It is calculated as a product of LU pivots; in practice we work with its logarithm.
  • Three axioms determine it: multilinear, alternating and det⁡I=1\det\mat{I} = 1. They yield Leibniz’s formula and uniqueness, and show that shears preserve it, dependent columns make it zero and a triangular determinant is the diagonal product.
  • It is multiplicative: det⁡(AB)=det⁡Adet⁡B\det(\mat{A}\mat{B}) = \det\mat{A}\det\mat{B}, because A\mat{A} scales every region by the same factor. This gives det⁡A−1=1/det⁡A\det\mat{A}\inv = 1/\det\mat{A}, invariance under change of basis and, with det⁡A⊤=det⁡A\det\mat{A}\T = \det\mat{A}, that A\mat{A} is invertible if and only if det⁡A≠0\det\mat{A} \neq 0.
  • Compute it with LU, not the definition: det⁡A=(−1)s∏kukk\det\mat{A} = (-1)^s\prod_k u_{kk} in O(n3)\bigO(n^3) versus factorial cost for Leibniz or cofactors, and log⁡∣det⁡A∣=∑klog⁡∣ukk∣\log\abs{\det\mat{A}} = \sum_k\log\abs{u_{kk}} to avoid overflow; for positive definite matrices, 2∑klog⁡Lkk2\sum_k\log L_{kk} using Cholesky.
  • Cofactors, adjugate and Cramer provide formulas for reasoning and differentiation, not computation. They give ∂log⁡∣det⁡A∣/∂A=A−⊤\partial\log\abs{\det\mat{A}}/\partial\mat{A} = \mat{A}^{-\top}, the gradient used by autograd.
  • The Jacobian is its local version: ∣det⁡Jf(x)∣\abs{\det\mat{J}_f(\vb{x})} scales volumes near x\vb{x}, giving change of variables, transformed densities and normalizing-flow likelihood. In R3\R^3, the cross product and scalar triple product are the same determinant viewed as a normal vector and as volume.
  • It does not measure closeness to singularity: ∣det⁡A∣=σ1⋯σn\abs{\det\mat{A}} = \sigma_1\cdots\sigma_n mixes size and shape. Use σmin⁡\sigma_{\min} and κ\kappa.