3.2  Gaussian Elimination

Every reader of this book has solved a system of equations by eliminating unknowns: subtract a multiple of one equation from another, and a variable disappears. Done by hand on small systems, this feels like common sense. Done on a system of 50 equations, or over F2, or in a proof about all systems at once, it needs to be an algorithm, and we need to know that it never changes the answer. This section makes elimination precise, proves that it always reaches a standard shape, and shows how to read every solution from that shape.

3.2.1. Three moves that do not change the answer

Here is a system over R, solved the way one would solve it on paper: x+2y+z=4,2x+4y+3z=9,x+3y+z=5. Subtract twice the first equation from the second: z=1. Subtract the first from the third: y=1. Then the first equation gives x=4−2−1=1.

Only three kinds of move were used, or could reasonably be used: reorder the equations, multiply an equation by a non-zero number, and add a multiple of one equation to another. None of them looks at the names x,y,z. Each acts on the coefficients and the right-hand side of whole equations, that is, on the rows of the augmented matrix. The first step above, for instance, replaces row 2, (2,4,3∣9), by row 2 minus twice row 1, (0,0,1∣1).

Not every move that looks harmless is safe. Multiplying an equation by 0 turns it into 0=0, and a constraint silently disappears. So we list the allowed moves carefully.

An elementary row operation is a reversible move on the rows of a matrix: swap two rows, rescale one row by a non-zero scalar, or add a multiple of one row to a different row.

Definition 3.2.1 (Elementary row operations)

Let F be a field and let M∈Mm×k(F) have rows r1,…,rm. An elementary row operation on M is one of the following.

  • (1) Swap two rows: for i≠j, exchange ri and rj. Notation: Ri↔Rj.
  • (2) Scale a row: for an index i and a scalar c∈F with c≠0, replace ri by cri. Notation: Ri→cRi.
  • (3) Replace a row by adding a multiple of another row: for indices i≠j and any c∈F, replace ri by ri+crj. Notation: Ri→Ri+cRj.

In each case the rows not mentioned are left unchanged.

In words: (1) reorders, (2) rescales one row by a non-zero scalar, and (3) changes one row, row i, using a different row j, which itself stays as it was. We write Ri→Ri−cRj for Ri→Ri+(−c)Rj. The notation Ri refers to the current row i at the moment the operation is performed.

Take M=(120311) over R. Then R1↔R2 gives (311120), R1→−2R1 gives (−2−40311), and R2→R2−3R1 gives (1200−51). The degenerate case m=1 is worth a glance: a one-row matrix admits no swap and no replacement, since both need two different rows, so its only elementary row operations are the scalings.

The minimal change that breaks the definition is to drop “c≠0”. The move R2→0R2 still replaces one row by a multiple of itself, but it sends (120311) to (120000), and no move of any kind can recover the lost row (3,1,1) from that matrix. The failing clause is c≠0, and the damage is exactly irreversibility.

Warning. Perform operations one at a time. It is tempting to write “R1→R1−R2 and R2→R2−R1” as one step, using the old rows in both. That is not a sequence of elementary row operations, and it can destroy information. On the system x=1, x=1 it produces 0=0, 0=0, whose solution set is all of F, not {1}. Done in order, the second operation uses the new row 1, (0∣0), and leaves row 2 unchanged, so no information is lost.

Why these three and no others? They are exactly the moves of hand elimination, and each can be undone by a move of the same kind, which is what the theorem below needs. The condition i≠j in (3) is not fussiness: “add c times row i to row i” would be scaling by 1+c, which is illegal when c=−1 (Exercise C1).

An elementary row operation acts on the rows, but it treats each column separately: the new entry in position (i,l) is computed only from entries of column l. We record this, because it will be used again and again.

Lemma 3.2.1 (Row operations act column by column)

Let M=[M1∣M2]∈Mm×k(F) be split into its first k1 columns M1 and its remaining columns M2. If an elementary row operation turns M into M′=[M1′∣M2′] (split in the same place), then the same operation turns M1 into M1′ and M2 into M2′. In particular, an elementary row operation turns a zero column into a zero column.

Proof. Let mhl be the entries of M and mhl′ those of M′. For a swap Ri↔Rj: mil′=mjl, mjl′=mil, and mhl′=mhl for h≠i,j. For a scaling Ri→cRi: mil′=cmil, and other rows are unchanged. For a replacement Ri→Ri+cRj: mil′=mil+cmjl, and other rows are unchanged. In each case, every entry of column l of M′ is computed from column l of M alone, by the same rule for every l. Hence applying the operation to M1 or to M2 separately gives M1′ and M2′. If column l of M is zero, each formula gives 0, since c⋅0=0 and 0+c⋅0=0 (Theorem 0.7.1).

For an augmented matrix, the lemma says: operating on [A∣b] is the same as operating on A and on b with the same moves. Now we name what sequences of moves produce.

Definition 3.2.2 (Row equivalence)

