5.4 Row Space, Column Space, Null Space and Rank
Every matrix carries three subspaces — $\operatorname{Row}A$, $\operatorname{Col}A$ and $\operatorname{Nul}A$ — and one row reduction finds bases for all of them. Their sizes obey $\operatorname{rank}A+\operatorname{nullity}A=n$.
A matrix $A$ is more than a table of numbers. Its columns span a subspace (the outputs $A\mathbf{x}$ can reach), its rows span another, and the solutions of $A\mathbf{x}=\mathbf{0}$ form a third. These three subspaces answer the two big questions about any linear system $A\mathbf{x}=\mathbf{b}$: does a solution exist? (is $\mathbf{b}$ among the reachable outputs?) and how many solutions are there? (how big is the set of inputs that $A$ sends to $\mathbf{0}$?).
The remarkable fact of this section is that a single row reduction to echelon form gives bases for all three subspaces at once, and that their dimensions are tied together by one simple equation, the Rank–Nullity Theorem. Engineers use it to count the independent loops in an electrical network, statisticians to count the parameters a data set can actually determine, and control engineers to decide whether a system can be steered wherever they want.
Three Subspaces of a Matrix
- The column space $\operatorname{Col}A=\operatorname{span}\{\mathbf{a}_1,\dots,\mathbf{a}_n\}=\{A\mathbf{x}:\mathbf{x}\in\mathbb{R}^n\}$, a subspace of $\mathbb{R}^m$.
- The row space $\operatorname{Row}A=\operatorname{span}\{\mathbf{r}_1,\dots,\mathbf{r}_m\}$, a subspace of $\mathbb{R}^n$. (Equivalently, $\operatorname{Row}A=\operatorname{Col}A^{T}$.)
- The null space $\operatorname{Nul}A=\{\mathbf{x}\in\mathbb{R}^n:A\mathbf{x}=\mathbf{0}\}$, a subspace of $\mathbb{R}^n$.
Notice where each space lives: $\operatorname{Col}A$ sits in the output space $\mathbb{R}^m$, while $\operatorname{Row}A$ and $\operatorname{Nul}A$ sit in the input space $\mathbb{R}^n$. Keeping track of this avoids many mistakes.
Throughout this section we use the $4\times5$ matrix $$A=\begin{bmatrix}1&2&0&1&0\\2&4&1&4&0\\-1&-2&1&1&1\\3&6&0&3&2\end{bmatrix}.$$ Row reduction gives $$A\xrightarrow{\substack{R_2\to R_2-2R_1\\R_3\to R_3+R_1\\R_4\to R_4-3R_1}}\begin{bmatrix}1&2&0&1&0\\0&0&1&2&0\\0&0&1&2&1\\0&0&0&0&2\end{bmatrix}\xrightarrow{R_3\to R_3-R_2}\begin{bmatrix}1&2&0&1&0\\0&0&1&2&0\\0&0&0&0&1\\0&0&0&0&2\end{bmatrix}\xrightarrow{R_4\to R_4-2R_3}\begin{bmatrix}1&2&0&1&0\\0&0&1&2&0\\0&0&0&0&1\\0&0&0&0&0\end{bmatrix}=R.$$ This $R$ is already the reduced echelon form. Its pivots are in columns 1, 3 and 5; $x_2$ and $x_4$ are free variables.
A basis for $\operatorname{Nul}A$
Bases for $\operatorname{Col}A$ and $\operatorname{Row}A$
Row operations change the columns of a matrix, so they generally change the column space. What they do not change is the set of linear relations among the columns: $A\mathbf{x}=\mathbf{0}$ and $R\mathbf{x}=\mathbf{0}$ have the same solutions. In $R$ the pivot columns are obviously independent and every other column is a combination of them; the same relations therefore hold among the columns of $A$. Rows behave differently: each row operation replaces rows by combinations of rows, so the row space never changes.
- The pivot columns of $A$ itself (the columns of $A$ in the positions where $U$ has pivots) form a basis of $\operatorname{Col}A$.
- $A$ and $U$ have the same row space, and the nonzero rows of $U$ form a basis of $\operatorname{Row}A$.
- Writing the solution of $A\mathbf{x}=\mathbf{0}$ in parametric vector form gives one vector per free variable, and these vectors form a basis of $\operatorname{Nul}A$.
1. Taking columns of the echelon form for $\operatorname{Col}A$. The echelon form tells you which columns; the vectors must come from the original $A$.
2. Taking rows of $A$ for $\operatorname{Row}A$ without care. The nonzero rows of the echelon form are a safe basis. The rows of $A$ in the same positions need not be: a row swap may have moved them, and a zero row of $U$ can come from any row of $A$.
3. Mixing up where the spaces live. For a $4\times5$ matrix, $\operatorname{Col}A\subseteq\mathbb{R}^4$ but $\operatorname{Nul}A\subseteq\mathbb{R}^5$ and $\operatorname{Row}A\subseteq\mathbb{R}^5$.
Rank and the Rank–Nullity Theorem
In the example, $\dim\operatorname{Col}A=\dim\operatorname{Row}A=3$. That is no coincidence: both equal the number of pivots. The pivots also decide the null space, since every column without a pivot gives a free variable.
- $\dim\operatorname{Col}A=\dim\operatorname{Row}A=$ the number of pivot positions of $A$; consequently $\operatorname{rank}A^{T}=\operatorname{rank}A$.
- $$\operatorname{rank}A+\operatorname{nullity}A=n\quad(\text{the number of columns}).$$
Why. Each of the $n$ columns of the echelon form is either a pivot column or a free column. Pivot columns give the basis of $\operatorname{Col}A$, so there are $\operatorname{rank}A$ of them; free columns give the basis vectors of $\operatorname{Nul}A$, so there are $\operatorname{nullity}A$ of them. The nonzero rows of the echelon form are exactly the rows with a pivot. Since $\operatorname{Row}A=\operatorname{Col}A^{T}$, part 1 also says $A$ and $A^{T}$ have the same rank.
In words: "the dimension of what $A$ reaches, plus the dimension of what $A$ crushes to $\mathbf{0}$, equals the dimension of what goes in." For our $4\times5$ example: $3+2=5$. ✓ Note also that $\operatorname{rank}A\le\min(m,n)$, because there is at most one pivot in each row and each column.
(b) Can a $6\times9$ matrix have nullity $2$?
(c) A $5\times3$ matrix has rank $3$. Describe $\operatorname{Nul}A$ and $\operatorname{Row}A$.
Solving $A\mathbf{x}=\mathbf{b}$: Existence and the Shape of the Solution Set
Because $A\mathbf{x}=x_1\mathbf{a}_1+\dots+x_n\mathbf{a}_n$, asking for a solution of $A\mathbf{x}=\mathbf{b}$ is asking for weights that build $\mathbf{b}$ from the columns. That is a question about $\operatorname{Col}A$. And if two vectors $\mathbf{p}$ and $\mathbf{y}$ both solve the system, then $A(\mathbf{y}-\mathbf{p})=\mathbf{b}-\mathbf{b}=\mathbf{0}$: they differ by a vector of $\operatorname{Nul}A$.
- $A\mathbf{x}=\mathbf{b}$ is consistent if and only if $\mathbf{b}\in\operatorname{Col}A$.
- If $\mathbf{p}$ is any one (particular) solution, then the set of all solutions is $$\{\mathbf{p}+\mathbf{v}_h:\ \mathbf{v}_h\in\operatorname{Nul}A\}.$$ So a consistent system has a unique solution exactly when $\operatorname{Nul}A=\{\mathbf{0}\}$, and otherwise infinitely many.
Geometrically, the solution set of a consistent system is the null space shifted so that it passes through $\mathbf{p}$ — a line, plane, … parallel to $\operatorname{Nul}A$. Interactive 2 shows both halves of the theorem side by side.
The Invertible Matrix Theorem, Extended
For a square matrix the ideas of this chapter join the list of equivalent conditions for invertibility met in Chapters 2 and 3.
- $A$ is invertible.
- $\det A\ne0$.
- $A$ is row equivalent to $I_n$.
- $A\mathbf{x}=\mathbf{b}$ has exactly one solution for every $\mathbf{b}$ in $\mathbb{R}^n$.
- The columns of $A$ form a basis of $\mathbb{R}^n$.
- $\operatorname{Col}A=\mathbb{R}^n$.
- $\operatorname{rank}A=n$.
- $\operatorname{Nul}A=\{\mathbf{0}\}$.
- $\operatorname{nullity}A=0$.
- The rows of $A$ form a basis of $\mathbb{R}^n$ ($\operatorname{Row}A=\mathbb{R}^n$).
The Rank–Nullity Theorem is what links items 7 and 9: for a square matrix, $\operatorname{rank}A=n$ and $\operatorname{nullity}A=0$ are the same statement. In particular, for square matrices only, "the columns span" and "the columns are independent" stand or fall together.
Exercises
- 1 $\begin{bmatrix}1&2\\3&6\end{bmatrix}$
- 2 $\begin{bmatrix}1&0&-1\\2&1&0\\3&1&-1\end{bmatrix}$
- 3 $\begin{bmatrix}1&3&1&2\\2&6&3&7\end{bmatrix}$
- 4 $\begin{bmatrix}1&2&0&-1\\2&4&1&1\\3&6&1&0\end{bmatrix}$
- 5 $\begin{bmatrix}1&-2&0&3&1\\2&-4&1&4&0\\0&0&1&-2&-2\end{bmatrix}$
- 6 $\begin{bmatrix}2&4&-2\\1&3&1\\0&1&2\\1&1&-3\end{bmatrix}$
- 1 $A$ is $5\times7$ with rank $4$. Find $\operatorname{nullity}A$, $\dim\operatorname{Row}A$ and $\dim\operatorname{Col}A$.
- 2 $A$ is $4\times6$ with a $3$-dimensional null space. Find $\operatorname{rank}A$.
- 3 Can a $4\times7$ matrix have a $2$-dimensional null space?
- 4 Can a $6\times4$ matrix have rank $5$?
- 5 Explain why a homogeneous system of $3$ equations in $5$ unknowns always has a solution set of dimension at least $2$.
- 6 $A$ is $6\times8$ and $A\mathbf{x}=\mathbf{b}$ is consistent for every $\mathbf{b}\in\mathbb{R}^6$. Find $\operatorname{nullity}A$.
- 7 $A$ is $7\times5$ with linearly independent columns. Find $\operatorname{rank}A$, $\operatorname{nullity}A$ and describe $\operatorname{Row}A$.
- 8 $A$ is $4\times9$ with rank $3$. Find $\operatorname{rank}A^{T}$ and $\operatorname{nullity}A^{T}$.
- 1 Let $A=\begin{bmatrix}1&2\\2&5\\3&7\end{bmatrix}$. Is $\mathbf{b}=(4,9,13)$ in $\operatorname{Col}A$? If so, write it as a combination of the columns.
- 2 For the same $A$, is $(1,0,0)$ in $\operatorname{Col}A$?
- 3 Let $A=\begin{bmatrix}1&2&-1\\2&4&-2\\1&3&0\end{bmatrix}$. Find the condition on $b_1,b_2,b_3$ for $A\mathbf{x}=\mathbf{b}$ to be consistent, and describe $\operatorname{Col}A$ geometrically.
- 4 For the matrix of part 3, solve $A\mathbf{x}=(1,2,4)$ and write the solution as $\mathbf{p}+\mathbf{v}_h$.
- 5 Write the general solution of the single equation $x_1+2x_2-x_3+x_4=3$ in $\mathbb{R}^4$ as a particular solution plus a combination of a basis of the null space.
- 6 $\mathbf{p}=(1,1,1)$ solves $A\mathbf{x}=\mathbf{b}$ and $\operatorname{Nul}A=\operatorname{span}\{(1,-1,0)\}$. Describe all solutions. Is $(3,-1,1)$ a solution? Is $(2,1,1)$?
- 1 $A$ is $5\times5$ and $\operatorname{Nul}A=\{\mathbf{0}\}$. Is $A\mathbf{x}=\mathbf{b}$ solvable for every $\mathbf{b}\in\mathbb{R}^5$? Explain.
- 2 $A$ is $4\times4$ with rank $3$. Is $A$ invertible? What is $\det A$?
- 3 Use rank to show that the rows of a square matrix are linearly independent if and only if its columns are.
- 4 Electrical network. A circuit has $4$ junctions (nodes) and $5$ wires (edges) with chosen directions $e_1:1\to2$, $e_2:2\to3$, $e_3:3\to1$, $e_4:3\to4$, $e_5:4\to1$. Its incidence matrix (entry $-1$ if the wire leaves the node, $+1$ if it enters) is $$A=\begin{bmatrix}-1&0&1&0&1\\1&-1&0&0&0\\0&1&-1&-1&0\\0&0&0&1&-1\end{bmatrix}.$$ Find $\operatorname{rank}A$ and $\operatorname{nullity}A$.
- 5 For the network of part 4, a vector $\mathbf{x}$ of wire currents (in amperes) with $A\mathbf{x}=\mathbf{0}$ satisfies Kirchhoff's current law (no charge builds up at any node). Find a basis of $\operatorname{Nul}A$ and interpret each basis vector as a loop in the circuit.
- 6 For the same $A$, show that $\mathbf{b}\in\operatorname{Col}A$ forces $b_1+b_2+b_3+b_4=0$, and explain this physically if $b_i$ is the current supplied to node $i$ from outside.
Research question. How many independent flow measurements does a water-distribution network need before every pipe flow is known?
Why it matters. City water utilities, district-heating companies and power-grid operators model their networks with incidence matrices. Flows that conserve water at every junction form $\operatorname{Nul}A$; its dimension (the number of independent loops) tells engineers how many extra flow meters are needed, and the Rank–Nullity Theorem gives that number without solving anything.
What to do.
- Sample case: a small district network has $6$ junctions and $8$ pipes, oriented $1\to2$, $2\to3$, $3\to6$, $6\to5$, $5\to4$, $4\to1$, $2\to5$, $1\to5$. Write its $6\times8$ incidence matrix $A$.
- Compute $\operatorname{rank}A$ (by hand, a spreadsheet, or Python with
sympy.Matrix(A).rank()) and use the Rank–Nullity Theorem to get the number of independent loops. - Find a basis of $\operatorname{Nul}A$ and draw each basis vector as a loop on a sketch of the network.
- Explain why $\operatorname{rank}A$ is always (number of junctions) $-1$ for a connected network, and deduce the formula loops $=$ pipes $-$ junctions $+1$.
Tools: Pencil and paper, spreadsheet or Python (sympy)
Hand in: A half-page report with the matrix, its rank and nullity, a labelled sketch of the loops, and one sentence on how many flow meters (beyond junction balances) the utility needs.
Going further. Find a published map of a real district network (many cities publish simplified ones) and estimate its number of loops. Look up how the same count appears in Euler's formula for planar graphs.
🧪 Self-check quiz
Q1. A $4\times6$ matrix has rank $4$. Its nullity is
Q2. A basis for $\operatorname{Col}A$ is given by
Q3. The system $A\mathbf{x}=\mathbf{b}$ is consistent exactly when
Q4. A $3\times5$ matrix $A$ has rank $2$. Then $\operatorname{rank}A^{T}$ is
Q5. If two solutions of $A\mathbf{x}=\mathbf{b}$ are $\mathbf{p}$ and $\mathbf{q}$, then $\mathbf{q}-\mathbf{p}$ lies in