# Kernels or Null Spaces

Throughout this section, we consider an*m*-by-

*n*matrices as transformations from

*n*-dimensional Euclidean vector space \( \mathbb{R}^n \) into another space \( \mathbb{R}^m . \) Any linear transformation \( T:\,U \to V \) between two finite dimensional vector spaces can be represented by a matrix when appropriate ordered bases in

*U*and

*V*are choisen. Most because of this dual role of matrices, the following definition introduces two terms for the same object: kernel is usually used in the theory of transformations and functional analysis, and nullspace in matrix theory.

Let **A** be an \( m \times n \)
matrix. The set of all (column) vectors
**x** of length *n* that satisfy the linear equation
\( {\bf A}\,{\bf x} = {\bf 0} , \)
where **0** is the *m*-dimensional column vector of zeroes,
forms a subset of
\( \mathbb{R}^n . \) This subset is nonempty
because it clearly contains the zero vector:
**x** = **0** always satisfies
\( {\bf A}\,{\bf x} = {\bf 0} . \)
This subset actually forms a subspace of
\( \mathbb{R}^n , \) called the
**kernel** (or **nullspace**) of the matrix
**A** and denoted ker(**A**).

Let's suppose that the matrix **A** represents a physical system.
As an example, let's assume our system is a rocket, and **A** is a matrix
representing the directions we can go based on our thrusters. Let's suppose
that we have three thrusters equally spaced around our rocket. If they're all
perfectly functional then we can move in any direction. But what happens when
a thruster breaks? Now we've only got two thrusters. The null space are the
set of thruster intructions that completely waste fuel. They're the set of
instructions where our thrusters will thrust, but the direction will not be
changed at all.

Another example: Perhaps **A** can represent a rate of return on
investments. The range are all the rates of return that are achievable. The
null space are all the investments that can be made that wouldn't change the
rate of return at all.

Another example: room illumination. The range of **A** represents the area of the room that can be illuminated.
The null space of **A** represents the power we can apply to lamps that don't change the illumination in the room
at all.

**Theorem:** Let *V* and
*U* be vector spaces and \( T:\,U \to V \) be
linear transformation. Then the set of all vectors that are mapped into the
zero vector (such set is called the kernel of transformation *T*) is a
subspace of *U*.

**u**and

**v**be arbitrary elements from the kernel of

*T*, then

*T*(

**u**) =

**0**and

*T*(

**v**) =

**0**, where

**0**is zero vector from

*V*. Since

*T*is a linear transformation, we get

*k*be a scalar, then

**Observation: ** Elementary row
operations do not change the null space of a matrix.

The dimension of the kernel (null space) of a matrix **A** is called the
**nullity** of
**A** and is denoted by nullity(**A**) = *n* - *r*, where
*r* is rank of matrix **A**.

**Theorem:** Nullity of a matrix
**A** is the number of free variables in its reduced row echelon
(Gauss--Jordan) form.

**Theorem: **
Let *T*: *U* ↦ *V* be a linear transformation from *n*
dimensional vector space *U* into *m*
dimensional vector space *V*. If { **v**_{1},
**v**_{2}, ... , **v**_{k} } is a basis for
ker(*T*), then there exist vectors **v**_{k+1},
**v**_{k+2}, ... , **v**_{n} so that
{ **v**_{1},
**v**_{2}, ... , **v**_{n} } is a basis for *U* and
{ *T*(**v**_{k+1}),
*T*(**v**_{k+2}), ... , *T*(**v**_{n}) } is a
basis for the range of *T*.

*U*is ker(

*T*) so there exist vectors

**v**

_{k+1},

**v**

_{k+2}, ... ,

**v**

_{n}so that {

**v**

_{1},

**v**

_{2}, ... ,

**v**

_{n}} is a basis for

*U*. next, if

**v**is in

*U*, then it can be expressed in terms of the basis {

**v**

_{1},

**v**

_{2}, ... ,

**v**

_{n}}; we have

*T*is a linear transformation and

*T*(

**v**

_{1}) =

*T*(

**v**

_{2}) = ... =

*T*(

**v**

_{k}) =

**0**

_{V}. Thus the image of any vector

**v**from

*U*is in span{

*T*(

**v**

_{k+1}),

*T*(

**v**

_{k+2}) , ... ,

*T*(

**v**

_{n}) } and hence

*T*(

**v**

_{k+1}),

*T*(

**v**

_{k+2}) , ... ,

*T*(

**v**

_{n}) spans the image of

*T*. It remains to show that {

*T*(

**v**

_{k+1}),

*T*(

**v**

_{k+2}) , ... ,

*T*(

**v**

_{n}) } is linearly independent. We proceed as follows.

Suppose that

*T*is a linear transformation, we have

*T*); hence this linear combination of vectors must be the sero vector. Since {

**v**

_{k+1},

**v**

_{k+2}, ... ,

**v**

_{n}} is a linearly independent set, the only way

*b*

_{k+1}=

*b*

_{k+2}= ... =

*b*

