The determinant of a square matrix $\mathbf{A}$, denoted as $\det(\mathbf{A})$ or $|\mathbf{A}|$, is a scalar value that represents the volume scaling factor of the linear transformation described by the matrix.
Imagine a unit square in 2D (with an area of $1$) or a unit cube in 3D (with a volume of $1$). When you apply a matrix transformation $\mathbf{A}$, that square is knocked into a new shape (a parallelogram). The determinant is the signed area (or volume) of that new shape: its magnitude is the size of the new shape, and — as we will see below — its sign records whether the orientation was preserved or flipped.
So a determinant measures how a transformation changes volume within the same dimensional space.
If the determinant is exactly zero, the transformation has collapsed the space into a lower dimension.
A determinant can be negative (e.g. $\det(\mathbf{A}) = -2$). The absolute value still gives the scaling factor (here the area doubles), while the negative sign indicates that space has been flipped or mirrored.
Intuition: in 2D a negative determinant is like flipping a piece of paper over; in 3D it is the difference between a "right-handed" and a "left-handed" coordinate system.
The determinant is defined only for square matrices, so the examples here use fresh $2 \times 2$ matrices rather than the $3 \times 2$ matrix from the previous notebook.
For a $2 \times 2$ matrix
$$\mathbf{A} = \begin{pmatrix} a & b \\ c & d \end{pmatrix},$$
the determinant is
$$\det(\mathbf{A}) = ad - bc.$$
This formula is the volume-scaling idea made concrete. The two columns $\begin{pmatrix} a \\ c \end{pmatrix}$ and $\begin{pmatrix} b \\ d \end{pmatrix}$ are the images of the unit basis vectors $\mathbf{e}_1$ and $\mathbf{e}_2$, so they form the two sides of the parallelogram that the unit square is mapped onto. The signed area of that parallelogram is exactly $ad - bc$: its magnitude is the area (the scaling factor), and its sign records whether the orientation was preserved ($+$) or flipped ($-$).
Worked example. For
$$\mathbf{A} = \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix}, \qquad \det(\mathbf{A}) = 2\cdot 3 - 1 \cdot 1 = 5 .$$
The transformation enlarges every area by a factor of $5$ and preserves orientation (the sign is positive). Equivalently, the parallelogram spanned by the columns $\begin{pmatrix} 2 \\ 1 \end{pmatrix}$ and $\begin{pmatrix} 1 \\ 3 \end{pmatrix}$ has area $5$.
For matrices larger than $2 \times 2$ the determinant is built up recursively (cofactor / Laplace expansion); we stay with the $2 \times 2$ case here, where the geometry is easiest to see.
import numpy as np
import matplotlib.pyplot as plt
# Unit square corners (traversed in order), stored as columns
square = np.array([[0, 1, 1, 0, 0],
[0, 0, 1, 1, 0]])
def transform(M):
return M @ square
A = np.array([[2., 1.],
[1., 3.]]) # det = 5, orientation preserved
S = np.array([[2., 1.],
[4., 2.]]) # singular: row 2 = 2 * row 1 -> det = 0
print("det(A) =", round(np.linalg.det(A), 6)) # 5.0 -> areas scale by 5
print("det(S) =", round(np.linalg.det(S), 6)) # 0.0 -> square collapses to a line
c_unit = "#7a7a7a" # neutral gray: the reference unit square
c_img = "#3b6fb0" # blue: a healthy (det != 0) image
c_sing = "#c25b3f" # red: a collapsed (det = 0) image
fig, axes = plt.subplots(1, 2, figsize=(9, 4.5))
for ax, M, col, title in [
(axes[0], A, c_img, f"$A$: det = {np.linalg.det(A):.0f} (area $\\times 5$)"),
(axes[1], S, c_sing, f"$S$: det = {np.linalg.det(S):.0f} (collapsed to a line)"),
]:
img = transform(M)
ax.fill(square[0], square[1], color=c_unit, alpha=0.25)
ax.plot(square[0], square[1], color=c_unit, lw=2, label="unit square (area 1)")
ax.fill(img[0], img[1], color=col, alpha=0.35)
ax.plot(img[0], img[1], color=col, lw=2, label="image under the matrix")
ax.set_title(title)
ax.set_aspect("equal")
ax.axhline(0, color="0.85", lw=1, zorder=0)
ax.axvline(0, color="0.85", lw=1, zorder=0)
ax.legend(loc="upper left", fontsize=8)
fig.suptitle("The determinant is the signed area of the image of the unit square")
fig.tight_layout()
plt.show()
The determinant collapses everything from the previous notebook into a single yes/no test. For a square $n \times n$ matrix $\mathbf{A}$, the following statements are all equivalent — either every one of them holds, or none of them does:
The opposite case, $\det(\mathbf{A}) = 0$, negates all of them at once: some column is redundant, the columns span only a lower-dimensional subspace ($\text{rank}(\mathbf{A}) < n$), the null space contains non-zero vectors ($N(\mathbf{A}) \neq \{\mathbf{0}\}$), and $\mathbf{A}$ is singular — no inverse exists, so $\mathbf{x} = \mathbf{A}^{-1}\mathbf{b}$ is unavailable and $\mathbf{A}\mathbf{x} = \mathbf{b}$ has either no solution or infinitely many.
So the geometric "collapse into a lower dimension" is precisely the loss of rank you already met: flattening space is the columns failing to span $\mathbb{R}^n$.
For square matrices $\mathbf{A}$ and $\mathbf{B}$ of the same size, the determinant satisfies:
| Determinant | Geometric meaning | Rank | Null space $N(\mathbf{A})$ | Invertibility |
|---|---|---|---|---|
| $\det(\mathbf{A}) \neq 0$ | Space is stretched or shrunk | Full, $\text{rank} = n$ | $\{\mathbf{0}\}$ only | Invertible |
| $\det(\mathbf{A}) = 0$ | Space is flattened / collapsed | Reduced, $\text{rank} < n$ | contains non-zero vectors | Singular (non-invertible) |
| $\det(\mathbf{A}) < 0$ | Space is flipped or mirrored | Full, $\text{rank} = n$ | $\{\mathbf{0}\}$ only | Invertible |