Drop a small blob of dye into water and follow it. The flow twists it, shears it into a long filament, folds it, but the volume of the blob never changes, because water is (very nearly) incompressible. A fluid simulator has to respect this. If its time step quietly shrinks every parcel of fluid by half a percent, then after a few hundred steps the smoke in your wind tunnel has faded away, and nobody can tell you where it went. So we need a number that answers one question about any transformation: by how much does it scale volume? That number is the determinant.
In 1.2 Matrices as Transformations you learned to see a matrix as a machine that moves every point of space, with its columns telling you where the basis vectors land. In 1.3 Linear Systems, Kernel & Column Space you met the kernel and the inverse. In this lesson a single number ties those ideas together. Your first linear algebra course probably handed you the determinant as a memorized recipe. Here we start from the geometry, and the recipe falls out of it.
Transcript
- Every matrix moves space around. Today we ask one simple question about that motion: how much does it stretch or squash area?
- Start with the unit square, built on the two basis vectors i hat and j hat. Its area is exactly one.
- Remember that the columns of a matrix are where i hat and j hat land. So wherever the basis vectors go, the square follows and becomes a parallelogram.
- Stretch horizontally by three. i hat lands on three, zero, and the square becomes a three by one rectangle. The area triples.
- Now stretch vertically by two. The area doubles again, to six.
- Next, a shear: slide the top edge sideways. The shape tilts, but the base and the height stay the same, so the area is still six.
- Finally tilt i hat upward as well. Now the area has dropped to five, and it is no longer obvious why. We need a formula.
- Here is the key fact. Grid lines stay parallel and evenly spaced, so every little square of the grid turns into the same parallelogram. Every square's area gets multiplied by the same number.
- And since any shape can be filled with tiny squares, any shape's area is multiplied by that number too. A round fluid parcel becomes an ellipse with five times the area.
- That area scaling factor is the determinant of the matrix. Let's find a formula for it.
- Draw a box around the parallelogram. With columns a, c and b, d, the box is a plus b wide and c plus d tall.
- The parallelogram is the box minus six pieces: two triangles of area a c over two, two triangles of area b d over two, and two small rectangles of area b times c.
- Multiply out the box and subtract. Almost everything cancels, and what is left is a d minus b c. Here that is three times two, minus one times one: five.
- So for any two by two matrix, the determinant is a d minus b c: the signed area of the parallelogram built from its columns.
- Why signed? Look at the order of the columns. Turning from where i hat lands to where j hat lands goes counterclockwise, just like turning from i hat to j hat.
- Now push j hat's landing spot down toward i hat's line. The parallelogram gets thinner, and its area drains toward zero.
- Keep going and the parallelogram reopens, but flipped over, like a mirror image. The turn from i hat to j hat is now clockwise, and the determinant reports this with a minus sign.
- The size of the determinant is the area factor. Its sign says whether orientation was kept or reversed. A pure reflection has determinant minus one.
- What if the determinant is zero? Take the matrix two, four, one, two. Its columns are parallel. Watch the plane get squashed as we move toward it.
- The square has collapsed onto a line segment with zero area. The whole plane lands on a single line. And the red vector, two, negative one, was crushed all the way to zero.
- That red line is the kernel from last lesson. Once a whole line has been crushed to a point, nothing can undo it, so there is no inverse.
- So these three statements are the same fact: the determinant is zero, the matrix has no inverse, and some nonzero vector is sent to zero.
- Now apply two matrices in a row. First B, a shear and stretch that doubles every area.
- Then A, which multiplies every area by one and a half. Two, times one and a half, gives three.
- Scalings compose by multiplying, so the determinant of a product is the product of the determinants. And undoing A divides areas by its factor: the determinant of the inverse is one over the determinant.
- Curved maps, like the motion of a fluid, do not scale area by one number everywhere. But zoom in far enough and any smooth map looks linear.
- So each tiny parcel has its own local area factor: the determinant of the Jacobian matrix. You will use it to change variables in integrals.
- This particular map is built from two shears, so every parcel keeps its area. Water behaves like this: an incompressible flow has Jacobian determinant exactly one.
- A sloppy simulation step with determinant point nine instead shrinks every parcel by ten percent per step. The fluid quietly loses mass.
- Keeping this determinant at one is exactly what the pressure projection in a fluid solver is for. Later we will see that its rate of change is the divergence.
- To recap: the determinant is the area or volume scaling factor, its sign records orientation, and zero means space is squashed and the matrix cannot be inverted.
- Next time we hunt for the special numbers lambda that make A minus lambda I squash space. They are the eigenvalues.
One number that summarizes a linear map
Take a 2×2 matrix and look at what it does to the unit square, the square with sides and . The columns of are where and land, so the unit square lands on the parallelogram spanned by the two columns:
The square had area 1. The parallelogram has some area, and that area is the factor by which stretched the square.
Here is the surprising part: every region gets scaled by that same factor. The reason is that linear maps keep grid lines parallel and evenly spaced. The grid of unit squares becomes a grid of identical parallelograms, and a grid of tiny squares of side becomes a grid of tiny parallelograms, each with area. Any reasonable shape, such as a disk, an airfoil or a blob of fluid, can be approximated by tiny squares, so its area also gets multiplied by the same factor.
A few examples you can see without any formula:
- The stretch turns the unit square into a rectangle, so .
- A shear slides the top edge sideways. Base and height are unchanged, so for every .
- A rotation moves the square rigidly, so .
- The projection flattens the square onto the -axis, so .
Orientation and the sign
Why a signed area? Walk from to the short way round: you turn counterclockwise. After the transformation, walk from to . If you still turn counterclockwise, preserves orientation and . If you now turn clockwise, the plane has been flipped over like a page turned face down, reverses orientation, and .
The reflection (flip across the -axis) keeps every area but swaps the turning direction, so its determinant is . Swapping the two columns of any matrix swaps the roles of and , so it flips the sign of the determinant.
In 3D the sign records handedness: means still form a right-handed frame, and means the image is a mirror image. This is the same right-hand rule as in the cross product.
Computing 2×2 determinants: deriving
Now let’s find the area of the parallelogram spanned by and . Assume for the picture that all four numbers are positive and is the “lower” column, as in the video. Draw the bounding box: it is wide and tall. The box minus the parallelogram consists of six pieces:
- two right triangles with legs and , total area ;
- two right triangles with legs and , total area ;
- two rectangles with sides and , total area .
So
The picture assumed positive entries and a particular arrangement. The formula, though, gets the sign right in every configuration. Swap the columns and becomes , which is exactly the orientation flip. You saw this expression already in 1.1 Vectors, Linear Combinations & Span as the test for independence of two vectors in the plane. Now you know why it works: two vectors are dependent exactly when the parallelogram they span is flat.
Worked example
Find the area of the parallelogram with vertices , , , , and decide whether the map sending , preserves orientation.
The matrix has these vectors as columns:
The area is 5 and the sign is positive, so orientation is preserved. As a cross-check, take the side as the base, with length . The height is the distance from to the line through the origin along , which is . Base times height gives . ✓
Try these in the explorer:
- Drag the amber tip (where lands) across the line through the green one. Watch the signed area pass through 0 and turn negative, and watch the orientation arrow reverse.
- Put at and at . The parallelogram collapses, the pink fluid parcel is squashed onto a line, and the dashed kernel line appears.
- Choose the Shear preset. The parcel is distorted but its “area ×” readout stays at 1.00.
- Switch the mode to B, then A and press play. Compare with for a few choices of , including the reflection.
Determinant zero: space gets squashed
When , the unit square lands on something with zero area: a line segment, or just the origin. Since every region scales by the same factor, the whole plane gets squashed onto a line (or a point). Two things follow, and both connect to 1.3 Linear Systems, Kernel & Column Space.
- A whole line of vectors is crushed to zero. In the video, sends to . The kernel is nontrivial.
- There is no inverse. An inverse would have to un-squash a line back into the plane, sending a single output back to many inputs. A function can’t do that.
Conversely, if , nothing is flattened: the columns span the whole plane (or space), every is hit by exactly one , and exists.
For 2×2 matrices, the inverse formula even shows the determinant in the denominator:
which visibly blows up when .
Worked example: when is a matrix singular?
For which is not invertible? For those , find the kernel.
gives . For , solve : both rows say , so . For the rows say , so . In both cases the columns are parallel. For example, when .
Three dimensions: volume
Everything carries over to 3D. The unit cube lands on the parallelepiped spanned by the three columns, and is its signed volume.
Transcript
- In three dimensions the same story plays out with volume. Start with the unit cube built on i hat, j hat and k hat. Its volume is one.
- A three by three matrix sends the cube to a slanted box called a parallelepiped. Its volume is the determinant, here about one point eight four.
- Turn it around: every edge of the box is a column of the matrix, exactly like the parallelogram in two dimensions.
- If the three columns lie in one plane, the box is flattened into a sheet with zero volume. Once again, determinant zero means space is squashed and the matrix has no inverse.
- To compute a three by three determinant, expand along the first row: each entry times the two by two determinant left over when you cross out its row and column, with alternating signs.
For a 3×3 matrix the formula is
This is cofactor expansion along the first row. Each entry of the top row is multiplied by the 2×2 determinant left after crossing out that entry’s row and column, and the signs alternate .
Multiplying out gives six terms, and Sarrus’ rule is a memory aid for them: copy the first two columns to the right of the matrix, add the three products along the down-right diagonals, and subtract the three products along the up-right diagonals.
Worked example: a 3×3 determinant two ways
Compute for .
Cofactor expansion along row 1:
Sarrus: , and . So . ✓
So scales volumes by 7 and turns a right-handed frame into a left-handed one.
Cofactor expansion in general
The 3×3 pattern generalizes to any size. For an matrix :
- The minor is the determinant of the matrix left after deleting row and column .
- The cofactor is . The signs form a checkerboard that starts with in the top-left corner:
You may expand along whichever row or column you like, so pick the one with the most zeros. Two consequences come almost for free:
- Triangular matrices. Expanding down the first column again and again shows that the determinant of an upper or lower triangular matrix is the product of its diagonal entries. Geometrically, a triangular matrix is a stretch along each axis combined with shears, and shears don’t change volume.
- Transpose. , because expanding along rows of is the same as expanding along columns of . So everything we say about columns also holds for rows.
Worked example: exploiting zeros
Compute for .
Row 2 has a single nonzero entry, , with sign . Delete row 2 and column 2:
Now the last row has a single nonzero entry, , in position with sign :
Row operations: the practical way to compute
Since elimination is how we actually compute determinants, we need to know what each row operation does to them. Each rule has a geometric reason. (Remember , so row rules are column rules in disguise, and columns are the edges of the parallelogram.)
| Row operation | Effect on | Geometric reason |
|---|---|---|
| Add a multiple of one row to another | unchanged | it’s a shear: slides one edge parallel to another, so base and height stay the same |
| Swap two rows | multiplied by | swapping two edges reverses orientation |
| Multiply a row by | multiplied by | stretches the shape by in one direction |
The recipe: row-reduce to an upper triangular matrix using only row replacements and swaps, keep count of the swaps, and then
Worked example: elimination
Compute for .
One swap, and the pivots are , so . Check by cofactors along row 1: . ✓
Products and inverses
Do first, then . The product is that composition (1.2 Matrices as Transformations). multiplies every area by , then multiplies every area by . Scalings compose by multiplying, so:
Signs behave too: two orientation flips make a non-flip. This is one of the most useful facts about determinants, and it’s very hard to see from the formulas but obvious from the picture. Here are some consequences:
- Inverses. and , so :
Undoing a map that triples areas must divide areas by three. This also explains again why rules out an inverse: there’s no number to divide by.
- Order doesn’t matter for the determinant, even though in general: .
- Scalar multiples. scales each of the directions by , so . In 3D, doubling every length multiplies volume by 8.
- Powers. .
Worked example: composing a shear-stretch with a tilt
Let () and (). Then
And . You can check this directly: , with determinant .
Jacobian determinant preview: curved maps
Real flows aren’t linear. A fluid particle that starts at ends up at some a moment later, and bends grid lines into curves. Even so, zoom in far enough and any smooth map looks linear. Near a point ,
where is the Jacobian matrix of partial derivatives. You’ll build it properly in 2.2 Linearization, the Chain Rule & the Jacobian. A tiny square near gets mapped to (almost) a tiny parallelogram, so its area is multiplied by . The Jacobian determinant is a local area-scaling factor that varies from point to point.
Example: polar coordinates. The map has
A small rectangle becomes a curved patch of area . Patches far from the origin are bigger, because there the same sweeps a longer arc. This is where the in comes from, and it’s the heart of change of variables in 2.5 Multiple Integrals.
The flip side matters just as much for simulation. A semi-Lagrangian advection step (10.7 Semi-Lagrangian Advection) traces each grid point backward along the velocity and interpolates. That backward map is only approximately volume-preserving: its Jacobian determinant is , and the interpolation smears things further. As a result, the total amount of smoke or dye isn’t exactly conserved from step to step. In a long-running wind tunnel the smoke can visibly fade, or “lose mass”. The same lens explains a classic ODE fact, which the next cell demonstrates.
For the rotation, forward Euler’s step matrix is , with determinant . Every step inflates every parcel a little. That’s the determinant view of why Euler spirals outward on oscillators. Methods designed so that their step has determinant exactly 1 are called area-preserving (in 2D, symplectic), and they are the topic of 4.7 Energy & Symplectic Integrators.
Code it yourself
Once it passes, time det_cofactor on a random 8×8 or 9×9 matrix and compare with np.linalg.det. You’ll feel the growth from the numerics callout.
Practice problems
For each matrix, compute the determinant and describe what the transformation does to the unit square: the area factor, whether orientation is preserved, and whether the plane is squashed.
Show worked solution
- . Areas are multiplied by 7 and orientation is preserved: and , and turning from the first to the second is counterclockwise.
- . The columns and are parallel, so the square collapses onto a segment of the line . Not invertible, and the kernel is .
- . This swaps and : it is the reflection across the line . Areas are kept and orientation is reversed.
- . A rotation keeps both area and orientation.
Let .
- Compute by cofactor expansion along the first row.
- Compute it again by row-reducing to triangular form.
- What is the volume of the parallelepiped spanned by the columns of ? Is invertible?
Show worked solution
- .
- and give . Then gives the last row . There were no swaps, so . ✓ (Row replacements don’t change the determinant.)
- The volume is . Since , is invertible, and .
Let .
- Show that .
- For which is not invertible?
- For each such , find the kernel and describe the image of space geometrically.
Show worked solution
- Expand along row 1: . Since , we get .
- exactly when or .
- : every entry is 1, so every row says . The kernel is that whole plane, spanned by and . All of space is squashed onto the line spanned by , because every column equals . : the rows sum to zero, so is in the kernel: each row gives . Rank–nullity says the rank is 2, so the kernel is the line spanned by , and space is squashed onto the plane spanned by the columns, which is the plane .
The double root at matches the bigger collapse there: two dimensions are lost instead of one.
and are 3×3 matrices with and . Find
- Is it possible that ? Is it forced?
Show worked solution
- .
- .
- , because each of the three directions doubles.
- .
- .
- It’s possible but not forced: there’s no sum rule. For example, and give with determinant 4. Other choices with the same determinants give other values.
Fluid particles in a rigid vortex obey with .
- Show that the exact flow preserves area. (Hint: the exact solution rotates by angle .)
- One forward Euler step is . Compute . By what factor has a parcel’s area grown after one full revolution with , (take steps)?
- Heun’s method (improved Euler) has step matrix . Compute its determinant and compare.
Show worked solution
- The exact solution is , where is a rotation matrix, and . So every region keeps its area.
- , so . After 63 steps the area factor is . The parcel’s area has almost doubled in one turn, even though the true flow keeps it constant.
- , so . Writing , . With that is per step, about after 63 steps. The error is much smaller, but it’s still not exactly 1. Only methods designed to preserve area hit 1 exactly.
Looking ahead: when does squash space?
Most vectors get knocked off their line by a matrix. The special vectors that don’t, the ones with , are the eigenvectors of 1.5 Eigenvectors & Eigenvalues. Rewrite the condition as with . That says has a nontrivial kernel, and by this lesson’s main theorem that happens exactly when
For a 2×2 matrix the left side is a quadratic in , the characteristic polynomial. Its roots, the eigenvalues, will decide whether a system of ODEs spirals, oscillates, grows or decays. The constant term of that polynomial is , and the linear term involves the trace. Together they build the trace–determinant plane of 7.3 Phase Portraits & the Trace–Determinant Plane, a map of every possible 2D linear flow.
Key Takeaways
- is the factor by which scales every area (2D) or volume (3D and up). It is the same factor for every region, because linear maps keep grids parallel and evenly spaced.
- The sign records orientation: negative means the map flips space over (handedness reversed). Passing from positive to negative forces a pass through zero.
- is the signed area of the parallelogram spanned by the columns. 3×3 determinants come from cofactor expansion (Sarrus’ rule is a 3×3-only shortcut).
- Cofactor expansion works along any row or column, so choose the one with the most zeros. Triangular determinants are the product of the diagonal. For big matrices use row reduction: replacements change nothing, swaps flip the sign, and scaling a row scales the determinant.
- space is squashed nontrivial kernel no inverse.
- because scalings compose by multiplying. Hence and , but there is no sum rule.
- The Jacobian determinant is the local area factor of a curved map (polar coordinates give ). Incompressible flow maps have Jacobian determinant 1, and numerical steps that miss this create or destroy mass.