---
title: Introduction to Determinants
module: Determinants
moduleNumber: 3
lessonNumber: 1
order: 301
summary: >
  The determinant of a square matrix is defined recursively by cofactor
  expansion: an n-by-n determinant is a signed sum of (n-1)-by-(n-1)
  determinants built from the first row. The expansion can equally run
  along any row or down any column, and a triangular matrix has determinant
  equal to the product of its diagonal.
topics: [Determinants]
sources:
  - book: Lay
    ref: "Ch. 3 — Determinants; §3.1 Introduction to Determinants"
---

A $2 \times 2$ matrix is invertible exactly when its determinant is nonzero, and
for $A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}$ that determinant is the
number $ad - bc$. Extending this quantity to a square matrix of any size is
recursive: an $n \times n$ determinant is a signed sum of $(n-1) \times (n-1)$
determinants, each of which unwinds the same way down to the $2 \times 2$ base
case. The single number that results decides invertibility, measures how a
linear map scales area and volume, and appears in closed-form solution formulas.

## Origin of the definition

The general definition comes from the condition for row reduction of a larger
matrix to succeed. Take a $3 \times 3$ matrix $A = [a_{ij}]$ with $a_{11} \neq 0$. Scaling rows 2
and 3 by $a_{11}$ and clearing the first column produces an equivalent matrix
whose lower-right $2 \times 2$ block, after one more elimination, has the single
nonzero entry $a_{11}\,\Delta$ in its corner, where[^lay-31]

$$
\Delta = a_{11}a_{22}a_{33} + a_{12}a_{23}a_{31} + a_{13}a_{21}a_{32}
       - a_{11}a_{23}a_{32} - a_{12}a_{21}a_{33} - a_{13}a_{22}a_{31}.
$$

Because $A$ reduces to a triangular matrix whose corner entry carries this factor
$\Delta$, the matrix is invertible exactly when $\Delta \neq 0$. The quantity
$\Delta$ is the determinant of the $3 \times 3$ matrix. Grouping its six terms by the
first-row entries $a_{11}, a_{12}, a_{13}$ rewrites $\Delta$ using three
$2 \times 2$ determinants:

$$
\Delta = a_{11}\det\!\begin{bmatrix} a_{22} & a_{23} \\ a_{32} & a_{33}\end{bmatrix}
       - a_{12}\det\!\begin{bmatrix} a_{21} & a_{23} \\ a_{31} & a_{33}\end{bmatrix}
       + a_{13}\det\!\begin{bmatrix} a_{21} & a_{22} \\ a_{31} & a_{32}\end{bmatrix}.
$$

Each $2 \times 2$ matrix here is $A$ with its first row and one column struck
out. This is the pattern that generalizes.

## Minors, cofactors, and the recursive definition

> **Definition (Submatrix and minor).** For a square matrix $A$, the submatrix
> $A_{ij}$ is the matrix obtained by deleting the $i$th row and the $j$th column
> of $A$. Its determinant $\det A_{ij}$ is called the $(i,j)$-**minor** of $A$.

The submatrix is one row and one column smaller than $A$. Deleting the crossing
row and column is the mechanical step behind every determinant computation.

