Inverse, Determinant, and Rank
The determinant tells you whether a matrix can be “undone,” the inverse does the undoing, and the rank counts how much independent information a matrix carries. Together they decide whether a regression has a unique solution — the normal equations only work when is invertible.
Determinant
For a matrix the determinant has a simple formula:
Geometric meaning: is the factor by which scales area (in 2-D) or volume (in 3-D). A determinant of means the transformation collapses space onto a lower-dimensional set — it destroys information and cannot be reversed.
Inverse
The inverse of a square matrix satisfies
For a matrix:
The inverse exists if and only if . Such a matrix is called nonsingular (or invertible); a matrix with is singular.
Rank and singularity
The rank of a matrix is the number of linearly independent rows (equivalently, columns). A square matrix is full rank (rank ) exactly when it is invertible and . If columns are linearly dependent — say one predictor is a copy or exact linear combination of others — the rank drops, the determinant is , and no inverse exists.
Worked example (by hand)
Let
Determinant:
so is invertible. The inverse:
Check:
The normal-equations connection
In linear regression with design matrix () and response , the least-squares estimates are
This requires (a matrix) to be invertible, i.e. must have full column rank . Perfect multicollinearity — a predictor that is an exact linear combination of others — makes singular and undefined.
Computing it
R
A <- matrix(c(4, 7, 2, 6), nrow = 2, byrow = TRUE)
det(A) # 10
solve(A) # inverse: [[0.6, -0.7], [-0.2, 0.4]]
qr(A)$rank # 2 (full rank)
$
# Solve a linear system A x = b directly (preferred over solve(A) %*% b):
b <- c(1, 1)
solve(A, b) # -> 0.1 0.1
Python
import numpy as np
A = np.array([[4.0, 7.0], [2.0, 6.0]])
np.linalg.det(A) # 10.0 (up to floating point)
np.linalg.inv(A) # [[0.6, -0.7], [-0.2, 0.4]]
np.linalg.matrix_rank(A) # 2
# Prefer solving over explicit inverse for numerical stability:
np.linalg.solve(A, np.array([1.0, 1.0])) # [0.1, 0.1]
Julia
using LinearAlgebra
A = [4.0 7.0; 2.0 6.0]
det(A) # 10.0
inv(A) # [0.6 -0.7; -0.2 0.4]
rank(A) # 2
# Backslash solves A x = b (preferred over inv):
A \ [1.0, 1.0] # [0.1, 0.1]
Why it matters for statistics
Invertibility is the dividing line between a regression that has a unique answer and one that does not.
A near-singular (large but nonzero determinant issues, tiny eigenvalues) signals collinearity that inflates coefficient variances.
In practice, use solve/\ rather than forming an explicit inverse — it is faster and numerically more stable.