_{n}= 0. Hence {

*T*(

**v**

_{k+1}),

*T*(

**v**

_{k+2}) , ... ,

*T*(

**v**

_{n}) } is a linearly independent set. Since these vectors both span the range of

*T*and is linearly independent, it is a basis.

**Example:**Define \( T:\,\mathbb{R}^3 \to \mathbb{R}^2 \) by

**Example:**The set of solutions of the homogeneous system

*x*

_{3}be free variables, the second equation directly implies

*x*

_{2}:

*Mathematica*

```
NullSpace[{{1,2,3},{4,5,6}}]
```

**Example:**Consider two square matrices

**A**consists of all vectors

**x**such that \( {\bf A} \, {\bf x} = {\bf 0} . \) We perform the following elementary row operations on

**A**and

**B**:

**A**, the second row implies that \( x_2 =0 , \) and back substituting this into the first row implies that \( x_1 =0 . \) Since the only solution of

**A x**=

**0**is

**x**=

**0**, the kernel of

**A**consists of the zero vector alone. This subspace, { 0 }, is called the

**trivial subspace**(of \( \mathbb{R}^2 \) ).

For matrix **B**, we have the only one equation

**Example:**Let us consider \( 4 \times 3 \) matrix:

```
A = {{1, 2, 5}, {3, -1, 2}, {-1, 4, 1}, {2, 3, -2}}
MatrixRank[A]
```

```
A // TraditionalForm
```

```
R = RowReduce[A]
```

**Example:**Consider the matrix of rank 3:

```
A = {{1, 2, 3, 6, 0}, {2, 1, 2, 7, 2}, {4, -1, 5, 19, 11}, {5, -2, -3, 6, 6}}
MatrixRank[A]
```

*Mathematica*:

```
R = RowReduce[A]
```

**F**is the 3-by-2 matrix defined above.

```
F = Take[R, {1, 3}, {4, 5}]
```

*Mathematica*:

```
A.{{-2}, {1}, {-2}, {1}, {0}}
A.{{-1}, {2}, {-1}, {0}, {1}}
```

**v**

_{1}and

**v**

_{2}are linearly independent (having zeroes in different components), they form a basis for the null space of matrix

**A**. ■

Theorem: Suppose that *m*-by-*n*
matrix **A** of rank *r*, when reduced to row echelon form
(without row excjange), has the first *r* rows or columns as pivots, so
it is reduced to the upper triangular form

**I**

_{r}is the identity square matrix of size

*r*, \( {\bf F}_{r \times (n-r)} \) is the \( r \times (n-r) \) matrix, and

**0**are zero matrices. Then the kernel of the matrix

**A**is spanned on column vectors of the matrix

**Theorem: ** Let *V* and
*U* be vector spaces and \( T:\,U \to V \) be
a linear transformation. Then *T* is one-to-one if and only if its
kernel is zero: ker(*T*) = {**0**_{U}} or, which is equivalent,
if and only if the dimension of the kernel is zero. ■

*T*is one-to-one, and let

**v**∈ ker(

*T*). We must show that

**v**=

**0**

_{V}. Now,

*T*(

**v**) =

**0**

_{U}. However,

*T*is a linear transformation and it maps zero vector into zero vector, so

*T*(

**0**) =

**0**

_{U}. Because

*T*(

**v**) =

*T*(

**0**) =

**0**

_{U}and

*T*is one-to-one, we must have

**v**=

**0**

_{V}.

Conversely, suppose that ker(*T*) = {**0**_{U}}. We must show
that *T* is one-to-one. Let **v**_{1}, **v**_{2}
∈ *V*, with *T*(**v**_{1}) =
*T*(**v**_{2}). We must show that **v**_{1} =
**v**_{2}. Since *T*(**v**_{1}) -
*T*(**v**_{2}) = *T*(**v**_{1} -
**v**_{2}) = **0**_{U}, we conclude that
*T*(**v**_{1} -
**v**_{2}) = **0**_{U}. However, then
**v**_{1} - **v**_{2} ∈ ket(*T*), by
definition of the kernel. Because ker(*T*) = {**0**_{U}},
we derive that **v**_{1} - **v**_{2} =
**0**_{V} and so **v**_{1} = **v**_{2}.

**Example:**Let us find the kernel of the 4-by-6 matrix

*Mathematica*:

```
A = {{1, 2, 3, -2, -1, 2}, {2, -1, 2, 3, 2, -3}, {3, 1, 2, -1,
3, -5}, {5, 5, 5, -7, 7, -4}}
A2 = A;
A2[[2]] += (-2)*A2[[1]]
A2[[3]] += (-3)*A2[[1]]
A2[[4]] += (-5)*A2[[1]]
A2 // MatrixForm
```

*Mathematica*helps

```
A3 = A2;
A3[[3]] += (-1)*A3[[2]]
A3[[4]] += (-1)*A3[[2]]
```

Finally, we add last two rows with a multiple (-2):
```
A4 = A3;
A4[[4]] += (-2)*A4[[3]]
A4 // MatrixForm
```

**A**has three pivots in the first three rows, and its rank is 3. To use the above theorem, we need its Gauss--Jordan form, which we obtain with just one

