Linear Algebra for Machine Learning

Determinants

Determinants as area and volume scaling factors that also detect collapse.

Lesson
4

Goal

Understand the determinant as a geometric summary of a matrix. It measures how much a transformation scales area or volume, and it tells us when a transformation collapses information.

Motivation

Once you know that a matrix is a transformation, a natural next question appears:

How much does that transformation stretch or shrink space?

The determinant answers that question.

It also tells us something even more important:

Did the transformation destroy information?

Prerequisites

Notation / Symbol Table

SymbolMeaning
det(A)The determinant of matrix A.
AA linear transformation whose area or volume scaling we are measuring.
IThe identity matrix.
orientationThe handedness of a transformation; whether it preserves or flips order.

Core Ideas

The determinant measures scale

For a linear transformation in 2D, the determinant tells us how the area changes.

The same idea extends to volume in 3D and to higher-dimensional spaces.

A diagonal matrix makes the scaling obvious

If:

A=[2003],A = \begin{bmatrix} 2 & 0 \\ 0 & 3 \end{bmatrix},

then the unit square becomes a rectangle with area 2 \cdot 3 = 6.

So:

det(A)=6.\det(A) = 6.

A shear can preserve area

If:

A=[1101],A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix},

the square becomes a parallelogram, but its area stays the same.

So:

det(A)=1.\det(A) = 1.

Zero determinant means collapse

If the columns of a matrix are dependent, the transformation flattens the plane into a line or a point.

Once that happens, the lost dimension cannot be recovered.

That is why det(A) = 0 is the warning sign for non-invertibility.

The sign tells you about orientation

Positive determinant:

Negative determinant:

A reflection has negative determinant because it reverses handedness.

The 2x2 formula is the algebraic summary

For:

A=[abcd],A = \begin{bmatrix} a & b \\ c & d \end{bmatrix},

the determinant is:

det(A)=adbc.\det(A) = ad - bc.

The formula is useful, but the geometric meaning comes first.

Worked Example

Consider:

A=[1224].A = \begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix}.

Using the 2x2 formula:

det(A)=1422=0.\det(A) = 1\cdot 4 - 2\cdot 2 = 0.

Geometrically, the second column is twice the first column, so the transformation sends the plane onto a line.

That means:

Now compare with:

B=[1101].B = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}.

This is a shear. It changes shape, but not area, so det(B) = 1.

That contrast is the main lesson: determinant is a geometric summary, not just a formula.

Why This Shows Up In ML

Determinants appear in a lot of places where geometry and probability overlap:

If a model maps many points to the same output, the determinant story helps explain why that matters.

Exercises

  1. Find the determinant of
[5002].\begin{bmatrix} 5 & 0 \\ 0 & 2 \end{bmatrix}.
  1. Decide whether
[1302]\begin{bmatrix} 1 & 3 \\ 0 & -2 \end{bmatrix}

preserves or flips orientation.

  1. If a transformation doubles every length in every direction in 3D, what is its determinant?

  2. Explain why

[1224]\begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix}

cannot be invertible.

  1. Explain the determinant as a local area or volume scaling factor in your own words.

Implementation Exercise

Write a small TypeScript helper that computes the determinant of a 2 x 2 matrix and uses it to test invertibility:

type Matrix2x2 = [[number, number], [number, number]];

export function determinant2x2(matrix: Matrix2x2): number

export function isInvertible2x2(matrix: Matrix2x2): boolean

Add tests for a diagonal matrix, a shear, and a collapsed matrix.

Reflection Questions