Let A,B∈Mm×k(F). We say A is row equivalent to B if B can be obtained from A by a finite sequence of elementary row operations. The empty sequence is allowed, so every matrix is row equivalent to itself.

In Example (Row equivalence) of Chapter 0 we met a definition that looks different: B=EA for an invertible matrix E. In section 4 of this chapter we prove that the two definitions agree (Theorem 3.4.8), by writing each elementary row operation as multiplication by an invertible matrix. Until then, “row equivalent” means the definition above.

3.2.2. Row operations preserve solutions

Here is the promise from the start of the section, now as a theorem.

Theorem 3.2.2 (Row operations preserve solutions)

Let F be a field.

  • (a) (Reversibility) If an elementary row operation turns M into M′, then an elementary row operation of the same type turns M′ back into M.
  • (b) Row equivalence is an equivalence relation on Mm×k(F).
  • (c) If [A∣b] and [A′∣b′] in Mm×(n+1)(F) are row equivalent, then the systems Ax=b and A′x=b′ have the same solution set.

Idea. Reversibility is checked type by type, and the check for scaling is the only place where c≠0 is used. For (c), every equation of the new system is a combination of equations of the old one, so an old solution satisfies the new system. That gives one inclusion. Instead of repeating the argument backwards, reversibility gives the other inclusion for free.

Proof.

  • (a) A swap Ri↔Rj is undone by the same swap. A scaling Ri→cRi is undone by Ri→c−1Ri, which is a legal scaling because c≠0 has an inverse c−1≠0 in F (Definition 0.7.1): the row becomes c−1(cri)=ri. A replacement Ri→Ri+cRj is undone by Ri→Ri−cRj. Here we use i≠j: row j was not changed by the first operation, so the second one gives (ri+crj)−crj=ri.

  • (b) Reflexivity holds via the empty sequence. For symmetry, suppose operations O1,…,Os, in this order, turn A into B. By (a), each Ot has an undoing operation Ot′. Then Os′,Os−1′,…,O1′, in this order, turn B back into A. For transitivity, if a sequence turns A into B and another turns B into C, performing the first and then the second turns A into C, and this is still a finite sequence.

  • (c) First suppose a single operation turns [A∣b] into [A′∣b′]. Let S and S′ be the two solution sets. Write rh for row h of A, so that equation h says rhx=bh, where rhx is a 1×1 product. Let s∈S, so rhs=bh for every h. Each equation of the new system holds at s:

  • after Ri↔Rj, the new equations are the old ones in another order;
  • after Ri→cRi, the new equation i is (cri)x=cbi, and (cri)s=c(ris)=cbi;
  • after Ri→Ri+cRj, the new equation i is (ri+crj)x=bi+cbj, and (ri+crj)s=ris+c(rjs)=bi+cbj, by Theorem 0.9.4.

The other equations are unchanged. Hence s∈S′, and S⊆S′. By (a), a single operation turns [A′∣b′] back into [A∣b], so the same argument gives S′⊆S. Therefore S=S′.

For a sequence of s operations, the intermediate augmented matrices all have the same solution set, by the single-operation case applied s times (formally, by induction on s). This proves (c).

This theorem is the license for everything that follows: we may transform a system as much as we like by row operations, and the solutions of the final system are the solutions of the original one. What it does not license is just as important.

Warning. Scaling by 0 is not a row operation, and it changes the solution set. Over R, the system x+y=2, x−y=0 has exactly one solution, (1,1). Applying the illegal move R2→0R2 gives x+y=2, 0=0, whose solutions (2−t,t) form a whole line. The inclusion S⊆S′ in the proof above still holds; what fails is reversibility, and with it S′⊆S.

Warning. Column operations are not allowed. Operations on the columns of [A∣b] mix up the unknowns. The system x+y=3, x−y=1 has the unique solution (2,1). Adding column 1 to column 2 of its augmented matrix gives [123101], the system x+2y=3, x=1, whose only solution is (1,1). Even swapping two columns of A swaps the corresponding entries of every solution.

3.2.3. Echelon forms

Row operations can change a system a great deal. We now choose a target: a shape of matrix from which the solutions can be read off with no further work. Look at the finished computation from the start of the section. After eliminating, the augmented matrix could be brought to [100101010011], which says x=1, y=1, z=1 outright. Not every system can be brought to this shape, since not every system has exactly one solution. The general target is a staircase.

For a non-zero row of a matrix, its leading entry is its first non-zero entry, reading from the left.

A matrix is in row echelon form when its non-zero rows come first and their leading entries step strictly to the right as we go down.

Definition 3.2.3 (Row echelon form)

A matrix R∈Mm×k(F) is in row echelon form if:

  • (E1) there is an integer r with 0≤r≤m such that rows 1,…,r are non-zero and rows r+1,…,m are zero; and
  • (E2) if the leading entry of row i lies in column ji, for i=1,…,r, then j1<j2<⋯<jr, strictly.

