MAT1041 · Week 9 · - Rank of a Matrix and Systems of Linear Equations

Rank, row/column/null space and linear systems

You learn to find bases for the row space, column space and null space of a matrix, rank and nullity, the rank-nullity theorem, and to decide the consistency of a system with rank and write its solution in the form 'particular solution + homogeneous solution'.

row spacecolumn spacenull spaceranknullityrank-nullity theoremparticular solutiongeneral solutionconsistentpivot columnsinvertible matrix theorem

Three subspaces go with a matrix: the row space spanned by the rows, the column space spanned by the columns, and the null space made of the solutions of Ax=0A\mathbf{x} = \mathbf{0}. The relation among their dimensions (the rank-nullity theorem) is the most useful counting rule in linear algebra. And the good news: bases for all three come out of a single RREF computation. This week we also close the theory behind the “unique / infinite / none” decision of week 1.

Golden rules:

  1. RREF first. All three subspaces are read off from it.
  2. For the row space use the rows of the RREF, for the column space use the original columns.
  3. Rank + nullity = number of columns.
  4. Consistency: rank⁡[A∣b]=rank⁡A\operatorname{rank}[A \mid \mathbf{b}] = \operatorname{rank}A.

The three subspaces

Let AA be m×nm \times n.

SubspaceDefinitionWhere it lives
Row spacethe span of its rowsRn\mathbb{R}^n
Column spacethe span of its columns = {Ax}\{A\mathbf{x}\}Rm\mathbb{R}^m
Null space{x:Ax=0}\{\mathbf{x} : A\mathbf{x} = \mathbf{0}\}Rn\mathbb{R}^n

The column space is all the values AxA\mathbf{x} can take, because AxA\mathbf{x} is a combination of the columns (week 2). So Ax=bA\mathbf{x} = \mathbf{b} is consistent if and only if b\mathbf{b} is in the column space.

One RREF, three bases

Example. A=[131226351301]A = \begin{bmatrix} 1 & 3 & 1 & 2 \\ 2 & 6 & 3 & 5 \\ 1 & 3 & 0 & 1 \end{bmatrix}.

A→R3←R3−R1R2←R2−2R1[1312001100−1−1]→R3←R3+R2[131200110000]→R1←R1−R2[130100110000]=RA \xrightarrow[R_3 \leftarrow R_3 - R_1]{R_2 \leftarrow R_2 - 2R_1} \begin{bmatrix} 1 & 3 & 1 & 2 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & -1 & -1 \end{bmatrix} \xrightarrow{R_3 \leftarrow R_3 + R_2} \begin{bmatrix} 1 & 3 & 1 & 2 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 \end{bmatrix} \xrightarrow{R_1 \leftarrow R_1 - R_2} \begin{bmatrix} 1 & 3 & 0 & 1 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 \end{bmatrix} = R

The pivots are in columns 1 and 3.

Row space. Row operations replace rows by combinations of each other; the span stays the same. The nonzero rows of RR are independent (the pivots are in different places):

basis of row(A): {(1,3,0,1), (0,0,1,1)}.\text{basis of row}(A)\text{: } \{(1, 3, 0, 1),\ (0, 0, 1, 1)\}.

Column space. Row operations preserve the linear relations among the columns but change the columns themselves. In RR, column 2 = 3 × column 1 and column 4 = column 1 + column 3; the same relations hold in AA. The pivot columns are independent, and the rest are combinations of them:

basis of col(A): {(1,2,1), (1,3,0)}(columns 1 and 3 of A).\text{basis of col}(A)\text{: } \{(1, 2, 1),\ (1, 3, 0)\} \quad (\text{columns 1 and 3 of } A).

Null space. Rx=0R\mathbf{x} = \mathbf{0}: x1+3x2+x4=0x_1 + 3x_2 + x_4 = 0, x3+x4=0x_3 + x_4 = 0. With x2=sx_2 = s, x4=tx_4 = t free:

x=s(−3,1,0,0)+t(−1,0,−1,1),basis of null(A): {(−3,1,0,0), (−1,0,−1,1)}.\mathbf{x} = s(-3, 1, 0, 0) + t(-1, 0, -1, 1), \qquad \text{basis of null}(A)\text{: } \{(-3, 1, 0, 0),\ (-1, 0, -1, 1)\}.

PITFALL · writing the RREF columns as the column space basis. The pivot columns of RR are (1,0,0)(1, 0, 0) and (0,1,0)(0, 1, 0); these are not even in the column space of AA (the column space of AA is the plane 3b1=b2+b33b_1 = b_2 + b_3). For the column space, always use the original AA.

Rank and nullity

