Unit 6, lesson 82

Gaussian Elimination and Solution Structure

How to row reduce an augmented matrix to echelon form, find the pivots and free variables, and read off whether a linear system has one solution, none, or infinitely many.

  • Theory part 163
  • Practice part 164
  • Matrices

Solving three equations in three unknowns by substitution gets messy fast, and one lost minus sign ruins the answer. Elimination done in a fixed order on a table of numbers is calm and mechanical. Better still, the finished table tells you whether the system has exactly one solution, no solution at all, or infinitely many. Software that solves large systems runs on the same idea.

Key terms

Augmented matrix

Definition Consider a system of mm linear equations in the variables x1,…,xnx_1, \ldots, x_n, where equation ii reads ai1x1+ai2x2+⋯+ainxn=bia_{i1}x_1 + a_{i2}x_2 + \cdots + a_{in}x_n = b_i. Its coefficient matrix is the m×nm \times n matrix A=[aij]A = [a_{ij}]. Its augmented matrix is the m×(n+1)m \times (n + 1) matrix [A∣b][A \mid \mathbf{b}] formed by appending the column of constants,

[a11a12⋯a1nb1⋮⋮⋮⋮am1am2⋯amnbm].\left[\begin{array}{cccc|c} a_{11} & a_{12} & \cdots & a_{1n} & b_1 \\ \vdots & \vdots & & \vdots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} & b_m \end{array}\right].

Each row stands for one equation and each of the first nn columns belongs to one variable. The bar only separates the constants.

In plain words Line up the variables in the same order in every equation, then copy only the numbers. A variable that is missing from an equation gets a 00.

Example The system

x+2y+z=82x+y=4x−y+2z=5\begin{aligned} x + 2y + z &= 8 \\ 2x + y &= 4 \\ x - y + 2z &= 5 \end{aligned}

has the augmented matrix

[121821041−125].\left[\begin{array}{ccc|c} 1 & 2 & 1 & 8 \\ 2 & 1 & 0 & 4 \\ 1 & -1 & 2 & 5 \end{array}\right].

The second equation has no zz, so its third entry is 00.

Elementary row operations

Definition The elementary row operations on a matrix are the following three moves, where RiR_i denotes row ii.

  1. Swap two rows, Ri↔RjR_i \leftrightarrow R_j.
  2. Multiply a row by a nonzero constant cc, replacing RiR_i by cRicR_i.
  3. Add a multiple of another row to a row, replacing RiR_i by Ri+cRjR_i + cR_j with j≠ij \ne i.

Two matrices are row equivalent when one can be turned into the other by a finite sequence of these moves. Each move can be undone by a move of the same kind, so if the augmented matrices of two systems are row equivalent, the systems have exactly the same solutions.

In plain words These are the moves you already make with equations, written for rows. Multiplying by 00 is not allowed, because it would erase an equation and could add solutions.

Example In the matrix above, replace R2R_2 by R2−2R1R_2 - 2R_1 and then R3R_3 by R3−R1R_3 - R_1. Both clear the first entry of their row,

[12180−3−2−120−31−3].\left[\begin{array}{ccc|c} 1 & 2 & 1 & 8 \\ 0 & -3 & -2 & -12 \\ 0 & -3 & 1 & -3 \end{array}\right].

The first move can be undone by replacing R2R_2 by R2+2R1R_2 + 2R_1.

Row echelon form

Definition The leading entry of a nonzero row is its leftmost nonzero entry. A matrix is in row echelon form when

  1. every row of zeros lies below all the nonzero rows, and
  2. the leading entry of each nonzero row lies in a column strictly to the right of the leading entry of the row above it.

It follows that every entry below a leading entry is 00. Some books also require each leading entry to be 11, which changes nothing that follows. Gaussian elimination is the process of bringing a matrix to row echelon form with elementary row operations, clearing the entries below a leading entry one column at a time from left to right.

In plain words The nonzero numbers form a staircase that steps down and to the right, with only zeros underneath it.

Example One more move finishes the elimination. Replacing R3R_3 by R3−R2R_3 - R_2 gives

[12180−3−2−120039],\left[\begin{array}{ccc|c} 1 & 2 & 1 & 8 \\ 0 & -3 & -2 & -12 \\ 0 & 0 & 3 & 9 \end{array}\right],

which is in row echelon form. The leading entries 11, −3-3 and 33 step to the right, one column per row.

Pivots

Definition A pivot position of a matrix is a position that holds a leading entry once the matrix has been brought to row echelon form. The pivot positions are the same whichever row operations are used. A pivot column is a column that contains a pivot position, and the nonzero entry in a pivot position during elimination is called a pivot.

In plain words The pivots are the corners of the staircase. Each one is the number you use to clear the entries beneath it.

Example In the echelon form above the pivots are 11, −3-3 and 33, in positions (1,1)(1, 1), (2,2)(2, 2) and (3,3)(3, 3). The columns of xx, yy and zz are all pivot columns, and the column of constants is not.

Back-substitution

Definition Back-substitution solves a consistent system whose augmented matrix is in row echelon form. Solve the last nonzero equation for its leading variable, substitute the result into the equation above it, solve that equation for its leading variable, and continue upward until every leading variable is known. If the system has free variables, described below, they stay as letters and the leading variables come out in terms of them.

In plain words The bottom row has the fewest unknowns, so start there and climb.

Example The echelon form above stands for the equations x+2y+z=8x + 2y + z = 8, −3y−2z=−12-3y - 2z = -12 and 3z=93z = 9. The last one gives z=3z = 3. Then

−3y−2⋅3=−12givesy=2,-3y - 2 \cdot 3 = -12 \quad \text{gives} \quad y = 2,

and finally x+2⋅2+3=8x + 2 \cdot 2 + 3 = 8 gives x=1x = 1. The solution is (1,2,3)(1, 2, 3), and all three original equations check out, 1+4+3=81 + 4 + 3 = 8, 2+2=42 + 2 = 4 and 1−2+6=51 - 2 + 6 = 5.

Reduced row echelon form

Definition A matrix is in reduced row echelon form when it is in row echelon form and also

  1. every leading entry is 11, and
  2. each leading 11 is the only nonzero entry in its column.

Every matrix is row equivalent to exactly one matrix in reduced row echelon form. Continuing elimination upward to reach it is called Gauss-Jordan elimination.

In plain words Scale each pivot to 11 and clear the entries above it too. Then each equation contains a single leading variable and you can read the answer directly.

Example Start from the echelon form above. Divide R3R_3 by 33, replace R2R_2 by R2+2R3R_2 + 2R_3 and divide it by −3-3, then replace R1R_1 by R1−R3R_1 - R_3 and then by R1−2R2R_1 - 2R_2. The result is

[100101020013],\left[\begin{array}{ccc|c} 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 2 \\ 0 & 0 & 1 & 3 \end{array}\right],

which says x=1x = 1, y=2y = 2 and z=3z = 3 with no further work.

Free variables

Definition Take a consistent system and an echelon form of its augmented matrix. A variable whose column is a pivot column is a leading, or basic, variable. Every other variable is a free variable. The general solution lets each free variable be any real number, usually named by a parameter such as tt, and expresses the leading variables in terms of the free ones.

In plain words A free variable is one the equations never pin down. Choose its value, and the rest follow.

Example Take the system x+2y−z=3x + 2y - z = 3 and 2x+4y+z=92x + 4y + z = 9. Replace R2R_2 by R2−2R1R_2 - 2R_1, divide it by 33, then add it to R1R_1,

[12−132419]→[12−130033]→[12040011].\begin{aligned} &\left[\begin{array}{ccc|c} 1 & 2 & -1 & 3 \\ 2 & 4 & 1 & 9 \end{array}\right] \\[0.8em] \to {} &\left[\begin{array}{ccc|c} 1 & 2 & -1 & 3 \\ 0 & 0 & 3 & 3 \end{array}\right] \\[0.8em] \to {} &\left[\begin{array}{ccc|c} 1 & 2 & 0 & 4 \\ 0 & 0 & 1 & 1 \end{array}\right]. \end{aligned}

The pivots sit in the columns of xx and zz, so yy is free. With y=ty = t the general solution is

x=4−2t,y=t,z=1,t any real number.\begin{gathered} x = 4 - 2t, \quad y = t, \quad z = 1, \\[0.4em] t \text{ any real number.} \end{gathered}

For t=0t = 0 this gives (4,0,1)(4, 0, 1), and indeed 4+0−1=34 + 0 - 1 = 3 and 8+0+1=98 + 0 + 1 = 9.

Inconsistent row

Definition An inconsistent row of an augmented matrix is a row of the form

