PrecalculusSystems of Equations and Matrices5 of 6
Systems of Equations and Matrices · 5

Solving Systems with Gaussian Elimination

We need a systematic way to solve systems of three equations and three unknowns without going in circles as we eliminate variables.

1

The Staircase Target and the Augmented Matrix

We want to find the values of xx, yy, and zz that satisfy all three equations at once:

x+2y+z=32x+5y+z=23x+4y+2z=8\displaystyle \begin{aligned} x + 2y + z &= 3 \\ 2x + 5y + z &= 2 \\ 3x + 4y + 2z &= 8 \end{aligned}

If we combine equations at random, canceling one variable often brings back another variable we already eliminated. First, let's see what a system looks like when it is easy to solve, and how to write just the numbers from the equations before we start.

The Staircase System and the Augmented Matrix
1x+2y+1z=3\displaystyle {\hspace{6.2em}\mathllap{\phantom{1}x + 2y + \phantom{1}z} = \mathrlap{3}\hspace{1.3em}}
2x+5y+1z=2\displaystyle {\hspace{6.2em}\mathllap{2x + 5y + \phantom{1}z} = \mathrlap{2}\hspace{1.3em}}
3x+4y+2z=8\displaystyle {\hspace{6.2em}\mathllap{3x + 4y + 2z} = \mathrlap{8}\hspace{1.3em}}
(x, y, z)=  ?\displaystyle {\rule{0pt}{1.6em}\hspace{6.2em}\mathllap{(x,\ y,\ z)} = \mathrlap{\;?}\hspace{1.3em}}

When a system is arranged in a staircase pattern, the bottom equation gives zz right away, and we work upward by plugging each answer into the row above it (back-substitution):

x+2y+z=3  ⟹  x+2(−1)+3=3  ⟹  x=2y−z=−4  ⟹  y−3=−4  ⟹  y=−1z=3\displaystyle \begin{aligned} x + 2y + z &= 3 \\ &\implies x + 2(\found{-1}) + \found{3} = 3 \\ &\implies x = \found{2} \\[6pt] y - z &= -4 \\ &\implies y - \found{3} = -4 \\ &\implies y = \found{-1} \\[6pt] z &= \found{3} \end{aligned}

To reach that staircase using our three legal moves (swapping two rows, multiplying or dividing a row by a nonzero number, and adding a multiple of one row to another), we put the numbers into an augmented matrix so we don't have to copy xx, yy, and zz at every step:

[1↑x2↑y1↑z3↑constants25123428]\displaystyle \left[\begin{array}{ccc|c} \underset{\substack{\uparrow \\ x}}{1} & \underset{\substack{\uparrow \\ y}}{2} & \underset{\substack{\uparrow \\ z}}{1} & \underset{\substack{\uparrow \\ \text{constants}}}{3} \\ 2 & 5 & 1 & 2 \\ 3 & 4 & 2 & 8 \end{array}\right]
2

Row Echelon Form: Clearing Column by Column

Our goal is to turn this augmented matrix into Row Echelon Form. For this system, we'll make leading ones (pivots) down the diagonal with zeros underneath them. Row echelon form does not require the pivots to be 1\pivot{1}, but using leading ones simplifies our work:

