Lab 7: Null Space and the Rank-Nullity Theorem

due by the end of your lab section on Wednesday, October 21st, 2026

Each lab worksheet will contain several activities, some of which will involve writing code and others that will involve writing math on paper. To receive credit for a lab, you must complete all activities and show your lab TA by the end of the lab section.

While you must get checked off by your lab TA individually, we encourage you to form groups with 1-2 other students to complete the activities together.


Activities


Recap: Rank, Column Space, and Null Space

  • For an \(n\times d\) matrix \(A\), \(\operatorname{colsp}(A)\) is a subspace of \(\mathbb R^n\); it is the span of \(A\)โ€™s columns.

  • \(\operatorname{rank}(A)=\dim(\operatorname{colsp}(A))\).

  • \(\operatorname{nullsp}(A)=\lbrace\vec x\in\mathbb R^d:A\vec x=\vec 0\rbrace\).

  • The Rank-Nullity Theorem states that

    $$ \operatorname{rank}(A)+\dim(\operatorname{nullsp}(A))=d $$
  • \(\operatorname{rank}(A^T)=\operatorname{rank}(A)\).


Activity 1: Null Space of a Matrix with Linearly Independent Columns

Let \(A = \begin{bmatrix} 3 & 0 \\ 0 & 4 \\ 1 & 0 \end{bmatrix}\). What is \(\text{nullsp}(A)\)?

Solution

The columns of \(A\) are linearly independent. So, the only way to combine them to get \(\vec 0\) is to use zero for both coefficients. This means

$$ \boxed{\text{nullsp}(A)=\left\{\begin{bmatrix}0\\\\0\end{bmatrix}\right\}} $$

Notice that the null space contains the zero vector in \(\mathbb R^2\), not \(\mathbb R^3\), since \(A\) has two columns.


Activity 2: Null Space from Column Relationships

Let \(X=\begin{bmatrix}1 & 2 & -1 & 3 & 4 & 4 \\ 2 & 5 & -2 & 7 & 11 & 10 \\ 4 & 8 & -4 & 12 & 16 & 16\end{bmatrix}\).

Note that \(X\)โ€™s first two columns form a basis for its column space; verify this before proceeding.

a)

Fill in the blanks: \(\text{nullsp}(X)\) is a ____-dimensional subspace of ____.

Solution

The Rank-Nullity Theorem tells us that

$$ 2+\dim(\text{nullsp}(X))=6 $$

so \(\dim(\text{nullsp}(X))=4\). Since \(X\) has six columns, the vectors in its null space have six components.

So, the blanks are \(\boxed{4}\) and \(\boxed{\mathbb R^6}\).

b)

Find a basis for \(\text{nullsp}(X)\). Hint: You should be able to answer this without solving equations.

Solution

Let \(\vec v_j\) be column \(j\) of \(X\). From the columns, we can see that

$$ \vec v_3=-\vec v_1,\qquad \vec v_4=\vec v_1+\vec v_2,\qquad \vec v_5=-2\vec v_1+3\vec v_2,\qquad \vec v_6=2\vec v_2 $$

Moving everything to one side in each equation gives a linear combination of the columns equal to \(\vec 0\). The coefficients give us four vectors in \(\text{nullsp}(X)\):

$$ \boxed{\left\{ \begin{bmatrix}1\\\\0\\\\1\\\\0\\\\0\\\\0\end{bmatrix}, \begin{bmatrix}1\\\\1\\\\0\\\\-1\\\\0\\\\0\end{bmatrix}, \begin{bmatrix}-2\\\\3\\\\0\\\\0\\\\-1\\\\0\end{bmatrix}, \begin{bmatrix}0\\\\2\\\\0\\\\0\\\\0\\\\-1\end{bmatrix} \right\}} $$

These vectors are linearly independent: in components 3 through 6, each vector has a non-zero entry where the other three have zeros. Since the null space has dimension 4, these four vectors form a basis.


Activity 3: Four Spaces Warm-Up

Let \(A\) be a \(7 \times 9\) matrix with rank \(5\). For each space below, state its dimension and the space \(\mathbb R^k\) of which it is a subspace.

SpaceDimensionSubspace of \(\mathbb R^k\) (state \(k\))
\(\text{colsp}(A)\)
\(\text{colsp}(A^T)\)
\(\text{nullsp}(A)\)
\(\text{nullsp}(A^T)\)
Solution

The completed table is:

SpaceDimensionSubspace of
\(\text{colsp}(A)\)5\(\mathbb R^7\)
\(\text{colsp}(A^T)\)5\(\mathbb R^9\)
\(\text{nullsp}(A)\)4\(\mathbb R^9\)
\(\text{nullsp}(A^T)\)2\(\mathbb R^7\)

Both column spaces have dimension 5, since \(\text{rank}(A)=\text{rank}(A^T)=5\). For the null spaces, apply the Rank-Nullity Theorem to \(A\) and \(A^T\):

$$ \dim(\text{nullsp}(A))=9-5=4,\qquad \dim(\text{nullsp}(A^T))=7-5=2 $$

Remember that \(A^T\) has shape \(9\times 7\).


Activity 4: Constructing a Matrix

Find a matrix \(A\) such that

$$ \begin{bmatrix}3\\\\1\end{bmatrix}\in\text{colsp}(A) \qquad\text{and}\qquad \begin{bmatrix}1\\\\3\end{bmatrix}\in\text{nullsp}(A). $$
Solution

