Unit 4, lesson 18

Kernel, Image and Rank-Nullity

How the kernel and image of a linear map record lost and reached directions, why rank plus nullity equals the input dimension, and what this says about injective and surjective maps, fibers and compositions.

  • Video 18
  • Kernel, Image and Rank-Nullity

The linear map that sends (x,y,z)(x, y, z) to (x+z,y+z)(x + z, y + z) gives the same output (4,5)(4, 5) for the inputs (1,2,3)(1, 2, 3) and (2,3,2)(2, 3, 2), where each tuple stands for a column vector. Three input numbers go in and only two come out, so some information is lost, but it is lost along a definite direction. This lesson names the inputs a map sends to zero and the outputs it can reach, and proves that their dimensions always add up to the dimension of the input space. The kernel, the image and that count together decide when a map can be one-to-one or onto, describe the full solution set of a linear system, and limit what can happen when maps are composed.

Key terms

Kernel

Definition Let T ⁣:Rn→RmT \colon \mathbb{R}^n \to \mathbb{R}^m be a linear map. The kernel of TT is the set of inputs that TT sends to the zero vector,

ker⁡T={x∈Rn∣T(x)=0}.\ker T = \{\mathbf{x} \in \mathbb{R}^n \mid T(\mathbf{x}) = \mathbf{0}\}.

It is a subspace of the input space Rn\mathbb{R}^n. It contains 0\mathbf{0} because T(0)=0T(\mathbf{0}) = \mathbf{0}, and if u\mathbf{u} and v\mathbf{v} lie in it, then T(au+bv)=aT(u)+bT(v)=0T(a\mathbf{u} + b\mathbf{v}) = aT(\mathbf{u}) + bT(\mathbf{v}) = \mathbf{0} for all real aa and bb. Its dimension dim⁡ker⁡T\dim \ker T is the nullity of TT. When T(x)=AxT(\mathbf{x}) = A\mathbf{x} for a real m×nm \times n matrix AA, the kernel is the null space, ker⁡T=Null⁡A\ker T = \operatorname{Null} A.

In plain words The kernel collects the input directions the map cannot see. Moving an input along a kernel vector never changes its output.

Example Let T(x)=AxT(\mathbf{x}) = A\mathbf{x} with

A=[101011],A = \begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \end{bmatrix},

so that T(x,y,z)=(x+z,y+z)T(x, y, z) = (x + z, y + z). The kernel is the solution set of x+z=0x + z = 0 and y+z=0y + z = 0. With z=tz = t free, both xx and yy equal −t-t, so

ker⁡T=span⁡{h},h=[−1−11],\ker T = \operatorname{span}\{\mathbf{h}\}, \qquad \mathbf{h} = \begin{bmatrix} -1 \\ -1 \\ 1 \end{bmatrix},

and the nullity is 11. The two inputs from the opening differ by (2,3,2)−(1,2,3)=(1,1,−1)=−h(2, 3, 2) - (1, 2, 3) = (1, 1, -1) = -\mathbf{h}, which lies in the kernel. That is why their outputs agree.

Image

Definition The image of a linear map T ⁣:Rn→RmT \colon \mathbb{R}^n \to \mathbb{R}^m is the set of outputs it actually reaches,

im⁡T={T(x)∣x∈Rn}.\operatorname{im} T = \{T(\mathbf{x}) \mid \mathbf{x} \in \mathbb{R}^n\}.

It is a subspace of the codomain Rm\mathbb{R}^m, since 0=T(0)\mathbf{0} = T(\mathbf{0}) is reached and a combination aT(u)+bT(v)=T(au+bv)aT(\mathbf{u}) + bT(\mathbf{v}) = T(a\mathbf{u} + b\mathbf{v}) of reached outputs is reached again. Its dimension is the rank of TT, written rank⁡T\operatorname{rank} T. For T(x)=AxT(\mathbf{x}) = A\mathbf{x} the image is the column space, im⁡T=Col⁡A\operatorname{im} T = \operatorname{Col} A, so rank⁡T=rank⁡A\operatorname{rank} T = \operatorname{rank} A. The codomain is the declared output space, and the image can be a proper subspace of it.