*Mathematica*command:

```
RowReduce[A]
```

**R**of the given matrix in the block form:

**I**is the identity 3-by-3 matrix,

**0**is the zero 3-row vector [0, 0, 0], and matrix

**F**is the following square matrix:

*Mathematica*, we extract matrix

**F**:

```
F = R[[1 ;; 3, 4 ;; 6]] // MatrixForm
```

**F**by 15 to obtain

```
F15 = 15*R[[1 ;; 3, 4 ;; 6]] // MatrixForm
```

**-F**, we obtain three linearly independent vectors that generate the kernel:

**A**. Since columns are linearly independent, they form the basis of the kernel.

```
nul = ArrayFlatten[{{-F}, {IdentityMatrix[3]}}]
```

*Mathematica*command

```
NullSpace[A]
```

*x*

_{1},

*x*

_{2}, and

*x*

_{3}are leading variables and

*x*

_{4},

*x*

_{5},

*x*

_{6}are free variables. Since rank(

**A**) is 3, the last row of matrix

**A**does not play any role in determination of solutions for the linear equation

**A**

**x**=

**b**. So we extract two matrices from the first three rows of

**A**:

```
B = A[[1 ;; 3, 1 ;; 3]] // MatrixForm
```

```
CC = A[[1 ;; 3, 4 ;; 6]] // MatrixForm
```

**B**by our matrix

**C**, we obtain our old friend: matrix

**F**:

**Example:**We consider a slightly different matrix

```
A = {{1, 2, 3, -2, -1, 2}, {2, -1, 2, 3, 2, -3}, {3, 1, 2, -1,
3, -5}, {5, 5, 5, -7, 7, -4}}
R = RowReduce[A]
```

```
MatrixRank[A]
```

**R**indicate that variables 1, 2, 3, and 5 are leading variables, while variables 4 and 6 are free variables. To find actual vectors that span the null space, we form two auxiliary matrices: 4-by-4 matrix

**B**that contain columns of matrix

**A**containing the leading variables, and 4-by-2 matrix

**C**that corresponds to free variables. Naturally, we ask

*Mathematica*for help. We build matrix

**B**in two steps: first we extract 4-by-5 matrix from

**A**by dropping last column, and then eliminate fifth column:

```
B1 = A[[1 ;; 4, 1 ;; 5]]
B = Transpose[Drop[Transpose[B1], {4}]]
```

```
B1 = Delete[A, {1, 6}]
```

```
C1 = A[[1 ;; 4, 4 ;; 6]]
CC = Transpose[Delete[Transpose[C1], {2}]]
```

**F**=

**B**

^{-1}

**C**. Then we build \( 4 \times 2 \) matrix

**F**. It can be obtained either by multiplication of matrices:

**R**. To avoid fractions, we multiply this matrix by 60:

```
F60 = Inverse[B].CC*60
```

**-F**that forms the 6-by-2 matrix from which we are going to extract two basis vectors:

*Mathematica*that each column vector from the above 6-by-2 matrix is annihilated by

**A**:

```
A.{{8}, {116}, {-40}, {60}, {0}, {0}}
A.{{183}, {-24}, {-90}, {0}, {-15}, {60}}
```

Since both answers are zero vectors, we are positive that the basis for null
space is found properly. Now we compare with the answer provided by
standard *Mathematica*command

```
NullSpace[A]
```

**Example:**We consider the matrix

```
A = {{1, -1, 3, 1, -1}, {2, 4, 0, -1, 7}, {3, 1, 5, 1, 3}, {4, 6, 2, -1, 11}}
MatrixRank[A]
```

```
R = RowReduce[A]
```

**R**the 2-by-3 matrix, which we denote by

**F**

```
F = Take[R, {1, 2}, {3, 5}]
```

```
nul = ArrayFlatten[{{-F}, {IdentityMatrix[3]}}]
```

*Mathematica*output:

```
NullSpace[A]
```

**Example 9:**To find the null space of a matrix, reduce it to echelon form as described in Part 1. To refresh your memory, the first nonzero elements in the rows of the echelon form are the pivots. Solve the homogeneous system by back substitution as also described in the mentioned above part. To remind you solve for pivot variables. The variables without pivots cannot be solved for and become parameters with arbitrary values in the null space, multiplying "basis vectors." The coefficients inside the basis vectors come from the solved variables.

For example, if your unknowns are { *x*₁, *x*₂, *x*₃, *x*₄, *x*₅, *x*₆ } and your echelon matrix is

*x*₁,

*x*₂,

*x*₃,

*x*₄,

*x*₅,

*x*₆ } that produce zero upon substitution, the variables {

*x*₁,

*x*₃,

*x*₆ } without pivots go in the right hand side as arbitrary constants that can be anything:

*x*₂,

*x*₄,

*x*₅ } in the vectors in the right hand side come from the solved equations, and those for {

*x*₁,

*x*₃,

*x*₆ } from arbitrary values.

To get a basis for the kernel space, you can use the constant vectors in the right hand side: