Linear Algebra — Lecture 2

Lecture 2: Gaussian Elimination and Solution Sets

Shuhong Gao  ·  Clemson University

These notes are interactive: click any dotted term to unfold its exact definition or statement in place, click ▸ Proof to expand a proof, and try the exercises — answers are checked instantly.

2.1  Echelon forms and Gaussian elimination

💡 Intuition

Some systems are effortless: if each equation involves fewer variables than the one above it — a triangular, staircase pattern — then the solution can be read off with hardly any work. Gaussian elimination is the strategy of using row operations to drive any augmented matrix into that staircase shape. This section defines the target shape precisely and proves the algorithm always reaches it.

Definition 2.1 (Row echelon form, reduced row echelon form)

A matrix is in row echelon form (REF, “triangular form”) if:

  1. the first nonzero entry (the leading entry) of each nonzero row lies strictly to the right of the leading entry of the row above it;
  2. all rows consisting entirely of zero (if any) are at the bottom.
It is in reduced row echelon form (RREF) if, in addition:
  1. every leading entry is 11;
  2. each leading 11 is the only nonzero entry in its column.
A pivot position is a position holding a leading entry of an REF of the matrix; a pivot column is a column containing a pivot position.

2026-07-22T21:26:03.644645 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/ A b * * * * * 0 * * * * 0 0 0 * * 0 0 0 0 0 * row echelon form A b 1 0 * 0 * * 0 1 * 0 * * 0 0 0 1 * * 0 0 0 0 0 * reduced row echelon form
The two echelon shapes of an augmented matrix (A𝐛)(\,A \mid \mathbf{b}\,). Shaded entries are pivots: \blacksquare stands for any nonzero number, ** for any number; the column right of the vertical rule is 𝐛\mathbf{b}. In the reduced form every pivot is 11 and its whole column is otherwise zero. (Looking ahead: the system is consistent exactly when no pivot falls in the 𝐛\mathbf{b} column.)
Theorem 2.2 (Gaussian elimination)

Every matrix can be transformed by elementary row operations into row echelon form, and further into reduced row echelon form.

Remark 2.3

A matrix has many different row echelon forms, but its reduced row echelon form is unique — so the pivot positions do not depend on the order of operations. We take this fact on faith today and prove it later in the course, once we have the language of linear independence.

Example 2.4 (Elimination with a unique solution)

Solve x1+2x2+x3=2\;x_1 + 2x_2 + x_3 = 2, 2x1+5x2+3x3=5\;2x_1 + 5x_2 + 3x_3 = 5, x1+3x2+3x3=4\;x_1 + 3x_2 + 3x_3 = 4. Working on the augmented matrix: (121225351334)R22R1R3R1(121201110122)R3R2(121201110011)\begin{pmatrix} 1 & 2 & 1 & 2 \\ 2 & 5 & 3 & 5 \\ 1 & 3 & 3 & 4 \end{pmatrix} \xrightarrow{\substack{R_2 - 2R_1 \\ R_3 - R_1}} \begin{pmatrix} 1 & 2 & 1 & 2 \\ 0 & 1 & 1 & 1 \\ 0 & 1 & 2 & 2 \end{pmatrix} \xrightarrow{R_3 - R_2} \begin{pmatrix} 1 & 2 & 1 & 2 \\ 0 & 1 & 1 & 1 \\ 0 & 0 & 1 & 1 \end{pmatrix} The matrix is now in row echelon form with three pivots. Continue to the reduced row echelon form by clearing the entries above each pivot, from the rightmost pivot leftward: R2R3R1R3(120101000011)R12R2(100101000011)\xrightarrow{\substack{R_2 - R_3 \\ R_1 - R_3}} \begin{pmatrix} 1 & 2 & 0 & 1 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 1 \end{pmatrix} \xrightarrow{R_1 - 2R_2} \begin{pmatrix} 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 1 \end{pmatrix} Each row of the reduced form names a single variable: x1=1x_1 = 1, x2=0x_2 = 0, x3=1x_3 = 1. The unique solution 𝐱=(101)T\mathbf{x} = \begin{pmatrix} 1 & 0 & 1 \end{pmatrix}^{T} (in the transpose notation) is read straight off the last column; substituting it into all three original equations confirms it.

Exercise 2.1 auto-check

Which of the following augmented matrices (four variables) is in reduced row echelon form?

Exercise 2.2 auto-check