In plain words The image is everything the map can produce. The codomain is only the space where its outputs are allowed to live.

Example For the matrix AA above every pair (a,b)(a, b) is reached, because T(a,b,0)=(a,b)T(a, b, 0) = (a, b). So im⁡T=R2\operatorname{im} T = \mathbb{R}^2 and rank⁡T=2\operatorname{rank} T = 2. Compare the transpose, which sends R2\mathbb{R}^2 to R3\mathbb{R}^3,

C=A⊤=[100111],C[ab]=[aba+b].\begin{gathered} C = A^{\top} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \\ 1 & 1 \end{bmatrix}, \\[0.4em] C\begin{bmatrix} a \\ b \end{bmatrix} = \begin{bmatrix} a \\ b \\ a + b \end{bmatrix}. \end{gathered}

Its image is the plane of vectors in R3\mathbb{R}^3 whose third entry is the sum of the first two. That plane has dimension 22, so it is not all of R3\mathbb{R}^3. The vector (1,2,0)(1, 2, 0), for instance, is never reached.

Rank-nullity theorem

Definition Let T ⁣:Rn→RmT \colon \mathbb{R}^n \to \mathbb{R}^m be a linear map. Then

rank⁡T+dim⁡ker⁡T=n,\operatorname{rank} T + \dim \ker T = n,

the dimension of the input space. For a real m×nm \times n matrix AA this reads rank⁡A+dim⁡Null⁡A=n\operatorname{rank} A + \dim \operatorname{Null} A = n. The same statement, with the same proof, holds for a linear map from any finite-dimensional vector space, with nn replaced by the dimension of that space.

The proof uses an adapted basis. Choose a basis u1,…,uk\mathbf{u}_1, \dots, \mathbf{u}_k of ker⁡T\ker T and extend it to a basis u1,…,uk,v1,…,vn−k\mathbf{u}_1, \dots, \mathbf{u}_k, \mathbf{v}_1, \dots, \mathbf{v}_{n-k} of Rn\mathbb{R}^n, which is always possible in finite dimension. The vectors T(v1),…,T(vn−k)T(\mathbf{v}_1), \dots, T(\mathbf{v}_{n-k}) span im⁡T\operatorname{im} T, because writing any x\mathbf{x} in the full basis and applying TT removes every ui\mathbf{u}_i term. They are also independent. If d1T(v1)+⋯+dn−kT(vn−k)=0d_1T(\mathbf{v}_1) + \cdots + d_{n-k}T(\mathbf{v}_{n-k}) = \mathbf{0}, then d1v1+⋯+dn−kvn−kd_1\mathbf{v}_1 + \cdots + d_{n-k}\mathbf{v}_{n-k} lies in ker⁡T\ker T, so it equals some combination of the ui\mathbf{u}_i, and independence of the full basis forces every djd_j to be 00. Hence rank⁡T=n−k\operatorname{rank} T = n - k. In elimination terms, an m×nm \times n matrix with rr pivot columns has rank rr and n−rn - r free variables, one kernel basis vector for each.

In plain words The nn directions of an adapted basis split into those lost in the kernel and those that survive as independent output directions, and none is counted twice. The total is the input dimension nn, not the output dimension mm.

Example For T(x,y,z)=(x+z,y+z)T(x, y, z) = (x + z, y + z) the rank is 22 and the nullity is 11, and 2+1=32 + 1 = 3. An adapted basis shows the split. Take the kernel vector h=(−1,−1,1)\mathbf{h} = (-1, -1, 1) together with e1\mathbf{e}_1 and e2\mathbf{e}_2. Every input decomposes as

