search
Search
Unlock 100+ guides
search toc
close
account_circle
Profile
exit_to_app
Sign out
search
keyboard_voice
close
Searching Tips
Search for a recipe:
"Creating a table in MySQL"
Search for an API documentation: "@append"
Search for code: "!dataframe"
Apply a tag filter: "#python"
Useful Shortcuts
/ to open search panel
Esc to close search panel
to navigate between search results
d to clear all current filters
Enter to expand content preview Doc Search Code Search Beta SORRY NOTHING FOUND!
mic
Start speaking... Voice search is only supported in Safari and Chrome.
Shrink
Navigate to

# Comprehensive Guide on Null Space in Linear Algebra

schedule Aug 12, 2023
Last updated
local_offer
Linear Algebra
Tags
mode_heat
Master the mathematics behind data science with 100+ top-tier guides
Start your free 7-days trial now!
Definition.

# Null space

The null space, or the kernel, of an $m\times{n}$ matrix $\boldsymbol{A}$ is defined as follows:

$$\mathrm{nullspace}(\boldsymbol{A})= \{{\boldsymbol{x}\in\mathbb{R}^n}\;\vert\;{\boldsymbol{Ax}=\boldsymbol{0}}\}$$

In words, we can interpret $\mathrm{nullspace}(\boldsymbol{A})$ as either:

• the solution set of the homogeneous systemlink of equations $\boldsymbol{Ax}=\boldsymbol{0}$.

• the set of all vectors $\boldsymbol{x}$ in $\mathbb{R}^n$ that are mapped to the zero vector of $\mathbb{R}^m$ through a linear transformation $\boldsymbol{x}↦\boldsymbol{Ax}$.

Example.

## Checking if a vector belongs to a null space

Consider the following matrix and vector:

$$\boldsymbol{A}= \begin{pmatrix} 1&2\\2&4\\ \end{pmatrix},\;\;\;\;\; \boldsymbol{v}= \begin{pmatrix} -2\\1 \end{pmatrix}$$

Show that $\boldsymbol{v}$ is in the null space of $\boldsymbol{A}$, that is, $\boldsymbol{v}\in{\mathrm{nullspace}(\boldsymbol{A})}$.

Solution. To show that $\boldsymbol{v}$ is in the null space of $\boldsymbol{A}$, we must show that the matrix-vector product $\boldsymbol{Av}$ is equal to the zero vector $\boldsymbol{0}$ like so:

\begin{align*} \boldsymbol{Av}&= \begin{pmatrix} 1&2\\2&4\\ \end{pmatrix} \begin{pmatrix} -2\\1 \end{pmatrix}\\ &=\begin{pmatrix} -2+2\\-4+4 \end{pmatrix}\\ &=\begin{pmatrix} 0\\0 \end{pmatrix} \end{align*}

Therefore, $\boldsymbol{v}$ is in the null space of $\boldsymbol{A}$.

Example.

## Finding the null space of a matrix (1)

Consider the same matrix:

$$\boldsymbol{A}= \begin{pmatrix}1&2\\2&4\end{pmatrix}$$

Find the null space of $\boldsymbol{A}$, that is, $\mathrm{nullspace}(\boldsymbol{A})$.

Solution. The null space of $\boldsymbol{A}$ is the set of all vectors $\boldsymbol{x}$ such that $\boldsymbol{Ax}=\boldsymbol{0}$. Let's find the solutions to the homogeneous system:

$$\boldsymbol{Ax}=\boldsymbol{0} \;\;\;\;\;\;\;\;\;\Longleftrightarrow\;\;\;\;\;\;\;\;\; \begin{pmatrix}1&2\\2&4\end{pmatrix} \begin{pmatrix}x_1\\x_2\end{pmatrix}= \begin{pmatrix}0\\0\end{pmatrix}$$

We reduce the coefficient matrix to the row echelon form:

$$\begin{pmatrix}1&2\\2&4\end{pmatrix}\sim \begin{pmatrix}1&2\\0&0\end{pmatrix}$$

Since we have all zeroes for the last row, this system has infinitely many solutions. Let $x_2=t$ where $t$ is any real number. Substituting $x_2=t$ into the first row gives:

$$x_1+2t=0 \;\;\;\;\;\implies\;\;\;\;\; x_1=-2t$$

