explainer
Determinants: signed area, volume, and collapsed directions
Calculate a determinant, see how its sign records orientation, and connect zero area to singular matrices. Learn why a small determinant alone does not imply poor conditioning.
What you will learn
- Calculate a two-by-two determinant and interpret its sign and magnitude separately.
- Explain why zero determinant means that a square linear map loses a direction.
- Apply determinant rules to a composition, a column swap, and a three-dimensional scale.
- Distinguish determinant size from sensitivity measured by a condition number.
Before you start
A matrix can turn a unit square into a parallelogram with area three. Swapping its columns keeps that area and reverses the order of its edges. The determinants are 3 and −3.
The sign and magnitude answer different questions. You will calculate both, inspect a collapse, and learn why a tiny determinant does not automatically signal an unreliable inverse.
Separate size from orientation
For a real square matrix A, its determinant, written det(A), is one real number. The usual determinant applies to square matrices. A rectangular matrix needs other tools, such as rank and null space, to describe the directions it preserves or loses.
In two dimensions, |det(A)| is the area scaling factor. In three dimensions, it is the volume scaling factor. A nonzero determinant also records orientation: positive preserves it, while negative reverses it.
The absolute value gives ordinary area or volume, which cannot be negative. A zero determinant signals collapse into fewer dimensions. Interactive Linear Algebra develops this geometric interpretation.
This lesson uses column vectors. In the two-dimensional experiment, inputs and outputs share fixed perpendicular unit axes, with x right and y up. The matrix entries are dimensionless gains.
Calculate ad minus bc
For a two-by-two matrix, write its entries as two rows:
A = [a, b; c, d]
det(A) = ad − bc
Multiply the main diagonal entries, then subtract the product of the other diagonal. For A = [2, 1; 1, 2]:
det(A) = 2 × 2 − 1 × 1 = 4 − 1 = 3
The transformed unit square has area 3, and the transformation preserves orientation. That does not mean every edge triples in length. A determinant combines the changes across directions into one area factor.
Now swap the columns, giving [1, 2; 2, 1]. Its determinant is 1 × 1 − 2 × 2 = −3. The unsigned area remains 3.
Follow the transformed columns
The columns tell you where the two unit coordinate vectors go. Our matrix sends e₁ = (1, 0) to u = (2, 1) and e₂ = (0, 1) to v = (1, 2).
The original square's four corners become:
| Corner | Input | Output |
|---|---|---|
| O | (0, 0) | (0, 0) |
| P | (1, 0) | (2, 1) |
| Q | (1, 1) | (3, 3) |
| R | (0, 1) | (1, 2) |
Follow O → P → Q → R → O. The first and second columns form adjacent edges; their sum gives the opposite corner. The matrix multiplication lesson explains this column interpretation.
For these two-dimensional vectors, append a zero z coordinate. Their cross product is (2, 1, 0) × (1, 2, 0) = (0, 0, 3). Its z component matches the determinant, and its magnitude gives the parallelogram's area.
If these edges describe lengths in metres, their geometric area is 3 m². When A acts as a dimensionless transformation, its determinant gives the ratio of output area to input area. Keep the interpretation and units attached to the quantity you calculate.
Change the square's image
The experiment begins with the area-three matrix. The dashed reference square has area one. The filled polygon shows its image, and the corner table preserves the coordinates when markers overlap.
Try Swap columns. The first and second transformed edges exchange places. The filled region stays the same, while the determinant changes from 3 to −3.
Choose Reflection across y. It reverses orientation with determinant −1. Choose Quarter-turn: its determinant is +1, so it preserves both area and orientation. A positive determinant can therefore describe a rotation as well as a stretch.
Horizontal shear also has determinant 1, although it changes the square's shape. Preserving area does not establish that a map preserves angles or individual lengths.
All controls use half-step values between −3 and 3. Those values make the displayed products, differences, and zero checks exact in browser arithmetic. The plot adjusts its axis limits; read the ticks before comparing apparent sizes across settings.
Recognize a collapsed direction
Choose Collapse to a line, with A = [1, 2; 1, 2]. Its columns are (1, 1) and (2, 2), so every output lies on y = x. The determinant is 1 × 2 − 2 × 1 = 0.
The matrix keeps a line's worth of outputs, even though its output area is zero. For example, both input (2, −1) and input (0, 0) map to zero. An inverse cannot recover which input produced that output.
Choose Collapse to a point to use the zero matrix. Every input now maps to the origin. Both examples have determinant zero, but their image dimensions differ: one and zero.
For a square matrix in exact arithmetic, det(A) ≠ 0 if and only if A is invertible. A singular matrix has determinant zero and loses at least one independent direction. Interactive Linear Algebra states the invertibility property.
The rank and null-space lesson identifies those lost directions. The determinant alone cannot count all of them. At collapse, the full-dimensional orientation is undefined; a zero result supplies no positive or negative orientation sign.
Track changes through determinant rules
For square matrices A and B of the same size, determinants multiply:
det(AB) = det(A) det(B)
Use the area-three matrix A and reflection B = [−1, 0; 0, 1]. Their product is AB = [−2, 1; −1, 2], with determinant −4 + 1 = −3. The factors also give 3 × (−1) = −3.
Two orientation reversals therefore produce a positive determinant. Matrix order can still change the resulting map: det(AB) = det(BA) does not establish AB = BA.
Several rules help check a calculation:
- Identity: det(I) = 1.
- Swap two columns or rows: the determinant changes sign.
- Scale one column or row by k: the determinant scales by k.
- Add a multiple of one column to another: the determinant stays unchanged.
- Transpose: det(Aᵀ) = det(A).
Scaling an entire n × n matrix by k scales all n columns, so det(kA) = kⁿ det(A). Doubling every entry in our two-by-two A therefore changes its determinant from 3 to 12, not 6.
These rules follow the determinant properties in Interactive Linear Algebra. The transpose and inverse lesson explains why those operations have different purposes despite this transpose identity.
Extend area to three-dimensional volume
A three-by-three matrix maps a unit cube to a parallelepiped, a solid with three pairs of parallel faces. The absolute determinant gives its volume. The determinant's sign tells you whether the ordered three-dimensional axes keep their handedness.
Consider D = [2, 0, 0; 0, 3, 0; 0, 0, −4]. It doubles x, triples y, and reverses z while multiplying its length by four. A diagonal matrix's determinant is the product of its diagonal entries:
det(D) = 2 × 3 × (−4) = −24
|det(D)| = 24
The volume scales by 24, and orientation reverses. An input cube of volume 1 m³ would have output volume 24 m³ under these dimensionless gains.
For three columns u, v, w in a right-handed orthonormal frame, the signed volume also equals the scalar triple product u · (v × w). The cross product supplies an oriented base area; the dot product includes the third edge's component normal to that base.
Distinguish a small determinant from poor conditioning
A nonzero determinant establishes invertibility in exact arithmetic. Its magnitude alone does not measure how sensitive solving a system will be. Uniform scaling can make a determinant arbitrarily small without changing relative conditioning.
Take S = εI, with ε = 1/1024. Then det(S) = ε² = 1/1,048,576, about 0.000000954. Every direction shrinks by the same factor.
The matrix's 2-norm condition number compares its largest length gain with its smallest. For this scaled identity, the ratio is ε/ε = 1, the best possible value. Nick Higham explains condition numbers as measures of sensitivity.
Now take T = [1024, 0; 0, 1/1024]. Its determinant is 1, yet its condition number is 1024 ÷ (1/1024) = 1,048,576. A determinant of one can hide a large imbalance between directions.
Condition numbers here describe relative sensitivity in the chosen norm. Inverting S still multiplies absolute output errors by 1024. A good relative condition number does not remove a sensor's fixed noise level.
For measured matrices, use a numerical rank or conditioning assessment suited to the application. Do not declare every determinant below an arbitrary fixed cutoff singular. Floating-point products can also underflow or overflow; NumPy documents a sign-and-log determinant alternative for handling a wide determinant range.
Reproduce the calculations exactly
This standard-library example uses integers and Fraction values. The tiny scaled-identity result is an exact fraction, so rounding cannot turn it into zero. The condition helper applies only to invertible diagonal two-by-two matrices.
from fractions import Fraction
def det2(matrix):
if len(matrix) != 2 or any(len(row) != 2 for row in matrix):
raise ValueError("Use a two-by-two matrix")
(a, b), (c, d) = matrix
return a * d - b * c
def diagonal_condition(a, d):
if a == 0 or d == 0:
raise ValueError("Diagonal matrix must be invertible")
gains = (abs(Fraction(a)), abs(Fraction(d)))
return max(gains) / min(gains)
A = ((2, 1), (1, 2))
B = ((-1, 0), (0, 1))
AB = tuple(tuple(sum(A[i][k] * B[k][j] for k in range(2))
for j in range(2)) for i in range(2))
swapped = tuple((right, left) for left, right in A)
print("det(A):", det2(A))
print("Swapped columns:", det2(swapped))
print("Collapsed:", det2(((1, 2), (1, 2))))
print("Signed volume:", 2 * 3 * -4)
print("det(AB):", det2(AB))
print("det(A) det(B):", det2(A) * det2(B))
epsilon = Fraction(1, 1024)
print("Tiny identity determinant:", det2(((epsilon, 0), (0, epsilon))))
print("Tiny identity condition:", diagonal_condition(epsilon, epsilon))
print("Uneven stretch determinant:", det2(((1024, 0), (0, epsilon))))
print("Uneven stretch condition:", diagonal_condition(1024, epsilon))
Expected output:
det(A): 3
Swapped columns: -3
Collapsed: 0
Signed volume: -24
det(AB): -3
det(A) det(B): -3
Tiny identity determinant: 1/1048576
Tiny identity condition: 1
Uneven stretch determinant: 1
Uneven stretch condition: 1048576
Try it yourself
Exercise 1. For A = [1, 2; 3, 4], find the signed determinant, the transformed unit square's area, and its orientation. What changes when you swap its columns? What changes when you double every entry of the original matrix?
Show solution: keep sign and magnitude separate
The determinant is 1 × 4 − 2 × 3 = −2. The area is 2, and orientation reverses. A column swap changes the determinant to +2 while keeping area 2.
Doubling every entry scales both columns. The determinant becomes 2² × (−2) = −8, with area 8 and reversed orientation.
Exercise 2. A diagonal matrix has entries 1/1000 and 1/1000. Another has entries 1000 and 1/1000. Calculate each determinant and 2-norm condition number. Which has the smaller determinant, and which has worse relative conditioning?
Show solution: compare directional gains
The uniformly scaled identity has determinant 1/1,000,000 and condition number 1. The uneven stretch has determinant 1 and condition number 1,000,000.
The first has the smaller determinant. The second has worse relative conditioning because its largest and smallest gains differ by a factor of one million. Determinant magnitude cannot replace that comparison.
Sources and further study
- Interactive Linear Algebra: Determinants and Volumes, for signed volume, area, and collapsed images.
- Interactive Linear Algebra: Determinants, Definition and Properties, for invertibility, multiplicativity, and row or column operations.
- Nick Higham: What Is a Condition Number?, for sensitivity, matrix norms, and relative condition numbers.
- NumPy: numpy.linalg.det, for square-array requirements, numerical computation, and the sign-and-log alternative.