The leading entries of rows 1,…,r are the pivots of R, and the columns j1,…,jr are its pivot columns.

In words: (E1) says zero rows sit at the bottom, and (E2) says each pivot lies strictly to the right of the pivot above it. Two consequences are used constantly. Each row contains at most one pivot, so there are at most m pivots. And every entry below a pivot is zero: if h>i, then row h is zero or has its leading entry in column jh>ji, so its entry in column ji is 0.

Definition 3.2.4 (Reduced row echelon form)

A matrix R∈Mm×k(F) is in reduced row echelon form (RREF) if it is in row echelon form, with pivot columns j1<⋯<jr, and moreover:

  • (E3) every pivot equals 1: riji=1 for i=1,…,r; and
  • (E4) every pivot is the only non-zero entry in its column: rhji=0 for all h≠i.

In words: (E3) normalizes the pivots, and (E4) clears the entries above each pivot as well as below. Together they say that the pivot column ji is the standard basis vector ei∈Fm.

Example (Echelon or not?)

Decide which of the following real matrices are in row echelon form, and which are in reduced row echelon form. Give the pivot columns where they exist. P=(21300−1000),Q=(15020013),T=(102001010),Z=(0000).

Solution. P is in row echelon form: rows 1 and 2 are non-zero, row 3 is zero, and the leading entries lie in columns 1<3. The pivot columns are 1 and 3. It is not reduced: the pivot 2 is not 1, failing (E3), and column 3 has the non-zero entry 3 above the pivot −1, failing (E4).

Q is in reduced row echelon form, with pivot columns 1 and 3. Both pivots are 1, and columns 1 and 3 are e1 and e2. The entries 5,2,3 in the non-pivot columns 2 and 4 are allowed to be anything.

T is not in row echelon form. Its leading entries lie in columns 1,3,2, and 3<2 fails, so (E2) fails. Swapping rows 2 and 3 would repair it.

Z is in reduced row echelon form, with r=0: there are no pivots, and (E2)–(E4) hold vacuously. This degenerate case matters, because the zero matrix must have an RREF too, and it is itself.

For Q, a minimal change gives a non-example: replacing the 0 in position (1,3) by 4 keeps (E1)–(E3), but column 3 now has the non-zero entry 4 above its pivot, so (E4) fails.

Why insist on the reduced form, when row echelon form already allows back substitution? Because a system in reduced form needs no substitution: each pivot variable appears in exactly one equation. More importantly, the reduced form turns out to be unique: a matrix is row equivalent to exactly one matrix in RREF, however the operations are chosen. That is proved in the next section, and it is what makes later definitions, such as the rank, independent of choices. Row echelon form is not unique, as the warning after the worked example shows.

Quick check. Is (120−100130000) in reduced row echelon form? If it is the coefficient matrix of a homogeneous system in x1,x2,x3,x4, which unknowns correspond to pivot columns?

Solution. Yes. Row 3 is the only zero row and it is last; the leading entries lie in columns 1<3; both are 1; and columns 1 and 3 are e1 and e2. The pivot columns are 1 and 3, so the unknowns x1 and x3 correspond to pivots, and x2,x4 do not.

3.2.4. Gauss–Jordan elimination

We now show that every matrix can be brought to reduced row echelon form. The procedure works through the columns from left to right, keeping a count r of the pivots found so far.

Algorithm. Gauss–Jordan elimination. Input: M∈Mm×k(F). Set r=0. For l=1,2,…,k in turn:

  1. Look for a row h with h>r whose entry in column l is non-zero. If there is none, column l gets no pivot; go on to the next l.
  2. Otherwise choose such an h. If h≠r+1, perform Rr+1↔Rh.
  3. Let a≠0 be the entry now in position (r+1,l). Perform Rr+1→a−1Rr+1, so that this entry becomes 1.
  4. For every row g≠r+1 whose entry c in column l is non-zero, perform Rg→Rg−cRr+1.
  5. Increase r by 1.

Output: the final matrix, which is in reduced row echelon form, with r pivots.

Step 2 involves a choice: any non-zero entry will do. By hand, we choose one that avoids fractions. If we skip the scaling in step 3 and clear only the entries below the pivot a, by Rg→Rg−ca−1Rr+1 for the rows g>r+1, the output is a row echelon form instead; this cheaper variant is Gaussian elimination, and it is followed by back substitution.

Theorem 3.2.3 (Existence of the reduced row echelon form)

Let F be a field. Every matrix M∈Mm×k(F) is row equivalent to a matrix in reduced row echelon form.

Idea. We prove that the algorithm works, by induction on the number l of columns processed. The invariant is: the first l columns of the current matrix form a matrix in RREF. When a new column is processed, all the operations involve only rows below the pivots found so far, or add multiples of the new pivot row, which is zero in the first l columns. So the part already built is never disturbed. After all k columns, the whole matrix is in RREF.