rank⁡A=dim⁡row(A)=dim⁡col(A)=number of pivots,nullity⁡A=dim⁡null(A).\operatorname{rank}A = \dim\text{row}(A) = \dim\text{col}(A) = \text{number of pivots}, \qquad \operatorname{nullity}A = \dim\text{null}(A).

That the row space and the column space have equal dimension is surprising (one lives in Rn\mathbb{R}^n, the other in Rm\mathbb{R}^m), but both equal the number of pivots. Consequence: rank⁡AT=rank⁡A\operatorname{rank}A^T = \operatorname{rank}A.

Rank-nullity theorem. If AA is m×nm \times n then

rank⁡A+nullity⁡A=n.\operatorname{rank}A + \operatorname{nullity}A = n.

Every column is either a pivot column (counted in the rank) or a free variable column (counted in the nullity). In the example 2+2=42 + 2 = 4.

A table for quick questions (AA is m×nm \times n):

InformationResult
rank⁡A≤min⁡(m,n)\operatorname{rank}A \le \min(m, n)a 4×6 matrix has rank at most 4
Ax=0A\mathbf{x} = \mathbf{0} only trivialnullity 0, rank =n= n
rank⁡A=m\operatorname{rank}A = ma pivot in every row, consistent for every b\mathbf{b}
rank⁡A=n\operatorname{rank}A = nno free variable, a unique solution if consistent
n>mn > mnullity ≥n−m>0\ge n - m > 0, the homogeneous system has a nontrivial solution

Rank and systems

For Ax=bA\mathbf{x} = \mathbf{b}:

CaseResult
rank⁡[A∣b]>rank⁡A\operatorname{rank}[A \mid \mathbf{b}] > \operatorname{rank}Ano solution
rank⁡[A∣b]=rank⁡A=n\operatorname{rank}[A \mid \mathbf{b}] = \operatorname{rank}A = nunique solution
rank⁡[A∣b]=rank⁡A<n\operatorname{rank}[A \mid \mathbf{b}] = \operatorname{rank}A < ninfinitely many solutions, n−rank⁡An - \operatorname{rank}A parameters

This is the same as the decision table of week 1, just in the language of rank. A row [0⋯0∣c≠0][0 \cdots 0 \mid c \neq 0] means adding an extra pivot to the augmented matrix.

In the example, for b=(b1,b2,b3)\mathbf{b} = (b_1, b_2, b_3) the same operations leave b2+b3−3b1b_2 + b_3 - 3b_1 on the right of the last row. For b=(3,7,2)\mathbf{b} = (3, 7, 2), 7+2−9=07 + 2 - 9 = 0: consistent. For b=(1,0,0)\mathbf{b} = (1, 0, 0), −3≠0-3 \neq 0: inconsistent, rank⁡[A∣b]=3\operatorname{rank}[A \mid \mathbf{b}] = 3.

General solution = particular solution + homogeneous solution

If xp\mathbf{x}_p is any (particular) solution of Ax=bA\mathbf{x} = \mathbf{b}, then all solutions are

x=xp+xh,xh∈null(A).\mathbf{x} = \mathbf{x}_p + \mathbf{x}_h, \qquad \mathbf{x}_h \in \text{null}(A).

Why: the difference of two solutions satisfies A(x−xp)=b−b=0A(\mathbf{x} - \mathbf{x}_p) = \mathbf{b} - \mathbf{b} = \mathbf{0}, so it is in the null space.

In the example with b=(3,7,2)\mathbf{b} = (3, 7, 2): the RREF of [A∣b][A \mid \mathbf{b}] gives x1+3x2+x4=2x_1 + 3x_2 + x_4 = 2, x3+x4=1x_3 + x_4 = 1. Take the free variables as 0: xp=(2,0,1,0)\mathbf{x}_p = (2, 0, 1, 0). Check: Axp=(2+1,4+3,2+0)=(3,7,2)A\mathbf{x}_p = (2 + 1, 4 + 3, 2 + 0) = (3, 7, 2). The general solution:

x=(2,0,1,0)+s(−3,1,0,0)+t(−1,0,−1,1).\mathbf{x} = (2, 0, 1, 0) + s(-3, 1, 0, 0) + t(-1, 0, -1, 1).

Geometrically: the solution set is the null space shifted by xp\mathbf{x}_p. It is not a subspace (it does not contain zero), but it is a parallel copy.

The invertible matrix theorem (current)

For n×nn \times n AA the following are equivalent:

  1. AA is invertible. 2. det⁡A≠0\det A \neq 0. 3. A∼InA \sim I_n. 4. Ax=0A\mathbf{x} = \mathbf{0} has only the trivial solution. 5. Ax=bA\mathbf{x} = \mathbf{b} has a unique solution for every b\mathbf{b}. 6. rank⁡A=n\operatorname{rank}A = n. 7. nullity⁡A=0\operatorname{nullity}A = 0. 8. The columns are independent. 9. The columns span Rn\mathbb{R}^n. 10. The rows are a basis of Rn\mathbb{R}^n.

On the exam, showing one item and writing another as the conclusion is a legitimate argument.

Common mistakes

WrongRight
Using the number of rows in rank-nullitynn = the number of columns
Writing the RREF columns as the column spaceThe original pivot columns
Blindly writing the original rows as the row spaceThey may be dependent; the nonzero rows of the RREF are safe
Thinking the rank is the number of nonzero entriesThe number of pivots
If det⁡=0\det = 0 then rank =0= 0Rank <n< n; it can be 1 or 2
Forgetting the particular solution in the general solutionxp+xh\mathbf{x}_p + \mathbf{x}_h
Looking for the null space in Rm\mathbb{R}^mIn Rn\mathbb{R}^n (where x\mathbf{x} lives)

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1easy

Find the rank of [1224]\begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix}.

Show answer
1

R2←R2−2R1R_2 \leftarrow R_2 - 2R_1 gives a zero row. One pivot: rank 1.
By columns: column 2 = 2 × column 1, the number of independent columns is 1.

Question 2easy

AA is a 5×75 \times 7 matrix with rank 3. What is the nullity of AA?

Show answer
4

Rank-nullity: rank⁡A+nullity⁡A=n\operatorname{rank}A + \operatorname{nullity}A = n = the number of columns =7= 7.nullity⁡=7−3=4\operatorname{nullity} = 7 - 3 = 4. The number of rows (5) does not appear in this formula.

Question 3medium

Find the rank of A=[1−1202−251−1113]A = \begin{bmatrix} 1 & -1 & 2 & 0 \\ 2 & -2 & 5 & 1 \\ -1 & 1 & 1 & 3 \end{bmatrix}.

Show answer
2

R2←R2−2R1R_2 \leftarrow R_2 - 2R_1: (0,0,1,1)(0, 0, 1, 1). R3←R3+R1R_3 \leftarrow R_3 + R_1: (0,0,3,3)(0, 0, 3, 3). R3←R3−3R2R_3 \leftarrow R_3 - 3R_2: a zero row.
Two pivots (columns 1 and 3): rank 2.

Question 4medium

For the matrix AA of the previous question, find a basis for the row space of AA.

Show answer
{(1,−1,0,−2), (0,0,1,1)}\{(1, -1, 0, -2),\ (0, 0, 1, 1)\}

Row operations do not change the row space. The nonzero rows of the RREF form a basis.
With R1←R1−2R2R_1 \leftarrow R_1 - 2R_2 the RREF is: (1,−1,0,−2)(1, -1, 0, -2) and (0,0,1,1)(0, 0, 1, 1).
(The REF rows (1,−1,2,0)(1, -1, 2, 0), (0,0,1,1)(0, 0, 1, 1) are also a correct answer.)

Question 5medium

For the same AA, find a basis for the column space of AA.

Show answer
{(1,2,−1), (2,5,1)}\{(1, 2, -1),\ (2, 5, 1)\}

The pivots are in columns 1 and 3. A basis of the column space: the original 1st and 3rd columns of AA.
Writing the columns of the RREF is wrong: row operations change the column space.

Question 6medium

For the same AA, find a basis for the null space and the nullity.

Show answer
Basis {(1,1,0,0),(2,0,−1,1)}\{(1, 1, 0, 0), (2, 0, -1, 1)\}, nullity 22

RREF: x1−x2−2x4=0x_1 - x_2 - 2x_4 = 0, x3+x4=0x_3 + x_4 = 0. x2=sx_2 = s, x4=tx_4 = t are free.x=(s+2t,s,−t,t)=s(1,1,0,0)+t(2,0,−1,1)\mathbf{x} = (s + 2t, s, -t, t) = s(1, 1, 0, 0) + t(2, 0, -1, 1).
Check: 2+2=42 + 2 = 4 the number of columns (rank + nullity).

Question 7medium

For the same AA, is b=(1,3,4)\mathbf{b} = (1, 3, 4) in the column space of AA?

Show answer
No

The same operations on [A∣b][A \mid \mathbf{b}]: R2−2R1R_2 - 2R_1: (0,0,1,1∣1)(0, 0, 1, 1 \mid 1); R3+R1R_3 + R_1: (0,0,3,3∣5)(0, 0, 3, 3 \mid 5); R3−3R2R_3 - 3R_2: (0,0,0,0∣2)(0, 0, 0, 0 \mid 2).
Inconsistent, that is, rank⁡[A∣b]=3>rank⁡A=2\operatorname{rank}[A \mid \mathbf{b}] = 3 > \operatorname{rank}A = 2. b\mathbf{b} is not in the column space.
(If b=(1,3,2)\mathbf{b} = (1, 3, 2) the last row would have been 0=00 = 0.)

Question 8hard

For which values of kk does A=[1232k611k]A = \begin{bmatrix} 1 & 2 & 3 \\ 2 & k & 6 \\ 1 & 1 & k \end{bmatrix} have rank 2?

Show answer
k=3k = 3 or k=4k = 4

det⁡A=1(k2−6)−2(2k−6)+3(2−k)=k2−7k+12=(k−3)(k−4)\det A = 1(k^2 - 6) - 2(2k - 6) + 3(2 - k) = k^2 - 7k + 12 = (k - 3)(k - 4).
If det⁡≠0\det \neq 0 the rank is 3. When k=3k = 3 or 44, det⁡=0\det = 0, rank <3< 3. Rows 1 and 3, (1,2,3)(1, 2, 3) and (1,1,k)(1, 1, k), are not proportional for any kk, so rank ≥2\ge 2.
Conclusion: the rank is exactly 2.

Question 9hard

Write the general solution of x1+x2+2x3=3x_1 + x_2 + 2x_3 = 3, 2x1+3x2+5x3=82x_1 + 3x_2 + 5x_3 = 8 in the form x=xp+xh\mathbf{x} = \mathbf{x}_p + \mathbf{x}_h.

Show answer
x=(1,2,0)+t(−1,−1,1)\mathbf{x} = (1, 2, 0) + t(-1, -1, 1)

R2←R2−2R1R_2 \leftarrow R_2 - 2R_1: (0,1,1∣2)(0, 1, 1 \mid 2). R1←R1−R2R_1 \leftarrow R_1 - R_2: (1,0,1∣1)(1, 0, 1 \mid 1).x3=tx_3 = t: x1=1−tx_1 = 1 - t, x2=2−tx_2 = 2 - t. The particular solution (t=0t = 0) is (1,2,0)(1, 2, 0); the homogeneous part t(−1,−1,1)t(-1, -1, 1) is the null space of AA.

Question 10easy

True or false: A 4×64 \times 6 matrix can have rank 5.

Show answer
False

Rank = number of pivots; there is at most one pivot per row, and there are 4 rows. rank⁡A≤min⁡(m,n)=4\operatorname{rank}A \le \min(m, n) = 4.

Question 11hard

AA is 6×46 \times 4 and Ax=0A\mathbf{x} = \mathbf{0} has only the trivial solution. Find rank⁡A\operatorname{rank}A. Is Ax=bA\mathbf{x} = \mathbf{b} consistent for every b∈R6\mathbf{b} \in \mathbb{R}^6?

Show answer
rank⁡A=4\operatorname{rank}A = 4; no

Only the trivial solution ⇒\Rightarrow nullity 0 ⇒\Rightarrow rank =4−0=4= 4 - 0 = 4.
The column space is a 4-dimensional subspace of R6\mathbb{R}^6, not all of R6\mathbb{R}^6. For some b\mathbf{b} it is inconsistent.
But when it is consistent the solution is unique (no free variable).

Question 12medium

If AA is 3×53 \times 5 with rank⁡A=3\operatorname{rank}A = 3, what are rank⁡AT\operatorname{rank}A^T and the dimension of the null space of ATA^T?

Show answer
33 and 00

rank⁡AT=rank⁡A=3\operatorname{rank}A^T = \operatorname{rank}A = 3 (the row space and the column space have equal dimension).ATA^T is 5×35 \times 3: nullity =3−3=0= 3 - 3 = 0.

Verification: The RREF, rank, pivot columns and null space bases were computed exactly in node with BigInt fractions; the consistency conditions were checked by trying exact solutions with many b vectors, the particular solutions by the product A·x = b, and the parametric rank question at many values of k (verify/MAT1041/09.mjs).

Review card

Row space row(A) ⊆ Rⁿ: the nonzero ROWS of the RREF are a basis (row operations do not change it). Column space col(A) ⊆ Rᵐ: the ORIGINAL form of the PIVOT COLUMNS is a basis. Null space null(A) ⊆ Rⁿ: solve Ax = 0, separate by the free variables. rank A = number of pivots = dim row = dim col. rank A^T = rank A. nullity A = dim null(A) = number of free variables. RANK-NULLITY: rank A + nullity A = n (number of COLUMNS). rank ≤ min(m, n). Ax = b is consistent ⇔ b ∈ col(A) ⇔ rank[A|b] = rank A. If consistent: x = x_p + x_h (a particular solution + any vector from the null space). rank = n → unique solution; rank < n → infinitely many. rank = m (a pivot in every row) → consistent for every b. Square A invertible ⇔ rank = n ⇔ nullity = 0 ⇔ det ≠ 0 ⇔ rows/columns are a basis.