[xyz]=z h+(x+z) e1+(y+z) e2.\begin{aligned} \begin{bmatrix} x \\ y \\ z \end{bmatrix} &= z\,\mathbf{h} + (x + z)\,\mathbf{e}_1 \\[0.4em] &\quad + (y + z)\,\mathbf{e}_2. \end{aligned}

Applying TT removes the h\mathbf{h} term and leaves (x+z)T(e1)+(y+z)T(e2)(x + z)T(\mathbf{e}_1) + (y + z)T(\mathbf{e}_2), where T(e1)=(1,0)T(\mathbf{e}_1) = (1, 0) and T(e2)=(0,1)T(\mathbf{e}_2) = (0, 1) form a basis of the image.

Injective and surjective maps

Definition A map T ⁣:Rn→RmT \colon \mathbb{R}^n \to \mathbb{R}^m is injective, or one-to-one, if T(x)=T(y)T(\mathbf{x}) = T(\mathbf{y}) implies x=y\mathbf{x} = \mathbf{y}. A linear map is injective exactly when ker⁡T={0}\ker T = \{\mathbf{0}\}. If the kernel is {0}\{\mathbf{0}\} and T(x)=T(y)T(\mathbf{x}) = T(\mathbf{y}), then T(x−y)=0T(\mathbf{x} - \mathbf{y}) = \mathbf{0}, so x=y\mathbf{x} = \mathbf{y}. If some nonzero k\mathbf{k} lies in the kernel, then k\mathbf{k} and 0\mathbf{0} have the same output.

The map is surjective onto Rm\mathbb{R}^m, or onto, if every b\mathbf{b} in Rm\mathbb{R}^m equals T(x)T(\mathbf{x}) for some x\mathbf{x}. That means im⁡T=Rm\operatorname{im} T = \mathbb{R}^m, or equivalently rank⁡T=m\operatorname{rank} T = m. By rank-nullity, a linear TT is injective exactly when rank⁡T=n\operatorname{rank} T = n. Since the rank is at most mm and at most nn, an injective linear map needs n≤mn \le m and a surjective one needs n≥mn \ge m. When n=mn = m, injective and surjective are equivalent, because each one says that the rank equals nn.

In plain words Injective means the map loses nothing, so no two inputs collide. Surjective means it misses nothing in the stated codomain. The first is a question about the kernel, the second a question about the image.

Example The map T(x)=AxT(\mathbf{x}) = A\mathbf{x} from R3\mathbb{R}^3 to R2\mathbb{R}^2 above is surjective but not injective, since every pair is reached and the nonzero vector h\mathbf{h} goes to 0\mathbf{0}. The transpose CC, as a map from R2\mathbb{R}^2 to R3\mathbb{R}^3, is injective, since C(a,b)=0C(a, b) = \mathbf{0} forces a=b=0a = b = 0, but it is not surjective. Both have rank 22. Their nullities are 11 and 00 because their input dimensions are 33 and 22. No linear map from R4\mathbb{R}^4 to R2\mathbb{R}^2 can be injective, since its rank is at most 22 and so its nullity is at least 4−2=24 - 2 = 2. Such a map can still be surjective.

Fiber of a linear map

Definition Let T ⁣:Rn→RmT \colon \mathbb{R}^n \to \mathbb{R}^m be linear and let b\mathbf{b} be a vector in Rm\mathbb{R}^m. The fiber of TT over b\mathbf{b} is the set of inputs with output b\mathbf{b},

{x∈Rn∣T(x)=b},\{\mathbf{x} \in \mathbb{R}^n \mid T(\mathbf{x}) = \mathbf{b}\},

which is the solution set of T(x)=bT(\mathbf{x}) = \mathbf{b}. It is empty when b\mathbf{b} is not in im⁡T\operatorname{im} T. If xp\mathbf{x}_p is any one vector in it, then the fiber is the translated kernel