Proof. For 0≤l≤k, let P(l) be the statement: there is a matrix Ml row equivalent to M and an integer r≥0 such that the m×l matrix L formed by the first l columns of Ml is in reduced row echelon form with exactly r non-zero rows. We prove P(l) for all l by induction (Theorem 0.2.7). For l=0 take M0=M and r=0; there are no columns, so there is nothing to check.

Suppose P(l) holds for some l<k, with Ml, L and r as described, and let j1<⋯<jr≤l be the pivot columns of L. By (E1) for L, rows r+1,…,m of Ml are zero in columns 1,…,l. Let L′ denote the first l+1 columns of the matrix we are about to construct.

Case 1: every entry of column l+1 of Ml in rows h>r is zero (this includes the case r=m). Put Ml+1=Ml. Rows r+1,…,m of L′ are zero, and rows 1,…,r are non-zero with the same leading entries as in L, which lie in columns ≤l. So (E1)–(E3) hold for L′ with the same r and pivot columns, and so does (E4), since the pivot columns of L′ are those of L and are unchanged. Hence L′ is in RREF and P(l+1) holds.

Case 2: some row h>r has a non-zero entry in column l+1. Then r+1≤h≤m. Perform steps 2, 3 and 4 of the algorithm with this h and with column l+1; call the result Ml+1. It is row equivalent to Ml, hence to M, by Theorem 3.2.2 (b).

These operations do not change columns 1,…,l. Indeed, the swap in step 2 and the scaling in step 3 only move or rescale rows h and r+1, which are both zero in those columns. Each replacement Rg→Rg−cRr+1 in step 4 adds a multiple of row r+1, which is still zero in columns 1,…,l. So the first l columns of Ml+1 form the matrix L. In column l+1, step 3 makes the entry in row r+1 equal to 1, and each replacement in step 4 makes the entry of row g equal to c−c⋅1=0 without changing any other row. So column l+1 of Ml+1 is er+1.

We check that L′ is in RREF with r+1 non-zero rows. Rows 1,…,r of L′ have the same leading entries as in L, in columns j1<⋯<jr≤l. Row r+1 is zero in columns 1,…,l and has a 1 in column l+1, so its leading entry is in column jr+1:=l+1>jr. Rows r+2,…,m are zero in columns 1,…,l and in column l+1, so they are zero. This gives (E1) and (E2). The pivots are 1, by (E3) for L and the construction, so (E3) holds. For (E4), the columns j1,…,jr are unchanged from L, and column l+1 is er+1. Hence P(l+1) holds.

By induction P(k) holds: Mk is row equivalent to M, and its first k columns, which are all of Mk, form a matrix in reduced row echelon form. This proves the theorem.

The proof is also the correctness proof of the algorithm: the matrix Ml is the state of the computation after column l. Note where the field axioms were used. Step 3 divides by a≠0, which needs (F8), and nothing else in the argument depends on which field we work over.

Example (Gauss–Jordan on a 3×4 system)

Solve the following system over R by Gauss–Jordan elimination, naming each operation: 2x2−2x3+x4=3,x1+x2+x3+x4=3,2x1+x2+3x3+x4=3.

Solution. We work on the augmented matrix. Column 1. Row 1 has a 0 there, so we bring up row 2, whose entry is already 1. Then we clear the rest of column 1. [02−2131110321313]→R1↔R2[1110302−21321313]→R3→R3−2R1[1110302−2130−111−3] Column 2. The candidates below row 1 are 2 and −1. Choosing −1 avoids fractions, so we swap it up and scale. →R2↔R3[111030−111−302−213]→R2→−R2[1110301−1−1302−213] Now clear column 2 above and below the pivot. →R1→R1−R2[1021001−1−1302−213]→R3→R3−2R2[1021001−1−130003−3] Column 3. The only entry below row 2 is 0, so column 3 gets no pivot. Column 4. The entry 3 in row 3 becomes the pivot. →R3→13R3[1021001−1−130001−1]→R1→R1−R3[1020101−1−130001−1]→R2→R2+R3[1020101−1020001−1] Column 5. No rows remain below row 3, so we stop. The final matrix is in RREF, with pivot columns 1, 2 and 4. It is the system x1+2x3=1,x2−x3=2,x4=−1, which by Theorem 3.2.2 has the same solutions as the original. The unknown x3 is unconstrained; writing x3=t, the solutions are (1−2t, 2+t, t, −1)=(1,2,0,−1)+t(−2,1,1,0),t∈R. Check: (1,2,0,−1) gives 4+0−1=3, 1+2+0=3 and 2+2+0−1=3; and (−2,1,1,0) gives 2−2+0=0, −2+1+1=0 and −4+1+3+0=0. This is the “particular plus homogeneous” form of Theorem 3.1.3.

The same computation can be carried out in exact arithmetic. In the online version the cell below can be edited and run, which is a good way to check a hand computation.

from sympy import Matrix

