One number from a square matrix: $\det A=ad-bc$ for a $2\times2$ matrix, and for larger matrices a cofactor expansion along whichever row or column makes the work easiest.
Solve the general $2\times2$ system $ax_1+bx_2=e$, $cx_1+dx_2=f$ by elimination: multiply the first equation by $d$, the second by $b$ and subtract. The $x_2$ terms cancel and you are left with
$$(ad-bc)\,x_1=ed-bf .$$
Everything now hangs on the single number $ad-bc$. If it is not zero we can divide and the system has exactly one solution; if it is zero, the system either has no solution or infinitely many. You met the same number in Section 2.2 as the denominator of the inverse formula $A^{-1}=\dfrac{1}{ad-bc}\begin{bmatrix}d&-b\\-c&a\end{bmatrix}$.
This number is the determinant of the coefficient matrix. In this section we define it for square matrices of every size, learn to compute it by cofactor expansion, and find the shortcuts — rows full of zeros, triangular matrices — that make the computation quick. In Section 3.2 we will see that the determinant still decides invertibility for $n\times n$ matrices, and in Section 3.3 that it measures area and volume.
Determinants of 2×2 Matrices
📘 Definition 3.1 — The determinant of a 2×2 matrix
The determinant of the $2\times2$ matrix $A=\begin{bmatrix}a&b\\c&d\end{bmatrix}$ is the number
$$\det A=\begin{vmatrix}a&b\\c&d\end{vmatrix}=ad-bc .$$
In words: the product of the main diagonal minus the product of the other diagonal. For a $1\times1$ matrix we set $\det[a]=a$.
Notice the notation: square brackets $\begin{bmatrix}\ \end{bmatrix}$ give a matrix, vertical bars $\begin{vmatrix}\ \end{vmatrix}$ give its determinant, which is a number. We write $\det A$ or $|A|$.
✏️ Example 1 — Computing 2×2 determinants
(a) Find $\det\begin{bmatrix}3&-2\\4&5\end{bmatrix}$. (b) Find $\det\begin{bmatrix}6&4\\3&2\end{bmatrix}$ and explain the answer. (c) Find every $x$ for which $\begin{vmatrix}x&2\\3&x-1\end{vmatrix}=0$.
💡 Show solution▶
(a) $\begin{vmatrix}3&-2\\4&5\end{vmatrix}=(3)(5)-(-2)(4)=15+8=23$. Watch the sign: subtracting a negative product adds.
(b) $\begin{vmatrix}6&4\\3&2\end{vmatrix}=(6)(2)-(4)(3)=12-12=0$. The first row is twice the second, so the rows are proportional. Such a matrix is not invertible, and the determinant detects this.
(c) $x(x-1)-(2)(3)=x^2-x-6=(x-3)(x+2)$, so the determinant is zero exactly when $x=3$ or $x=-2$.
Check At $x=3$ the matrix is $\begin{bmatrix}3&2\\3&2\end{bmatrix}$ (equal rows); at $x=-2$ it is $\begin{bmatrix}-2&2\\3&-3\end{bmatrix}$, whose second row is $-\tfrac32$ times the first. ✓
The $2\times2$ determinant also has a picture. Draw the two columns $\mathbf{a}_1=\begin{bmatrix}a\\c\end{bmatrix}$ and $\mathbf{a}_2=\begin{bmatrix}b\\d\end{bmatrix}$ as arrows from the origin. They span a parallelogram, and $|\det A|$ is its area; the sign of $\det A$ records the orientation — positive when you turn anticlockwise from $\mathbf{a}_1$ to $\mathbf{a}_2$, negative when you turn clockwise. We prove this in Section 3.3; for now, explore it.
Interactive 1 — The 2×2 Determinant as a Signed Area
Drag the tips of the column vectors $\mathbf{a}_1=(a,c)$ and $\mathbf{a}_2=(b,d)$ (they snap to half-units). The parallelogram they span is shaded blue when $\det A=ad-bc\gt 0$ and red when $\det A\lt 0$. Press Play to swing $\mathbf{a}_2$ round in a circle: the area shrinks to zero as $\mathbf{a}_2$ lines up with $\mathbf{a}_1$, and the sign flips as it crosses over.
$\mathbf{a}_1=(a,c)$—
$\mathbf{a}_2=(b,d)$—
$\det A=ad-bc$—
area $=|\det A|$—
orientation—
Minors, Cofactors and the 3×3 Determinant
For larger matrices we build the determinant out of smaller determinants. The building blocks get names.
📘 Definition 3.2 — Minors and cofactors
Let $A=[a_{ij}]$ be an $n\times n$ matrix with $n\ge2$.
The minor $M_{ij}$ of the entry $a_{ij}$ is the determinant of the $(n-1)\times(n-1)$ matrix left when row $i$ and column $j$ of $A$ are deleted.
The cofactor of $a_{ij}$ is $C_{ij}=(-1)^{i+j}M_{ij}$.
The factor $(-1)^{i+j}$ is $+1$ when $i+j$ is even and $-1$ when it is odd, giving a chessboard of signs that always starts with $+$ in the top-left corner:
$$\begin{bmatrix}+&-&+\\-&+&-\\+&-&+\end{bmatrix}\qquad\begin{bmatrix}+&-&+&-\\-&+&-&+\\+&-&+&-\\-&+&-&+\end{bmatrix}$$
📘 Definition 3.3 — The determinant of an n×n matrix
For $n\ge2$, the determinant of the $n\times n$ matrix $A=[a_{ij}]$ is the sum of the entries of the first row, each multiplied by its own cofactor:
$$\det A=a_{11}C_{11}+a_{12}C_{12}+\cdots+a_{1n}C_{1n}=\sum_{j=1}^{n}a_{1j}C_{1j}.$$
Each cofactor is (up to sign) a determinant of size $n-1$, so this defines $\det A$ step by step from the $2\times2$ case. For $n=2$ it gives $a_{11}a_{22}+a_{12}(-a_{21})=ad-bc$, agreeing with Definition 3.1.
Written out for a $3\times3$ matrix, Definition 3.3 reads
$$\begin{vmatrix}a_{11}&a_{12}&a_{13}\\a_{21}&a_{22}&a_{23}\\a_{31}&a_{32}&a_{33}\end{vmatrix}=a_{11}\begin{vmatrix}a_{22}&a_{23}\\a_{32}&a_{33}\end{vmatrix}-a_{12}\begin{vmatrix}a_{21}&a_{23}\\a_{31}&a_{33}\end{vmatrix}+a_{13}\begin{vmatrix}a_{21}&a_{22}\\a_{31}&a_{32}\end{vmatrix}.$$
The minus sign in the middle is the cofactor sign $(-1)^{1+2}$ — forgetting it is the most common error in this whole chapter.
✏️ Example 2 — Minors and cofactors
Let $A=\begin{bmatrix}2&-1&3\\1&4&0\\-2&5&1\end{bmatrix}$. Find the minors and cofactors of the three entries in the first row, and the cofactor $C_{32}$.
💡 Show solution▶
$a_{11}$ Delete row 1 and column 1: $M_{11}=\begin{vmatrix}4&0\\5&1\end{vmatrix}=4-0=4$, and $C_{11}=(-1)^{2}\cdot4=4$.
$a_{12}$ Delete row 1 and column 2: $M_{12}=\begin{vmatrix}1&0\\-2&1\end{vmatrix}=1-0=1$, and $C_{12}=(-1)^{3}\cdot1=-1$.
$a_{13}$ Delete row 1 and column 3: $M_{13}=\begin{vmatrix}1&4\\-2&5\end{vmatrix}=5-(-8)=13$, and $C_{13}=(-1)^{4}\cdot13=13$.
$a_{32}$ Delete row 3 and column 2: $M_{32}=\begin{vmatrix}2&3\\1&0\end{vmatrix}=0-3=-3$, and $C_{32}=(-1)^{5}\cdot(-3)=3$. A minor and its cofactor differ at most in sign; the chessboard tells you which.
✏️ Example 3 — A 3×3 determinant by cofactor expansion
Find $\det A$ for the matrix $A$ of Example 2.
💡 Show solution▶
Expand Along the first row, using the cofactors from Example 2: $$\det A=a_{11}C_{11}+a_{12}C_{12}+a_{13}C_{13}=(2)(4)+(-1)(-1)+(3)(13).$$
Add $\det A=8+1+39=48$.
Check Column 3 contains a zero, so expanding down column 3 (Theorem 3.1 below) needs only two minors: $$\det A=3\,C_{13}+0\,C_{23}+1\,C_{33}=3(13)+0+1\cdot\begin{vmatrix}2&-1\\1&4\end{vmatrix}=39+9=48.\ ✓$$
⚠️ The rule of Sarrus — for 3×3 matrices only
For a $3\times3$ matrix there is a well-known shortcut. Copy the first two columns to the right of the matrix:
$$\begin{array}{ccc|cc}a_{11}&a_{12}&a_{13}&a_{11}&a_{12}\\a_{21}&a_{22}&a_{23}&a_{21}&a_{22}\\a_{31}&a_{32}&a_{33}&a_{31}&a_{32}\end{array}$$
Add the three products along the diagonals running down to the right, and subtract the three products along the diagonals running up to the right:
$$\det A=a_{11}a_{22}a_{33}+a_{12}a_{23}a_{31}+a_{13}a_{21}a_{32}-a_{13}a_{22}a_{31}-a_{11}a_{23}a_{32}-a_{12}a_{21}a_{33}.$$
It does not work for $4\times4$ or larger matrices. A $4\times4$ determinant is a sum of $24$ products, and the diagonal pattern produces only $8$ of them. There is no Sarrus rule beyond size 3 — use cofactor expansion or the row reduction of Section 3.2.
✏️ Example 4 — Checking with the rule of Sarrus
Use the rule of Sarrus to confirm $\det A=48$ for the matrix of Example 2.
Definition 3.3 singles out the first row, but nothing is special about it. Example 3 already hinted that column 3 gives the same answer. This is always true, and it is the key to computing determinants efficiently.
📐 Theorem 3.1 — Cofactor expansion along any row or column
Let $A=[a_{ij}]$ be an $n\times n$ matrix with $n\ge2$. For every row $i$ and every column $j$,
$$\det A=\sum_{k=1}^{n}a_{ik}C_{ik}=a_{i1}C_{i1}+a_{i2}C_{i2}+\cdots+a_{in}C_{in}\qquad\text{(expansion along row }i\text{)}$$
$$\det A=\sum_{k=1}^{n}a_{kj}C_{kj}=a_{1j}C_{1j}+a_{2j}C_{2j}+\cdots+a_{nj}C_{nj}\qquad\text{(expansion along column }j\text{).}$$
All $2n$ expansions give the same number. (The proof is a careful but unexciting count of the products involved; we omit it.)
🧭 Problem-solving strategy — choosing where to expand
Look for the row or column with the most zeros. Every zero entry kills its whole term, so you never need that minor.
Write down the chessboard sign for each remaining entry: the sign of $C_{ij}$ is $(-1)^{i+j}$.
Compute each needed minor — again choosing the best row or column inside it — and multiply: entry $\times$ sign $\times$ minor.
Add. If you have time, check by expanding along a different line (or with Sarrus for a $3\times3$).
✏️ Example 5 — A 4×4 determinant with zeros
Find $\det B$ where $B=\begin{bmatrix}1&0&2&-1\\3&0&0&5\\2&-4&1&0\\0&0&3&1\end{bmatrix}$.
💡 Show solution▶
Choose Column 2 is $(0,0,-4,0)$ — three zeros. Expanding along column 2 leaves a single term: $$\det B=b_{32}C_{32}=(-4)\cdot(-1)^{3+2}M_{32}=4\,M_{32}.$$
Minor Delete row 3 and column 2: $M_{32}=\begin{vmatrix}1&2&-1\\3&0&5\\0&3&1\end{vmatrix}$. Expand along column 1, which has a zero (signs $+,-,+$): $$M_{32}=1\begin{vmatrix}0&5\\3&1\end{vmatrix}-3\begin{vmatrix}2&-1\\3&1\end{vmatrix}+0=1(0-15)-3(2+3)=-15-15=-30.$$
Answer $\det B=4(-30)=-120$.
Effort Expanding along row 1 instead would need three $3\times3$ minors. Choosing column 2 needed one — and Interactive 2 lets you compare the two routes.
Interactive 2 — Cofactor Expansion Explorer
Choose a matrix and the row or column to expand along. Each step crosses out the row and column of one entry, shows the minor that is left, attaches the chessboard sign, and adds the term $a_{ij}C_{ij}$ to the running sum. Zero entries are skipped for free — try expanding the $4\times4$ matrices along their best and worst lines and count the minors you need.
current term $a_{ij}C_{ij}$—
running sum—
minors actually needed—
$\det$ (when complete)—
Triangular Matrices
A square matrix is upper triangular if every entry below the main diagonal is zero, lower triangular if every entry above it is zero, and diagonal if both. For these, cofactor expansion collapses completely.
📐 Theorem 3.2 — Determinant of a triangular matrix
If $A$ is an $n\times n$ triangular matrix (upper, lower or diagonal), then $\det A$ is the product of the entries on its main diagonal:
$$\det A=a_{11}a_{22}\cdots a_{nn}.$$
In particular $\det I_n=1$.
Why. For an upper triangular matrix, column 1 is $(a_{11},0,\dots,0)$. Expanding along it leaves one term, $a_{11}$ times the minor $M_{11}$, which is again upper triangular, of size $n-1$. Repeat: $\det A=a_{11}a_{22}\cdots a_{nn}$. For a lower triangular matrix expand along row 1 instead.
✏️ Example 6 — Triangular determinants at a glance
Find (a) $\det\begin{bmatrix}2&5&-1&7\\0&-3&4&1\\0&0&1&6\\0&0&0&4\end{bmatrix}$ and (b) $\det\begin{bmatrix}5&0&0\\-2&\tfrac12&0\\9&8&-6\end{bmatrix}$.
💡 Show solution▶
(a) Upper triangular: $\det=(2)(-3)(1)(4)=-24$. The entries above the diagonal ($5,-1,7,4,1,6$) play no part.
Check (b) Expanding along row 1: $5\begin{vmatrix}\tfrac12&0\\8&-6\end{vmatrix}=5(-3-0)=-15$. ✓
Why it matters Row reduction turns any square matrix into a triangular one. Section 3.2 shows how each row operation changes the determinant — and that is how computers actually find determinants.
4 $C_{12}=-\begin{vmatrix}4&-1\\2&6\end{vmatrix}=-(24+2)=-26$ and $C_{13}=\begin{vmatrix}4&0\\2&5\end{vmatrix}=20$. So $\det A=(1)(5)+(-2)(-26)+(3)(20)=5+52+60=117$.
5 Column 2 is $(-2,0,5)$ and contains a zero, so only two minors are needed: $\det A=(-2)C_{12}+0\cdot C_{22}+5\,C_{32}=(-2)(-26)+0+5(13)=52+65=117$. ✓
8 $\begin{vmatrix}2&1&0&0\\3&4&0&0\\0&0&1&5\\0&0&2&3\end{vmatrix}$. Compare your answer with the determinants of the two $2\times2$ blocks on the diagonal.
💡 Show solutions▶
1 Expand along row 2, which is all zeros: every term is $0\cdot C_{2j}$, so the determinant is $0$.
2 Column 2 is $(0,0,6)$: $\det=6\,C_{32}=6\cdot(-1)^{5}\begin{vmatrix}3&-2\\1&5\end{vmatrix}=-6(15+2)=-102$.
3 Row 2 is $(0,4,0,0)$: $\det=4\,C_{22}=4\begin{vmatrix}1&0&3\\2&3&-1\\0&0&2\end{vmatrix}$. In this minor, column 2 is $(0,3,0)$: it equals $3\begin{vmatrix}1&3\\0&2\end{vmatrix}=3(2)=6$. So $\det=4(6)=24$.
4 Along row 1 (two zeros): $2\begin{vmatrix}3&0&0\\1&4&0\\0&-2&5\end{vmatrix}+1\cdot(-1)^{1+4}\begin{vmatrix}-1&3&0\\0&1&4\\0&0&-2\end{vmatrix}$. Both minors are triangular: $2(3\cdot4\cdot5)-(-1)(1)(-2)=120-2=118$.
5 Upper triangular: $(3)(2)(-1)(5)=-30$.
6 Lower triangular: $(2)(-1)(3)(2)(-1)=12$.
7 Expand along row 1 (only $a_{15}=3$, sign $+$), then the new row 1 (only the $2$, in position $(1,4)$, sign $-$), then the $1$ (position $(1,3)$, sign $+$), leaving $\begin{vmatrix}0&4\\5&0\end{vmatrix}=-20$. So $\det=3\cdot(-2)\cdot(1)\cdot(-20)=120$.
8 Along row 1: $2\begin{vmatrix}4&0&0\\0&1&5\\0&2&3\end{vmatrix}-1\begin{vmatrix}3&0&0\\0&1&5\\0&2&3\end{vmatrix}=2\cdot4(3-10)-3(3-10)=-56+21=-35$. The diagonal blocks have determinants $8-3=5$ and $3-10=-7$, and $5\cdot(-7)=-35$: for a block-diagonal matrix the determinant is the product of the block determinants.
IV
Equations, geometry and cost.
1 Find every $x$ with $\begin{vmatrix}x&1&0\\1&x&1\\0&1&x\end{vmatrix}=0$.
2 Find every $k$ with $\begin{vmatrix}k&2&1\\0&k&3\\1&0&1\end{vmatrix}=8$.
3A line from a determinant. Expand $\begin{vmatrix}x&y&1\\1&2&1\\3&8&1\end{vmatrix}=0$ along row 1 and show that it is the equation of the line through $(1,2)$ and $(3,8)$.
4 Show by an example with $2\times2$ matrices that $\det(A+B)$ is in general not $\det A+\det B$.
5 Expand $\begin{vmatrix}a&b&c\\a&b&c\\g&h&i\end{vmatrix}$ along row 3 and explain why a $3\times3$ matrix with two equal rows has determinant $0$.
6Differential equations (uses calculus). The Wronskian of $e^{t}$ and $e^{2t}$ is the determinant whose first row holds the two functions and whose second row holds their derivatives, $(e^{t})'=e^{t}$ and $(e^{2t})'=2e^{2t}$ (given here, so only algebra is needed). Evaluate $W=\begin{vmatrix}e^{t}&e^{2t}\\e^{t}&2e^{2t}\end{vmatrix}$ and show that $W\ne0$ for every real $t$.
7Computing cost. Written out in full, an $n\times n$ determinant is a sum of $n!$ products of entries. If a computer forms $10^9$ such products per second, roughly how long would it need for a $20\times20$ matrix?
💡 Show solutions▶
1 Along row 1: $x(x^2-1)-1(x-0)+0=x^3-2x=x\left(x^2-2\right)$. So $x=0$, $x=\sqrt2$ or $x=-\sqrt2$.
2 Along column 1: $k\begin{vmatrix}k&3\\0&1\end{vmatrix}-0+1\begin{vmatrix}2&1\\k&3\end{vmatrix}=k^2+(6-k)=k^2-k+6$. Setting $k^2-k+6=8$: $k^2-k-2=(k-2)(k+1)=0$, so $k=2$ or $k=-1$.
3 $x\begin{vmatrix}2&1\\8&1\end{vmatrix}-y\begin{vmatrix}1&1\\3&1\end{vmatrix}+1\begin{vmatrix}1&2\\3&8\end{vmatrix}=-6x+2y+2=0$, i.e. $y=3x-1$. This is a line, and both points satisfy it ($3\cdot1-1=2$, $3\cdot3-1=8$); geometrically, substituting either point makes two rows equal, which gives $0$ (part 5).
4 Take $A=B=I_2$: $\det(A+B)=\det\begin{bmatrix}2&0\\0&2\end{bmatrix}=4$, but $\det A+\det B=1+1=2$.
5 $g\begin{vmatrix}b&c\\b&c\end{vmatrix}-h\begin{vmatrix}a&c\\a&c\end{vmatrix}+i\begin{vmatrix}a&b\\a&b\end{vmatrix}=g(bc-cb)-h(ac-ca)+i(ab-ba)=0$. Every $2\times2$ minor keeps both copies of the repeated row, so each is $0$. (Section 3.2 proves this for all sizes.)
6 $W=e^{t}\cdot2e^{2t}-e^{2t}\cdot e^{t}=2e^{3t}-e^{3t}=e^{3t}$, and $e^{3t}\gt0$ for every real $t$.
7 $20!\approx2.43\times10^{18}$ products, taking $\dfrac{2.43\times10^{18}}{10^{9}}\approx2.43\times10^{9}$ seconds $\approx77$ years. Row reduction (Section 3.2) needs only a few thousand operations for the same matrix.
🔬 Research–Teaching NexusResearch-tutored · optional, about 30 minutes
Research question. How fast does the work of cofactor expansion grow with the size of the matrix, and why does no engineering or scientific software use it?
Why it matters. Structural engineers analysing a bridge, climate scientists running a weather model and medical scanners reconstructing a CT image all work with matrices that have thousands or millions of rows. Whether an algorithm takes a second or a billion years depends on how its cost grows with $n$.
What to do.
Let $c(n)$ be the number of multiplications needed to expand an $n\times n$ determinant fully by cofactors. Explain why $c(2)=2$ and $c(n)=n\,c(n-1)+n$ (each of the $n$ entries is multiplied by its cofactor, and each cofactor costs $c(n-1)$).
In a spreadsheet, tabulate $c(n)$ and $n!$ for $n=2,\dots,20$, and the ratio $c(n)/n!$. What number does the ratio approach?
Row reduction (Section 3.2) needs roughly $n^3/3$ multiplications. Add this column and compare the two methods at $n=5,10,20$.
At $10^9$ multiplications per second, find the smallest $n$ for which cofactor expansion takes longer than one day.
Tools: Spreadsheet (or Python); a calculator for factorials.
Hand in: A half-page note with your table, a sentence on how $c(n)$ grows compared with $n^3$, and the answer to step 4.
Going further. Look up how large the matrices are in a finite-element model of a building or an aircraft wing, and estimate how long elimination takes for them on a laptop.
Instructor note: $c(3)=9$, $c(4)=40$, $c(5)=205$, $c(6)=1236$; $c(n)/n!\to e-1\approx1.718$. At $n=20$: $c\approx4.2\times10^{18}$ against $n^3/3\approx2.7\times10^{3}$. One day is $8.64\times10^{13}$ multiplications: $c(16)\approx3.6\times10^{13}$ (under a day) and $c(17)\approx6.1\times10^{14}$, so $n=17$.
🧪 Self-check quiz
0/5 correct
Q1. $\begin{vmatrix}2&3\\1&4\end{vmatrix}=$
Q2. In a $3\times3$ matrix, the cofactor $C_{23}$ equals
Q3. To find $\begin{vmatrix}5&0&2\\1&0&-3\\4&7&6\end{vmatrix}$ with the least work, expand along