Determinant of a Square Matrix

Definition and Intuition

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.

  • If $\det(\mathbf{A}) = 3$, the transformation triples the area of any shape.
  • If $\det(\mathbf{A}) = 0.5$, the transformation shrinks the area to half.

So a determinant measures how a transformation changes volume within the same dimensional space.

The Meaning of Zero ($\det(\mathbf{A}) = 0$)

If the determinant is exactly zero, the transformation has collapsed the space into a lower dimension.

  • In 2D, a determinant of zero means the entire plane was squashed onto a single line or a single point.
  • Because the information is "flattened," it is impossible to reverse the process. This is why matrices with a determinant of zero are non-invertible (singular).

Negative Determinants and Orientation

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.

Computing the Determinant of a $2 \times 2$ Matrix

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.

In [1]:
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()
det(A) = 5.0
det(S) = 0.0
No description has been provided for this image

Relation to Span, Column Space, Rank and the Null Space

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:

  • $\det(\mathbf{A}) \neq 0$
  • the columns of $\mathbf{A}$ are linearly independent
  • the columns span the whole space: $C(\mathbf{A}) = \mathbb{R}^n$
  • $\mathbf{A}$ has full rank, $\text{rank}(\mathbf{A}) = n$
  • the null space is trivial, $N(\mathbf{A}) = \{\mathbf{0}\}$ (the only solution of $\mathbf{A}\mathbf{x} = \mathbf{0}$ is $\mathbf{x} = \mathbf{0}$)
  • $\mathbf{A}$ is invertible, so $\mathbf{x} = \mathbf{A}^{-1}\mathbf{b}$ is the unique solution of $\mathbf{A}\mathbf{x} = \mathbf{b}$ for every $\mathbf{b}$

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$.

Summary of Algebraic Properties

For square matrices $\mathbf{A}$ and $\mathbf{B}$ of the same size, the determinant satisfies:

  • Identity: $\det(\mathbf{I}) = 1$ — the identity transformation changes no volumes.
  • Multiplicativity: $\det(\mathbf{A}\mathbf{B}) = \det(\mathbf{A})\det(\mathbf{B})$. Intuitively, applying $\mathbf{B}$ and then $\mathbf{A}$ scales volume first by $\det(\mathbf{B})$ and then by $\det(\mathbf{A})$, so the composite scales by the product.
  • Inverse: $\det(\mathbf{A}^{-1}) = \dfrac{1}{\det(\mathbf{A})}$, valid precisely when $\det(\mathbf{A}) \neq 0$. It follows from the two rules above: $\det(\mathbf{A})\det(\mathbf{A}^{-1}) = \det(\mathbf{A}\mathbf{A}^{-1}) = \det(\mathbf{I}) = 1$. A singular matrix ($\det = 0$) has no inverse, consistent with the equivalences above.
  • Transpose: $\det(\mathbf{A}^\top) = \det(\mathbf{A})$. Rows and columns play completely symmetric roles — this is the determinant's echo of the row rank $=$ column rank fact from the previous notebook. In particular, every "column" statement in the equivalences above holds verbatim for the rows as well.

Summary Table: The Determinant as a Diagnostic Tool

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