[121325123428]⟶[1###01##001#]⏟Row Echelon Form\displaystyle \left[\begin{array}{ccc|c} 1 & 2 & 1 & 3 \\ \cleared{2} & 5 & 1 & 2 \\ \cleared{3} & \cleared{4} & 2 & 8 \end{array}\right] \longrightarrow \underbrace{\left[\begin{array}{ccc|c} \pivot{1} & \# & \# & \# \\ \cleared{0} & \pivot{1} & \# & \# \\ \cleared{0} & \cleared{0} & \pivot{1} & \# \end{array}\right]}_{\text{Row Echelon Form}}

To get those three zeros without undoing earlier work, we clear one column at a time from left to right.

Row Echelon Form: Clearing Column by Column
xyz\mathclap{\htmlClass{lc-mute}{x}}\hspace{1.85em}\mathclap{\htmlClass{lc-mute}{y}}\hspace{1.85em}\mathclap{\htmlClass{lc-mute}{z}}
121\mathclap{1}\hspace{1.57em}\mathclap{2}\hspace{1.57em}\mathclap{1}
3\mathclap{3}
251\mathclap{\htmlClass{lc-green}{2}}\hspace{1.57em}\mathclap{5}\hspace{1.57em}\mathclap{1}
2\mathclap{2}
342\mathclap{\htmlClass{lc-green}{3}}\hspace{1.57em}\mathclap{\htmlClass{lc-green}{4}}\hspace{1.57em}\mathclap{2}
8\mathclap{8}
1##\mathclap{\htmlClass{lc-pink}{1}}\hspace{1.65em}\mathclap{\#}\hspace{1.65em}\mathclap{\#}
#\mathclap{\#}
0\mathclap{\htmlClass{lc-green}{0}}
1#\mathclap{\htmlClass{lc-pink}{1}}\hspace{1.65em}\mathclap{\#}
#\mathclap{\#}
00\mathclap{\htmlClass{lc-green}{0}}\hspace{1.65em}\mathclap{\htmlClass{lc-green}{0}}
1\mathclap{\htmlClass{lc-pink}{1}}
#\mathclap{\#}
Row Echelon Form\text{Row Echelon Form}
Text solution
Clear Column 1Use the top-left pivot 1\pivot{1} in Row 1 to cancel the 2\cleared{2} and 3\cleared{3} underneath it, then leave Row 1 alone for the rest of the problem.
[121325123428]→−2R1+R2→R2−3R1+R3→R3[121301−1−40−2−1−1]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} \pivot{1} & 2 & 1 & 3 \\ \cleared{2} & 5 & 1 & 2 \\ \cleared{3} & 4 & 2 & 8 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\substack{-2R_1 + R_2 \to R_2 \\[3pt] -3R_1 + R_3 \to R_3}}} \\ &\left[\begin{array}{ccc|c} 1 & 2 & 1 & 3 \\ \cleared{0} & 1 & -1 & -4 \\ \cleared{0} & -2 & -1 & -1 \end{array}\right] \end{aligned}
Clear Column 2Use the middle pivot 1\pivot{1} in Row 2 to cancel the −2\cleared{-2} below it in Row 3.
[121301−1−40−2−1−1]→2R2+R3→R3[121301−1−400−3−9]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & 2 & 1 & 3 \\ 0 & \pivot{1} & -1 & -4 \\ 0 & \cleared{-2} & -1 & -1 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{2R_2 + R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & 2 & 1 & 3 \\ 0 & 1 & -1 & -4 \\ 0 & \cleared{0} & -3 & -9 \end{array}\right] \end{aligned}
Make the bottom pivot 1\pivot{1}Divide Row 3 by −3\pivot{-3} to finish the staircase.
[121301−1−400−3−9]→−13R3→R3[121301−1−40013]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & 2 & 1 & 3 \\ 0 & 1 & -1 & -4 \\ 0 & 0 & \pivot{-3} & -9 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{-\frac{1}{3}R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & 2 & 1 & 3 \\ 0 & 1 & -1 & -4 \\ 0 & 0 & \pivot{1} & 3 \end{array}\right] \end{aligned}
Back-substitute from the bottom row upPut the variables back on the rows and plug each value into the equation above it.
z=3y−3=−4  ⟹  y=−1x+2(−1)+3=3  ⟹  x=2\displaystyle \begin{aligned} z &= \found{3} \\ y - \found{3} &= -4 \\ \implies y &= \found{-1} \\ x + 2(\found{-1}) + \found{3} &= 3 \\ \implies x &= \found{2} \end{aligned}

So the solution to the system is (2,−1,3)\found{(2, -1, 3)}.

Now try picking the move that clears the next entry without undoing your zeros in Column 1.

Clearing columns from left to right keeps the zeros you already made. In this matrix, clearing Column 2 first or using Row 1 to clear Column 2 can undo a zero when you continue.
3

Gauss-Jordan Elimination: Clearing Above the Diagonal

Instead of switching back to equations to back-substitute, we can keep working in the staircase matrix and clear the numbers above the diagonal until each variable is by itself in its own row:

[121301−1−40013]⟶[1002010−10013]⏟Reduced Row Echelon Form\displaystyle \left[\begin{array}{ccc|c} 1 & \cleared{2} & \cleared{1} & 3 \\ 0 & 1 & \cleared{-1} & -4 \\ 0 & 0 & 1 & 3 \end{array}\right] \longrightarrow \underbrace{\left[\begin{array}{ccc|c} 1 & \cleared{0} & \cleared{0} & \found{2} \\ 0 & 1 & \cleared{0} & \found{-1} \\ 0 & 0 & 1 & \found{3} \end{array}\right]}_{\text{Reduced Row Echelon Form}}
Gauss-Jordan Elimination: Clearing Above the Diagonal
xyz\mathclap{\htmlClass{lc-mute}{x}}\hspace{2.79em}\mathclap{\htmlClass{lc-mute}{y}}\hspace{2.79em}\mathclap{\htmlClass{lc-mute}{z}}
R1\htmlClass{lc-mute}{R_1}
1\mathclap{\htmlClass{lc-pink}{1}}
21\mathclap{\htmlClass{lc-green}{2}}\hspace{1.95em}\mathclap{\htmlClass{lc-green}{1}}
3\mathclap{3}
R2\htmlClass{lc-mute}{R_2}
0\mathclap{0}
1\mathclap{\htmlClass{lc-pink}{1}}
−1\mathclap{\htmlClass{lc-green}{-1}}
−4\mathclap{-4}
R3\htmlClass{lc-mute}{R_3}
00\mathclap{0}\hspace{1.95em}\mathclap{0}
1\mathclap{\htmlClass{lc-pink}{1}}
3\mathclap{3}
Text solution
Clear above the pivot in Column 3Start at the bottom-right pivot 1\pivot{1} in Row 3 so its two leading zeros leave Columns 1 and 2 unchanged.
[121301−1−40013]→R3+R2→R2−R3+R1→R1[1200010−10013]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & 2 & \cleared{1} & 3 \\ 0 & 1 & \cleared{-1} & -4 \\ 0 & 0 & \pivot{1} & 3 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\substack{R_3 + R_2 \to R_2 \\[3pt] -R_3 + R_1 \to R_1}}} \left[\begin{array}{ccc|c} 1 & 2 & \cleared{0} & 0 \\ 0 & 1 & \cleared{0} & -1 \\ 0 & 0 & 1 & 3 \end{array}\right] \end{aligned}
Clear above the pivot in Column 2Move left to the middle pivot 1\pivot{1} in Row 2 and cancel the 2\cleared{2} above it in Row 1.
[1200010−10013]→−2R2+R1→R1[1002010−10013]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & \cleared{2} & 0 & 0 \\ 0 & \pivot{1} & 0 & -1 \\ 0 & 0 & 1 & 3 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{-2R_2 + R_1 \to R_1}} \left[\begin{array}{ccc|c} 1 & \cleared{0} & 0 & \found{2} \\ 0 & 1 & 0 & \found{-1} \\ 0 & 0 & 1 & \found{3} \end{array}\right] \end{aligned}

Reading straight across each row gives x=2x = \found{2}, y=−1y = \found{-1}, and z=3z = \found{3}, or (2,−1,3)\found{(2, -1, 3)}.

4

Handling Zero Pivots and Fractions

Now let's solve a system where the first equation is missing xx and the remaining pivots aren't 1\pivot{1}:

y+z=42x+3y−z=43x+2y+z=11\displaystyle \begin{aligned} y + z &= 4 \\ 2x + 3y - z &= 4 \\ 3x + 2y + z &= 11 \end{aligned}

A 00 in a pivot spot can't cancel anything below it, and dividing a row to make a pivot 1\pivot{1} can bring in fractions.

Handling Zero Pivots and Fractions
xyz\mathclap{\htmlClass{lc-mute}{x}}\hspace{2.79em}\mathclap{\htmlClass{lc-mute}{y}}\hspace{2.79em}\mathclap{\htmlClass{lc-mute}{z}}
R1\htmlClass{lc-mute}{R_1}
0\mathclap{0}
11\mathclap{1}\hspace{1.95em}\mathclap{1}
4\mathclap{4}
R2\htmlClass{lc-mute}{R_2}
23−1\mathclap{2}\hspace{1.95em}\mathclap{3}\hspace{1.95em}\mathclap{-1}
4\mathclap{4}
R3\htmlClass{lc-mute}{R_3}
321\mathclap{3}\hspace{1.95em}\mathclap{2}\hspace{1.95em}\mathclap{1}
11\mathclap{11}
Text solution
Swap rows to get a nonzero pivotPut 00 in the missing xx spot of Row 1 and swap it with Row 2, which also gives us a zero in Column 1 of Row 2 right away.
[011423−1432111]→R1↔R2[23−14011432111]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 0 & 1 & 1 & 4 \\ 2 & 3 & -1 & 4 \\ 3 & 2 & 1 & 11 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{R_1 \leftrightarrow R_2}} \left[\begin{array}{ccc|c} \pivot{2} & 3 & -1 & 4 \\ \cleared{0} & 1 & 1 & 4 \\ 3 & 2 & 1 & 11 \end{array}\right] \end{aligned}
Make the top-left pivot 1\pivot{1} and clear Column 1Multiply Row 1 by 12\rowop{\frac{1}{2}}, then rewrite the whole numbers in Row 3 as halves (42\frac{4}{2} and 22\frac{2}{2}) to add −3R1\rowop{-3R_1} straight down.
[23−14011432111]→12R1→R1[132−12201143422211]→−3R1+R3→R3[132−12201140−52525]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} \pivot{2} & 3 & -1 & 4 \\ 0 & 1 & 1 & 4 \\ 3 & 2 & 1 & 11 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\frac{1}{2}R_1 \to R_1}} \left[\begin{array}{ccc|c} \pivot{1} & \frac{3}{2} & -\frac{1}{2} & 2 \\ 0 & 1 & 1 & 4 \\ \cleared{3} & \frac{4}{2} & \frac{2}{2} & 11 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{-3R_1 + R_3 \to R_3}} \\ &\left[\begin{array}{ccc|c} 1 & \frac{3}{2} & -\frac{1}{2} & 2 \\ 0 & 1 & 1 & 4 \\ \cleared{0} & -\frac{5}{2} & \frac{5}{2} & 5 \end{array}\right] \end{aligned}
Clear Column 2 and make the bottom pivot 1\pivot{1}Cancel −52\cleared{-\frac{5}{2}} using the middle pivot 1\pivot{1} in Row 2, then divide Row 3 by 5\pivot{5}.
[132−12201140−52525]→52R2+R3→R3[132−122011400515]→15R3→R3[132−12201140013]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & \frac{3}{2} & -\frac{1}{2} & 2 \\ 0 & \pivot{1} & 1 & 4 \\ 0 & \cleared{-\frac{5}{2}} & \frac{5}{2} & 5 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\frac{5}{2}R_2 + R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & \frac{3}{2} & -\frac{1}{2} & 2 \\ 0 & 1 & 1 & 4 \\ 0 & \cleared{0} & \pivot{5} & 15 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\frac{1}{5}R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & \frac{3}{2} & -\frac{1}{2} & 2 \\ 0 & 1 & 1 & 4 \\ 0 & 0 & \pivot{1} & 3 \end{array}\right] \end{aligned}
Back-substitute from the bottom row upUse z=3z = \found{3} in Row 2 to find yy, then plug both into Row 1 to find xx.
z=3y+3=4  ⟹  y=1x+32(1)−12(3)=2  ⟹  x=2\displaystyle \begin{aligned} z &= \found{3} \\ y + \found{3} &= 4 \\ \implies y &= \found{1} \\ x + \tfrac{3}{2}(\found{1}) - \tfrac{1}{2}(\found{3}) &= 2 \\ \implies x &= \found{2} \end{aligned}

