Skip to the workspace
Pebellslearn by building
Linear Algebra  ›  Lesson

Determinants and the Inverse

Determinants, inverse of Matrix 14 minThe determinant measures how a matrix scales space, and a matrix has an inverse only when its determinant is not zero.

machine learning / Determinants and the Inverse

Explore each scene at your own pace.

01 · The rule

The rule

Determinants and the Inverse

An analyst adds a new column to the flats table: size in square feet, right next to size in square metres. Training suddenly fails with "singular matrix". Nothing is wrong with the code. The two columns say the same thing, and the determinant is how you see that.

The rule

Determinant zero means information lost, and no inverse brings it back.

A 2 × 2 matrix (abcd)\begin{pmatrix} a & b \\ c & d \end{pmatrix} has determinant ad−bcad - bc. Think of the matrix as a machine that moves every point in the plane. The determinant is how much it scales areas:

  • (2111)\begin{pmatrix} 2 & 1 \\ 1 & 1 \end{pmatrix}: determinant 2−1=12 - 1 = 1. Areas keep their size.
  • (2436)\begin{pmatrix} 2 & 4 \\ 3 & 6 \end{pmatrix}: determinant 12−12=012 - 12 = 0. The second column is twice the first, so the whole plane is squashed onto a line.

The inverse M−1M^{-1} undoes the machine: MM−1=IM M^{-1} = I, the identity. If the plane was squashed onto a line, many points landed on the same spot, and no machine can tell them apart again. So:

  • determinant not zero → an inverse exists;
  • determinant zero → no inverse (the matrix is singular).

Because the inverse undoes the scaling, its determinant is one over the original: if det⁡M=0.5\det M = 0.5 then det⁡M−1=2\det M^{-1} = 2.

In ML, the classic linear-regression formula needs the inverse of XTXX^T X. If one feature column is a multiple of another, like square feet and square metres, that matrix is singular. The fix is to drop the duplicate or add regularisation. Libraries solve the equations directly rather than forming the inverse, but the same singularity still breaks them.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.