Column Space and Null Space#
Every matrix defines two subspaces of special importance: one in the output space , and one in the input space .
Column space. Write the columns of as . The column space is their span:
So is exactly the set of all possible outputs of the map . It is a subspace of (Week 5: span is always a subspace). Its dimension is the rank of — the number of pivot columns, or equivalently the size of any basis drawn from the columns.
Null space. The null space (or nullspace) of is the set of all inputs that map to zero:
It is a subspace of : if and , then and . Geometrically, is the set of directions that “kills.” Algebraically it is the solution set of the homogeneous system .
Worked picture. Take the matrix
The second row is twice the first, so every column is a multiple of ; every lies on that same line — a multiple of . Thus
a one-dimensional subspace of , and . The null space lives in and will turn out to be two-dimensional — we compute it explicitly below.
Solvability of . The equation has a solution if and only if . When a solution exists and is nontrivial, solutions are never unique: if and , then as well. The general solution is a particular solution plus the null space.
Row Space and Left Null Space#
The same two constructions applied to the transpose produce the remaining pair.
Row space. The rows of are the columns of , so the row space is
It is the span of the row vectors of , viewed as vectors in . A fundamental fact from elimination is that row operations do not change the row space, and that
Column rank equals row rank: the number of independent rows equals the number of independent columns.
Left null space. The left null space is the null space of :
Vectors in are orthogonal to every column of (because means is orthogonal to each column). Equivalently, for every , so is orthogonal to the entire column space. That is the seed of the orthogonal complements we will prove carefully in Week 7.
Where each subspace lives.
| Subspace | Symbol | Ambient space | Dimension | | --- | --- | --- | --- | | Column space | | | | | Null space | | | | | Row space | | | | | Left null space | | | |
Two live in (row space and null space) and two live in (column space and left null space). Their dimensions are completely determined by , , and the single number .
Picture. Think of two ambient spaces linked by :
- Domain : row space (dim ) and null space (dim ) sit side by side and will later turn out to be orthogonal complements.
- Codomain : column space (dim ) and left null space (dim ) are the matching pair.
The map sends the row space onto the column space and collapses the null space to .
Computing the Null Space#
To find a basis for , solve by elimination and express the pivot variables in terms of the free variables. Each free variable produces one special solution by setting that free variable to and the others to . Those special solutions form a basis of .
Worked example. Continue with
Row-reduce: subtract times row 1 from row 2 to get
There is one pivot, in column 1, so is a basic (pivot) variable and are free. The single nonzero equation is
Special solution for , :
Special solution for , :
Check: , and similarly . The set is independent (the free-variable identity block in the last two coordinates makes that immediate) and spans every solution, so it is a basis of and .
In general, after reduction to row echelon form with pivots and free variables, you get exactly special solutions — a basis of the null space.
A = [[1,2,3],[2,4,6]] has null space defined by x1 + 2x2 + 3x3 = 0. Setting the free variables x2 = 1 and x3 = 0, what is x1?
The Dimension Formula#
The counts above are not an accident. For any matrix of rank ,
This is the rank–nullity theorem (also called the dimension formula). Equivalently, .
Why it holds. Elimination produces pivot variables and free variables. The free variables parametrize , so . The pivot columns form a basis of , so . Adding these identities gives the formula.
Geometric meaning. The map “uses up” independent input directions (those that produce the -dimensional column space) and “kills” the remaining directions (the null space). Input dimension splits cleanly into range contribution plus kernel:
For the transpose the same theorem says , and since we get — completing the four dimension counts in the table above.
Check on the example. For our matrix, and , so , matching the two special solutions. Also : the left null space is spanned by , because that vector is orthogonal to every column of .
Kernel, Range, and the Four Subspaces#
Week 2 defined a linear transformation by . The four subspaces are the kernel and range of and of under different names.
Range of . By definition,
So the column space is the range (image) of the transformation.
Kernel of . Likewise,
The null space is the kernel. Rank–nullity then reads
the classical form for any linear map between finite-dimensional spaces.
The transpose map. The map given by has range (row space) and kernel (left null space). Everything we said about applies to with the roles of and swapped.
Summary dictionary.
| Transformation language | Matrix language | | --- | --- | | for | | | for | | | | | | | |
Week 7 will add one more structural fact: within , the row space and null space are orthogonal complements of each other, and within the column space and left null space are orthogonal complements. Week 13’s SVD will build orthonormal bases for all four of these spaces at once.
Knowledge check#
The column space C(A) lives in which space, for an m×n matrix A?
Browser lab#
Compute rank and a null-space basis with numpy only (SVD — no scipy). For an matrix of rank , the last right singular vectors (rows of , or columns of ) form an orthonormal basis of . That basis spans the same null space as the special solutions from elimination above, but the individual vectors need not match those special solutions numerically.
import numpy as np
A = np.array([[1., 2., 3.],
[2., 4., 6.]])
# Full SVD: A = U @ diag(S) @ Vt (Vt is V^T)
U, S, Vt = np.linalg.svd(A, full_matrices=True)
rank = np.linalg.matrix_rank(A)
# Right singular vectors for near-zero singular values: last n - rank rows of Vt
ns = Vt[rank:].T # columns form a basis of N(A)
print("rank(A) =", rank)
print("null space basis (columns):\n", ns)
print("A @ ns ≈ 0?", np.allclose(A @ ns, 0))
print("dim N(A) should be n - r =", A.shape[1] - rank)