M = Matrix([
    [0, 2, -2, 1, 3],
    [1, 1,  1, 0, 3],
    [2, 1,  3, 1, 3],
])
R, pivots = M.rref()   # the RREF and the (0-based) pivot columns
print(R)
print("pivot columns:", [j + 1 for j in pivots])

Warning. Echelon forms are not unique; only the reduced form is. Different choices in step 2 give different intermediate matrices. For (1234) over R, the operation R2→R2−3R1 gives the row echelon form (120−2). Starting instead with R1↔R2 and then R2→R2−13R1 gives the row echelon form (34023). Both continue to the same RREF, I2. That this always happens is the theorem of the next section; until it is proved, “the” RREF of a matrix is not yet justified.

3.2.5. Reading off the solutions

Once [A∣b] is in reduced row echelon form, the example shows what to do: a pivot in the last column signals a contradiction, and otherwise the unknowns without pivots can be chosen freely. We name the two kinds of unknowns.

Suppose [A∣b], with A∈Mm×n(F), is row equivalent to a matrix [R∣c] in reduced row echelon form, where R is m×n. For l≤n, the unknown xl is a pivot variable if l is a pivot column of [R∣c], and a free variable otherwise. (By the uniqueness theorem of the next section, this does not depend on which sequence of operations was used.)

Theorem 3.2.4 (Reading solutions from the RREF)

Let A∈Mm×n(F) and b∈Fm, and suppose [A∣b] is row equivalent to a matrix [R∣c] in reduced row echelon form. Let ril be the entries of R and c=(c1,…,cm).

  • (a) Ax=b is inconsistent if and only if the last column, column n+1, is a pivot column of [R∣c], that is, some row of [R∣c] is (0 ⋯ 0∣1).
  • (b) Suppose there is no pivot in the last column. Let j1<⋯<jr be the pivot columns. Then for every choice of scalars tl∈F, one for each free variable xl, there is exactly one solution with xl=tl for all free l, namely the one with xji=ci−∑l freeriltl(i=1,…,r). In particular, setting every free variable to 0 gives the solution p with pji=ci and all other entries 0.
  • (c) A consistent system Ax=b has exactly one solution if and only if it has no free variables, that is, each of the columns 1,…,n is a pivot column.

Proof. By Theorem 3.2.2 (c), Ax=b has the same solution set as Rx=c, so we work with the latter.

(a, ⇐) If row i of [R∣c] has its pivot in column n+1, then its first n entries are 0 and ci=1 by (E3). Equation i reads 0=1, which is false in any field (Definition 0.7.1). So there is no solution.

  • (b) Suppose no pivot lies in column n+1. Then all pivots of [R∣c] lie in columns j1,…,jr≤n. By (E1), rows r+1,…,m of [R∣c] are zero, so the corresponding equations read 0=0 and hold for every x. For i≤r, row i of R has riji=1 by (E3) and rijh=0 for h≠i by (E4). So equation i reads xji+∑l freerilxl=ci. Hence x is a solution if and only if xji=ci−∑l freerilxl for i=1,…,r. Each unknown is either a pivot variable or a free variable, not both. So once the free variables are given the values tl, these equations determine every pivot variable uniquely, and the resulting vector is a solution. This proves (b).

    (a, ⇒) This is the contrapositive of what (b) just showed: if there is no pivot in the last column, then choosing all tl=0 produces a solution, so the system is consistent.

  • (c) By (a), a consistent system has no pivot in the last column, so (b) applies. If there are no free variables, (b) gives exactly one solution. If xl is free, the choices tl=0 and tl=1, with all other free variables 0, give two solutions whose l-th entries differ, since 0≠1. This proves (c).

In Example (Gauss–Jordan on a 3×4 system) the pivot columns were 1, 2, 4, the free variable was x3, and (b) gave x1=1−2t, x2=2+t, x4=−1, with p=(1,2,0,−1). The same recipe works over any field, and over a finite field the free variables can take only finitely many values.

Example (Elimination over F2)

Solve the following system over F2: x1+x2+x4=1,x2+x3+x4=0,x1+x3+x4=1. How many solutions are there? What changes if the same equations are read over R?

Solution. In F2, −1=1, so Ri→Ri−Rj is the same operation as Ri→Ri+Rj, and every non-zero pivot is already 1. Column 1 has its pivot in row 1; clear row 3. Column 2 has its pivot in row 2; clear rows 3 and 1. [110110111010111]→R3→R3+R1[110110111001100]→R3→R3+R2[110110111000010] →R1→R1+R2[101010111000010] In the row R3+R1, the entries 1+1 became 0, and in R3+R2 the entry in column 3 is 1+1=0. Column 3 has only a 0 below row 2, so no pivot. Column 4 has its pivot in row 3; row 1 already has a 0 there, so only row 2 needs clearing. →R2→R2+R3[101010110000010] This is in RREF, with pivot columns 1, 2, 4 and no pivot in the last column, so the system is consistent by Theorem 3.2.4 (a). The free variable is x3=t, and part (b) gives x1=1−t=1+t, x2=−t=t, x4=0. Since t∈F2={0,1}, there are exactly two solutions: (1,0,0,0)and(0,1,1,0). Check the second: 0+1+0=1, 1+1+0=0, 0+1+0=1 in F2.

Over R the first step is R3→R3−R1, giving row 3 =(0,−1,1,0∣0), and adding row 2 then gives (0,0,2,1∣0). The entry 2 is non-zero in R, so column 3 now gets a pivot. Completing the reduction gives pivot columns 1, 2, 3, free variable x4, and infinitely many real solutions. The same equations lead to different pivot patterns over different fields, because 1+1=0 in one and not in the other.

When a coefficient depends on a parameter, whether a column gets a pivot can depend on the parameter too. Then the reduction splits into cases, one for each answer to “is this entry zero?”.

Example (A system with a parameter)

For which k∈R does the system x+ky=1, kx+y=1 have no solution, exactly one solution, or infinitely many? Find the solutions when they exist.

Solution. The entry in position (1,1) is 1 for every k, so it is a pivot with no case distinction: [1k1k11]→R2→R2−kR1[1k101−k21−k]. (For k=0 this operation changes nothing, which is allowed.) Column 2 gets a pivot in row 2 exactly when 1−k2=(1−k)(1+k) is non-zero, and only then may we scale by its inverse. So we split into cases.

Case k≠±1. Then 1−k2≠0, and R2→(1−k2)−1R2 turns row 2 into (0,1∣11+k), since 1−k(1−k)(1+k)=11+k. Then R1→R1−kR2 turns row 1 into (1,0∣1−k1+k)=(1,0∣11+k). The RREF is [I2∣c] with c=(11+k,11+k), and by Theorem 3.2.4 (c) this is the only solution. Check: 11+k+k1+k=1 for both equations.

Case k=1. Row 2 is (0,0∣0), and [111000] is in RREF with pivot column 1. The free variable is y=t, and Theorem 3.2.4 (b) gives the solutions (1−t,t), t∈R: infinitely many.

Case k=−1. Row 2 is (0,0∣2), and R2→12R2 makes it (0,0∣1). The last column is a pivot column, so the system is inconsistent by Theorem 3.2.4 (a). Directly: x−y=1 and −x+y=1 add up to 0=2.

Hence there is no solution for k=−1, there are infinitely many for k=1, and there is exactly one otherwise. The trap is to scale by (1−k2)−1 before asking whether 1−k2 is zero: that step silently assumes k≠±1, and loses exactly the two interesting cases.

3.2.6. More unknowns than equations

Counting pivots gives a first general theorem. A matrix with m rows has at most m pivots, one per non-zero row. If there are more unknowns than that, some unknown must be free.

Corollary 3.2.5 (More unknowns than equations)

Let A∈Mm×n(F) with n>m.

  • (a) The homogeneous system Ax=0 has a non-trivial solution.
  • (b) Consequently, every list of n vectors in Fm with n>m is linearly dependent.

Proof.

  • (a) By Theorem 3.2.3, [A∣0] is row equivalent to a matrix [R∣c] in RREF. By Lemma 3.2.1, each operation keeps the last column zero, so c=0, and the last column is not a pivot column. Each pivot is the leading entry of a different row, so there are at most m pivots, hence at most m<n pivot columns among the first n columns. So some xl is a free variable. By Theorem 3.2.4 (b), with tl=1 and every other free variable 0, there is a solution whose l-th entry is 1≠0. This solution is non-trivial.

  • (b) Let v1,…,vn∈Fm and let A∈Mm×n(F) have these columns. By (a) there is x≠0 with Ax=0, and by Theorem 0.9.3 this says x1v1+⋯+xnvn=0 with x1,…,xn not all zero. So the list is linearly dependent.

Part (b) is not new: since dim⁡Fm=m, it is also a case of Theorem 1.6.3, which rests on the Steinitz Exchange Theorem (Theorem 1.6.1). The proof here is independent of that one. It uses nothing from Chapter 1 beyond the definition of independence, only elimination and a count of pivots. Two proofs by different routes give some confidence that the dimension theory of Chapter 1 and the computations of this chapter will fit together, and the rest of the chapter makes that fit exact.

3.2.7. Exercises

A. Check your understanding

Exercise (A1)
  • (a) List the three types of elementary row operation, including the conditions on the scalar and on the indices.
  • (b) Determine whether the following statement is true: “every matrix in row echelon form is in reduced row echelon form.” Justify your answer.
  • (c) Determine whether the following statement is true: “if the RREF of [A∣b] has a zero row, then Ax=b is inconsistent.” Justify your answer.
  • (d) Determine whether the following statement is true: “a homogeneous system of 3 equations in 5 unknowns over R has infinitely many solutions.” Justify your answer.
  • (e) Explain why swapping two columns of A in [A∣b] is not a safe step when solving Ax=b.

