Tutorials › Linear Algebra › Solving Ax=b by Augmented Row Reduction

Vectors and Linear Combinations · Tutorial 128 of 1000

Solving Ax=b by Augmented Row Reduction

Learn to solve small exact linear systems by row-reducing the augmented matrix and checking the resulting solution in the original equations.

Beginner 9 min read

What You'll Learn

  • Build the augmented matrix for a system written as \(A\mathbf{x}=\mathbf{b}\).
  • Apply row swaps, nonzero row scaling, and row replacement to the whole augmented matrix.
  • Use row-echelon form and back-substitution to obtain solution values.
  • Understand why each elementary row operation preserves the system’s solutions.
  • Check a computed solution by substituting it into the original equations.

From \(A\mathbf{x}=\mathbf{b}\) to an Augmented Matrix

A system written as \(A\mathbf{x}=\mathbf{b}\) records several scalar equations at once. Here \(A\) is an \(m\times n\) real matrix, \(\mathbf{x}\in\mathbb{R}^n\) is the column of unknowns, and \(\mathbf{b}\in\mathbb{R}^m\) is the column of constants. Solving the system means finding values of the unknowns for which every equation holds. Augmented row reduction gives a compact way to carry out the same equation operations on all rows at once.

The coefficient matrix \(A\) contains the coefficients of the unknowns; the extra column \(\mathbf{b}\) contains the right-hand sides. The vertical bar is a visual separator, not an additional column of coefficients. Since each row represents an equation, any row operation used to simplify the system must be applied to the entire row, including the entry to the right of the bar.

Definition: The augmented matrix of \(A\mathbf{x}=\mathbf{b}\) is the matrix \([\mathbf{A}\mid\mathbf{b}]\) formed by appending \(\mathbf{b}\) as the last column of \(\mathbf{A}\). An elementary row operation on an augmented matrix is one of: swapping two rows, multiplying a row by a nonzero real scalar, or adding a scalar multiple of one row to another row.

These operations correspond to familiar equation operations: reorder equations, multiply an equation by a nonzero number, or add a multiple of one equation to another. In every case, the right-hand sides must undergo the same operation as the coefficients. The goal is often to reach row-echelon form: all zero rows, if any, are at the bottom, and the first nonzero entry in each nonzero row lies farther to the right than the first nonzero entry in the row above it. Those first nonzero entries are called leading entries. When the leading entries identify the variables in order, the equations can be solved from the bottom row upward by back-substitution.

Why Row Operations Preserve Solutions

Theorem: If one elementary row operation is applied to \([\mathbf{A}\mid\mathbf{b}]\), the resulting augmented matrix represents a system with exactly the same solutions \(\mathbf{x}\) as \(\mathbf{A}\mathbf{x}=\mathbf{b}\).

Proof. A row of the augmented matrix represents an equation. Swapping two rows changes only the order of the equations, so a vector \(\mathbf{x}\) satisfies all the equations before the swap exactly when it satisfies all of them after the swap. Multiplying a row by a nonzero scalar \(c\) replaces an equation \(L(\mathbf{x})=d\) by \(cL(\mathbf{x})=cd\). If the original equation holds, the new one holds; if the new equation holds, division by \(c\ne0\) recovers the original. Finally, replacing one row by itself plus \(c\) times another replaces \(L_1(\mathbf{x})=d_1\) by \(L_1(\mathbf{x})+cL_2(\mathbf{x})=d_1+cd_2\), while leaving the second equation in the system. If both original equations hold, the replacement equation holds. Conversely, subtracting \(c\) times the unchanged second equation recovers the original first equation. Thus each operation preserves the solutions in both directions. \(\square\)

The conclusion also applies to a sequence of row operations.

Corollary: Any finite sequence of elementary row operations on \([\mathbf{A}\mid\mathbf{b}]\) produces a matrix representing a system with the same solutions as the original system.

Proof. For a sequence of zero operations, the matrix is unchanged, so its system has the same solutions. For a sequence of \(k\ge1\) operations, the first \(k-1\) operations preserve the solution set by induction on the sequence length. The final operation preserves it by the theorem. Therefore the full sequence preserves the solution set. \(\square\)

This is the justification for row-reducing an augmented matrix: the simplified equations are not an approximation or a different problem. They are equivalent equations, obtained by reversible steps. Once the system has a form that can be solved directly, the values found must satisfy the original system as well. Substitution is a useful independent check on the arithmetic.

