Scientia sine finibus

Linear Algebra / Unit 4, Vector Spaces / Topic 4.4

Units and Topics

Unit 4. Vector Spaces

4.4 The Four Subspaces of a Matrix and Rank

This topic describes the four subspaces that belong to a matrix: the column space, the null space, the row space, and the left null space. Their dimensions are fixed by one number, the rank, and together they give a complete account of the system Ax = b.

You need Topics 2.3, 3.3, 4.1, 4.2, and 4.3 for this topic.

1. The Example

The matrix of Topic 2.3 is used throughout this topic. Its reduced row echelon form R has two pivots, in columns 1 and 3.

A = 121243364 R = 120001000

An m by n matrix takes vectors in ℝⁿ and gives vectors in ℝm. Two of its four subspaces are parts of ℝⁿ, and the other two are parts of ℝm. For this matrix m = 3 and n = 3.

2. The Column Space

The column space is the span of the columns of A. It is the set of all vectors Ax, and it is a subspace of ℝm. From Topic 4.3, the columns of A that have pivots are a basis.

For the example, the pivots are in columns 1 and 3, so a basis of the column space is (1, 2, 3) and (1, 3, 4). The column space is a plane in ℝ³. Column 2 is 2 times column 1, so it adds nothing.

3. The Null Space

The null space is the set of solutions of Ax = 0. It is a subspace of ℝⁿ. A basis comes from the general solution, with one basis vector for each free variable.

For the example, R gives x + 2y = 0 and z = 0, with y free. The solutions are the multiples of (−2, 1, 0). The null space is a line in ℝ³.

4. The Row Space

The row space is the span of the rows of A. It is a subspace of ℝⁿ. Because the rows of A are the columns of AT, the row space is the column space of AT.

Row operations replace rows by combinations of rows, so they do not change the row space. The rows of R that are not zero are a basis of it.

For the example, a basis of the row space is (1, 2, 0) and (0, 0, 1). The row space is a plane in ℝ³.

5. The Left Null Space

The left null space is the null space of AT: the set of vectors y with ATy = 0. It is a subspace of ℝm. The name comes from writing the same equation as yT A = 0, with y on the left of A. This equation says that the combination of the rows of A with the coefficients in y is the zero row.

For the example, reducing AT gives the solutions y = t(−1, −1, 1). So −(row 1) − (row 2) + (row 3) is the zero row: the third row of A is the sum of the first two. The left null space is a line in ℝ³.

6. The Rank and the Four Dimensions

The rank r of a matrix is its number of pivots. The four dimensions follow from it.

SubspacePart ofDimensionIn the example
Column spaceℝmr2
Left null spaceℝmm − r1
Row spaceℝⁿr2
Null spaceℝⁿn − r1
  • The column space and the row space have the same dimension, although they are parts of different spaces. A matrix has as many independent rows as independent columns, so the rank of AT is equal to the rank of A.
  • In ℝⁿ, the dimensions of the row space and the null space add to n. In ℝm, the dimensions of the column space and the left null space add to m.

The statement r + (n − r) = n is called the rank-nullity theorem. Each of the n columns either has a pivot or belongs to a free variable. The dimension of the null space is called the nullity.

Try it: the four subspaces of a matrix

Type numbers into the matrix, or choose an example. The readout shows the reduced row echelon form, the rank, and a basis of each of the four subspaces.

A =

7. Perpendicular Subspaces

The equation Ax = 0 says that the dot product of each row of A with x is 0. So each vector in the null space is orthogonal to each row, and to each combination of the rows.

The null space is orthogonal to the row space. In the same way, the left null space is orthogonal to the column space.

Check this for the example.

  • (−2, 1, 0) · (1, 2, 0) = 0 and (−2, 1, 0) · (0, 0, 1) = 0.
  • (−1, −1, 1) · (1, 2, 3) = 0 and (−1, −1, 1) · (1, 3, 4) = 0.

In ℝ³, the row space of the example is a plane, and the null space is the line through the origin that is perpendicular to that plane.

8. What the Subspaces Say About Ax = b

  • The system has a solution exactly when b is in the column space.
  • Because the column space is orthogonal to the left null space, b is in the column space exactly when b is orthogonal to each vector of the left null space.
  • If x is one solution, then all of the solutions are x plus a vector of the null space. The solution is unique exactly when the null space contains only the zero vector.

For the example, the left null space is spanned by (−1, −1, 1), so the system has a solution exactly when −b₁ − b₂ + b₃ = 0. The right side (4, 9, 13) of Topic 2.3 passes this test, and the right side (4, 9, 14) does not.

Full rank

RankMeaningSolutions of Ax = b
r = nThe columns are independent, and the null space contains only the zero vectorAt most one
r = mThe column space is all of ℝmAt least one, for each b
r = m = nThe matrix is square and has an inverseExactly one, for each b

The rank can never be larger than m or larger than n.

Common Mistakes

  • Taking the basis of the column space from the columns of R. Use the columns of A that have pivots. Row operations change the column space.
  • Thinking that row operations change the row space. They do not, so the rows of R that are not zero are a basis of the row space of A.
  • Placing a subspace in the wrong space. For a 2 by 5 matrix, the null space is a part of ℝ⁵ and the column space is a part of ℝ².
  • Calculating the dimension of the null space as m − r. It is n − r, the number of columns minus the rank.
  • Assuming that the column space and the row space are the same subspace because they have the same dimension.