$$
% caption: The submatrix $A_{32}$ is what remains after striking out row 3 and
% column 2; its determinant is the $(3,2)$-minor.
\begin{tikzpicture}[scale=1.0, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
% grid of a 4x4 matrix
\foreach \r/\rr in {0/1,1/2,2/3,3/4}{
  \foreach \c/\cc in {0/1,1/2,2/3,3/4}{
    \node[minimum size=8mm] at (\c*1.0, -\r*1.0) {$a_{\rr\cc}$};
  }
}
% bracket outline
\draw[black, thick] (-0.55,0.45) rectangle (3.55,-3.45);
% strike row 3 (index r=2) and column 2 (index c=1)
\draw[acc, very thick] (-0.7,-2.0) -- (3.7,-2.0);
\draw[acc, very thick] (1.0,0.6) -- (1.0,-3.6);
\node[acc, anchor=west, font=\footnotesize] at (4.0,-2.0) {delete row 3};
\node[acc, anchor=south, font=\footnotesize] at (1.0,0.75) {delete col 2};
\end{tikzpicture}
$$

The determinant of a $1 \times 1$ matrix $[a_{11}]$ is $a_{11}$; the
$2 \times 2$ case is $ad - bc$. Everything larger is defined by reducing to these.

> **Definition (Determinant).** For $n \geq 2$, the determinant of an
> $n \times n$ matrix $A = [a_{ij}]$ is the alternating sum of $n$ terms built
> from the first row,
> $$
> \det A = a_{11}\det A_{11} - a_{12}\det A_{12} + \cdots + (-1)^{1+n} a_{1n}\det A_{1n}
>        = \sum_{j=1}^{n} (-1)^{1+j}\, a_{1j}\det A_{1j}.
> $$

The sign $(-1)^{1+j}$ alternates $+, -, +, \dots$ across the row. Reading the
definition top-down, an $n \times n$ determinant calls $n$ determinants of size
$n-1$, each of which calls $n-1$ of size $n-2$, and so on. The recursion bottoms
out at the $2 \times 2$ or $1 \times 1$ rule.

$$
% caption: A $3\times3$ determinant expands into three signed $2\times2$
% minors, each a lower-order determinant to evaluate directly.
\begin{tikzpicture}[scale=1.0, font=\small,
  box/.style={draw, minimum width=16mm, minimum height=9mm, align=center, font=\footnotesize}]
\definecolor{acc}{HTML}{4A6FA5}
\node[box, draw=acc, text=acc, thick] (root) at (0,0) {$\det A$};
\node[box] (t1) at (-4.4,-2.0) {+ $a_{11}\det A_{11}$};
\node[box] (t2) at (0,-2.0)    {- $a_{12}\det A_{12}$};
\node[box] (t3) at (4.4,-2.0)  {+ $a_{13}\det A_{13}$};
\draw[->, acc, thick] (root) -- (t1);
\draw[->, acc, thick] (root) -- (t2);
\draw[->, acc, thick] (root) -- (t3);
\node[font=\footnotesize, align=center] (m1) at (-4.4,-3.5) {2-by-2 minor};
\node[font=\footnotesize, align=center] (m2) at (0,-3.5)    {2-by-2 minor};
\node[font=\footnotesize, align=center] (m3) at (4.4,-3.5)  {2-by-2 minor};
\draw[->, black] (t1) -- (m1);
\draw[->, black] (t2) -- (m2);
\draw[->, black] (t3) -- (m3);
\end{tikzpicture}
$$

It is convenient to fold the alternating sign into the minor itself.

> **Definition (Cofactor).** The $(i,j)$-**cofactor** of $A$ is
> $C_{ij} = (-1)^{i+j}\det A_{ij}$. With this notation the determinant reads
> $$
> \det A = a_{11}C_{11} + a_{12}C_{12} + \cdots + a_{1n}C_{1n},
> $$
> a **cofactor expansion across the first row**.

The cofactor is the minor with its position sign attached, so the expansion
becomes an ordinary (unsigned) dot product of the first row with its cofactors.

> **Worked example.** Compute the determinant of
> $$
> A = \begin{bmatrix} 1 & 5 & 0 \\ 2 & 4 & -1 \\ 0 & -2 & 0 \end{bmatrix}.
> $$
> Expanding across the first row,
> $$
> \det A = 1\det\!\begin{bmatrix} 4 & -1 \\ -2 & 0 \end{bmatrix}
>        - 5\det\!\begin{bmatrix} 2 & -1 \\ 0 & 0 \end{bmatrix}
>        + 0\det\!\begin{bmatrix} 2 & 4 \\ 0 & -2 \end{bmatrix}.
> $$
> The three $2 \times 2$ determinants are $4\cdot 0 - (-1)(-2) = -2$, then
> $2\cdot 0 - (-1)\cdot 0 = 0$, and the last term carries a factor $0$, so
> $\det A = 1(-2) - 5(0) + 0 = -2$. The vertical-bar notation writes the same
> computation without the word $\det$:
> $$
> \det A =
> \begin{vmatrix} 1 & 5 & 0 \\ 2 & 4 & -1 \\ 0 & -2 & 0 \end{vmatrix}
> = 1\begin{vmatrix} 4 & -1 \\ -2 & 0 \end{vmatrix}
> - 5\begin{vmatrix} 2 & -1 \\ 0 & 0 \end{vmatrix}
> + 0 = -2.
> $$

## Expansion along any row or column

The first row is not special. The following theorem, stated without proof to
avoid a lengthy digression, is what makes determinants practical to compute.[^lay-31]

> **Theorem (Cofactor expansion).** The determinant of an $n \times n$ matrix
> $A$ can be computed by a cofactor expansion across any row or down any column.
> The expansion across row $i$ is
> $$
> \det A = a_{i1}C_{i1} + a_{i2}C_{i2} + \cdots + a_{in}C_{in},
> $$
> and the expansion down column $j$ is
> $$
> \det A = a_{1j}C_{1j} + a_{2j}C_{2j} + \cdots + a_{nj}C_{nj}.
> $$

Every row and every column gives the same number. The freedom to choose which
one is the practical value of the theorem: pick the row or column with the
most zeros, and the terms attached to those zeros vanish before any minor is
computed.

The sign $(-1)^{i+j}$ attached to position $(i,j)$ does not depend on the entry
$a_{ij}$ itself, only on where it sits. Laid out over the whole matrix the signs
form a checkerboard.

$$
% caption: The cofactor sign $(-1)^{i+j}$ alternates like a checkerboard; the
% top-left corner is always $+$.
\begin{tikzpicture}[scale=0.85, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
% plus cells (i+j even) shaded, with the sign glyph
\foreach \c/\r in {0/0,2/0,1/1,3/1,0/2,2/2,1/3,3/3}{
  \fill[acc!12] (\c,-\r) rectangle ++(1,-1);
  \node at (\c+0.5,-\r-0.5) {+};
}
% minus cells (i+j odd)
\foreach \c/\r in {1/0,3/0,0/1,2/1,1/2,3/2,0/3,2/3}{
  \node at (\c+0.5,-\r-0.5) {-};
}
\draw[black, thick] (0,0) rectangle (4,-4);
\foreach \k in {1,2,3}{
  \draw[black] (\k,0) -- (\k,-4);
  \draw[black] (0,-\k) -- (4,-\k);
}
\end{tikzpicture}
$$

> **Worked example.** Recompute the determinant of the same $A$ by expanding
> across its third row $[\,0,\ -2,\ 0\,]$:
> $$
> \det A = a_{31}C_{31} + a_{32}C_{32} + a_{33}C_{33}
>        = 0 + (-2)(-1)^{3+2}\det\!\begin{bmatrix} 1 & 0 \\ 2 & -1 \end{bmatrix} + 0.
> $$
> The lone surviving minor is $1\cdot(-1) - 0\cdot 2 = -1$, and the sign is
> $(-1)^{3+2} = -1$, so the term is $(-2)(-1)(-1) = -2$. The result matches the
> first-row expansion, as the cofactor-expansion theorem guarantees, and the third-row route touched
> a single $2 \times 2$ determinant instead of three.

> **Worked example.** Repeated expansion cuts a large determinant down quickly
> when zeros are plentiful. Compute
> $$
> A = \begin{bmatrix}
> 3 & -7 & 8 & 9 & -6 \\
> 0 & 2 & -5 & 7 & 3 \\
> 0 & 0 & 1 & 5 & 0 \\
> 0 & 0 & 2 & 4 & -1 \\
> 0 & 0 & 0 & -2 & 0
> \end{bmatrix}.
> $$
> Expanding down the first column leaves only the $a_{11} = 3$ term, since every
> other first-column entry is zero:
> $$
> \det A = 3 \begin{vmatrix} 2 & -5 & 7 & 3 \\ 0 & 1 & 5 & 0 \\ 0 & 2 & 4 & -1 \\ 0 & 0 & -2 & 0 \end{vmatrix}.
> $$
> Expand the $4 \times 4$ down its first column for the same reason, keeping only
> the leading $2$:
> $$
> \det A = 3\cdot 2 \begin{vmatrix} 1 & 5 & 0 \\ 2 & 4 & -1 \\ 0 & -2 & 0 \end{vmatrix}
>        = 3\cdot 2\cdot(-2) = -12,
> $$
> the inner $3 \times 3$ being the matrix from the first worked example. Each
> expansion cost one term because each chosen column held a single nonzero entry.

## Triangular matrices

The chaining above always terminates in one step when the matrix is triangular,
because every column below the diagonal is a column of zeros in the relevant
submatrix. Expanding repeatedly down the first column peels off one diagonal
entry at a time.

> **Theorem (Triangular determinant).** If $A$ is a triangular matrix, then
> $\det A$ is the product of the entries on its main diagonal.

$$
% caption: For a triangular matrix the cofactor expansion keeps only the diagonal
% entries; their product is the determinant.
\begin{tikzpicture}[scale=0.9, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
% entries of an upper-triangular 4x4; diagonal = d_i, above = *, below = 0
\foreach \r/\d in {0/1,1/2,2/3,3/4}{
  \foreach \c in {0,1,2,3}{
    \ifnum\c<\r \node at (\c, -\r) {0};\fi
    \ifnum\c=\r \node[draw=acc, thick, circle, minimum size=8.5mm] at (\c,-\r) {$d_\d$};\fi
    \ifnum\c>\r \node at (\c, -\r) {*};\fi
  }
}
\draw[black, thick] (-0.55,0.5) rectangle (3.55,-3.5);
\node[acc, anchor=west, font=\footnotesize] at (4.0,-1.5)
  {$\det A = d_1 d_2 d_3 d_4$};
\end{tikzpicture}
$$

A row or column of all zeros forces $\det A = 0$ by the same reasoning: the
cofactor expansion along that line is a sum of zeros. This is often the fastest
way to spot a zero determinant by eye.

## Determinants of a few standard matrices

The triangular-determinant rule fixes several determinants that recur constantly and are worth knowing
on sight. Each follows by reading the diagonal of a triangular (indeed diagonal)
matrix.

- **Identity.** $\det I_n = 1$, the product of $n$ ones.
- **Diagonal.** $\det\operatorname{diag}(d_1, \dots, d_n) = d_1 d_2 \cdots d_n$.
- **Scalar.** For the scalar matrix $cI_n$, every diagonal entry is $c$, so
  $\det(cI_n) = c^n$.

The elementary matrices — the identity altered by one row operation — also have
determinants readable at a glance. A
matrix that adds a multiple of one row to another is triangular with ones on the
diagonal, so its determinant is $1$; a matrix that scales a row by $k$ is diagonal
with a single off-one entry $k$, so its determinant is $k$; and a matrix that
swaps two rows has determinant $-1$, a fact that takes one cofactor expansion to
check.

| Elementary matrix | Effect on $I$ | Determinant |
| --- | --- | --- |
| Replacement | add $k\cdot(\text{row } j)$ to row $i$ | $1$ |
| Scaling | multiply row $i$ by $k$ | $k$ |
| Interchange | swap rows $i$ and $j$ | $-1$ |

These three numbers are the factors by which the corresponding row
operations rescale a determinant, which is the content of
[Properties of Determinants](/linear-algebra/determinants/properties-of-determinants).

## Base cases

The base cases recur inside every larger computation.

| Size | Matrix | Determinant |
| --- | --- | --- |
| $1 \times 1$ | $[a]$ | $a$ |
| $2 \times 2$ | $\begin{bmatrix} a & b \\ c & d \end{bmatrix}$ | $ad - bc$ |
| $3 \times 3$ (first-row) | $[a_{ij}]$ | $a_{11}C_{11} + a_{12}C_{12} + a_{13}C_{13}$ |

Every expansion ultimately resolves into the $2 \times 2$ rule, main-diagonal
product minus anti-diagonal product. A diagonal-based mnemonic exists for the
$3 \times 3$ case, but it does not extend to $4 \times 4$ or larger, so cofactor
expansion remains the general method.

## The cost of the definition

Cofactor expansion defines the determinant cleanly but computes it slowly. An
$n \times n$ expansion generates $n$ subdeterminants, each of size $n-1$, so the
recursion visits on the order of $n!$ terms. Even for a matrix that today counts
as small, this is impractical.[^lay-31]

$$
% caption: Cofactor-expansion cost grows as $n!$, far outrunning the $\sim n^3$
% cost of the row-reduction method.
\begin{tikzpicture}[scale=1.0, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
% axes
\draw[->, black] (0,0) -- (6.4,0) node[right, font=\footnotesize, black] {$n$};
\draw[->, black] (0,0) -- (0,4.4) node[above, font=\footnotesize, black] {work (log scale)};
% n^3 curve (mild), sampled
\draw[black, thick]
  (0.4,0.2) .. controls (2.5,0.6) and (4.0,1.1) .. (6.0,1.7);
\node[black, anchor=west, font=\footnotesize] at (5.6,1.3) {row reduction ($n^3$)};
% n! curve (steep)
\draw[acc, very thick]
  (0.4,0.15) .. controls (2.6,0.4) and (3.6,1.4) .. (4.6,4.1);
\node[acc, anchor=south, font=\footnotesize] at (4.3,3.9) {cofactors ($n!$)};
\end{tikzpicture}
$$

A $25 \times 25$ determinant by cofactor expansion needs more than $25! \approx
1.5 \times 10^{25}$ multiplications; a machine doing a trillion per second would
run for over $500{,}000$ years.[^lay-31] The definition is the right tool for
small matrices and for proofs. The practical algorithm for large matrices comes
from [row reduction](/linear-algebra/determinants/properties-of-determinants),
which also settles the invertibility criterion $\det A \neq 0$ and the
multiplicative law $\det(AB) = (\det A)(\det B)$.

## Summary

- The determinant of a square matrix is defined recursively by **cofactor
  expansion**: $\det A = \sum_j (-1)^{1+j} a_{1j}\det A_{1j}$, bottoming out at the
  $2 \times 2$ rule $ad - bc$.
- The **minor** $\det A_{ij}$ is the determinant of $A$ with row $i$ and column
  $j$ deleted; the **cofactor** $C_{ij} = (-1)^{i+j}\det A_{ij}$ folds in the
  position sign.
- **Cofactor expansion** can run along any row or down any column, so
  choosing a line rich in zeros minimizes work.
- **Triangular determinant**: a triangular matrix has determinant equal to the product of its
  diagonal; a zero row or column forces $\det A = 0$.
- Cofactor expansion costs $\sim n!$ operations, unusable for large $n$; row
  reduction is the practical algorithm.

[^lay-31]: Lay, Lay & McDonald, _Linear Algebra and Its Applications_, 5th ed., §3.1 — Introduction to Determinants: the $3\times3$ motivation via row reduction, the recursive definition, Theorem 1 (expansion across any row or down any column), Theorem 2 (triangular matrices), and the numerical note on the $n!$ cost of cofactor expansion.