Therefore, the solution set can be described by:

$$\begin{pmatrix}x_1\\x_2\end{pmatrix}= \begin{pmatrix}-2t\\t\end{pmatrix} =\begin{pmatrix}-2\\1\end{pmatrix}t$$

Plugging in any real value for $t$ will give us a solution to the homogenous system, which again implies that there are infinitely many solutions. The null space of $\boldsymbol{A}$ is:

$$\mathrm{nullspace}(\boldsymbol{A})=\left\{ \begin{pmatrix} -2\\1 \end{pmatrix}t \;\;|\;\;t\in\mathbb{R} \right\}$$

For instance, when $t=1$, we get the following particular solution:

$$\boldsymbol{x}= \begin{pmatrix} -2\\1 \end{pmatrix}$$

This is a particular element of our null space.

Example.

## Finding the null space of a matrix (2)

Consider the following matrix:

$$\boldsymbol{A}= \begin{pmatrix}4&3\\1&2\end{pmatrix}$$

Find the null space of $\boldsymbol{A}$.

Solution. The null space is the set of vectors $\boldsymbol{x}$ that satisfy $\boldsymbol{Ax}=\boldsymbol{0}$ so let's solve the following:

$$\boldsymbol{Ax}=\boldsymbol{0} \;\;\;\;\;\;\;\;\;\Longleftrightarrow\;\;\;\;\;\;\;\;\; \begin{pmatrix}4&3\\1&2\end{pmatrix} \begin{pmatrix}x_1\\x_2\end{pmatrix}= \begin{pmatrix}0\\0\end{pmatrix}$$

The reduced row echelon form of the coefficient matrix is:

$$\begin{pmatrix}4&3\\1&2\end{pmatrix}\sim \begin{pmatrix}4&3\\0&-5\end{pmatrix}\sim \begin{pmatrix}4&3\\0&1\end{pmatrix}\sim \begin{pmatrix}4&0\\0&1\end{pmatrix}\sim \begin{pmatrix}1&0\\0&1\end{pmatrix}$$

Because $x_1=x_2=0$, we have that $\boldsymbol{x}$ must be the zero vector. Therefore, the null space of $\boldsymbol{A}$ is a set containing just the zero vector:

$$\mathrm{nullspace}(\boldsymbol{A})= \{\boldsymbol{0}\}$$
Example.

## Finding a spanning set for the null space of a matrix

Find a spanning set for the null space of the following matrix:

$$\boldsymbol{A}= \begin{pmatrix} 2&2&3&1&2\\ 2&1&1&1&2\\ 1&1&2&1&1\\ \end{pmatrix}$$

Solution. Let's first find the null space of $\boldsymbol{A}$. The row echelon form of matrix $\boldsymbol{A}$ is:

\begin{align*} \begin{pmatrix} 2&2&3&1&2\\ 2&1&1&1&2\\ 1&1&2&1&1\\ \end{pmatrix} \sim \begin{pmatrix} 2&2&3&1&2\\ 0&1&2&0&0\\ 0&0&-1&-1&0\\ \end{pmatrix} \sim \begin{pmatrix} 2&0&-1&1&2\\ 0&1&2&0&0\\ 0&0&-1&-1&0\\ \end{pmatrix}\\ \sim \begin{pmatrix} 2&0&0&2&2\\ 0&1&2&0&0\\ 0&0&-1&-1&0\\ \end{pmatrix} \sim \begin{pmatrix} 1&0&0&1&1\\ 0&1&2&0&0\\ 0&0&1&1&0\\ \end{pmatrix} \sim \begin{pmatrix} 1&0&0&1&1\\ 0&1&0&-2&0\\ 0&0&1&1&0\\ \end{pmatrix} \end{align*}

We have that $x_1$, $x_2$ and $x_3$ are basic variableslink while $x_4$ and $x_5$ are free variableslink. Let $x_4=r$ and $x_5=t$ where $r$ and $t$ are scalars. The solution can now be expressed as:

$$\begin{pmatrix} x_1\\x_2\\x_3\\x_4\\x_5\\\end{pmatrix}= \begin{pmatrix} -r-t\\2r\\-r\\r\\t\\ \end{pmatrix} = \begin{pmatrix} -1\\2\\-1\\1\\0\\ \end{pmatrix}r + \begin{pmatrix} -1\\0\\0\\0\\1\\ \end{pmatrix}t$$

