Unit 3, lesson 16

Column Space, Row Space and Rank

How to find bases for the column space and the row space of a matrix by elimination, why basis columns come from the original matrix, why row rank equals column rank, and what a rank factorization is.

  • Video 16
  • The Four Fundamental Subspaces

Take the 3 by 3 matrix MM with columns (1,2,3)(1, 2, 3), (2,4,6)(2, 4, 6) and (1,0,1)(1, 0, 1), where each tuple stands for a column vector. The second column is twice the first, so the outputs MxM\mathbf{x} cannot fill all of R3\mathbb{R}^3. Which plane do they fill, and how can we find such a plane when the dependence is harder to see? This lesson finds bases for the column space and the row space of a matrix by elimination, shows that the two spaces always have the same dimension, and uses that number, the rank, to factor the matrix.

Key terms

Column space

Definition Let AA be a real m×nm \times n matrix with columns a1,…,an\mathbf{a}_1, \dots, \mathbf{a}_n. The column space of AA is the span of its columns,

Col⁡A=span⁡{a1,…,an}={Ax∣x∈Rn}.\begin{aligned} \operatorname{Col} A &= \operatorname{span}\{\mathbf{a}_1, \dots, \mathbf{a}_n\} \\[0.4em] &= \{A\mathbf{x} \mid \mathbf{x} \in \mathbb{R}^n\}. \end{aligned}

The two descriptions agree because Ax=x1a1+⋯+xnanA\mathbf{x} = x_1\mathbf{a}_1 + \cdots + x_n\mathbf{a}_n. Each column has mm entries, so Col⁡A\operatorname{Col} A is a subspace of Rm\mathbb{R}^m, the output space of AA. The system Ax=bA\mathbf{x} = \mathbf{b} has a solution exactly when b\mathbf{b} lies in Col⁡A\operatorname{Col} A.

In plain words The column space is the set of all outputs the matrix can produce. Each output is a combination of the columns, weighted by the entries of the input.

Example Write the matrix from the opening as

M=[121240361].M = \begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 0 \\ 3 & 6 & 1 \end{bmatrix}.

In each column the third entry is the sum of the first two, so every output MxM\mathbf{x} lies in the plane w3=w1+w2w_3 = w_1 + w_2 of R3\mathbb{R}^3. The columns (1,2,3)(1, 2, 3) and (1,0,1)(1, 0, 1) are not parallel, so they span a two-dimensional subspace of that plane, which is therefore the whole plane. Thus Col⁡M\operatorname{Col} M is the plane w3=w1+w2w_3 = w_1 + w_2. The target (1,1,5)(1, 1, 5) is not in it, since 5≠1+15 \ne 1 + 1, so the system Mx=(1,1,5)M\mathbf{x} = (1, 1, 5) has no solution.

Row space

Definition The row space of a real m×nm \times n matrix AA is the span of its mm rows, where each row is identified with the vector of Rn\mathbb{R}^n that has the same entries. Equivalently Row⁡A=Col⁡A⊤\operatorname{Row} A = \operatorname{Col} A^{\top}, a subspace of Rn\mathbb{R}^n, the input space of AA. Row operations do not change the row space, because each new row is a combination of the old rows and each operation can be undone. The nonzero rows of any echelon form of AA are linearly independent, since in a zero combination of them the pivot columns, read from left to right, force each coefficient to be zero in turn. So those nonzero rows form a basis of Row⁡A\operatorname{Row} A.

In plain words The row space collects every combination of the rows. It lives in the input space, so its vectors have one entry for each column of AA, even when the matrix is square and the input and output spaces are both Rn\mathbb{R}^n.

Example For MM, the operations R2→R2−2R1R_2 \to R_2 - 2R_1 and R3→R3−3R1R_3 \to R_3 - 3R_1 come first. Then R3→R3−R2R_3 \to R_3 - R_2, R2→−12R2R_2 \to -\tfrac{1}{2}R_2 and R1→R1−R2R_1 \to R_1 - R_2 give the reduced row echelon form FF.

M→[12100−200−2]→[120001000]=F.\begin{aligned} M &\to \begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & -2 \\ 0 & 0 & -2 \end{bmatrix} \\[0.4em] &\to \begin{bmatrix} 1 & 2 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix} = F. \end{aligned}

So Row⁡M\operatorname{Row} M has basis (1,2,0)(1, 2, 0), (0,0,1)(0, 0, 1). It consists of the vectors (a,2a,b)(a, 2a, b), the plane x2=2x1x_2 = 2x_1 in R3\mathbb{R}^3. All three rows of MM are nonzero, but row 3 is row 1 plus row 2, so counting the nonzero rows of MM itself would overstate the dimension.

Pivot columns of the original matrix

Definition Let AA be a real m×nm \times n matrix and FF an echelon form of AA. The columns of AA with the same indices as the pivot columns of FF form a basis of Col⁡A\operatorname{Col} A. The reason is that F=EAF = EA for an invertible matrix EE, the product of the elementary matrices of the row operations, so Ax=0A\mathbf{x} = \mathbf{0} exactly when Fx=0F\mathbf{x} = \mathbf{0}. Hence the columns of AA and the columns of FF satisfy the same linear relations. In FF the pivot columns are independent and every other column is a combination of them, so the same holds for the columns of AA. The pivot columns of FF itself need not lie in Col⁡A\operatorname{Col} A, because row operations can change the column space.

In plain words Let the echelon form tell you which columns to keep, then take those columns from the original matrix. Row operations keep the relations among the columns but can change the columns themselves.

Example The reduced form FF of MM has pivots in columns 1 and 3, so the first and third columns of MM, namely (1,2,3)(1, 2, 3) and (1,0,1)(1, 0, 1), form a basis of Col⁡M\operatorname{Col} M. The second column is twice the first in FF and in MM alike. The pivot columns of FF are (1,0,0)(1, 0, 0) and (0,1,0)(0, 1, 0), and neither lies in Col⁡M\operatorname{Col} M. For instance, the third entry of (1,0,0)(1, 0, 0) is 00, not the sum 1+01 + 0 of its first two entries. The column space of FF is the plane w3=0w_3 = 0, a different plane.

Rank

Definition The rank of a real m×nm \times n matrix AA is the dimension of its column space,

rank⁡A=dim⁡Col⁡A.\operatorname{rank} A = \dim \operatorname{Col} A.

Since the pivot columns of AA form a basis of Col⁡A\operatorname{Col} A, the rank equals the number of pivots in any echelon form of AA. Each pivot uses its own row and its own column, so rank⁡A≤min⁡(m,n)\operatorname{rank} A \le \min(m, n).

In plain words The rank counts the independent directions among the outputs. It is the number of columns you really need once the redundant ones are dropped.

Example The matrix MM has two pivots, so rank⁡M=2\operatorname{rank} M = 2 and its outputs fill a plane rather than all of R3\mathbb{R}^3. The zero m×nm \times n matrix has rank 00, and the n×nn \times n identity matrix has rank nn.

Equality of row rank and column rank

Definition The row rank of a real m×nm \times n matrix AA is dim⁡Row⁡A\dim \operatorname{Row} A, and its column rank is dim⁡Col⁡A\dim \operatorname{Col} A. For every such matrix the two are equal,

dim⁡Row⁡A=dim⁡Col⁡A.\dim \operatorname{Row} A = \dim \operatorname{Col} A.

Both numbers equal the number rr of pivots in an echelon form of AA, so the row rank and the column rank are the same number, the rank. Proof. Reduce AA to an echelon form with rr pivots. The rr pivot columns of AA form a basis of Col⁡A\operatorname{Col} A, and the nonzero rows of the echelon form, one for each pivot, form a basis of Row⁡A\operatorname{Row} A. Both bases have rr vectors. The proof uses two different facts, that row operations keep the row space itself and that they keep the linear relations among the columns. Since Col⁡A⊤=Row⁡A\operatorname{Col} A^{\top} = \operatorname{Row} A, it follows that rank⁡A⊤=rank⁡A\operatorname{rank} A^{\top} = \operatorname{rank} A.

In plain words The largest number of independent rows of a matrix equals the largest number of independent columns, even when the rows and the columns have different lengths and the two spaces are different.

Example Let

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

Its two rows are independent, and its first two columns are e1\mathbf{e}_1 and e2\mathbf{e}_2 of R2\mathbb{R}^2, so the row rank and the column rank are both 22. Yet Col⁡A=R2\operatorname{Col} A = \mathbb{R}^2, while Row⁡A\operatorname{Row} A consists of the vectors (a,b,a+b)(a, b, a + b), the plane x3=x1+x2x_3 = x_1 + x_2 in R3\mathbb{R}^3. Equal dimensions do not make two spaces equal, and here the spaces do not even lie in the same Rk\mathbb{R}^k.

Rank factorization

Definition Let AA be a real m×nm \times n matrix of rank r≥1r \ge 1. A rank factorization of AA is a product

A=CR,A = CR,

where CC is m×rm \times r with linearly independent columns and RR is r×nr \times n with linearly independent rows. One always exists. Take for CC the pivot columns of AA, in order, and for RR the rr nonzero rows of the reduced row echelon form of AA. Column jj of RR then lists the coefficients that write column jj of AA as a combination of the columns of CC. In every rank factorization the columns of CC form a basis of Col⁡A\operatorname{Col} A and the rows of RR form a basis of Row⁡A\operatorname{Row} A.

In plain words The matrix CC keeps a basis of the outputs, and RR records how to rebuild every column from that basis. Applying AA becomes two steps. First RR turns the input into rr weights, then CC combines its columns with those weights.

Example For MM the pivot columns are columns 1 and 3, and the nonzero rows of FF are (1,2,0)(1, 2, 0) and (0,0,1)(0, 0, 1), so

M=CR=[112031][120001].\begin{aligned} M &= CR \\[0.4em] &= \begin{bmatrix} 1 & 1 \\ 2 & 0 \\ 3 & 1 \end{bmatrix} \begin{bmatrix} 1 & 2 & 0 \\ 0 & 0 & 1 \end{bmatrix}. \end{aligned}

The columns of RR are (1,0)(1, 0), (2,0)(2, 0) and (0,1)(0, 1). They say that the columns of MM are the first column of CC, twice the first column of CC, and the second column of CC. For the input x=(2,1,−1)\mathbf{x} = (2, 1, -1) the first step gives Rx=(4,−1)R\mathbf{x} = (4, -1), and the second gives

4[123]−[101]=[3811],4 \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} - \begin{bmatrix} 1 \\ 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 3 \\ 8 \\ 11 \end{bmatrix},

which is MxM\mathbf{x}. The rows of MM confirm it directly, since 2+2−1=32 + 2 - 1 = 3, 4+4+0=84 + 4 + 0 = 8 and 6+6−1=116 + 6 - 1 = 11.

Check yourself

  1. A real 3 by 5 matrix AA has rank rr. In which spaces do Col⁡A\operatorname{Col} A and Row⁡A\operatorname{Row} A lie, and what is the largest possible value of rr?
Show the answer

Each column has 33 entries, so Col⁡A\operatorname{Col} A is a subspace of R3\mathbb{R}^3. Each row has 55 entries, so Row⁡A\operatorname{Row} A is a subspace of R5\mathbb{R}^5. There are only three rows to hold pivots, so r≤min⁡(3,5)=3r \le \min(3, 5) = 3. The value 33 does occur, for example when the first three columns of AA are e1\mathbf{e}_1, e2\mathbf{e}_2 and e3\mathbf{e}_3, so the largest possible rank is 33. In particular the row space is never all of R5\mathbb{R}^5.

  1. A student reduces the matrix below to reduced row echelon form and offers its pivot columns (1,0,0)(1, 0, 0) and (0,1,0)(0, 1, 0) as a basis of Col⁡A\operatorname{Col} A. Explain the error and give a correct basis.
A=[101213011]A = \begin{bmatrix} 1 & 0 & 1 \\ 2 & 1 & 3 \\ 0 & 1 & 1 \end{bmatrix}
Show the answer

The operation R2→R2−2R1R_2 \to R_2 - 2R_1 gives the row (0,1,1)(0, 1, 1), and then R3→R3−R2R_3 \to R_3 - R_2 gives a zero row. The reduced form has rows (1,0,1)(1, 0, 1), (0,1,1)(0, 1, 1) and (0,0,0)(0, 0, 0), with pivots in columns 1 and 2. Those positions are right, but they select columns of AA itself, here (1,2,0)(1, 2, 0) and (0,1,1)(0, 1, 1), and these form a basis of Col⁡A\operatorname{Col} A. Every combination of them has the form (a,2a+b,b)(a, 2a + b, b), so every vector w\mathbf{w} in Col⁡A\operatorname{Col} A satisfies 2w1−w2+w3=02w_1 - w_2 + w_3 = 0. The vector (1,0,0)(1, 0, 0) gives 22 and (0,1,0)(0, 1, 0) gives −1-1, so neither is in Col⁡A\operatorname{Col} A at all. The rank is 22.

  1. Find the rank of the matrix below, a basis of its column space, a basis of its row space and a rank factorization.
A=[121024311221]A = \begin{bmatrix} 1 & 2 & 1 & 0 \\ 2 & 4 & 3 & 1 \\ 1 & 2 & 2 & 1 \end{bmatrix}
Show the answer

The operations R2→R2−2R1R_2 \to R_2 - 2R_1 and R3→R3−R1R_3 \to R_3 - R_1 come first, then R3→R3−R2R_3 \to R_3 - R_2 and R1→R1−R2R_1 \to R_1 - R_2.

A→[121000110011]→[120−100110000].\begin{aligned} A &\to \begin{bmatrix} 1 & 2 & 1 & 0 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 1 & 1 \end{bmatrix} \\[0.4em] &\to \begin{bmatrix} 1 & 2 & 0 & -1 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 \end{bmatrix}. \end{aligned}

The pivots are in columns 1 and 3, so rank⁡A=2\operatorname{rank} A = 2. A basis of Col⁡A\operatorname{Col} A in R3\mathbb{R}^3 is (1,2,1)(1, 2, 1), (1,3,2)(1, 3, 2), the first and third columns of AA. A basis of Row⁡A\operatorname{Row} A in R4\mathbb{R}^4 is (1,2,0,−1)(1, 2, 0, -1), (0,0,1,1)(0, 0, 1, 1). A rank factorization is

A=CR,C=[112312],R=[120−10011].\begin{gathered} A = CR, \quad C = \begin{bmatrix} 1 & 1 \\ 2 & 3 \\ 1 & 2 \end{bmatrix}, \\[0.4em] R = \begin{bmatrix} 1 & 2 & 0 & -1 \\ 0 & 0 & 1 & 1 \end{bmatrix}. \end{gathered}

As a check, the last column of RR says that column 4 of AA is −(1,2,1)+(1,3,2)=(0,1,1)-(1, 2, 1) + (1, 3, 2) = (0, 1, 1), which is correct.

How this lesson connects