The course has already used the image and the kernel under other names. The column space appeared in the treatment of subspaces; the solution set of , in the description of the general solution of a system. This lesson gathers them under the point of view of the linear map, where they cease to be two independent constructions and become the two halves of a single identity.
The two questions
Let be a linear map. Two subspaces describe it completely.
The image is what reaches:
The kernel is what annihilates:
Both are subspaces, and the verification follows immediately from linearity. The kernel always contains , since ; if then . The image contains for the same reason, and is closed under combinations because .
For a matrix , which represents a map , the image is the span of the columns and the kernel is the solution set of the homogeneous system. They live in different spaces: the kernel in the domain, the image in the codomain.
The kernel measures ambiguity
Defining the kernel as the set of vectors sent to zero is correct but deceptively narrow. Its actual content is the following. If , then
and therefore . The converse is equally direct. The conclusion is an equivalence:
The kernel is not a set of special vectors: it is the complete list of the confusions the map commits. Two inputs become indistinguishable at the output exactly when their difference falls in the kernel. Hence the familiar criterion, which now appears as a particular case: is injective if and only if , because only then can two inputs agree at the output solely by having been equal to begin with.
This reading is the one that matters in machine learning. A linear layer with a non-trivial kernel discards information irreversibly, and does so by a precise rule: it discards exactly the directions of the kernel. No later layer can recover them, because they never arrived.
The rank-nullity theorem
The dimensions of these two subspaces are not independent. They are bound by an exact identity.
The proof explains why. Let be a basis of the kernel, with . Being an independent set in , it extends to a full basis of . The images then span the image —since the contribute zero— and are independent: a vanishing combination places in the kernel, which forces it to be a combination of the , and independence of the full basis forces . There are therefore exactly of them.
The statement is a conservation law. The domain contributes dimensions and none of them is lost from view: each is either transmitted to the image or crushed against the kernel. Raising the rank requires shrinking the kernel by the same amount.
2 + 3 = 5 · rank(A) + dim ker(A) = n
The blocks are sized by the dimension they hold. The rank can exceed neither n nor m.
- row space → image, one to one
- kernel → 0
- left null space: never reached
The figure records two consequences the statement leaves implicit. The first is that the rank is bounded by both dimensions, : a wide matrix necessarily has a kernel, and a tall matrix necessarily leaves part of the codomain unreached. The second is that the two lower blocks are of different natures. The kernel describes information that goes in and does not come out; the lower right block describes outputs the system never produces, and is the reason may fail to have a solution.
The two orthogonal decompositions
The theorem admits a finer reading, which additionally explains why it holds. Consider the condition written row by row: the product of each row of with is zero. That is, is orthogonal to every row, and hence to the whole subspace they span:
This is not an approximate relation nor an analogy: it is the definition of the matrix product read another way. Since a subspace and its orthogonal complement add up to the whole space,
Applying the same to , whose row space is the column space of , yields the decomposition of the codomain:
Rank-nullity is now a corollary. The first decomposition gives , and the theorem equating row rank with column rank —treated in the lesson on rank— identifies the first summand with .
The structure of the map is also now clear: restricted to the row space, is a bijection onto its image. That is the solid arrow in the figure above. Everything does of interest happens between two subspaces of dimension ; the rest is annihilation on one side and inaccessibility on the other.
The four bases
The singular value decomposition delivers orthonormal bases of all four subspaces at once. If has rank , the first columns of span the row space and the remaining span the kernel; the first columns of span the image and the remaining span .
A concrete example. Let
whose third row is the first plus , and whose second is twice the first plus the same vector. The relation leaves the rank at .
import numpy as np
A = np.array([[1, 2, 3, 4],
[2, 4, 7, 10],
[1, 2, 4, 6]], dtype=float)
U, s, Vt = np.linalg.svd(A)
r = np.linalg.matrix_rank(A) # 2
kernel = Vt[r:].T # 4 × 2
left = U[:, r:] # 3 × 1
print(np.abs(A @ kernel).max()) # ≈ 1e-15
print(np.abs(left.T @ A).max()) # ≈ 1e-15
The non-zero singular values are and ; an independent check: . The count matches on both sides: in the domain and in the codomain.
The bases returned by the decomposition are orthonormal but are not the only possible ones. Solving the homogeneous system by hand gives the integer basis
and the relation among the rows identifies . These span the same subspaces; what the decomposition adds is orthonormality and numerical stability.
On that last point a warning already stated in the lesson on linear independence applies. Obtaining the singular values through squares the conditioning: in this very example that route returns instead of zero, large enough that a poorly chosen threshold would count a rank of that does not exist. np.linalg.svd operates directly on and does not incur that loss.
The minimum-norm solution
The lesson on the particular and general solution established that the solution set of is . The orthogonal decomposition pins down which of those infinitely many solutions is distinguished: exactly one of them belongs to the row space.
The dashed line is the kernel; the solid one, the solution set. Drag the row of A or slide t.
‖x‖ = 1.66 · ‖x†‖ = 0.89
‖x‖² = ‖x†‖² + t² · 2.76 = 0.80 + 1.96
Every point on the line solves Ax = b; only one lies in the row space. ✓
The argument is the Pythagorean theorem. Written as with and , orthogonality of the two summands gives
so the norm is minimal precisely when . The minimum-norm solution is the row-space component, and it is what the pseudoinverse returns.
For and , the computation gives , with norm . The alternative solution satisfies the same system and has norm .
A = np.array([[1, 1, 1, 1],
[1, 2, 3, 4]], dtype=float)
b = np.array([4.0, 10.0])
x = np.linalg.pinv(A) @ b # [1. 1. 1. 1.]
The relevance to machine learning is the following. A model with more parameters than data poses an underdetermined system, and the set of parameters that fit the training set is an entire affine subspace. Which element of that set is obtained depends on the algorithm, not on the problem. Gradient descent initialised at zero on a linear least-squares problem converges to the minimum-norm solution, because every update is a combination of rows of and the iterate never leaves the row space. It is an implicit bias towards the smallest solution, imposed by the geometry of the optimiser rather than by an explicit regularisation term.
What a layer loses
Rank-nullity turns architecture design into arithmetic. A projection from to dimensions has rank at most , so its kernel has dimension at least : seven hundred and four independent directions of the input space become indistinguishable on passing through it.
W = np.random.randn(64, 768)
r = np.linalg.matrix_rank(W) # 64
print(W.shape[1] - r) # 704
Two qualifications prevent extracting more from this than it says. The first is that a network with non-linear activations is not a linear map, and the count applies layer by layer, not to the composition: the bound it produces is necessary, not sufficient, and the lesson on linear maps already showed that without activations the composition collapses into a single matrix. The second is that numerical rank is a binary answer to a continuous question, as treated in the lesson on linear independence: a direction with singular value formally counts inside the image and survives the passage, but lies buried under the noise of the floating-point representation and under the noise of the data themselves.
With those reservations, the claim that does hold is structural in character. Information loss in a linear layer is neither diffuse nor gradual: it has a direction, a subspace and an exact dimension, and all three are computable before anything is trained.
Exercise. Build a matrix of rank as the product of random and matrices. Obtain bases of the four subspaces with np.linalg.svd and verify numerically the four orthogonality and annihilation relations. Then check that np.linalg.lstsq returns, for a in the image, the smallest-norm solution among several obtained by adding kernel vectors to it.