Solving Systems with Gaussian Elimination
By the end of this section, you will be able to:
- 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
Carl Friedrich Gauss lived during the late 18th century and early 19th century, but he is still considered one of the most prolific mathematicians in history. His contributions to the science of mathematics and physics span fields such as algebra, number theory, analysis, differential geometry, astronomy, and optics, among others. His discoveries regarding matrix theory changed the way mathematicians have worked for the last two centuries.
We first encountered Gaussian elimination in Systems of Linear Equations: Two Variables. In this section, we will revisit this technique for solving systems, this time using matrices.
Writing the Augmented Matrix of a System of Equations
A matrix can serve as a device for representing and solving a system of equations. To express a system in matrix form, we extract the coefficients of the variables and the constants, and these become the entries of the matrix. We use a vertical line to separate the coefficient entries from the constants, essentially replacing the equal signs. When a system is written in this form, we call it an augmented matrix.
For example, consider the following system of equations.
We can write this system as an augmented matrix:
We can also write a matrix containing just the coefficients. This is called the coefficient matrix.
A three-by-three system of equations such as
has a coefficient matrix
and is represented by the augmented matrix
Notice that the matrix is written so that the variables line up in their own columns: -terms go in the first column, -terms in the second column, and -terms in the third column. It is very important that each equation is written in standard form so that the variables line up. When there is a missing variable term in an equation, the coefficient is .
Given a system of equations, write an augmented matrix.
- Write the coefficients of the -terms as the numbers down the first column.
- Write the coefficients of the -terms as the numbers down the second column.
- If there are -terms, write the coefficients as the numbers down the third column.
- Draw a vertical line and write the constants to the right of the line.
Example. Write the augmented matrix for the given system of equations.
Solution. The augmented matrix displays the coefficients of the variables, and an additional column for the constants.
Write the systemas an augmented matrix. Enter row 2 of the matrix as a comma-separated list of three numbers.
Row 2 holds the coefficients ofandin the second equation, then its constant.Writing a System of Equations from an Augmented Matrix
We can use augmented matrices to help us solve systems of equations because they simplify operations when the systems are not encumbered by the variables. However, it is important to understand how to move back and forth between formats in order to make finding solutions smoother and more intuitive. Here, we will use the information in an augmented matrix to write the system of equations in standard form.
Example. Find the system of equations from the augmented matrix.
Solution. When the columns represent the variables , , and ,
The augmented matrixcorresponds to a system of equations. Enter the coefficients of,, and, and the constant, in the second equation, as a comma-separated list of four numbers.
Row 2 of the matrix is the second equation: the first three entries are the coefficients of,, and, and the last entry is the constant.Performing Row Operations on a Matrix
Now that we can write systems of equations in augmented matrix form, we will examine the various row operations that can be performed on a matrix, such as addition, multiplication by a constant, and interchanging rows.
Performing row operations on a matrix is the method we use for solving a system of equations. In order to solve the system of equations, we want to convert the matrix to row-echelon form, in which there are ones down the main diagonal from the upper left corner to the lower right corner, and zeros in every position below the main diagonal, as shown.
We use row operations corresponding to equation operations to obtain a new matrix that is row-equivalent in a simpler form. Here are the guidelines to obtaining row-echelon form.
- In any nonzero row, the first nonzero number is a . It is called a leading .
- Any all-zero rows are placed at the bottom of the matrix.
- Any leading is below and to the right of a previous leading .
- Any column containing a leading has zeros in all other positions in the column.
To solve a system of equations we can perform the following row operations to convert the coefficient matrix to row-echelon form and do back-substitution to find the solution.
- Interchange rows. (Notation: )
- Multiply a row by a constant. (Notation: )
- Add the product of a row multiplied by a constant to another row. (Notation: )
Each of the row operations corresponds to the operations we have already learned to solve systems of equations in three variables. With these operations, there are some key moves that will quickly achieve the goal of writing a matrix in row-echelon form. To obtain a matrix in row-echelon form for finding solutions, we use Gaussian elimination, a method that uses row operations to obtain a as the first entry so that row can be used to convert the remaining rows.
Gaussian Elimination. The Gaussian elimination method refers to a strategy used to obtain the row-echelon form of a matrix. The goal is to write matrix with the number as the entry down the main diagonal and have all zeros below.
The first step of the Gaussian strategy includes obtaining a as the first entry, so that row may be used to alter the rows below.
Given an augmented matrix, perform row operations to achieve row-echelon form.
- The first equation should have a leading coefficient of . Interchange rows or multiply by a constant, if necessary.
- Use row operations to obtain zeros down the first column below the first entry of .
- Use row operations to obtain a in row , column .
- Use row operations to obtain zeros down column , below the entry of .
- Use row operations to obtain a in row , column .
- Continue this process for all rows until there is a in every entry down the main diagonal and there are only zeros below.
- If any rows contain all zeros, place them at the bottom.
Example. Solve the given system by Gaussian elimination.
Solution. First, we write this as an augmented matrix.
We want a in row , column . This can be accomplished by interchanging row and row .
We now have a as the first entry in row , column . Now let’s obtain a in row , column . This can be accomplished by multiplying row by , and then adding the result to row .
We only have one more step, to multiply row by .
Use back-substitution. The second row of the matrix represents . Back-substitute into the first equation.
The solution is the point .
Solve the given system by Gaussian elimination:. Enter the solution as an ordered pair.
Use row operations to get a leadingin row 1, then a zero below it in column 1, then back-substitute.Example. Use Gaussian elimination to solve the given system of equations.
Solution. Write the system as an augmented matrix.
Obtain a in row , column . This can be accomplished by multiplying the first row by .
Next, we want a in row , column . Multiply row by and add row to row .
The second row represents the equation . Therefore, the system is inconsistent and has no solution.
Example. Solve the system of equations.
Solution. Perform row operations on the augmented matrix to try and achieve row-echelon form.
The matrix ends up with all zeros in the last row: . Thus, there are an infinite number of solutions and the system is classified as dependent. To find the generic solution, return to one of the original equations and solve for .
So the solution to this system is .
Example. Perform row operations on the given matrix to obtain row-echelon form.
Solution. The first row already has a in row , column . The next step is to multiply row by and add it to row . Then replace row with the result.
Next, obtain a zero in row , column .
Next, obtain a zero in row , column .
The last step is to obtain a in row , column .
Use row operations to write the systemin row-echelon form, then use back-substitution to solve it. Enter the solution as an ordered triple.
Eliminatefrom equations 2 and 3 using row 1, obtain a leadingin row 2, eliminate below it, then back-substitute starting from row 3.Solving a System of Linear Equations Using Matrices
We have seen how to write a system of equations with an augmented matrix, and then how to use row operations and back-substitution to obtain row-echelon form. Now, we will take row-echelon form a step farther to solve a by system of linear equations. The general idea is to eliminate all but one variable using row operations and then back-substitute to solve for the other variables.
Example. Solve the system of linear equations using matrices.
Solution. First, we write the augmented matrix.
Next, we perform row operations to obtain row-echelon form.
The easiest way to obtain a in row , column is to interchange and .
Then
The last matrix represents the equivalent system.
Using back-substitution, we obtain the solution as .
Example. Solve the following system of linear equations using matrices.
Solution. Write the augmented matrix.
First, multiply row by to get a in row , column . Then, perform row operations to obtain row-echelon form.
The last matrix represents the following system.
We see by the identity that this is a dependent system with an infinite number of solutions. We then find the generic solution. By solving the second equation for and substituting it into the first equation we can solve for in terms of .
Now we substitute the expression for into the second equation to solve for in terms of .
The generic solution is .
Solve the system using matrices:. Enter the solution as an ordered triple.
Row-reduce the augmented matrix to row-echelon form, then back-substitute starting from the last row.Q&A. Can any system of linear equations be solved by Gaussian elimination?
Yes, a system of linear equations of any size can be solved by Gaussian elimination.
Given a system of equations, solve with matrices using a calculator.
- Save the augmented matrix as a matrix variable , , , ….
- Use the ref( function in the calculator, calling up each matrix variable as needed.
Example. Solve the system of equations.
Solution. Write the augmented matrix for the system of equations.
On the matrix page of the calculator, enter the augmented matrix above as the matrix variable .
Use the ref( function in the calculator, calling up the matrix variable .
Evaluate.
Using back-substitution, the solution is .
Example. Carolyn invests a total of $12,000 in two municipal bonds, one paying interest and the other paying interest. The annual interest earned on the two investments last year was $1,335. How much was invested at each rate?
Solution. We have a system of two equations in two variables. Let the amount invested at interest, and the amount invested at interest.
As a matrix, we have
Multiply row by and add the result to row .
Then,
So .
Thus, $5,000 was invested at interest and $7,000 at interest.
Example. Ava invests a total of $10,000 in three accounts, one paying interest, another paying interest, and the third paying interest. The annual interest earned on the three investments last year was $770. The amount invested at was twice the amount invested at . How much was invested at each rate?
Solution. We have a system of three equations in three variables. Let be the amount invested at interest, let be the amount invested at interest, and let be the amount invested at interest. Thus,
As a matrix, we have
Now, we perform Gaussian elimination to achieve row-echelon form.
The third row tells us ; thus .
The second row tells us . Substituting , we get
The first row tells us . Substituting and , we get
The answer is $3,000 invested at interest, $1,000 invested at , and $6,000 invested at interest.
A small shoe company took out a loan of $1,500,000 to expand their inventory. Part of the money was borrowed at 7% interest, part was borrowed at 8% interest, and part was borrowed at 10% interest. The amount borrowed at 10% was four times the amount borrowed at 7%, and the annual interest on all three loans was $130,500. Use matrices to find how much was borrowed at 7% interest. Enter your answer as a plain number, without a dollar sign or commas.
Let,,be the amounts at 7%, 8%, and 10%. Then,, and.A small shoe company took out a loan of $1,500,000 to expand their inventory. Part of the money was borrowed at 7% interest, part was borrowed at 8% interest, and part was borrowed at 10% interest. The amount borrowed at 10% was four times the amount borrowed at 7%, and the annual interest on all three loans was $130,500. Use matrices to find how much was borrowed at 8% interest. Enter your answer as a plain number, without a dollar sign or commas.
Once you have found the amount borrowed at 7% interest, the total of $1,500,000 minus the 7% and 10% amounts gives the 8% amount.A small shoe company took out a loan of $1,500,000 to expand their inventory. Part of the money was borrowed at 7% interest, part was borrowed at 8% interest, and part was borrowed at 10% interest. The amount borrowed at 10% was four times the amount borrowed at 7%, and the annual interest on all three loans was $130,500. Use matrices to find how much was borrowed at 10% interest. Enter your answer as a plain number, without a dollar sign or commas.
The amount borrowed at 10% is four times the amount borrowed at 7%.Key concepts
- An augmented matrix is one that contains the coefficients and constants of a system of equations. See Example 1.
- A matrix augmented with the constant column can be represented as the original system of equations. See Example 2.
- Row operations include multiplying a row by a constant, adding one row to another row, and interchanging rows.
- We can use Gaussian elimination to solve a system of equations. See Example 3, Example 4, and Example 5.
- Row operations are performed on matrices to obtain row-echelon form. See Example 6.
- To solve a system of equations, write it in augmented matrix form. Perform row operations to obtain row-echelon form. Back-substitute to find the solutions. See Example 7 and Example 8.
- A calculator can be used to solve systems of equations using matrices. See Example 9.
- Many real-world problems can be solved using augmented matrices. See Example 10 and Example 11.
Practice
Write the augmented matrix of a system of equations
Write the systemas an augmented matrix. Enter row 1 of the matrix as a comma-separated list of three numbers.
Equation 1 has no-term, so its coefficient is; list the coefficients ofand, then the constant.Write the systemas an augmented matrix. Enter row 2 of the matrix as a comma-separated list of four numbers.
Equation 2 has no-term, so its coefficient is; list the coefficients of,, and, then the constant.Write the system of equations from an augmented matrix
The augmented matrixcorresponds to a system of two equations inand. Enter the coefficients ofand, and the constant, in the second equation, as a comma-separated list of three numbers.
Row 2 of the matrix is the second equation: the first two entries are the coefficients ofand, and the last entry is the constant.The augmented matrixcorresponds to a system of three equations in,, and. Enter the coefficients of,, and, and the constant, in the third equation, as a comma-separated list of four numbers.
Row 3 of the matrix is the third equation: the first three entries are the coefficients of,, and, and the last entry is the constant.Perform row operations on a matrix
Starting from the augmented matrix, interchange rows 1 and 2, then multiply the new row 1 byand add the result to row 2. Enter the resulting row 2 as a comma-separated list of three numbers.
After interchanging, row 1 is; multiply each of its entries byand add the result to the matching entry of row 2.Starting from the augmented matrix(without interchanging rows), multiply row 1 by. Enter the resulting row 1 as a comma-separated list of three numbers.
Divide every entry of row 1, including the entry after the bar, by.Solve a system of linear equations using matrices
If the row-echelon form of an augmented matrix has a row of all zero entries to the left of the vertical bar, how many solutions can the system have?
A zero row means an equation reduced to(dependent) ora nonzero number (inconsistent) — never a single value for a variable.Solve the system by Gaussian elimination:. Enter the solution as an ordered pair.
Eliminate one variable using row operations on the augmented matrix, then back-substitute.The augmented matrixis already in row-echelon form for a system in,, and. Use back-substitution to solve it. Enter the solution as an ordered triple.
Row 3 givesdirectly; substitute into row 2 to find, then into row 1 to find.This section is adapted from Precalculus 2e, Section 9.6: Solving Systems with Gaussian Elimination by Jay Abramson and OpenStax, © OpenStax, licensed under CC BY-NC-SA 4.0. Access the original for free at openstax.org. Changes: omitted a coreq-skills block the pinned CNXML prepends before the section proper (its own “Objective 1”/“Objective 2” review of row operations and solving with matrices, keyed to Intermediate Algebra 4.5, complete with its own Learning Objectives list and two “Practice Makes Perfect” exercise sets) — the printed PDF (pages 969–981, folios 959–971) runs straight from the chapter’s Gaussian-elimination introduction into the Carl Friedrich Gauss portrait and biographical paragraph, with no corequisite-skills material before it; this joins the same prepended-block pattern already logged in this book’s errata for §§4.3–4.8 and §9.5. Omitted the decorative portrait photograph of Carl Friedrich Gauss, which carries no mathematics, and the “Access these online resources” media links. The grader cannot take a matrix-shaped answer (the MathLive matrix-entry path is menu-only and untested for learners), so — following house precedent from Intermediate Algebra 4.5 and this book’s own §9.5 — every retained Try It and Practice item whose source answer is a full augmented matrix is re-posed as a row-entry fill-in (“enter row N of the matrix as a comma-separated list of N numbers”). The Try It that asks to “write the system… in row-echelon form” (module id ti_09_06_04) could not be re-posed this way at all: row-echelon form is not unique, and independently re-deriving it by ordinary elimination (leaving row 1 as the pivot equation) produces a different, equally valid row-echelon matrix than the one the source’s own solution prints — confirmed by checking that both matrices back-substitute to the same solution . Any single row asked for would therefore have more than one correct answer depending on the learner’s chosen operations; this Try It is re-posed as “use row operations to write the system in row-echelon form, then use back-substitution to solve,” graded on the resulting ordered triple, which is unique. The Verbal exercise asking whether there is “only one correct method” of row-reducing a given matrix (its own solution walks through two distinct valid operation sequences) is adapted into the “Perform row operations on a matrix” Practice group as two fill-ins, one per method the source’s solution demonstrates, since neither method alone is more than half the source item and both are independently correct. The “can a matrix with an all-zero row have one solution” Verbal exercise is adapted into a multiplechoice, since its answer is a categorical fact about solvability, not a number. The shoe-company loan Try It’s three-way dollar answer ($150,000/$750,000/$600,000, module id ti_09_06_06) is split into three plain-number fill-ins, each restating the full word problem, because the grader re-absorbs digit-grouping commas and a combined comma list of six-figure amounts is not reliably enterable. Every retained answer was independently re-derived from the printed system or word problem (by running the row reduction or the linear system in Node, not by reading the source key) before being checked against the CNXML solution; all matched. Eight selected end-of-section exercises with a solution present in the CNXML Answer Key were adapted into the closing Practice block’s nine items, one or two per objective.