Summary

SubspaceDefinitionA basis
Column spaceAll vectors AxThe columns of A that have pivots
Null spaceAll x with Ax = 0One vector for each free variable
Row spaceAll combinations of the rows of AThe rows of R that are not zero
Left null spaceAll y with ATy = 0One vector for each free variable of AT

Practice

Work each problem on paper first. Then open the answer to check your work.

1. A is a 3 by 5 matrix of rank 2. Find the dimensions of its four subspaces.

dimension of the column space = 2the rank rdimension of the row space = 2the rank rdimension of the null space = 5 − 2 = 3n − rdimension of the left null space = 3 − 2 = 1m − r

2. Find a basis of the column space and of the null space of A = 122436.

Column 2 is 2 times column 1, so the only pivot is in column 1. A basis of the column space is (1, 2, 3).

The equation x + 2y = 0 has y free. A basis of the null space is (−2, 1).

3. For the matrix in Problem 2, find the dimension of the left null space, and find one vector in it other than the zero vector.

m − r = 3 − 1 = 2.

A vector y is in the left null space when y₁ + 2y₂ + 3y₃ = 0. One choice is (2, −1, 0).

4. The reduced row echelon form of a matrix A is 103001−100001. Find the rank, a basis of the row space, and a basis of the null space.

There are 3 pivots, so the rank is 3.

A basis of the row space is the three rows (1, 0, 3, 0), (0, 1, −1, 0), and (0, 0, 0, 1).

The third unknown is free. With that unknown equal to t, the solutions are t(−3, 1, 1, 0). A basis of the null space is (−3, 1, 1, 0).

5. Can a 4 by 6 matrix have a null space that contains only the zero vector?

No. The rank is at most 4, so the dimension of the null space is at least 6 − 4 = 2.

6. A is a square matrix of size 5 with rank 5. What are its four subspaces?

The column space and the row space are all of ℝ⁵.

The null space and the left null space contain only the zero vector. The matrix has an inverse.

Python Practice

Step 1. Compare the rank of a matrix and of its transpose

The instruction np.linalg.matrix_rank gives the rank of a matrix, and A.T is the transpose of A. The code below uses the matrix of this topic.

Python

Both ranks are 2. The column space and the row space have the same dimension.

Change the matrix to any other 3 by 3 matrix and run the code again. The two ranks are equal each time.

Step 2. Calculate the four dimensions

The expression A.shape gives the number of rows and the number of columns. The number of rows is A.shape[0], and the number of columns is A.shape[1]. The code below stores them under the names m and n, and prints the dimensions of the column space and the null space.

Python

The results are 2 and 1.

The next box has a matrix with 3 rows and 4 columns. Replace the 0 in the line that starts with left with an expression that gives the dimension of the left null space. Use the names m, n, and r.

Python

This matrix has the rank 2, because its second row is 2 times its first row. Its null space has the dimension 4 − 2 = 2, and its left null space has the dimension 3 − 2 = 1.

Step 3. Check a vector of the null space

The @ sign multiplies a matrix by a vector. The code below checks that (−2, 1, 0) is in the null space of the matrix of this topic.

Python

The result is [0 0 0]. Each component of the result is the dot product of one row of A with x, so x is orthogonal to each row.

Step 4. Find a vector of a left null space

A vector y is in the left null space of A when ATy = 0. The code below checks the vector (−1, −1, 1) from Part 5.

Python

The result is [0 0 0].

The next box has the matrix of Practice Problem 2. Replace the zeros so that y is a vector of its left null space, other than the zero vector.

Python

Step 5. Test a right side with the left null space

From Part 8, the system Ax = b has a solution exactly when b is orthogonal to the left null space. For the matrix of this topic, the test is the dot product of (−1, −1, 1) with b. The instruction np.dot calculates a dot product.

Python

The first result is 0, so the system with the right side (4, 9, 13) has a solution. The second result is 1, so the system with the right side (4, 9, 14) has none.

In the next box, change the third component of b so that the system has a solution. Do not change the first two components.

Python

Quiz

This quiz has 5 questions on this topic. A question asks you either to choose one answer or to type numbers. The page grades your answers and explains each one. A number can be typed as a whole number, a decimal, a fraction such as 1/3, or a calculation such as sqrt(18)/2 or arccos(1/2). The page shows the value of a calculation next to the box. Angles in a calculation are in degrees. The Calculator button under each question opens a calculator. Your answers are saved in your browser, so they are still on the page when you come back to it.

Choose how your answers are checked

1. A is a 4 by 7 matrix with the rank 3. Find the dimension of its null space.

2. For the same 4 by 7 matrix with the rank 3, find the dimension of its left null space.

3. The null space of a matrix A is orthogonal to which subspace?

4. The system Ax = b has a solution exactly when b is in which subspace?

5. Find the rank of 123246101.

Next: Topic 4.5, Linear Maps: Kernel and Range