[0⋯0c]withc≠0.\left[\begin{array}{ccc|c} 0 & \cdots & 0 & c \end{array}\right] \quad \text{with} \quad c \ne 0.

It stands for the equation 0=c0 = c, which no values of the variables satisfy. A linear system has no solution exactly when an echelon form of its augmented matrix contains an inconsistent row, that is, when the column of constants is a pivot column. A row of all zeros, including the last entry, only says 0=00 = 0 and does no harm.

In plain words If elimination ever produces zero equals a nonzero number, the equations contradict each other and the system has no solution.

Example Take x+y+z=2x + y + z = 2, x+2y=3x + 2y = 3 and 2x+3y+z=62x + 3y + z = 6. Replace R2R_2 by R2−R1R_2 - R_1, then R3R_3 by R3−2R1R_3 - 2R_1, then R3R_3 by R3−R2R_3 - R_2,

[111212032316]→[111201−1101−12]→[111201−110001].\begin{aligned} &\left[\begin{array}{ccc|c} 1 & 1 & 1 & 2 \\ 1 & 2 & 0 & 3 \\ 2 & 3 & 1 & 6 \end{array}\right] \\[0.8em] \to {} &\left[\begin{array}{ccc|c} 1 & 1 & 1 & 2 \\ 0 & 1 & -1 & 1 \\ 0 & 1 & -1 & 2 \end{array}\right] \\[0.8em] \to {} &\left[\begin{array}{ccc|c} 1 & 1 & 1 & 2 \\ 0 & 1 & -1 & 1 \\ 0 & 0 & 0 & 1 \end{array}\right]. \end{aligned}

The last row says 0=10 = 1, so there is no solution. You can see why directly. Adding the first two equations gives 2x+3y+z=52x + 3y + z = 5, which contradicts the third.

Solution structure

Definition Bring the augmented matrix of a linear system to row echelon form.

  1. If the column of constants is a pivot column, the system has no solution.
  2. Otherwise, if every variable column is a pivot column, the system has exactly one solution.
  3. Otherwise the system has at least one free variable and infinitely many solutions.

So a linear system has no solution, exactly one, or infinitely many, never exactly two. Each row holds at most one pivot, so a consistent system with more variables than equations always has infinitely many solutions.

In plain words Look for a contradiction first. If there is none, count the variables without a pivot. None means one answer, and any means infinitely many.

Example The three systems on this page show all three cases.

SystemPivot columnsFree variablesSolutions
x+2y+z=8x + 2y + z = 8 and two morexx, yy, zznoneexactly one, (1,2,3)(1, 2, 3)
x+2y−z=3x + 2y - z = 3 and one morexx, zzyyinfinitely many
x+y+z=2x + y + z = 2 and two morexx, yy, constantsnot applicablenone

Check yourself

  1. The augmented matrix of a system in xx, yy and zz has the reduced row echelon form below. Write the general solution.
[102501−130000]\left[\begin{array}{ccc|c} 1 & 0 & 2 & 5 \\ 0 & 1 & -1 & 3 \\ 0 & 0 & 0 & 0 \end{array}\right]
Show the answer

The pivots are in the columns of xx and yy, and there is no inconsistent row, so zz is free. With z=tz = t the rows say x+2t=5x + 2t = 5 and y−t=3y - t = 3, so

x=5−2t,y=3+t,z=t,t any real number.\begin{gathered} x = 5 - 2t, \quad y = 3 + t, \quad z = t, \\[0.4em] t \text{ any real number.} \end{gathered}
  1. For which values of kk does the system x+2y=3x + 2y = 3, 2x+4y=k2x + 4y = k have a solution, and how many solutions does it have then?
Show the answer

Replacing R2R_2 by R2−2R1R_2 - 2R_1 gives the row [00k−6]\left[\begin{array}{cc|c} 0 & 0 & k - 6 \end{array}\right]. For k≠6k \ne 6 this is an inconsistent row and there is no solution. For k=6k = 6 it is a zero row, yy is free, and there are infinitely many solutions, x=3−2tx = 3 - 2t and y=ty = t for any real number tt.

  1. A system of three linear equations in four variables is known to have a solution. How many solutions does it have?
Show the answer

Infinitely many. Each of the three rows holds at most one pivot, so at most three of the four variable columns are pivot columns. At least one variable is free, and a consistent system with a free variable has infinitely many solutions.

How this lesson connects