From the free course College Algebra on Lykke

7.6 Solving Systems with Gaussian Elimination

Key concepts: Gaussian elimination for solving systems of linear equations · Systems of linear equations in three variables · Augmented matrices · Representing a system by separating coefficients from constants with a vertical line · Converting a system of equations into an augmented matrix · Converting an augmented matrix back into a system of equations · Elementary row operations · Using row operations to solve a linear system · The role of Karl Friedrich Gauss in Gaussian elimination

By the end of this section the student can: Write the augmented matrix of a system of equations; Write the system of equations from an augmented matrix; Perform row operations on a matrix; Solve a system of linear equations using matrices; Figure 1 German mathematician Carl Friedrich Gauss (1777–1855)

7.6 Solving Systems with Gaussian Elimination

A system of linear equations asks for values that satisfy several equations simultaneously. Gaussian elimination turns those equations into a sequence of simpler equivalent systems until the solution becomes visible. The method works especially well for systems with three variables, such as $x$, $y$, and $z$, where graphing is difficult to visualize.

A system of three linear equations can model a situation with three unknown quantities. For example, a financial allocation problem might ask how much money is invested in three accounts, while three equations describe the total amount invested, the total interest earned, and another condition. The same algebraic method applies whether the variables represent money, dimensions, rates, or physical measurements.

Learning objectives

By the end of this topic, you should be able to:

  1. Write an augmented matrix for a system of linear equations.
  2. Write a system of equations from an augmented matrix.
  3. Perform elementary row operations on a matrix.
  4. Use Gaussian elimination to solve a linear system.

Systems of linear equations in three variables

A system of linear equations is a collection of linear equations considered at the same time. A solution must make every equation true. A system in three variables has the general form

$$ \begin{aligned} a_1x+b_1y+c_1z&=d_1\ a_2x+b_2y+c_2z&=d_2\ a_3x+b_3y+c_3z&=d_3. \end{aligned} $$

The coefficients of $x$, $y$, and $z$ are arranged in corresponding columns. This consistent arrangement allows the equations to be represented compactly by a matrix. Gaussian elimination is named after the German mathematician Karl Friedrich Gauss, whose discoveries in astronomy, optics, and matrix theory influenced mathematics for centuries.

Augmented matrices

An augmented matrix is a matrix in which a vertical line separates the coefficient entries from the constant terms. The vertical line plays the role of the equal signs in the original equations.

For the system

$$ \begin{aligned} x+2y-z&=3\ 2x-y+2z&=6\ x-3y+3z&=4, \end{aligned} $$

the coefficients of $x$, $y$, and $z$ form the first three columns, and the constants form the final column:

$$ \left[ \begin{array}{rrr|r} 1&2&-1&3\ 2&-1&2&6\ 1&-3&3&4 \end{array} \right]. $$

The first row corresponds to the first equation, the second row corresponds to the second equation, and the third row corresponds to the third equation. The entries must remain aligned: the first coefficient column always represents $x$, the second represents $y$, the third represents $z$, and the column after the vertical line represents constants.

Writing an augmented matrix from a system

To write an augmented matrix, write the coefficients of the $x$-terms down the first column, the coefficients of the $y$-terms down the second column, and, when present, the coefficients of the $z$-terms down the third column. Then draw a vertical line and place the constants to its right. A missing variable has coefficient $0$.

Worked example: Write an augmented matrix.

Write the augmented matrix for

$$ \begin{aligned} 4x-3y&=11\ 3x+2y&=4. \end{aligned} $$

The coefficient of $x$ in the first equation is $4$, and the coefficient of $x$ in the second equation is $3$. These form the first column. The $y$-coefficients form the second column, and the constants form the final column:

$$ \left[ \begin{array}{rr|r} 4&-3&11\ 3&2&4 \end{array} \right]. $$

For a three-variable example,

$$ \begin{aligned} 2x-y+4z&=7\ x+3y-z&=-2\ -5x+2y&=9, \end{aligned} $$

the third equation has no $z$-term, so its $z$-coefficient is $0$:

$$ \left[ \begin{array}{rrr|r} 2&-1&4&7\ 1&3&-1&-2\ -5&2&0&9 \end{array} \right]. $$

Converting an augmented matrix back into equations

To reverse the process, read each row as an equation. The entries before the vertical line become coefficients, and the entry after the line becomes the constant. For example,

$$ \left[ \begin{array}{rrr|r} 1&0&-2&5\ 0&1&3&-1\ 0&0&1&4 \end{array} \right] $$

represents

$$ \begin{aligned} x-2z&=5\ y+3z&=-1\ z&=4. \end{aligned} $$

Notice that a coefficient of $1$ is usually not written, and a coefficient of $0$ means that the corresponding variable is absent. Thus, the second row represents $0x+y+3z=-1$, which simplifies to $y+3z=-1$.

Elementary row operations

Gaussian elimination works because certain operations change the appearance of a system without changing its solution. These are called elementary row operations:

  1. Interchange two rows.
  2. Multiply every entry in a row by a nonzero constant.
  3. Replace one row by the sum of that row and a multiple of another row.

These operations correspond to valid equation moves. Switching equations does not change the system. Multiplying an equation by a nonzero number produces an equivalent equation. Adding a multiple of one equation to another eliminates a variable while preserving the common solution.

For example, starting with

$$ \left[ \begin{array}{rr|r} 1&2&5\ 3&2&9 \end{array} \right], $$

we can replace row $2$ with row $2-3R_1$:

$$ R_2\longrightarrow R_2-3R_1. $$

Entry by entry,

$$ \begin{aligned} 3-3(1)&=0,\ 2-3(2)&=-4,\ 9-3(5)&=-6. \end{aligned} $$

Therefore,

$$ \left[ \begin{array}{rr|r} 1&2&5\ 3&2&9 \end{array} \right] \longrightarrow \left[ \begin{array}{rr|r} 1&2&5\ 0&-4&-6 \end{array} \right]. $$

Gaussian elimination

Gaussian elimination uses row operations to create zeros below leading coefficients. For a three-variable system, the usual goal is a triangular, or row-echelon, form:

$$ \left[ \begin{array}{rrr|r} a&b&c&d\ 0&e&f&g\ 0&0&h&i \end{array} \right]. $$

The bottom row gives an equation in one variable. Substitution into the row above then reveals the remaining variables. This final process is called back-substitution.

Worked example: Solve a three-variable system by Gaussian elimination.

Solve

$$ \begin{aligned} x+y+z&=6\ 2x-y+z&=3\ x+2y-z&=2. \end{aligned} $$

First write the augmented matrix:

$$ \left[ \begin{array}{rrr|r} 1&1&1&6\ 2&-1&1&3\ 1&2&-1&2 \end{array} \right]. $$

Use the first row to eliminate $x$ from rows $2$ and $3$:

$$ R_2\longrightarrow R_2-2R_1, \qquad R_3\longrightarrow R_3-R_1. $$

The entries become

$$ R_2: \quad \left[ \begin{array}{rrr|r} 2&-1&1&3 \end{array} \right]

2 \left[ \begin{array}{rrr|r} 1&1&1&6 \end{array} \right]

\left[ \begin{array}{rrr|r} 0&-3&-1&-9 \end{array} \right], $$

and

Thus,

$$ \left[ \begin{array}{rrr|r} 1&1&1&6\ 0&-3&-1&-9\ 0&1&-2&-4 \end{array} \right]. $$

It is convenient to place the row with leading coefficient $1$ above the row with leading coefficient $-3$. Interchange rows $2$ and $3$:

$$ R_2\longleftrightarrow R_3. $$

Then,

$$ \left[ \begin{array}{rrr|r} 1&1&1&6\ 0&1&-2&-4\ 0&-3&-1&-9 \end{array} \right]. $$

Now eliminate $y$ from row $3$:

$$ R_3\longrightarrow R_3+3R_2. $$

Since

$$ \left[ \begin{array}{rrr|r} 0&-3&-1&-9 \end{array} \right] + 3 \left[ \begin{array}{rrr|r} 0&1&-2&-4 \end{array} \right]

\left[ \begin{array}{rrr|r} 0&0&-7&-21 \end{array} \right], $$

we obtain

$$ \left[ \begin{array}{rrr|r} 1&1&1&6\ 0&1&-2&-4\ 0&0&-7&-21 \end{array} \right]. $$

Translate this matrix back into equations:

$$ \begin{aligned} x+y+z&=6,\ y-2z&=-4,\ -7z&=-21. \end{aligned} $$

Solve from the bottom upward:

$$ -7z=-21 $$

$$ z=3. $$

Substitute $z=3$ into the second equation:

$$ y-2(3)=-4 $$

$$ y-6=-4 $$

$$ y=2. $$

Substitute $y=2$ and $z=3$ into the first equation:

$$ x+2+3=6 $$

$$ x+5=6 $$

$$ x=1. $$

Therefore, the solution is

$$ \boxed{(x,y,z)=(1,2,3)}. $$

Always check the result in the original equations:

$$ 1+2+3=6, $$

$$ 2(1)-2+3=3, $$

$$ 1+2(2)-3=2. $$

All three equations are true, so the solution is verified.

Recognizing special outcomes

Row reduction can also reveal that a system has no solution or infinitely many solutions. A row such as

$$ \left[ \begin{array}{rrr|r} 0&0&0&5 \end{array} \right] $$

represents $0=5$, which is impossible; therefore, the system has no solution. A row of all zeros,

$$ \left[ \begin{array}{rrr|r} 0&0&0&0 \end{array} \right], $$

represents $0=0$ and may indicate infinitely many solutions when a variable remains free.

The key misconception is that a matrix is merely a shorter way to write equations. It is more useful than that: row operations let us systematically transform the system while preserving its solution set. The vertical line does not mean division; it marks the boundary between variable coefficients and constants.

Practice

1. Write the augmented matrix for

$$ \begin{aligned} 2x+5y-z&=8\ -x+3y+4z&=1\ 4x-y&=6. \end{aligned} $$

Answer:

$$ \left[ \begin{array}{rrr|r} 2&5&-1&8\ -1&3&4&1\ 4&-1&0&6 \end{array} \right]. $$

2. Write the system represented by

$$ \left[ \begin{array}{rrr|r} 1&-2&0&7\ 0&1&3&-4\ 2&0&-1&5 \end{array} \right]. $$

Answer:

$$ \begin{aligned} x-2y&=7\ y+3z&=-4\ 2x-z&=5. \end{aligned} $$

3. Solve using Gaussian elimination:

Answer:

Begin with

Apply

to obtain

Interchange rows $2$ and $3$:

Then apply $R_3\longrightarrow R_3+3R_2$:

Thus, $-7z=-21$, so $z=3$. Then

$$ y-2(3)=-4 \quad\Longrightarrow\quad y=2, $$

and

$$ x+2+3=6 \quad\Longrightarrow\quad x=1. $$

Therefore,

$$ \boxed{(x,y,z)=(1,2,3)}. $$

Content adapted from OpenStax College Algebra 2e by Jay Abramson et al., licensed CC BY 4.0.

7.6 Solving Systems with Gaussian Elimination - College Algebra - image 1
7.6 Solving Systems with Gaussian Elimination - College Algebra - image 1
7.6 Solving Systems with Gaussian Elimination - College Algebra - image 2
7.6 Solving Systems with Gaussian Elimination - College Algebra - image 2
7.6 Solving Systems with Gaussian Elimination - College Algebra - image 3
7.6 Solving Systems with Gaussian Elimination - College Algebra - image 3
7.6 Solving Systems with Gaussian Elimination - College Algebra - image 4
7.6 Solving Systems with Gaussian Elimination - College Algebra - image 4
7.6 Solving Systems with Gaussian Elimination - College Algebra - image 5
7.6 Solving Systems with Gaussian Elimination - College Algebra - image 5
7.6 Solving Systems with Gaussian Elimination - College Algebra - image 6
7.6 Solving Systems with Gaussian Elimination - College Algebra - image 6

Source Materials

Study College Algebra on Lykke

This course page is free to open: signed out, you can read its first two sections, and signing in, on any plan, opens the rest. The free Lykke Chrome extension syncs your own Canvas courses, so ChatGPT, Claude and Muse can answer from your classes and deadlines. It only reads Canvas.

Add the free extensionSign in to open every section

All sections of College Algebra · Browse more course pages

7.6 Solving Systems with Gaussian Elimination — College Algebra | Lykke