Solution.

  • (a) Ri↔Rj with i≠j; Ri→cRi with c≠0; Ri→Ri+cRj with i≠j and any c∈F.
  • (b) False. (2101) is in row echelon form, but its first pivot is 2≠1, so (E3) fails; its second column also has a non-zero entry above the pivot, so (E4) fails.
  • (c) False. A zero row is the equation 0=0, which every vector satisfies. Inconsistency means a row (0 ⋯ 0∣1) (Theorem 3.2.4 (a)). For example [1100] is the consistent system x=1, 0=0.
  • (d) True. By Corollary 3.2.5 (5>3) there is a non-trivial solution h, and since R is infinite, the multiples ch (c∈R) are infinitely many distinct solutions, as in Exercise (C1: How many solutions?).
  • (e) It swaps the roles of two unknowns: s solves the new system exactly when the vector obtained from s by swapping those two entries solves the old one. So the solution set changes, unless the swap happens to fix it. For instance x=1, y=2 becomes y=1, x=2.

B. Practice

Exercise (B1: Reduce and solve)

Reduce the augmented matrix of each system over R to reduced row echelon form, naming each operation. Hence decide whether the system is consistent, and if so, describe all solutions.

  • (a) x1+2x2−x3=1, 2x1+5x2+x3=4, x1+3x2+2x3=4.
  • (b) x1+x2+2x3=3, 2x1+3x2+5x3=7, x1+2x2+4x3=5.
  • (c) x1−x2+2x3+x4=2, 2x1−2x2+5x3+4x4=5, −x1+x2−x3+x4=−1.

Solution.

  • (a) [12−1125141324]→R2→R2−2R1[12−1101321324]→R3→R3−R1[12−1101320133] →R1→R1−2R2[10−7−301320133]→R3→R3−R2[10−7−301320001] Column 3 gets no pivot. Column 4 has its pivot in row 3: →R1→R1+3R3[10−7001320001]→R2→R2−2R3[10−7001300001]. The last column is a pivot column, so by Theorem 3.2.4 (a) the system is inconsistent. (Row 3 already said 0=1 before the last two operations.)
  • (b) [112323571245]→R2→R2−2R1[112301111245]→R3→R3−R1[112301110122] →R1→R1−R2[101201110122]→R3→R3−R2[101201110011]→R1→R1−R3[100101110011]→R2→R2−R3[100101000011]. Columns 1, 2, 3 are pivot columns and the last column is not, so by Theorem 3.2.4 (c) there is exactly one solution, (1,0,1). Check: 1+0+2=3, 2+0+5=7, 1+0+4=5.
  • (c) [1−12122−2545−11−11−1]→R2→R2−2R1[1−121200121−11−11−1]→R3→R3+R1[1−12120012100121] Column 2 has only zeros below row 1, so no pivot. Column 3 has its pivot in row 2: →R1→R1−2R2[1−10−300012100121]→R3→R3−R2[1−10−300012100000]. Columns 4 and 5 have only a 0 in row 3, so this is the RREF. The pivot columns are 1 and 3; the free variables are x2=s and x4=t. By Theorem 3.2.4 (b), x1=s+3t and x3=1−2t. Hence the solution set is {(0,0,1,0)+s(1,1,0,0)+t(3,0,−2,1):s,t∈R}.
Exercise (B2: A parameter)

For which k∈R is the system x+y−z=2,x+2y+z=3,x+y+(k2−5)z=k inconsistent, which give exactly one solution, and which give infinitely many? Justify your answer, and find the solutions when they exist.

Solution. [11−12121311k2−5k]→R2→R2−R1[11−12012111k2−5k]→R3→R3−R1[11−12012100k2−4k−2]→R1→R1−R2[10−31012100k2−4k−2]. Whether column 3 gets a pivot depends on whether k2−4=(k−2)(k+2) is zero.

Case k≠±2. Then k2−4≠0, and R3→(k2−4)−1R3 turns row 3 into (0,0,1∣1k+2), since k−2(k−2)(k+2)=1k+2. Then R1→R1+3R3 and R2→R2−2R3 give the RREF [I3∣c] with c=(k+5k+2, kk+2, 1k+2), using 1+3k+2=k+5k+2 and 1−2k+2=kk+2. By Theorem 3.2.4 (c) there is exactly one solution, c.

Case k=2. Row 3 is zero, and the matrix is in RREF with pivot columns 1, 2 and free variable z=t. The solutions are (1+3t,1−2t,t), t∈R: infinitely many.

Case k=−2. Row 3 is (0,0,0∣−4), and R3→−14R3 makes it (0,0,0∣1). The last column is a pivot column, so the system is inconsistent.

Hence: inconsistent for k=−2, infinitely many solutions for k=2, and exactly one solution otherwise.

Exercise (B3: Over F3)

Solve each system over F3 by reducing to RREF, naming each operation, and list all solutions.

  • (a) x+2y+z=1, 2x+y+z=0, x+z=2.
  • (b) x+y+2z=1, 2x+z=2.