So the solution is (2,1,3)\found{(2, 1, 3)}. If you prefer not to work with fractions in a row like [0−52525]\left[\begin{array}{ccc|c} 0 & -\frac{5}{2} & \frac{5}{2} & 5 \end{array}\right], you can also multiply that entire row by 2\rowop{2} at any time to clear its denominators.

5

Systems with No Solution

Not every system of three equations has a point where all three meet. Let's see how the matrix tells us when there is no solution:

x+y+2z=42x+3y+3z=53x+4y+5z=12\displaystyle \begin{aligned} x + y + 2z &= 4 \\ 2x + 3y + 3z &= 5 \\ 3x + 4y + 5z &= 12 \end{aligned}
Systems with No Solution
1x+1y+2z=4\displaystyle {\hspace{6.2em}\mathllap{\phantom{1}x + \phantom{1}y + 2z} = \mathrlap{4}\hspace{1.3em}}
2x+3y+3z=5\displaystyle {\hspace{6.2em}\mathllap{2x + 3y + 3z} = \mathrlap{5}\hspace{1.3em}}
3x+4y+5z=12\displaystyle {\hspace{6.2em}\mathllap{3x + 4y + 5z} = \mathrlap{12}\hspace{1.3em}}
(x, y, z)=  ?\displaystyle {\rule{0pt}{1.6em}\hspace{6.2em}\mathllap{(x,\ y,\ z)} = \mathrlap{\;?}\hspace{1.3em}}
Text solution
Clear Column 1Use the top-left pivot 1\pivot{1} to cancel the 2\cleared{2} and 3\cleared{3} below it.
[1124233534512]→−2R1+R2→R2−3R1+R3→R3[112401−1−301−10]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} \pivot{1} & 1 & 2 & 4 \\ \cleared{2} & 3 & 3 & 5 \\ \cleared{3} & 4 & 5 & 12 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\substack{-2R_1 + R_2 \to R_2 \\[3pt] -3R_1 + R_3 \to R_3}}} \left[\begin{array}{ccc|c} 1 & 1 & 2 & 4 \\ \cleared{0} & 1 & -1 & -3 \\ \cleared{0} & 1 & -1 & 0 \end{array}\right] \end{aligned}
Clear Column 2 and read the bottom rowSubtract Row 2 from Row 3, which cancels both remaining variables in Row 3 at the same time.
[112401−1−301−10]→−R2+R3→R3[112401−1−30003]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & 1 & 2 & 4 \\ 0 & \pivot{1} & -1 & -3 \\ 0 & \cleared{1} & \cleared{-1} & 0 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{-R_2 + R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & 1 & 2 & 4 \\ 0 & 1 & -1 & -3 \\ 0 & \cleared{0} & \cleared{0} & \leftover{3} \end{array}\right] \end{aligned}

Putting the variables back on the bottom row gives 0x+0y+0z=30x + 0y + 0z = \leftover{3}, or 0=30 = \leftover{3}, which is impossible, so the system has No Solution.

6

Infinitely Many Solutions and Free Variables

Now compare what happens when an entire row, including the number on the right, cancels out to zero:

