Session 07 · Unit 1

Solving Ax = 0: Pivot Variables, Special Solutions


The null space stops being a definition and becomes a computation. Elimination, extended to rectangular matrices, sorts the columns into pivot columns and free columns; assigning the free variables the special values one and zero produces the special solutions, and every vector in the null space is a combination of them. One number runs the whole show — the rank r, the count of pivots — leaving exactly n minus r special solutions.

From definition to algorithm

Lectures five and six defined the null space and the column space — what’s in those spaces. Now Strang wants to actually describe them: how do you compute all the vectors in the null space? “This is turning the idea, the definition, into an algorithm.” The algorithm for solving Ax=0A\mathbf{x} = \mathbf{0}.

The running example is deliberately rectangular — this whole chapter is about rectangular matrices:

A=[1222246836810]A = \begin{bmatrix} 1 & 2 & 2 & 2 \\ 2 & 4 & 6 & 8 \\ 3 & 6 & 8 & 10 \end{bmatrix}

Before any computing, Strang eyeballs it. Column two is a multiple of column one — same direction, not independent. And row one plus row two gives row three, so the third row isn’t independent either. “All that should come out of elimination.” The algorithm is elimination — but extended to the rectangular case, where we keep going even when a zero shows up in a pivot position.

One thing to hold onto throughout: elimination does not change the null space. Subtracting a multiple of one equation from another is a legitimate operation on the equations — the solutions of the system don’t move. (The column space does change, as we’ll see — you have to pay attention to what elimination leaves unchanged.) And since the right-hand side is all zeros, it stays all zeros; there’s no point writing it down.

Elimination on a rectangular matrix: the echelon form U

The first pivot is the 11 in the corner, and you know what to do with it. Subtract 22 times row one from row two, and 33 times row one from row three:

[1222246836810]    [122200240024]\begin{bmatrix} 1 & 2 & 2 & 2 \\ 2 & 4 & 6 & 8 \\ 3 & 6 & 8 & 10 \end{bmatrix} \;\longrightarrow\; \begin{bmatrix} \boxed{1} & 2 & 2 & 2 \\ 0 & 0 & 2 & 4 \\ 0 & 0 & 2 & 4 \end{bmatrix}

On to the second column. The pivot position holds a zero — that’s signaling a difficulty. Look below, hoping for a nonzero to row-exchange with: zero there too. What that’s really telling us is that column two is a combination of the earlier columns — it’s dependent. But we don’t stop to think; in that column there’s nothing to do, so we go on to the next column. There sits a perfectly good pivot, the 22. The multiplier is one: subtract row two from row three, and out comes a row of zeros.

U=[122200240000]U = \begin{bmatrix} \boxed{1} & 2 & 2 & 2 \\ 0 & 0 & \boxed{2} & 4 \\ 0 & 0 & 0 & 0 \end{bmatrix}

Strang can’t quite call UU upper triangular — it’s in echelon form. “The word echelon means, like, staircase form”: the nonzeros come down in a staircase. That row of zeros at the bottom is elimination discovering what we saw by eye: row three was a combination of rows one and two, and elimination knocked it out.

Pivot variables, free variables, special solutions

Now solve Ux=0U\mathbf{x} = \mathbf{0} — same null space as Ax=0A\mathbf{x} = \mathbf{0}. There are solutions: three equations (really two, as it turned out), four unknowns — solutions were guaranteed.

Here’s the critical step. Separate the columns into two kinds. Columns one and three hold the pivots: they are the pivot columns, and x1,x3x_1, x_3 are the pivot variables. Columns two and four are the free columns, and x2,x4x_2, x_4 are the free variables. Why “free”? Because we may assign any numbers to x2x_2 and x4x_4, freely — and then the equations determine x1x_1 and x3x_3 by back substitution. In equations, Ux=0U\mathbf{x} = \mathbf{0} says

x1+2x2+2x3+2x4=02x3+4x4=0\begin{aligned} x_1 + 2x_2 + 2x_3 + 2x_4 &= 0 \\ 2x_3 + 4x_4 &= 0 \end{aligned}

First choice: set x2=1x_2 = 1, x4=0x_4 = 0 — a free choice, but a convenient one. Back up from the last equation: x4=0x_4 = 0 forces x3=0x_3 = 0; then the first equation gives x1=2x_1 = -2. One solution found:

x=[2100]\mathbf{x} = \begin{bmatrix} -2 \\ 1 \\ 0 \\ 0 \end{bmatrix}

Check what it says about the columns: minus two of column one plus one of column two is the zero column — of course, since column two is twice column one. And once we have one solution, we have a line of them: any multiple c(2,1,0,0)c\,(-2, 1, 0, 0) is in the null space too — an infinitely long line in four-dimensional space.

Is that the whole null space? No — there are two free variables, and we’ve only made one choice. Second choice: x2=0x_2 = 0, x4=1x_4 = 1. This solution is guaranteed to be new — no multiple of the first one can put a 11 in the fourth slot. Back substitution: 2x3+4=02x_3 + 4 = 0 gives x3=2x_3 = -2; then x14+2=0x_1 - 4 + 2 = 0 gives x1=2x_1 = 2:

x=[2021]\mathbf{x} = \begin{bmatrix} 2 \\ 0 \\ -2 \\ 1 \end{bmatrix}

The whole null space: n − r special solutions

Now we can describe the complete null space — all solutions of Ax=0A\mathbf{x} = \mathbf{0}. Take all combinations of the special solutions. Don’t forget the crucial plus sign:

x=c[2100]+d[2021]\mathbf{x} = c \begin{bmatrix} -2 \\ 1 \\ 0 \\ 0 \end{bmatrix} + d \begin{bmatrix} 2 \\ 0 \\ -2 \\ 1 \end{bmatrix}

That’s a complete algorithm. Do elimination, pressing onward when a column offers nothing. Count the pivots — that’s rr. Give the nrn - r free variables their zero–one values, back-substitute for the pivot variables, and take all combinations.

Going further: the reduced row echelon form R

Strang could stop at UU, but he wants to clean the matrix up “as good as it can be.” Two more moves. First, eliminate upwards — get zeros above the pivots as well as below. Subtracting row two of UU from row one turns the 22 above the second pivot into a 00 (and produces a 2-2 in the last column). Second, divide each row by its pivot so the pivots equal 11 — dividing an equation by 22 changes no solutions. The result is RR, the reduced row echelon form:

R=[120200120000]R = \begin{bmatrix} 1 & 2 & 0 & -2 \\ 0 & 0 & 1 & 2 \\ 0 & 0 & 0 & 0 \end{bmatrix}

Matlab produces it in one command: rref(A). And RR carries all the information as clearly as it can be carried. Pivot rows one and two, pivot columns one and three — and sitting in those pivot rows and columns is the 2×22 \times 2 identity matrix. In the free columns sits the free part FF: the entries 2,02, 0 in column two and 2,2-2, 2 in column four. Zero rows below, recording that the original third row was a combination of the others.

Here’s why, in block form. Pretend the pivot columns come first (a typical reduced form):

R=[IF00]I: r×r, the pivot columnsF: the nr free columnsR = \begin{bmatrix} I & F \\ 0 & 0 \end{bmatrix} \qquad \begin{array}{l} I:\ r \times r,\ \text{the pivot columns} \\ F:\ \text{the } n - r \text{ free columns} \end{array}

Do all the special solutions at once by building a null space matrix NN whose columns are the special solutions, so that RN=0RN = 0 (that’s the teaching-code command null(A)). The equation Rx=0R\mathbf{x} = \mathbf{0} says: (pivot variables) +F+\, F \cdot (free variables) =0= \mathbf{0}, so the pivot variables equal F-F times the free variables. Put the identity in the free-variable part, and F-F appears in the pivot part:

N=[FI]N = \begin{bmatrix} -F \\ I \end{bmatrix}

Back substitution, when the system has been reduced this far, is totally simple.

The same algorithm on the transpose

To practice, Strang runs the whole thing again on ATA^T — “just for the heck of it.” Before calculating, predict: this matrix has three columns, and the third column is the sum of the first two, so we expect two pivot columns and one free column. Elimination had better discover that.

Problems

Run the lecture’s algorithm yourself — elimination, rank, free variables, special solutions — before opening the solutions.

Problem 7.1 The full algorithm

Find all solutions of Ax=0A\mathbf{x} = \mathbf{0} for

A=[131226480024]A = \begin{bmatrix} 1 & 3 & 1 & 2 \\ 2 & 6 & 4 & 8 \\ 0 & 0 & 2 & 4 \end{bmatrix}

Give the rank, identify the pivot and free variables, and write the null space as all combinations of special solutions.

Show solution

Subtract 22 times row one from row two:

[131200240024]\begin{bmatrix} 1 & 3 & 1 & 2 \\ 0 & 0 & 2 & 4 \\ 0 & 0 & 2 & 4 \end{bmatrix}

Column two has a zero pivot position with zeros below — move on. Column three has pivot 22; subtract row two from row three:

U=[131200240000]U = \begin{bmatrix} 1 & 3 & 1 & 2 \\ 0 & 0 & 2 & 4 \\ 0 & 0 & 0 & 0 \end{bmatrix}

Two pivots, so r=2r = 2. Pivot variables x1,x3x_1, x_3; free variables x2,x4x_2, x_4; there will be 42=24 - 2 = 2 special solutions.

Set x2=1,x4=0x_2 = 1, x_4 = 0: the second equation 2x3+4x4=02x_3 + 4x_4 = 0 gives x3=0x_3 = 0; the first, x1+3x2+x3+2x4=0x_1 + 3x_2 + x_3 + 2x_4 = 0, gives x1=3x_1 = -3. Special solution (3,1,0,0)(-3, 1, 0, 0).

Set x2=0,x4=1x_2 = 0, x_4 = 1: 2x3+4=02x_3 + 4 = 0 gives x3=2x_3 = -2; then x12+2=0x_1 - 2 + 2 = 0 gives x1=0x_1 = 0. Special solution (0,0,2,1)(0, 0, -2, 1).

The null space is

x=c[3100]+d[0021]\mathbf{x} = c \begin{bmatrix} -3 \\ 1 \\ 0 \\ 0 \end{bmatrix} + d \begin{bmatrix} 0 \\ 0 \\ -2 \\ 1 \end{bmatrix}
Problem 7.2 Reading solutions off R

Continue Problem 7.1: reduce UU to the reduced row echelon form RR, identify the identity part II and the free part FF, and confirm that the special solutions are the columns of NN with F-F in the pivot variables and II in the free variables.

Show solution

Eliminate upward — subtract 12\tfrac{1}{2} of row two from row one to clear the 11 above the second pivot — then divide row two by 22:

R=[130000120000]R = \begin{bmatrix} 1 & 3 & 0 & 0 \\ 0 & 0 & 1 & 2 \\ 0 & 0 & 0 & 0 \end{bmatrix}

The identity sits in the pivot rows and pivot columns (columns one and three). The free columns (two and four) hold

F=[3002]F = \begin{bmatrix} 3 & 0 \\ 0 & 2 \end{bmatrix}

Then F-F placed in the pivot slots x1,x3x_1, x_3 and the identity in the free slots x2,x4x_2, x_4 gives exactly the special solutions (3,1,0,0)(-3, 1, 0, 0) and (0,0,2,1)(0, 0, -2, 1) found by back substitution: the entries 3,03, 0 and 0,20, 2 reappear with their signs switched. RN=0RN = 0 checks.

Problem 7.3 Counting with the rank

(a) A matrix AA is 5×75 \times 7 with rank 44. How many free variables and how many special solutions does Ax=0A\mathbf{x} = \mathbf{0} have? (b) For which relationship between rr and nn does the null space contain only the zero vector? (c) BB is 7×57 \times 5 with rank 44 — how many special solutions now? Why does the rank not change in passing from a matrix to its transpose here?

Show solution

(a) Free variables: nr=74=3n - r = 7 - 4 = 3, so there are 33 special solutions, one per free variable.

(b) The null space is only x=0\mathbf{x} = \mathbf{0} exactly when there are no free variables: nr=0n - r = 0, i.e. r=nr = n — a pivot in every column.

(c) Now n=5n = 5, so nr=54=1n - r = 5 - 4 = 1: one special solution. The rank is the same 44 because, as the lecture notes, the number of pivot columns of AA and ATA^T is the same — but the number of special solutions changes, since it depends on nn, the number of columns.

Problem 7.4 Predict, then verify

The third column of

A=[1232573912]A = \begin{bmatrix} 1 & 2 & 3 \\ 2 & 5 & 7 \\ 3 & 9 & 12 \end{bmatrix}

is the sum of the first two. Before computing: what rank do you expect, and how many special solutions? Then run elimination and find the whole null space.

Show solution

Prediction: columns one and two are independent, column three depends on them — so two pivot columns, rank 22, and 32=13 - 2 = 1 special solution.

Elimination: subtract 22 times row one from row two, and 33 times row one from row three:

[123011033]    U=[123011000]\begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 1 \\ 0 & 3 & 3 \end{bmatrix} \;\longrightarrow\; U = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{bmatrix}

(subtracting 33 times row two from row three). Rank 22 as predicted; x3x_3 is free.

Special solution: set x3=1x_3 = 1. Then x2+x3=0x_2 + x_3 = 0 gives x2=1x_2 = -1, and x1+2(1)+3(1)=0x_1 + 2(-1) + 3(1) = 0 gives x1=1x_1 = -1. Check: c1c2+c3=0-\mathbf{c}_1 - \mathbf{c}_2 + \mathbf{c}_3 = \mathbf{0}, which is exactly the dependence we spotted. The null space is the line

x=c[111]\mathbf{x} = c \begin{bmatrix} -1 \\ -1 \\ 1 \end{bmatrix}