The first condition tells us that \(A\) needs two rows, and the second tells us that it needs two columns.

Letโ€™s make the first column \(\begin{bmatrix}3\\1\end{bmatrix}\). Then the first condition is automatically satisfied. For the second condition, we need the first column plus three times the second column to be \(\vec 0\). So, one answer is

$$ \boxed{A=\begin{bmatrix}3&-1\\\\1&-1/3\end{bmatrix}} $$

We can check that

$$ A\begin{bmatrix}1\\\\3\end{bmatrix}=\begin{bmatrix}3-3\\\\1-1\end{bmatrix}=\vec 0 $$

There are many other correct answers!


Activity 5: The Systems of Equations View

Let \(A\) be an \(n \times d\) matrix of rank \(r\), and suppose there exist vectors \(\vec b \in \mathbb{R}^n\) such that

$$ A \vec x = \vec b $$

does not have a solution (meaning no \(\vec x\) makes \(A \vec x = \vec b\)).

a)

What are all inequalities (\(<\) or \(\le\)) that must be true between \(n\), \(d\), and \(r\)?

Solution

If \(A\vec x=\vec b\) has no solution, then \(\vec b\) is not in \(\text{colsp}(A)\). So, the columns of \(A\) donโ€™t span all of \(\mathbb R^n\), which means \(r<n\).

Also, \(A\) only has \(d\) columns, so it canโ€™t have more than \(d\) linearly independent columns. This gives

$$ \boxed{r<n\qquad\text{and}\qquad r\le d} $$

We canโ€™t conclude whether \(n<d\), \(n=d\), or \(n>d\); all three are possible.

b)

How do you know that \(A^T\vec y= \vec 0\) has solutions other than \(\vec y=\vec 0\)?

Solution

From part (a), \(r<n\). Since \(A^T\) has \(n\) columns and rank \(r\), the Rank-Nullity Theorem gives

$$ \dim(\text{nullsp}(A^T))=n-r>0 $$

So, \(\text{nullsp}(A^T)\) contains more than just the zero vector. Any non-zero vector in this null space is a solution to \(A^T\vec y=\vec 0\).


Activity 6: Columns in a Null Space

Let \(A\) and \(B\) be non-zero \(6 \times 6\) matrices. Suppose \(\text{rank}(A)=4\), and that every column of \(B\) is in \(\text{nullsp}(A)\).

a)

Show that every row of \(A\) is orthogonal to every column of \(B\).

Solution

Take any column \(\vec b\) of \(B\). Since \(\vec b\in\text{nullsp}(A)\), we know that \(A\vec b=\vec 0\).

Each entry of \(A\vec b\) is the dot product of a row of \(A\) with \(\vec b\). Since every entry is zero, every row of \(A\) is orthogonal to \(\vec b\). This works for every column of \(B\).

b)

Find \(AB\) and \(\text{rank}(AB)\). Justify your answers.

Solution

Each column of \(AB\) is \(A\) times the corresponding column of \(B\). All of these products are \(\vec 0\), so

$$ \boxed{AB=0_{6\times6}\qquad\text{and}\qquad\text{rank}(AB)=0} $$

The zero matrix has no linearly independent columns.

c)

What are the possible values of \(\text{rank}(B)\)? Explain why these are the only possibilities, and why each one is possible.

Solution

By the Rank-Nullity Theorem, \(\dim(\text{nullsp}(A))=6-4=2\). Every column of \(B\) is in this two-dimensional space, so at most two columns of \(B\) can be linearly independent. Also, \(B\) is non-zero, so its rank canโ€™t be 0.

This leaves \(\boxed{\text{rank}(B)\in\lbrace1,2\rbrace}\). Both are possible. Let \(\lbrace\vec u,\vec v\rbrace\) be a basis for \(\text{nullsp}(A)\):

  • For rank 1, make every column of \(B\) equal to \(\vec u\).

  • For rank 2, make the first two columns \(\vec u\) and \(\vec v\), and make the remaining columns \(\vec 0\).

Both choices satisfy all of the conditions in the question.


Activity 7: Can the Column Space Equal the Null Space?

In each part, determine whether itโ€™s possible to find a matrix whose column space and null space are the same. If it is, give an example and show that it works. If not, explain why not.

a)

Can you find a \(2 \times 2\) matrix \(A\) such that \(\text{colsp}(A)=\text{nullsp}(A)\)?

Solution

Yes! One example is

$$ \boxed{A=\begin{bmatrix}0&1\\\\0&0\end{bmatrix}} $$

Its column space is \(\text{span}\left\lbrace\begin{bmatrix}1\\0\end{bmatrix}\right\rbrace\). To find its null space, note that

$$ A\begin{bmatrix}x_1\\\\x_2\end{bmatrix}=\begin{bmatrix}x_2\\\\0\end{bmatrix}=\vec 0 \quad\Longleftrightarrow\quad x_2=0 $$

So, its null space is also \(\text{span}\left\lbrace\begin{bmatrix}1\\0\end{bmatrix}\right\rbrace\). Both spaces are the horizontal axis in \(\mathbb R^2\).

b)

Can you find a \(3 \times 3\) matrix \(A\) such that \(\text{colsp}(A)=\text{nullsp}(A)\)?

Solution

No. If the column space and null space were equal, they would have the same dimension. Calling this dimension \(r\), the Rank-Nullity Theorem would give

$$ r+r=3\quad\Longrightarrow\quad r=\frac32 $$

But the dimension of a subspace must be an integer, so this is impossible.