x+y−z=22x+3y−z=73x+4y−2z=9\displaystyle \begin{aligned} x + y - z &= 2 \\ 2x + 3y - z &= 7 \\ 3x + 4y - 2z &= 9 \end{aligned}
Infinitely Many Solutions and Free Variables
xyz\mathclap{\htmlClass{lc-mute}{x}}\hspace{2.79em}\mathclap{\htmlClass{lc-mute}{y}}\hspace{2.79em}\mathclap{\htmlClass{lc-mute}{z}}
R1\htmlClass{lc-mute}{R_1}
11−1\mathclap{1}\hspace{1.95em}\mathclap{1}\hspace{1.95em}\mathclap{-1}
2\mathclap{2}
R2\htmlClass{lc-mute}{R_2}
23−1\mathclap{2}\hspace{1.95em}\mathclap{3}\hspace{1.95em}\mathclap{-1}
7\mathclap{7}
R3\htmlClass{lc-mute}{R_3}
34−2\mathclap{3}\hspace{1.95em}\mathclap{4}\hspace{1.95em}\mathclap{-2}
9\mathclap{9}
(x, y, z)=  ?(x,\ y,\ z) = \;?
Text solution
Clear Column 1Use the top-left pivot 1\pivot{1} to cancel the 2\cleared{2} and 3\cleared{3} below it.
[11−1223−1734−29]→−2R1+R2→R2−3R1+R3→R3[11−1201130113]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} \pivot{1} & 1 & -1 & 2 \\ \cleared{2} & 3 & -1 & 7 \\ \cleared{3} & 4 & -2 & 9 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\substack{-2R_1 + R_2 \to R_2 \\[3pt] -3R_1 + R_3 \to R_3}}} \left[\begin{array}{ccc|c} 1 & 1 & -1 & 2 \\ \cleared{0} & 1 & 1 & 3 \\ \cleared{0} & 1 & 1 & 3 \end{array}\right] \end{aligned}
Clear Column 2Subtract Row 2 from the identical Row 3, leaving a bottom row of all zeros and two remaining equations.
[11−1201130113]→−R2+R3→R3[1↑pivot1−1201↑pivot1↑freevariable30000]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & 1 & -1 & 2 \\ 0 & \pivot{1} & 1 & 3 \\ 0 & \cleared{1} & \cleared{1} & \cleared{3} \end{array}\right] \\[8pt] &\xrightarrow{\rowop{-R_2 + R_3 \to R_3}} \\ &\left[\begin{array}{ccc|c} \underset{\pivot{\substack{\uparrow \\ \text{pivot}}}}{\pivot{1}} & 1 & -1 & 2 \\ 0 & \underset{\pivot{\substack{\uparrow \\ \text{pivot}}}}{\pivot{1}} & \underset{\found{\substack{\uparrow \\ \text{free} \\ \text{variable}}}}{1} & 3 \\ 0 & \cleared{0} & \cleared{0} & \cleared{0} \end{array}\right] \end{aligned}
Set the free variable to t\found{t} and back-substituteBecause Column 3 (zz) has no leading 1\pivot{1}, set the free variable z=tz = \found{t} (a parameter) and solve the two remaining equations from the bottom up in terms of t\found{t}.
z=ty+t=3  ⟹  y=3−tx+(3−t)−t=2  ⟹  x=2t−1\displaystyle \begin{aligned} z &= \found{t} \\ y + \found{t} &= 3 \\ \implies y &= \found{3 - t} \\ x + (\found{3 - t}) - \found{t} &= 2 \\ \implies x &= \found{2t - 1} \end{aligned}

The system has Infinitely Many Solutions, given by the formula (2t−1,3−t,t)\found{(2t - 1, 3 - t, t)} for any real number t\found{t} (or (2z−1,3−z,z)\found{(2z - 1, 3 - z, z)}).

Geometrically, (2t−1,3−t,t)\found{(2t - 1, 3 - t, t)} gives every point on the line where all three planes meet; points off that line don't satisfy the system.

Every point along the intersection line makes all three equations work at once, while any point off the line breaks at least two of them.

Key concepts

Write the augmented matrix and work column by column from left to right. If a pivot spot is 00, look below it for a nonzero entry in that column and swap the rows (R1↔R2\rowop{R_1 \leftrightarrow R_2}). If every entry at and below that spot is 00, move to the next column. You can divide a row by its nonzero pivot to make the pivot 1\pivot{1} (12R1→R1\rowop{\frac{1}{2}R_1 \to R_1}). Clear the entries below each pivot and leave that pivot row alone while clearing below later pivots, so 0+0=0\cleared{0} + \cleared{0} = \cleared{0} keeps the zeros you already made.

Once you reach the Row Echelon staircase [121301−1−40013]\left[\begin{array}{ccc|c} \pivot{1} & 2 & 1 & 3 \\ \cleared{0} & \pivot{1} & -1 & -4 \\ \cleared{0} & \cleared{0} & \pivot{1} & 3 \end{array}\right], stop and back-substitute upward (Gaussian elimination). Only keep clearing above the diagonal from right to left if a problem asks for Gauss-Jordan elimination or Reduced Row Echelon Form [1002010−10013]\left[\begin{array}{ccc|c} \pivot{1} & 0 & 0 & \found{2} \\ 0 & \pivot{1} & 0 & \found{-1} \\ 0 & 0 & \pivot{1} & \found{3} \end{array}\right].

If clearing a column cancels all the variables in a row at once, look at the number on the right. A row like [0003]\left[\begin{array}{ccc|c} 0 & 0 & 0 & \leftover{3} \end{array}\right] says 0=30 = \leftover{3}, which means No Solution. A row of all zeros [0000]\left[\begin{array}{ccc|c} 0 & 0 & 0 & 0 \end{array}\right] says 0=00 = 0. Finish clearing the remaining rows and check for a contradiction. If there is none, each variable without a pivot is free, and the system has Infinitely Many Solutions, like (2t−1,3−t,t)\found{(2t - 1, 3 - t, t)}.

7

Practice

1

Solve the system using Gaussian elimination and back-substitution:

x+y+z=22x+3y+4z=43x+y+2z=3\displaystyle \begin{aligned} x + y + z &= 2 \\ 2x + 3y + 4z &= 4 \\ 3x + y + 2z &= 3 \end{aligned}