Solution. In F3 the inverses are 1−1=1 and 2−1=2, since 2⋅2=4=1, and −1=2, −2=1.

  • (a) [121121101012]→R2→R2−2R1[121100211012]→R3→R3−R1[121100210101] Here 1−4=−3=0, 1−2=−1=2, 0−2=1, and 0−2=1, 2−1=1. Column 2 has entries 0,1 below row 1, so we swap: →R2↔R3[121101010021]→R1→R1−2R2[101201010021]→R3→2R3[101201010012]→R1→R1−R3[100001010012]. There are no free variables, so the unique solution is (0,1,2). Check: 0+2+2=4=1, 0+1+2=3=0, 0+2=2.
  • (b) [11212012]→R2→R2−2R1[11210100]→R1→R1−R2[10210100], using 0−2=1, 1−4=0, 2−2=0. The free variable is z=t, and x=1−2t=1+t, y=0. As t runs through 0,1,2, the solutions are (1,0,0), (2,0,1), (0,0,2): exactly three.

C. Going deeper

Exercise (C1: Why i≠j?)

Consider the move “Ri→Ri+cRi”, which the definition does not allow.

  • (a) Show that for c=−1 this move is not reversible: give a matrix on which its effect cannot be undone by any sequence of elementary row operations and moves of this kind, and a system whose solution set it changes.
  • (b) Show that for c≠−1 the move is an elementary row operation of another type. Explain why the condition i≠j in type (3) therefore loses nothing.

Solution.

  • (a) The move replaces ri by ri+(−1)ri=0. Apply it to the 1×2 augmented matrix [1∣1] of the equation x=1 over any field F: the result is [0∣0], the equation 0=0. The solution set changes from {1} to all of F. No sequence of moves can return to [1∣1]: every elementary row operation, and every move “Ri→Ri+cRi”, sends a zero matrix to a zero matrix, by the formulas in the proof of Lemma 3.2.1 and c⋅0=0.
  • (b) The move replaces ri by (1+c)ri. If c≠−1, then 1+c≠0, and this is the scaling Ri→(1+c)Ri, an operation of type (2). So allowing i=j in type (3) would add only moves that are already available (when c≠−1) and one move that destroys information (c=−1). Requiring i≠j excludes exactly the bad case.
Exercise (C2: The cost of elimination)

Let A∈Mn(F) and b∈Fn, and suppose that Gauss–Jordan elimination on [A∣b] finds, for each l=1,…,n, a non-zero entry in position (l,l) and so never swaps. Count as one operation each multiplication or division of two scalars, under these conventions: scaling row l costs one division for each entry in columns l+1,…,n+1 (the pivot is simply set to 1), and each replacement Rg→Rg−cRl costs one multiplication for each entry in columns l+1,…,n+1 (the entry in column l is simply set to 0).

  • (a) Show that processing column l costs at most n(n+1−l) operations.
  • (b) Hence show that the whole elimination costs at most 12(n3+n2) operations.
  • (c) Roughly how many times more work is a system of 2n equations than one of n equations, for large n?

Solution.

  • (a) Scaling row l costs n+1−l divisions. At most n−1 other rows need a replacement, each costing n+1−l multiplications. The total is at most (n+1−l)+(n−1)(n+1−l)=n(n+1−l).
  • (b) Summing (a) over l=1,…,n, and substituting q=n+1−l, which runs through 1,…,n, ∑l=1nn(n+1−l)=n∑q=1nq=n⋅n(n+1)2=n3+n22, using the formula for 1+⋯+n (Proposition 0.2.8).
  • (c) The bound is dominated by 12n3 for large n, since 12n2 is small compared with it. Replacing n by 2n multiplies n3 by 8, so doubling the size of the system costs roughly eight times as much.
Exercise (C3: Solvable for every right-hand side)

Let A∈Mm×n(F), and suppose that Ax=b is consistent for every b∈Fm. Prove that m≤n.

Hint: suppose m>n, reduce A to its RREF R, and run the operations backwards on [R∣em].

Solution. Suppose, for a contradiction, that m>n. By Theorem 3.2.3, some sequence of operations O1,…,Os turns A into a matrix R in RREF. By (E2), R has at most n pivots, one in each pivot column, so at most n<m non-zero rows, and by (E1) its last row is zero. Therefore the last row of [R∣em] is (0 ⋯ 0∣1), so the system Rx=em has no solution.

By Theorem 3.2.2 (a), each Ot is undone by an operation Ot′, and Os′,…,O1′ turn R back into A. Apply them to [R∣em]. By Lemma 3.2.1 they act on the two blocks separately, so the result is [A∣b] for some b∈Fm. By Theorem 3.2.2 (c), Ax=b has the same solutions as Rx=em, namely none. This contradicts the hypothesis, so m≤n.

Found a typo or a mistake? Report it, or read this page’s source

The text of this book is licensed under CC BY-NC-SA 4.0.