xp+ker⁡T={xp+k∣k∈ker⁡T}.\mathbf{x}_p + \ker T = \{\mathbf{x}_p + \mathbf{k} \mid \mathbf{k} \in \ker T\}.

Every such vector is a solution, since T(xp+k)=b+0=bT(\mathbf{x}_p + \mathbf{k}) = \mathbf{b} + \mathbf{0} = \mathbf{b}. Conversely, any solution x\mathbf{x} satisfies T(x−xp)=b−b=0T(\mathbf{x} - \mathbf{x}_p) = \mathbf{b} - \mathbf{b} = \mathbf{0}, so x−xp\mathbf{x} - \mathbf{x}_p lies in the kernel. The fiber over 0\mathbf{0} is the kernel itself. A fiber over b≠0\mathbf{b} \ne \mathbf{0} is not a subspace, because it does not contain 0\mathbf{0}.

In plain words All the inputs that share one output form a parallel copy of the kernel, shifted by any one of those inputs. Every nonempty fiber has the same shape and dimension as the kernel, and only the fiber over zero passes through the origin.

Example For T(x,y,z)=(x+z,y+z)T(x, y, z) = (x + z, y + z) and b=(4,5)\mathbf{b} = (4, 5), one solution is xp=(4,5,0)\mathbf{x}_p = (4, 5, 0). The fiber is the line of all vectors

[450]+t[−1−11]=[4−t5−tt]\begin{bmatrix} 4 \\ 5 \\ 0 \end{bmatrix} + t\begin{bmatrix} -1 \\ -1 \\ 1 \end{bmatrix} = \begin{bmatrix} 4 - t \\ 5 - t \\ t \end{bmatrix}

with tt real. The opening inputs (1,2,3)(1, 2, 3) and (2,3,2)(2, 3, 2) are the points with t=3t = 3 and t=2t = 2. The line misses the origin, as it must, since the origin goes to (0,0)(0, 0).

Rank of a composition

Definition Let T ⁣:Rn→RmT \colon \mathbb{R}^n \to \mathbb{R}^m and S ⁣:Rm→RpS \colon \mathbb{R}^m \to \mathbb{R}^p be linear, so that SS can receive the outputs of TT and the composition S∘TS \circ T is defined. Then

ker⁡T⊆ker⁡(S∘T),rank⁡(S∘T)≤min⁡(rank⁡S,rank⁡T).\begin{gathered} \ker T \subseteq \ker (S \circ T), \\[0.4em] \operatorname{rank}(S \circ T) \le \min(\operatorname{rank} S, \operatorname{rank} T). \end{gathered}

The first statement holds because T(k)=0T(\mathbf{k}) = \mathbf{0} gives S(T(k))=S(0)=0S(T(\mathbf{k})) = S(\mathbf{0}) = \mathbf{0}. For the rank, every output of S∘TS \circ T lies in im⁡S\operatorname{im} S, so rank⁡(S∘T)≤rank⁡S\operatorname{rank}(S \circ T) \le \operatorname{rank} S. If w1,…,wr\mathbf{w}_1, \dots, \mathbf{w}_r is a basis of im⁡T\operatorname{im} T, then every output S(T(x))S(T(\mathbf{x})) is a combination of S(w1),…,S(wr)S(\mathbf{w}_1), \dots, S(\mathbf{w}_r), so rank⁡(S∘T)≤r=rank⁡T\operatorname{rank}(S \circ T) \le r = \operatorname{rank} T. In matrix form, rank⁡(MA)≤min⁡(rank⁡M,rank⁡A)\operatorname{rank}(MA) \le \min(\operatorname{rank} M, \operatorname{rank} A) whenever the product MAMA is defined.

In plain words A later map cannot bring back a direction that an earlier map has already lost. At best it keeps every direction that is left, and it may lose more.

Example Follow T(x,y,z)=(x+z,y+z)T(x, y, z) = (x + z, y + z) by S(a,b)=a−bS(a, b) = a - b. Then (S∘T)(x,y,z)=(x+z)−(y+z)=x−y(S \circ T)(x, y, z) = (x + z) - (y + z) = x - y, and in matrices

[1−1][101011]=[1−10].\begin{bmatrix} 1 & -1 \end{bmatrix}\begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \end{bmatrix} = \begin{bmatrix} 1 & -1 & 0 \end{bmatrix}.

The composition has rank 11, below rank⁡T=2\operatorname{rank} T = 2. Its kernel is the plane x=yx = y, spanned by (1,1,0)(1, 1, 0) and (0,0,1)(0, 0, 1), and this plane contains ker⁡T\ker T, since h=(−1,−1,1)\mathbf{h} = (-1, -1, 1) has equal first and second entries.

Check yourself

  1. Let T(x)=AxT(\mathbf{x}) = A\mathbf{x} with the matrix below. Find a basis of ker⁡T\ker T, the rank and the nullity, and decide whether TT is injective or surjective.
A=[12−124−2]A = \begin{bmatrix} 1 & 2 & -1 \\ 2 & 4 & -2 \end{bmatrix}
Show the answer

The second row is twice the first, so the kernel is the solution set of x+2y−z=0x + 2y - z = 0. With y=sy = s and z=tz = t free, x=−2s+tx = -2s + t, so

[xyz]=s[−210]+t[101].\begin{bmatrix} x \\ y \\ z \end{bmatrix} = s\begin{bmatrix} -2 \\ 1 \\ 0 \end{bmatrix} + t\begin{bmatrix} 1 \\ 0 \\ 1 \end{bmatrix}.

The vectors (−2,1,0)(-2, 1, 0) and (1,0,1)(1, 0, 1) form a basis of the kernel, and the nullity is 22. Every column is a multiple of (1,2)(1, 2), so the image is the line spanned by (1,2)(1, 2) and the rank is 11. The count 1+2=31 + 2 = 3 agrees with rank-nullity. The map is not injective, because its kernel is not {0}\{\mathbf{0}\}, and not surjective, because its rank 11 is less than 22.

  1. A linear map T ⁣:R5→R3T \colon \mathbb{R}^5 \to \mathbb{R}^3 has a kernel of dimension 22. Is TT surjective? Can S∘TS \circ T be injective for some linear map S ⁣:R3→R5S \colon \mathbb{R}^3 \to \mathbb{R}^5?
Show the answer

Rank-nullity uses the input dimension, so rank⁡T=5−2=3\operatorname{rank} T = 5 - 2 = 3. That equals the dimension of the codomain R3\mathbb{R}^3, so TT is surjective. Subtracting the nullity from the output dimension, which would give 3−2=13 - 2 = 1, is the common mistake here. The composition can never be injective, whatever SS is, because ker⁡T⊆ker⁡(S∘T)\ker T \subseteq \ker(S \circ T) and ker⁡T\ker T already has dimension 22.

  1. For the matrix of question 1, describe the fiber over (3,6)(3, 6) and explain why the fiber over (3,5)(3, 5) is empty.
Show the answer

Over (3,6)(3, 6) the second equation is twice the first, so only x+2y−z=3x + 2y - z = 3 remains. One solution is (3,0,0)(3, 0, 0), and the fiber is the translated kernel

[300]+s[−210]+t[101]\begin{bmatrix} 3 \\ 0 \\ 0 \end{bmatrix} + s\begin{bmatrix} -2 \\ 1 \\ 0 \end{bmatrix} + t\begin{bmatrix} 1 \\ 0 \\ 1 \end{bmatrix}

with ss and tt real, a plane parallel to the kernel that does not pass through the origin. Over (3,5)(3, 5) the first equation says x+2y−z=3x + 2y - z = 3, and the second then requires 2⋅3=52 \cdot 3 = 5, which is false. In other words, the vector (3,5)(3, 5) is not a multiple of (1,2)(1, 2), so it is not in the image and nothing maps to it.

How this lesson connects