Column 1 already has a 1\pivot{1} in the top-left corner. What multiples of Row 1 cancel the 2\cleared{2} and 3\cleared{3} below it?

Clear Column 1Use the top-left 1\pivot{1} in Row 1 to cancel the 2\cleared{2} and 3\cleared{3} below it.
[111223443123]→−2R1+R2→R2−3R1+R3→R3[111201200−2−1−3]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} \pivot{1} & 1 & 1 & 2 \\ \cleared{2} & 3 & 4 & 4 \\ \cleared{3} & 1 & 2 & 3 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\substack{-2R_1 + R_2 \to R_2 \\[3pt] -3R_1 + R_3 \to R_3}}} \left[\begin{array}{ccc|c} 1 & 1 & 1 & 2 \\ \cleared{0} & 1 & 2 & 0 \\ \cleared{0} & -2 & -1 & -3 \end{array}\right] \end{aligned}
Clear Column 2 and make the bottom pivot 1\pivot{1}Use Row 2 to cancel the −2\cleared{-2} in Row 3, then divide Row 3 by 3\pivot{3}.
[111201200−2−1−3]→2R2+R3→R3[11120120003−3]→13R3→R3[11120120001−1]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & 1 & 1 & 2 \\ 0 & \pivot{1} & 2 & 0 \\ 0 & \cleared{-2} & -1 & -3 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{2R_2 + R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & 1 & 1 & 2 \\ 0 & 1 & 2 & 0 \\ 0 & \cleared{0} & \pivot{3} & -3 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\frac{1}{3}R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & 1 & 1 & 2 \\ 0 & 1 & 2 & 0 \\ 0 & 0 & \pivot{1} & -1 \end{array}\right] \end{aligned}
Back-substituteWatch the sign when solving Row 2: y+2(−1)=0y + 2(\found{-1}) = 0 adds 22 to both sides to give y=2y = \found{2} (leaving it negative as y=−2y = -2 leads to the wrong answer (5,−2,−1)(5, -2, -1)).
z=−1y+2(−1)=0  ⟹  y=2x+2+(−1)=2  ⟹  x=1\displaystyle \begin{aligned} z &= \found{-1} \\ y + 2(\found{-1}) &= 0 \\ \implies y &= \found{2} \\ x + \found{2} + (\found{-1}) &= 2 \\ \implies x &= \found{1} \end{aligned}
Answer(1,2,−1)(1, 2, -1)
2

Solve the system using Gauss-Jordan elimination by reducing the augmented matrix to Reduced Row Echelon Form:

x−y+2z=72x−y+3z=11x+y+z=2\displaystyle \begin{aligned} x - y + 2z &= 7 \\ 2x - y + 3z &= 11 \\ x + y + z &= 2 \end{aligned}

Once you reach the staircase, start at the bottom-right pivot in Column 3 and clear upward from right to left.

Clear Column 1When computing −R1+R3\rowop{-R_1 + R_3} in Column 2, be careful with the negative sign on −1-1: −(−1)+1=2-(-1) + 1 = 2 (writing 1−1=01 - 1 = 0 turns Row 3 into [00−1−5]\left[\begin{array}{ccc|c} 0 & 0 & -1 & -5 \end{array}\right] and gives the wrong answer (−1,2,5)(-1, 2, 5)).
[1−1272−13111112]→−2R1+R2→R2−R1+R3→R3[1−12701−1−302−1−5]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} \pivot{1} & -1 & 2 & 7 \\ \cleared{2} & -1 & 3 & 11 \\ \cleared{1} & 1 & 1 & 2 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\substack{-2R_1 + R_2 \to R_2 \\[3pt] -R_1 + R_3 \to R_3}}} \left[\begin{array}{ccc|c} 1 & -1 & 2 & 7 \\ \cleared{0} & 1 & -1 & -3 \\ \cleared{0} & 2 & -1 & -5 \end{array}\right] \end{aligned}
Clear Column 2Use the middle pivot 1\pivot{1} in Row 2 to cancel the 2\cleared{2} below it.
[1−12701−1−302−1−5]→−2R2+R3→R3[1−12701−1−30011]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & -1 & 2 & 7 \\ 0 & \pivot{1} & -1 & -3 \\ 0 & \cleared{2} & -1 & -5 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{-2R_2 + R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & -1 & 2 & 7 \\ 0 & 1 & -1 & -3 \\ 0 & \cleared{0} & 1 & 1 \end{array}\right] \end{aligned}
Clear above Column 3, then above Column 2Work from right to left so the zeros in Row 3 keep Columns 1 and 2 from changing.
[1−12701−1−30011]→R3+R2→R2−2R3+R1→R1[1−105010−20011]→R2+R1→R1[1003010−20011]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & -1 & \cleared{2} & 7 \\ 0 & 1 & \cleared{-1} & -3 \\ 0 & 0 & \pivot{1} & 1 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\substack{R_3 + R_2 \to R_2 \\[3pt] -2R_3 + R_1 \to R_1}}} \left[\begin{array}{ccc|c} 1 & \cleared{-1} & \cleared{0} & 5 \\ 0 & \pivot{1} & \cleared{0} & -2 \\ 0 & 0 & 1 & 1 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{R_2 + R_1 \to R_1}} \left[\begin{array}{ccc|c} 1 & \cleared{0} & 0 & \found{3} \\ 0 & 1 & 0 & \found{-2} \\ 0 & 0 & 1 & \found{1} \end{array}\right] \end{aligned}
Answer[1003010−20011]\left[\begin{array}{ccc|c} 1 & 0 & 0 & 3 \\ 0 & 1 & 0 & -2 \\ 0 & 0 & 1 & 1 \end{array}\right], so (3,−2,1)(3, -2, 1)
3