A Reliable Row-Reduction Routine

1
Set up the augmented matrix.
Put the coefficients of the unknowns in \(\mathbf{A}\), and append the right-hand-side column \(\mathbf{b}\), keeping the unknowns in the same order throughout.
2
Choose a leading entry.
Use a nonzero entry as the first leading entry. If convenient, swap rows to place it in the desired row.
3
Eliminate entries below it.
Add suitable multiples of the leading row to other rows. Apply each operation across the entire augmented matrix.
4
Continue to row-echelon form.
Move to the next column and lower row, and repeat the process until the leading entries move to the right as you go down.
5
Back-substitute and check.
Solve the last equation first, then use its value in the equation above. Substitute the resulting values into the original scalar equations.

Row reduction does not require every leading entry to be \(1\); scaling a row can make back-substitution easier, but it is optional. The essential discipline is to record the operation correctly and apply it to every entry in the row. The examples below use small systems so that each intermediate entry can be checked directly.

Worked Systems

Worked Example: A Two-Equation System

Solve \(2x_1+x_2=5\) and \(x_1-x_2=1\) by reducing the augmented matrix.

The coefficient columns correspond to \(x_1\) and \(x_2\), in that order. Swap the two rows to put a \(1\) in the first position, then subtract twice the first row from the second:

$$ \begin{bmatrix}2&1&\mid&5\\1&-1&\mid&1\end{bmatrix} \xrightarrow{R_1\leftrightarrow R_2} \begin{bmatrix}1&-1&\mid&1\\2&1&\mid&5\end{bmatrix} \xrightarrow{R_2\to R_2-2R_1} \begin{bmatrix}1&-1&\mid&1\\0&3&\mid&3\end{bmatrix}. $$

Divide the second row by \(3\), then add that row to the first:

$$ \begin{bmatrix}1&-1&\mid&1\\0&3&\mid&3\end{bmatrix} \xrightarrow{R_2\to \frac13 R_2} \begin{bmatrix}1&-1&\mid&1\\0&1&\mid&1\end{bmatrix} \xrightarrow{R_1\to R_1+R_2} \begin{bmatrix}1&0&\mid&2\\0&1&\mid&1\end{bmatrix}. $$

The rows now give \(x_1=2\) and \(x_2=1\). Check: in the first original equation, \(2(2)+1=5\); in the second, \(2-1=1\). Both equations hold.

Worked Example: A Three-Equation System

Solve the system \(2x_1+x_3=5\), \(x_2+x_3=3\), and \(x_1+x_2=3\). The variables are ordered as \(x_1,x_2,x_3\), so a missing variable has coefficient \(0\).

Swap the first and third rows. Then subtract twice the first row from the third row, and add twice the second row to the new third row. Each operation acts on the entire augmented matrix:

$$ \begin{bmatrix}2&0&1&\mid&5\\0&1&1&\mid&3\\1&1&0&\mid&3\end{bmatrix} \xrightarrow{R_1\leftrightarrow R_3} \begin{bmatrix}1&1&0&\mid&3\\0&1&1&\mid&3\\2&0&1&\mid&5\end{bmatrix} $$
$$ \xrightarrow{R_3\to R_3-2R_1} \begin{bmatrix}1&1&0&\mid&3\\0&1&1&\mid&3\\0&-2&1&\mid&-1\end{bmatrix} \xrightarrow{R_3\to R_3+2R_2} \begin{bmatrix}1&1&0&\mid&3\\0&1&1&\mid&3\\0&0&3&\mid&5\end{bmatrix}. $$

For example, in the first elimination the new third-row right-hand side is \(5-2(3)=-1\). In the next operation it is \(-1+2(3)=5\). Scale the third row by \(\tfrac13\), subtract the new third row from the second, and subtract the new second row from the first:

$$ \begin{bmatrix}1&1&0&\mid&3\\0&1&1&\mid&3\\0&0&3&\mid&5\end{bmatrix} \xrightarrow{R_3\to \frac13R_3} \begin{bmatrix}1&1&0&\mid&3\\0&1&1&\mid&3\\0&0&1&\mid&\frac53\end{bmatrix} $$
$$ \xrightarrow{R_2\to R_2-R_3} \begin{bmatrix}1&1&0&\mid&3\\0&1&0&\mid&\frac43\\0&0&1&\mid&\frac53\end{bmatrix} \xrightarrow{R_1\to R_1-R_2} \begin{bmatrix}1&0&0&\mid&\frac53\\0&1&0&\mid&\frac43\\0&0&1&\mid&\frac53\end{bmatrix}. $$