The solution is any linear combination of the two vectors. Therefore, the null space of $\boldsymbol{A}$ is:

$$\mathrm{nullspace}(\boldsymbol{A})= \mathrm{span}\left( \begin{pmatrix} -1\\2\\-1\\1\\0\\ \end{pmatrix},\; \begin{pmatrix} -1\\0\\0\\0\\1\\ \end{pmatrix}\right)$$
Theorem.

# Null space containing only the zero vector

The null space of matrix $\boldsymbol{A}$ contains only the zero vector if and only if the column vectors $\boldsymbol{A}$ are linearly independentlink.

Proof. We know from theoremlink that the homogeneous system $\boldsymbol{Ax}=\boldsymbol{0}$ can be written as:

$$\begin{equation}\label{eq:ryOQasK21UKM6MeuStk} \boldsymbol{Ax}=\boldsymbol{0} \;\;\Longleftrightarrow\;\; \begin{pmatrix} \vert&\vert&\cdots&\vert\\ \boldsymbol{v}_1&\boldsymbol{v}_2&\cdots&\boldsymbol{v}_n\\ \vert&\vert&\cdots&\vert\\ \end{pmatrix} \begin{pmatrix}x_1\\x_2\\\vdots\\x_n\\\end{pmatrix}=\boldsymbol{0} \;\;\Longleftrightarrow\;\; x_1\boldsymbol{v}_1+x_2\boldsymbol{v}_2+\cdots+ x_n\boldsymbol{v}_n =\boldsymbol{0} \end{equation}$$

If the null space of matrix $\boldsymbol{A}$ contains only the zero vector, then the only solution to the above homogenous system is the zero vector, that is, $x_1=x_2=\cdots=x_n=0$. By definitionlink, the column vectors $\boldsymbol{v}_1$, $\boldsymbol{v}_2$, $\cdots$, $\boldsymbol{v}_n$ must be linearly independent.

Let's now prove the converse, that is, if the column vectors $\boldsymbol{A}$ are linearly independent, then the null space of matrix $\boldsymbol{A}$ contains only the zero vector. The logic is exactly the same except that we perform \eqref{eq:ryOQasK21UKM6MeuStk} in reverse.

This completes the proof.

Theorem.

# Square matrix with a null space containing only the zero vector is invertible

The null space of a square matrix $\boldsymbol{A}$ contains only the zero vector if and only if $\boldsymbol{A}$ is invertible.

Proof. Suppose the null space of a square matrix $\boldsymbol{A}$ contains only the zero vector. By definition of null space, this means that the homogeneous linear system $\boldsymbol{Ax}=\boldsymbol{0}$ only has the trivial solution, that is, $\boldsymbol{x}$ is equal to the zero vector. By theoremlink, we have that $\boldsymbol{A}$ is invertible.

Let's now prove the converse - the flow is essentially the same. Suppose $\boldsymbol{A}$ is invertible. By theoremlink, this means that the only solution to the homogeneous linear system $\boldsymbol{Ax}=\boldsymbol{0}$ is $\boldsymbol{x}=\boldsymbol{0}$. Therefore, the null space of $\boldsymbol{A}$ only contains the zero vector.

The next theorem is extremely important in linear algebra because it connects the key concepts of invertibility, null space and linear independence.

Theorem.

# Relationship between invertibility, null space and linear independence

Let $\boldsymbol{A}$ be a square matrix. The following statements are equivalent:

1. $\boldsymbol{A}$ is invertible.

2. The null space of $\boldsymbol{A}$ contains only the zero vector.

3. The column vectors of $\boldsymbol{A}$ are linearly independent.

Proof. We have already proven $(1)\Longleftrightarrow(2)$ and $(2)\Longleftrightarrow(3)$ in theoremlink and theoremlink respectively. This implies that $(1)\Longleftrightarrow(3)$. This completes the proof.

The next theorem will be useful for future proofs.

Theorem.

# Magnitude of a product of an invertible matrix and a vector is greater than 0

If $\boldsymbol{P}$ is an invertible $n\times{n}$ matrix and $\boldsymbol{x}$ is any vector in $\mathbb{R}^n$, then:

$$\Vert\boldsymbol{Px}\Vert\gt0$$

Proof. By definitionlink, the magnitude of a vector is non-negative. Therefore, it suffices to show that $\Vert\boldsymbol{Px}\Vert\ne0$ or $\boldsymbol{Px}\ne\boldsymbol{0}$. By theoremlink, since $\boldsymbol{P}$ is invertible, the only solution to the homogeneous system $\boldsymbol{Px}=\boldsymbol{0}$ is the trivial solution of $\boldsymbol{x}=0$. However, $\boldsymbol{x}$ cannot be the zero vector by assumption, which means that $\boldsymbol{Px}\ne\boldsymbol{0}$. Therefore, $\Vert\boldsymbol{Px}\Vert\ne0$. This completes the proof.

The next theorem explains why the name "null space" is appropriate.

Theorem.

# Null space is a subspace

The null space of an $m\times{n}$ matrix $\boldsymbol{A}$ is a subspace of $\mathbb{R}^n$.

Proof. By definitionlink, the null space is defined as the set of vectors $\boldsymbol{x}$ such that:

$$\boldsymbol{Ax}=\boldsymbol{0}$$

Since $\boldsymbol{A}$ is an $m\times{n}$ matrix, we have that $\boldsymbol{x}\in\mathbb{R}^n$ for the matrix-vector multiplication to be valid. Therefore, the null space is a subset of $\mathbb{R}^n$.

To show that $\boldsymbol{A}$ is a subspace of $\mathbb{R}^n$, we need to show that $\boldsymbol{A}$ is closed under addition and scalar multiplication.

Let vectors $\boldsymbol{v},\boldsymbol{w}\in{\mathrm{nullspace}(\boldsymbol{A})}$, which means that:

\begin{equation}\label{eq:lKwphhXfFzNwK3ogtBX} \begin{aligned} \boldsymbol{Av}&=\boldsymbol{0}\\ \boldsymbol{Aw}&=\boldsymbol{0}\\ \end{aligned} \end{equation}

Let's check if $\boldsymbol{v}+\boldsymbol{w}$ is contained in $\mathrm{nullspace}(\boldsymbol{A})$ like so:

$$\begin{equation}\label{eq:OS3qOe4sECZzULgwfqe} \boldsymbol{A}(\boldsymbol{v}+\boldsymbol{w})= \boldsymbol{A}\boldsymbol{v}+\boldsymbol{A}\boldsymbol{w} \end{equation}$$

Substituting \eqref{eq:lKwphhXfFzNwK3ogtBX} into \eqref{eq:OS3qOe4sECZzULgwfqe} gives:

$$\begin{equation}\label{eq:ArTcI8uAqptW1VnRVd7} \boldsymbol{A}\boldsymbol{v}+\boldsymbol{A}\boldsymbol{w}=\boldsymbol{0} \end{equation}$$

Therefore, we have that $\boldsymbol{v}+\boldsymbol{w} \in\mathrm{nullspace}(\boldsymbol{A})$. This means that the null space of $\boldsymbol{A}$ is closed under addition.

Next, let's check if the null space is closed under scalar multiplication. Suppose vector $\boldsymbol{v}\in \mathrm{nullspace}(\boldsymbol{A})$ and $k$ is a scalar. Since $\boldsymbol{v}$ is in the null space of $\boldsymbol{A}$, we have that $\boldsymbol{Av}=\boldsymbol{0}$. We now show $k\boldsymbol{v}\in \mathrm{nullspace}(\boldsymbol{A})$ like so:

\begin{align*} \boldsymbol{A}(k\boldsymbol{v})&= k\boldsymbol{A}\boldsymbol{v}\\ &=k(0)\\ &=0 \end{align*}

Because $k\boldsymbol{v}$ is also contained in the null space of $\boldsymbol{A}$, we have that $\boldsymbol{A}$ is closed under scalar multiplication.

Because the null space of $\boldsymbol{A}$ is closed under addition and scalar multiplication, we conclude that the null space is a subspace of $\mathbb{R}^n$ by definitionlink. This completes the proof.

thumb_up
thumb_down
Comment
Citation
Ask a question or leave a feedback...
thumb_up
0
thumb_down
0
chat_bubble_outline
0
settings
Enjoy our search
Hit / to insta-search docs and recipes!