Solve the system using Gaussian elimination:

y+2z=32x+y−z=53x+2y+z=12\displaystyle \begin{aligned} y + 2z &= 3 \\ 2x + y - z &= 5 \\ 3x + 2y + z &= 12 \end{aligned}

The first equation has no xx term. What is your first move when the top-left pivot spot has a 00?

Write the augmented matrix and swap rowsPut a 00 in Column 1 of Row 1 for the missing xx term (putting y+2zy + 2z into the first two columns as [1203]\left[\begin{array}{ccc|c} 1 & 2 & 0 & 3 \end{array}\right] gives the wrong answer (257,−27,137)\left(\tfrac{25}{7}, -\tfrac{2}{7}, \tfrac{13}{7}\right)), then swap Row 1 and Row 2.
[012321−1532112]→R1↔R2[21−15012332112]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 0 & 1 & 2 & 3 \\ 2 & 1 & -1 & 5 \\ 3 & 2 & 1 & 12 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{R_1 \leftrightarrow R_2}} \left[\begin{array}{ccc|c} \pivot{2} & 1 & -1 & 5 \\ \cleared{0} & 1 & 2 & 3 \\ 3 & 2 & 1 & 12 \end{array}\right] \end{aligned}
Make the top-left pivot 1\pivot{1} and clear Column 1Divide Row 1 by 2\pivot{2}, then write Row 3 in halves to add −3R1+R3\rowop{-3R_1 + R_3}.
[21−15012332112]→12R1→R1[112−1252012334222242]→−3R1+R3→R3[112−125201230125292]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} \pivot{2} & 1 & -1 & 5 \\ 0 & 1 & 2 & 3 \\ 3 & 2 & 1 & 12 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\frac{1}{2}R_1 \to R_1}} \left[\begin{array}{ccc|c} \pivot{1} & \frac{1}{2} & -\frac{1}{2} & \frac{5}{2} \\ 0 & 1 & 2 & 3 \\ \cleared{3} & \frac{4}{2} & \frac{2}{2} & \frac{24}{2} \end{array}\right] \\[8pt] &\xrightarrow{\rowop{-3R_1 + R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & \frac{1}{2} & -\frac{1}{2} & \frac{5}{2} \\ 0 & 1 & 2 & 3 \\ \cleared{0} & \frac{1}{2} & \frac{5}{2} & \frac{9}{2} \end{array}\right] \end{aligned}
Clear Column 2 and make the bottom pivot 1\pivot{1}Subtract 12R2\rowop{\frac{1}{2}R_2} from Row 3, then multiply Row 3 by 23\rowop{\frac{2}{3}}.
[112−125201230125292]→−12R2+R3→R3[112−1252012300323]→23R3→R3[112−125201230012]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & \frac{1}{2} & -\frac{1}{2} & \frac{5}{2} \\ 0 & \pivot{1} & 2 & 3 \\ 0 & \cleared{\frac{1}{2}} & \frac{5}{2} & \frac{9}{2} \end{array}\right] \\[8pt] &\xrightarrow{\rowop{-\frac{1}{2}R_2 + R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & \frac{1}{2} & -\frac{1}{2} & \frac{5}{2} \\ 0 & 1 & 2 & 3 \\ 0 & \cleared{0} & \pivot{\frac{3}{2}} & 3 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\frac{2}{3}R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & \frac{1}{2} & -\frac{1}{2} & \frac{5}{2} \\ 0 & 1 & 2 & 3 \\ 0 & 0 & \pivot{1} & 2 \end{array}\right] \end{aligned}
Back-substituteWork from Row 3 up to Row 1.
z=2y+2(2)=3  ⟹  y=−1x+12(−1)−12(2)=52  ⟹  x=4\displaystyle \begin{aligned} z &= \found{2} \\ y + 2(\found{2}) &= 3 \\ \implies y &= \found{-1} \\ x + \tfrac{1}{2}(\found{-1}) - \tfrac{1}{2}(\found{2}) &= \tfrac{5}{2} \\ \implies x &= \found{4} \end{aligned}
Answer(4,−1,2)(4, -1, 2)
4

Solve the system using Gaussian elimination:

x−y+2z=32x−y+3z=83x−y+4z=10\displaystyle \begin{aligned} x - y + 2z &= 3 \\ 2x - y + 3z &= 8 \\ 3x - y + 4z &= 10 \end{aligned}

Clear Column 1 first, then watch what happens to the left side of Row 3 when you clear Column 2.

Clear Column 1Use the top-left 1\pivot{1} in Row 1 to cancel the 2\cleared{2} and 3\cleared{3} below it.
[1−1232−1383−1410]→−2R1+R2→R2−3R1+R3→R3[1−12301−1202−21]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} \pivot{1} & -1 & 2 & 3 \\ \cleared{2} & -1 & 3 & 8 \\ \cleared{3} & -1 & 4 & 10 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\substack{-2R_1 + R_2 \to R_2 \\[3pt] -3R_1 + R_3 \to R_3}}} \left[\begin{array}{ccc|c} 1 & -1 & 2 & 3 \\ \cleared{0} & 1 & -1 & 2 \\ \cleared{0} & 2 & -2 & 1 \end{array}\right] \end{aligned}
Clear Column 2Subtract 2R2\rowop{2R_2} from Row 3. Notice that all three variables in Row 3 cancel out while −3\leftover{-3} remains on the right, meaning 0=−30 = \leftover{-3} (misreading [000−3]\left[\begin{array}{ccc|c} 0 & 0 & 0 & \leftover{-3} \end{array}\right] as z=−3z = -3 gives the wrong answer (−1,−1,−3)(-1, -1, -3)).
[1−12301−1202−21]→−2R2+R3→R3[1−12301−12000−3]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & -1 & 2 & 3 \\ 0 & \pivot{1} & -1 & 2 \\ 0 & \cleared{2} & \cleared{-2} & 1 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{-2R_2 + R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & -1 & 2 & 3 \\ 0 & 1 & -1 & 2 \\ 0 & \cleared{0} & \cleared{0} & \leftover{-3} \end{array}\right] \end{aligned}
AnswerNo Solution (Row 3 becomes [0    0    0∣−3][0\;\; 0\;\; 0 \mid -3], which says 0=−30 = -3)
5

Solve the system using Gaussian elimination, writing the solution in terms of the parameter tt where z=tz = t if there are infinitely many solutions:

x+2y−z=12x+5y−4z=53x+8y−7z=9\displaystyle \begin{aligned} x + 2y - z &= 1 \\ 2x + 5y - 4z &= 5 \\ 3x + 8y - 7z &= 9 \end{aligned}

After clearing Column 1 and Column 2, check which column has no leading 1\pivot{1}. That variable becomes your parameter t\found{t}.

Clear Column 1Use the top-left 1\pivot{1} in Row 1 to cancel the 2\cleared{2} and 3\cleared{3} below it.
[12−1125−4538−79]→−2R1+R2→R2−3R1+R3→R3[12−1101−2302−46]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} \pivot{1} & 2 & -1 & 1 \\ \cleared{2} & 5 & -4 & 5 \\ \cleared{3} & 8 & -7 & 9 \end{array}\right] \\[8pt] &\xrightarrow{\rowop{\substack{-2R_1 + R_2 \to R_2 \\[3pt] -3R_1 + R_3 \to R_3}}} \left[\begin{array}{ccc|c} 1 & 2 & -1 & 1 \\ \cleared{0} & 1 & -2 & 3 \\ \cleared{0} & 2 & -4 & 6 \end{array}\right] \end{aligned}
Clear Column 2Subtract 2R2\rowop{2R_2} from Row 3, which turns the entire bottom row into [0000]\left[\begin{array}{ccc|c} 0 & \cleared{0} & \cleared{0} & \cleared{0} \end{array}\right].
[12−1101−2302−46]→−2R2+R3→R3[12−1101−230000]\displaystyle \begin{aligned} &\left[\begin{array}{ccc|c} 1 & 2 & -1 & 1 \\ 0 & \pivot{1} & -2 & 3 \\ 0 & \cleared{2} & \cleared{-4} & \cleared{6} \end{array}\right] \\[8pt] &\xrightarrow{\rowop{-2R_2 + R_3 \to R_3}} \left[\begin{array}{ccc|c} 1 & 2 & -1 & 1 \\ 0 & 1 & -2 & 3 \\ 0 & \cleared{0} & \cleared{0} & \cleared{0} \end{array}\right] \end{aligned}
Set z=tz = \found{t} and back-substituteWhen plugging y=2t+3y = \found{2t + 3} into Row 1, distribute the 22 to both terms to get 2(2t+3)=4t+62(\found{2t + 3}) = 4t + 6 (forgetting to multiply the 33 by 22 gives the wrong answer (−3t−2,2t+3,t)(-3t - 2, 2t + 3, t)).
z=ty−2t=3  ⟹  y=2t+3x+2(2t+3)−t=1  ⟹  x=−3t−5\displaystyle \begin{aligned} z &= \found{t} \\ y - 2\found{t} &= 3 \\ \implies y &= \found{2t + 3} \\ x + 2(\found{2t + 3}) - \found{t} &= 1 \\ \implies x &= \found{-3t - 5} \end{aligned}
AnswerInfinitely Many Solutions: (−3t−5,2t+3,t)(-3t - 5, 2t + 3, t) (or (−3z−5,2z+3,z)(-3z - 5, 2z + 3, z))