How many pivot columns does the augmented matrix (11021021040003622042)\begin{pmatrix} 1 & 1 & 0 & 2 & 1 \\ 0 & 2 & 1 & 0 & 4 \\ 0 & 0 & 0 & 3 & 6 \\ 2 & 2 & 0 & 4 & 2 \end{pmatrix} (four variables) have?

Answer:

2.2  Solution sets: parametric form

💡 Intuition

Once the staircase is reached, the variables split into two kinds: those that sit on pivots, which the equations determine, and the rest, which are genuinely free — dials we may set to any values whatsoever, each setting producing exactly one solution. Describing the solution set means expressing the pivot variables in terms of the dials.

Definition 2.5 (Basic and free variables)

Suppose the augmented matrix of a consistent system has been brought to row echelon form. The variables corresponding to pivot columns of the coefficient matrix are called basic variables; all other variables are free variables.

Example 2.6 (Parametric form and parametric vector form)

Let b1,b2,b3b_1, b_2, b_3 be any constants and consider the system {x1+x2+x3+x4+x5+x6=b1x3x4+2x5+x6=b2x5+3x6=b3\left\{ \begin{aligned} x_1 + x_2 + x_3 + x_4 + x_5 + x_6 &= b_1 \\ x_3 - x_4 + 2x_5 + x_6 &= b_2 \\ x_5 + 3x_6 &= b_3 \end{aligned} \right. The augmented matrix is already in echelon form, with pivots in columns 11, 33, 55: the basic variables are x1,x3,x5x_1, x_3, x_5, and the remaining variables x2,x4,x6x_2, x_4, x_6 are free — six columns, three pivots, 63=36 - 3 = 3 free variables. The echelon form tells us which variables are free; to read off all the solutions, continue to the reduced row echelon form by clearing the entries above each pivot, working from the rightmost pivot leftward: (111111b1001121b2000013b3)R1R3R22R3R1R2(110203b1b2+b3001105b22b3000013b3)\begin{pmatrix} 1 & 1 & 1 & 1 & 1 & 1 & b_1 \\ 0 & 0 & 1 & -1 & 2 & 1 & b_2 \\ 0 & 0 & 0 & 0 & 1 & 3 & b_3 \end{pmatrix} \xrightarrow{\substack{R_1 - R_3 \\ R_2 - 2R_3 \\ R_1 - R_2}} \begin{pmatrix} 1 & 1 & 0 & 2 & 0 & 3 & b_1 - b_2 + b_3 \\ 0 & 0 & 1 & -1 & 0 & -5 & b_2 - 2b_3 \\ 0 & 0 & 0 & 0 & 1 & 3 & b_3 \end{pmatrix} In the reduced form each pivot row contains exactly one basic variable, so every basic variable is expressed directly in terms of the free ones — nothing left to solve. Solving each pivot row for its basic variable gives the parametric form x1=b1b2+b3x22x43x6,x3=b22b3+x4+5x6,x5=b33x6,\begin{aligned} x_1 &= b_1 - b_2 + b_3 - x_2 - 2x_4 - 3x_6, \\ x_3 &= b_2 - 2b_3 + x_4 + 5x_6, \\ x_5 &= b_3 - 3x_6, \end{aligned} with x2,x4,x6x_2, x_4, x_6 \in \mathbb{R} arbitrary. There is no need to rename the free variables: they are already names, and every choice of the three numbers x2,x4,x6x_2, x_4, x_6 produces exactly one solution.

To get the parametric vector form, first assemble the solution into a single column, using the parametric form for the basic entries and the free variables themselves for the rest: 𝐱=(x1x2x3x4x5x6)=(b1b2+b3x22x43x6x2b22b3+x4+5x6x4b33x6x6).\mathbf{x} = \begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ x_4 \\ x_5 \\ x_6 \end{pmatrix} = \begin{pmatrix} b_1 - b_2 + b_3 - x_2 - 2x_4 - 3x_6 \\ x_2 \\ b_2 - 2b_3 + x_4 + 5x_6 \\ x_4 \\ b_3 - 3x_6 \\ x_6 \end{pmatrix}. Now split that one column into the constant part plus the part carried by each free variable: 𝐱=(b1b2+b30b22b30b30)+x2(110000)+x4(201100)+x6(305031),\mathbf{x} = \begin{pmatrix} b_1 - b_2 + b_3 \\ 0 \\ b_2 - 2b_3 \\ 0 \\ b_3 \\ 0 \end{pmatrix} + x_2 \begin{pmatrix} -1 \\ 1 \\ 0 \\ 0 \\ 0 \\ 0 \end{pmatrix} + x_4 \begin{pmatrix} -2 \\ 0 \\ 1 \\ 1 \\ 0 \\ 0 \end{pmatrix} + x_6 \begin{pmatrix} -3 \\ 0 \\ 5 \\ 0 \\ -3 \\ 1 \end{pmatrix}, again with x2,x4,x6x_2, x_4, x_6 \in \mathbb{R} arbitrary. Every solution appears exactly once as x2,x4,x6x_2, x_4, x_6 range over \mathbb{R}: one particular solution built from the constants, plus one direction vector per free variable. Geometrically the solution set is a three-dimensional flat sheet inside 6\mathbb{R}^6. Note also that this works for every choice of b1,b2,b3b_1, b_2, b_3 — each row carries a pivot, a fact whose meaning is part of the theorem below.

Remark 2.7 (Backward substitution)

There is an alternative to reducing all the way to the reduced form: backward substitution directly from the echelon form. In the example above, solve the last equation for its basic variable x5x_5, substitute the result into the equation above it and solve for x3x_3, then substitute both into the first equation and solve for x1x_1 — working upward, one equation at a time. It produces the same answer.

Use it only on small systems worked by hand. For anything larger, the reduced row echelon form is the organized way to extract the complete solution set: each pivot row hands you one basic variable already expressed in the free ones, with no chain of substitutions to carry along and no opportunity to lose a term along the way.

Exercise 2.3 auto-check

In the parametric example, take b3=6b_3 = 6 and choose the free variables x2=0x_2 = 0, x4=0x_4 = 0, x6=1x_6 = 1. What is the value of x5x_5 in the resulting solution?

Answer:

2.3  Existence and uniqueness

Theorem 2.8 (Existence and uniqueness)

Let AA be the m×nm \times n coefficient matrix of a linear system, and bring the augmented matrix (A𝐛)(\,A \mid \mathbf{b}\,) to row echelon form. Then:

  1. (Existence) The system is consistent if and only if the echelon form has no row of the shape (000c)(\,0 \;\, 0 \;\, \cdots \;\, 0 \mid c\,) with c0c \neq 0 — that is, if and only if the last (augmented) column is not a pivot column.
  2. (Uniqueness) A consistent system has a unique solution if and only if every column of AA is a pivot column; otherwise it has infinitely many solutions.
  3. (Counting) The number of free variables equals nn minus the number of pivots, i.e. #{free variables}=#{columns of A}#{pivots}.\#\{\text{free variables}\} = \#\{\text{columns of } A\} - \#\{\text{pivots}\}.
  4. (Existence for every right-hand side) If every row of AA contains a pivot position, then A𝐱=𝐛A\mathbf{x} = \mathbf{b} is consistent for every choice of 𝐛\mathbf{b}.
Consequently, every linear system has no solution, exactly one solution, or infinitely many solutions.

Example 2.9 (Inconsistent systems)

For x1+x2=1x_1 + x_2 = 1, 2x1+2x2=3\;2x_1 + 2x_2 = 3, the row operation R22R1R_2 - 2R_1 gives the row (001)(\,0 \; 0 \mid 1\,), i.e., the false equation 0=10 = 1. By the existence theorem the system is inconsistent — this is case (ii) of the opening example of Lecture 1, parallel lines, seen through algebra: the left-hand sides are proportional but the right-hand sides are not.

The same principle decides bigger systems. Consider four equations in five unknowns with the augmented matrix below, and run Gaussian elimination column by column. First column: the top-left 11 is the first pivot; clear everything below it. (A𝐛)=(111111123111234223345612)R2R1R32R1R43R1(111111012000012001012321)(\,A \mid \mathbf{b}\,) = \begin{pmatrix} 1 & 1 & 1 & 1 & 1 & 1 \\ 1 & 2 & 3 & 1 & 1 & 1 \\ 2 & 3 & 4 & 2 & 2 & 3 \\ 3 & 4 & 5 & 6 & 1 & 2 \end{pmatrix} \xrightarrow{\substack{R_2 - R_1 \\ R_3 - 2R_1 \\ R_4 - 3R_1}} \begin{pmatrix} 1 & 1 & 1 & 1 & 1 & 1 \\ 0 & 1 & 2 & 0 & 0 & 0 \\ 0 & 1 & 2 & 0 & 0 & 1 \\ 0 & 1 & 2 & 3 & -2 & -1 \end{pmatrix} Second column: the 11 in row 22 is the next pivot; clear below it. R3R2R4R2(111111012000000001000321)\xrightarrow{\substack{R_3 - R_2 \\ R_4 - R_2}} \begin{pmatrix} 1 & 1 & 1 & 1 & 1 & 1 \\ 0 & 1 & 2 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 3 & -2 & -1 \end{pmatrix} Stop right here. We are only halfway to echelon form — rows 33 and 44 would still need a swap — but row 33 already reads (000001)(\,0 \;\, 0 \;\, 0 \;\, 0 \;\, 0 \mid 1\,), the impossible equation 0=10 = 1. By part (1) of the theorem the system is inconsistent, and no amount of further elimination can change that. This early exit is worth remembering: the moment a row (00c)(\,0 \, \cdots \, 0 \mid c\,) with c0c \neq 0 appears, the system has no solution, and the computation is over.

Example 2.10 (A consistency problem with parameters)

For which values of hh and kk is the following system consistent? x1+hx2+x3=1,x2x3=2,x1x2+x3=k.x_1 + h\,x_2 + x_3 = 1, \qquad x_2 - x_3 = 2, \qquad x_1 - x_2 + x_3 = k. Row-reduce the augmented matrix, treating hh and kk as unknown constants: (1h110112111k)R3R1(1h11011201h0k1)\begin{pmatrix} 1 & h & 1 & 1 \\ 0 & 1 & -1 & 2 \\ 1 & -1 & 1 & k \end{pmatrix} \xrightarrow{R_3 - R_1} \begin{pmatrix} 1 & h & 1 & 1 \\ 0 & 1 & -1 & 2 \\ 0 & -1-h & 0 & k-1 \end{pmatrix} R3+(1+h)R2(1h11011200(1+h)k+1+2h)\xrightarrow{R_3 + (1+h)R_2} \begin{pmatrix} 1 & h & 1 & 1 \\ 0 & 1 & -1 & 2 \\ 0 & 0 & -(1+h) & k+1+2h \end{pmatrix} Now read the last row through the existence–uniqueness theorem.

Case h1h \neq -1. The entry (1+h)-(1+h) is nonzero, so it is a third pivot, and there are no free variables: the system is consistent with a unique solution — for every value of kk.

Case h=1h = -1. The last row becomes (000k1)(\,0 \;\, 0 \;\, 0 \mid k - 1\,) (note k+1+2h=k1k+1+2h = k-1 here). If k1k \neq 1 this row says 0=k100 = k-1 \neq 0: inconsistent. If k=1k = 1 the row vanishes, leaving two pivots and one free variable: consistent with infinitely many solutions.

Conclusion. The system is consistent exactly when h1h \neq -1 (any kk; unique solution), or h=1h = -1 and k=1k = 1 (infinitely many solutions). Note how all three cases of the theorem appear in a single family of systems as the parameters vary.

Remark 2.11

Gaussian elimination is the computational engine of everything that follows. Next week we look at the vectors 𝐱\mathbf{x} and 𝐛\mathbf{b} themselves — the geometry of n\mathbb{R}^n — and re-interpret A𝐱=𝐛A\mathbf{x} = \mathbf{b} in a way that explains why solution sets look like points, lines, and planes.

Exercise 2.4 auto-check

In the parameter example, suppose h=1h = -1. For which value of kk is the system consistent?

Answer:
Exercise 2.5 auto-check

A linear system of 33 equations in 33 unknowns turns out to have the two distinct solutions (100)T\begin{pmatrix} 1 & 0 & 0 \end{pmatrix}^{T} and (010)T\begin{pmatrix} 0 & 1 & 0 \end{pmatrix}^{T}. What can you conclude?

Index of statements

  1. Definition 2.1 (Row echelon form, reduced row echelon form)
  2. Theorem 2.2 (Gaussian elimination)
  3. Remark 2.3
  4. Example 2.4 (Elimination with a unique solution)
  5. Definition 2.5 (Basic and free variables)
  6. Example 2.6 (Parametric form and parametric vector form)
  7. Remark 2.7 (Backward substitution)
  8. Theorem 2.8 (Existence and uniqueness)
  9. Example 2.9 (Inconsistent systems)
  10. Example 2.10 (A consistency problem with parameters)
  11. Remark 2.11