Reading off the rows gives \(x_1=\tfrac53\), \(x_2=\tfrac43\), and \(x_3=\tfrac53\). Check: \(2(\tfrac53)+\tfrac53=5\); \(\tfrac43+\tfrac53=3\); and \(\tfrac53+\tfrac43=3\). Each original equation is satisfied.

Worked Example: A Solution with Fractions

Solve \(x_1+2x_2=1\) and \(3x_1+x_2=0\). This example shows that exact fractions can appear naturally during reduction.

Subtract three times the first row from the second. Then scale the second row by \(-\tfrac15\), and eliminate the \(x_2\) entry in the first row:

$$ \begin{bmatrix}1&2&\mid&1\\3&1&\mid&0\end{bmatrix} \xrightarrow{R_2\to R_2-3R_1} \begin{bmatrix}1&2&\mid&1\\0&-5&\mid&-3\end{bmatrix} \xrightarrow{R_2\to-\frac15R_2} \begin{bmatrix}1&2&\mid&1\\0&1&\mid&\frac35\end{bmatrix} $$
$$ \xrightarrow{R_1\to R_1-2R_2} \begin{bmatrix}1&0&\mid&-\frac15\\0&1&\mid&\frac35\end{bmatrix}. $$

Thus \(x_1=-\tfrac15\) and \(x_2=\tfrac35\). Check: \(-\tfrac15+2(\tfrac35)=1\), and \(3(-\tfrac15)+\tfrac35=0\). The fractions satisfy both original equations.

Common Pitfall: Losing Track of the Right-Hand Side

A frequent error is to update the coefficients in a row but calculate its right-hand side incorrectly. For instance, begin with rows \([2,1\mid5]\) and \([1,-1\mid1]\), and apply \(R_2\to R_2-2R_1\). The coefficient entries become \(1-2(2)=-3\) and \(-1-2(1)=-3\), while the right-hand side becomes \(1-2(5)=-9\). Therefore the correct new row is \([-3,-3\mid-9]\), not \([0,-3\mid-9]\).

The first coefficient does become \(0\) if the rows are swapped first. After the swap, the rows are \([1,-1\mid1]\) and \([2,1\mid5]\). Applying \(R_2\to R_2-2R_1\) now gives \([0,3\mid3]\): the entries are \(2-2(1)=0\), \(1-2(-1)=3\), and \(5-2(1)=3\). The operation and the row order must match the displayed calculation.

A second version of the same pitfall is changing a coefficient row but copying the old right-hand side. This does not represent an equivalent equation. The theorem above explains why: the right-hand side is part of the equation and must undergo the same row operation. When in doubt, calculate each new entry, including the final column, from the stated operation.

What to Keep in Mind

Augmented row reduction is a bookkeeping method grounded in equivalence of equations. Set up the coefficient columns in a fixed variable order, include the entire right-hand-side column, and write each operation so that its effect can be checked. After reduction, use the resulting equations to determine the values, then substitute those values into the original system. The substitution check tests the final answer; checking the intermediate rows tests whether the reduction itself was carried out correctly.

In the worked systems, the reduced rows directly specified the values of all variables. Other row-echelon forms require additional care in interpreting the equations; the first task is always to read each row as an equation in the same ordered variables. The preservation theorem remains the reason the reduction is legitimate in every case.

Check Your Understanding

For each system, form the augmented matrix and use exact arithmetic. Check any values you obtain in the original equations.

  1. Write the augmented matrix for \(x_1+3x_2=4\) and \(2x_1-x_2=1\).
  2. Apply \(R_2\to R_2-2R_1\) to \(\begin{bmatrix}1&-1&\mid&2\\2&3&\mid&5\end{bmatrix}\). What is the complete new second row?
  3. Reduce the augmented matrix for \(x_1+x_2=4\), \(2x_1-x_2=2\), and state the values read from the reduced rows.
  4. Why must multiplying a row by a scalar use a nonzero scalar if the new equation is to have exactly the same solutions?
  5. In one sentence, explain why a sequence of elementary row operations preserves the solutions of the original system.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon