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 has determinant . Think of the matrix as a machine that moves every point in the plane. The determinant is how much it scales areas:
- : determinant . Areas keep their size.
- : determinant . The second column is twice the first, so the whole plane is squashed onto a line.
The inverse undoes the machine: , 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 then .
In ML, the classic linear-regression formula needs the inverse of . 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.