3.3: Solving Systems with Gauss-Jordan Elimination
Learning Objectives
- Write the augmented matrix of a system of equations.
- Write the system of equations from an augmented matrix.
- Solve a system of linear equations using matrices and a graphing calculator.
- Solve financial applications using matrices and a graphing calculator.
Prerequisite Skills
Before you get started, take this prerequisite quiz.
Enter the following matrices in your calculator and then perform the indicated operations. If the operation cannot be done, give a reason.
\(A=\begin{bmatrix} 5 & 1 & -2\\2 & 6 & 7\\4 & 1 & −5 \end{bmatrix} \), \(B=\begin{bmatrix} 3 & -7\\0 & 1\\2 & −8 \end{bmatrix} \), \(C=\begin{bmatrix} 9 & 4\\6 & -5\\7 & −1 \end{bmatrix} \)
a. \(A \cdot B\)
b. \(B \cdot A\)
c. \(4B-2C\)
d. \(A+C\)
- Click here to check your answer
-
a. \(\begin{bmatrix} 11 & -18\\20 & -64\\2 & 13 \end{bmatrix} \)
b. Undefined since the number of columns in matrix \(B\) do not match the number of rows in matrix \(A\).
c. \(\begin{bmatrix} -6 & -36\\-12 & 14\\-6 & −30 \end{bmatrix} \)
d. Undefined since the dimension of matrix \(A\) do not match the dimensions of matrix \(C\).
If you missed any part of this problem, review Section 3.2 . (Note that this will open in a new window.)
Carl Friedrich Gauss lived during the late \(18^{th}\) century and early \(19^{th}\) 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.
Earlier in this chapter we explored methods of solving systems of equations. In this section, we will learn another technique for solving systems, this time using matrices.
Augmented Matrices
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 \(2 × 2\) system of equations.
\[\begin{align*} 3x+4y&= 7\\ 4x-2y&= 5 \end{align*}\]
We can write this system as an augmented matrix:
\(\left[ \begin{array}{cc|c} 3&4&7\\4&-2&5\end{array} \right]\)
We can also write a matrix containing just the coefficients. This is called the coefficient matrix.
\(\begin{bmatrix}3&4\\4&−2\end{bmatrix}\)
A three-by-three system of equations such as
\[\begin{align*} 3x-y-z&= 0\\ x+y&= 5\\ 2x-3z&= 2 \end{align*}\]
has a coefficient matrix
\(\begin{bmatrix}3&−1&−1\\1&1&0\\2&0&−3\end{bmatrix}\)
and is represented by the augmented matrix
\(\left[ \begin{array}{ccc|c}3&−1&−1&0\\1&1&0&5\\2&0&−3&2\end{array} \right]\)
Notice that the matrix is written so that the variables line up in their own columns: \(x\)-terms go in the first column, \(y\)-terms in the second column, and \(z\)-terms in the third column. It is very important that each equation is written in standard form \(ax+by+cz=d\) so that the variables line up. When there is a missing variable term in an equation, the coefficient is \(0\).
How to: Given a system of equations, write an augmented matrix
- Write the coefficients of the \(x\)-terms as the numbers down the first column.
- Write the coefficients of the \(y\)-terms as the numbers down the second column.
- If there are \(z\)-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 \(\PageIndex{1}\): Writing the Augmented Matrix for a System of Equations
Write the augmented matrix for the given system of equations.
\[\begin{align*} x+2y-z&= 3\\ 2x-y+2z&= 6\\ x-3y+3z&= 4 \end{align*}\]
Solution
The augmented matrix displays the coefficients of the variables, and an additional column for the constants.
\(\left[ \begin{array}{ccc|c}1&2&−1&3\\2&−1&2&6\\1&−3&3&4\end{array} \right]\)
Exercise \(\PageIndex{1}\)
Write the augmented matrix of the given system of equations.
\[\begin{align*} 4x-3y&= 11\\ 3x+2y&= 4 \end{align*}\]
- Answer
-
\(\left[ \begin{array}{cc|c} 4&−3&11\\3&2&4\end{array} \right]\)
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 \(\PageIndex{2}\): Writing a System of Equations from an Augmented Matrix Form
Find the system of equations from the augmented matrix.
\(\left[ \begin{array}{ccc|c}1&−3&−5&-2\\2&−5&−4&5\\−3&5&4&6 \end{array} \right]\)
Solution
When the columns represent the variables \(x\), \(y\), and \(z\),
\[\left[ \begin{array}{ccc|c}1&-3&-5&-2\\2&-5&-4&5\\-3&5&4&6 \end{array} \right] \rightarrow \begin{align*} x-3y-5z&= -2\\ 2x-5y-4z&= 5\\ -3x+5y+4z&= 6 \end{align*}\]
Exercise \(\PageIndex{2}\)
Write the system of equations from the augmented matrix.
\(\left[ \begin{array}{ccc|c}1&−1& 1&5\\2&−1&3&1\\0&1&1&-9\end{array}\right]\)
- Answer
-
\(\begin{align*} x-y+z&= 5\\ 2x-y+3z&= 1\\ y+z&= -9 \end{align*}\)
Reduced Row-Echelon Form
In order to solve a system of equations, we want to convert its matrix to reduced 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 above and below the main diagonal as shown.
Reduced row-echelon form \(\begin{bmatrix}1&0&0\\0&1&0\\0&0&1\end{bmatrix}\)
The following augmented matrices are in reduced row-echelon form.
\(\left[ \begin{array}{cc|c}1 & 0 & -2 \\ 0 & 1 & 5\end{array} \right]\), \(\left[ \begin{array}{ccc|c}1 & 0 & 0 & 4 \\ 0 & 1 & 0 & 3 \\ 0 & 0 & 1 & 2\end{array} \right]\)
The following augmented matrices are not in reduced row-echelon form.
\(\left[ \begin{array}{cc|c}2 & 4 & -6 \\ 4 & 0 & 7\end{array} \right]\), \(\left[ \begin{array}{ccc|c}0 & 2 & 3 & 3 \\ 1 & 5 & 0 & 2 \\ 0 & 0 & 1 & 0\end{array} \right]\)
Example \(\PageIndex{3}\): Matrices in Reduced Row-Echelon Form
Write the system of equations from each of the matrices in reduced row-echelon form from above. What is the advantage of this form?
a. \(\left[ \begin{array}{cc|c}1 & 0 & -2 \\ 0 & 1 & 5\end{array} \right]\)
b. \(\left[ \begin{array}{ccc|c}1 & 0 & 0 & 4 \\ 0 & 1 & 0 & 3 \\ 0 & 0 & 1 & 2\end{array} \right]\)
Solution
a. \(\begin{align*} x=-2\\ y=5 \end{align*}\)
b. \(\begin{align*} x=4\\ y=3\\z=2 \end{align*}\)
The advantage of reduced row-echelon form is that the solution to the system of equations is given in the right column.
GAUSS-JORDAN ELIMINATION
The Gauss-Jordan elimination method refers to a strategy used to obtain the reduced row-echelon form of a matrix. The goal is to write matrix \(A\) with the number \(1\) as the entry down the main diagonal and have all zeros above and below.
\(A=\begin{bmatrix}a_{11}&a_{12}&a_{13}\\a_{21}&a_{22}&a_{23}\\a_{31}&a_{32}&a_{33}\end{bmatrix}\xrightarrow{After\space Gauss-Jordan\space elimination} A=\begin{bmatrix}1&0&0\\0&1&0\\0&0&1\end{bmatrix}\)
We can perform row operations on a matrix, such as addition, multiplication by a constant, and interchanging rows, to create reduced row-echelon form. The process of performing these steps by hand is beyond the scope of this class. However, you are welcome and encouraged to find more information about the Gauss-Jordan Method HERE .
Solving Systems of Equations with Gauss-Jordan Elimination
For the purposes of this course, we'll demonstrate how to find reduced row-echelon form in the graphing calculator.
How to: Given a system of equations, solve with matrices using a calculator
-
Save the augmented matrix as a matrix variable \([A], [B], [C],...\)
-
Press 2 nd MATRIX. The screen will display the Matrix menu. Use the right arrow key twice to select the EDIT menu. From the EDIT menu, use the down arrow to move the cursor to select the matrix name desired from the menu, and press ENTER. The matrix input screen will appear.
-
Enter the dimensions of the total matrix size as rows \(\times\) columns. Type the number of rows, press ENTER, type the number of columns, and press ENTER again. The shape of the matrix adjusts on the screen to show the requested number of rows and columns. Check that the shape matches the desired matrix; if it does not, then return to the top row and adjust the dimensions. If the matrix is too large to fit the screen, use the arrow keys to scroll right or down to see the remaining rows and columns.
-
Input the matrix entries, press ENTER after each. The cursor scrolls through the matrix by moving across each row from left to right and then down to the next row. Using the arrow keys to move the cursor instead of pressing ENTER may result in a value not being stored in the calculator memory.
-
Press 2 nd QUIT to complete the saving process and return to the home screen.
-
-
Use the rref( function in the calculator to find the reduced row-echelon form of the matrix.
-
From the home screen, press 2 nd MATRIX. Use the right arrow once to go to the MATH menu.
-
Scroll down (or up) to rref(, being careful not to select ref(, and press ENTER.
-
Press 2 nd MATRIX again and use the down arrow (if necessary) to select the name of the matrix and press ENTER.
-
Press ENTER to complete the operation.
-
- If the reduced row-echelon form of the matrix exists, the calculator will display it on the home screen.
Example \(\PageIndex{4}\): Solving Systems of Equations with Matrices Using a Calculator
Solve the system of equations.
\[\begin{align*} 6x+4y+3z&= -6\\ x+2y+z&=\dfrac{1}{3}\\ -12x-10y-7z&= 11 \end{align*}\]
Solution
Write the augmented matrix for the system of equations.
\(\left[ \begin{array}{ccc|c} 6&4&3&-6\\1&2&1&\dfrac{1}{3}\\-12&-10&-7&11\end{array} \right]\)
On the matrix page of the calculator, enter the augmented matrix above as the matrix variable \([A]\).
\([A]=\left[ \begin{array}{ccc|c} 6&4&3&-6\\1&2&1&\dfrac{1}{3}\\-12&-10&-7&11\end{array} \right]\)
Use the rref( function in the calculator, calling up the matrix variable \([A]\).
rref([A])
Use the MATH --> FRAC option in the calculator to express the matrix elements as fractions.
Evaluate
\[\begin{array}{cc} {\left[ \begin{array}{ccc|c} 1&0&0&-\dfrac{2}{3}\\0&1&0&\dfrac{5}{2}\\0&0&1&-4\end{array} \right] \rightarrow} & {\begin{align*} x+0y+0z &= -\dfrac{2}{3} \\ y+0z &= \dfrac{5}{2} \\ z &= -4 \end{align*}} \end{array}\]
Thus the solution, which can easily be read from the right column of the reduced row-echelon form of the matrix, is \(\left(-\dfrac{2}{3},\dfrac{5}{2},−4\right)\).
Exercise \(\PageIndex{3}\)
Solve the system of equations.
\[\begin{align*} 4x-7y+2z&= -5\\ -x+3y-8z&= -10\\ -5x-4y+6z&= 19 \end{align*}\]
- Answer
-
Write the augmented matrix for the system of equations.
\(\left[ \begin{array}{ccc|c} 4&-7&2&-5 \\ -1&3&-8&-10 \\ -5&-4&6&19 \end{array} \right]\)
On the matrix page of the calculator, enter the augmented matrix above as the matrix variable \([A]\).
\([A]=\left[ \begin{array}{ccc|c} 4&-7&2&-5 \\ -1&3&-8&-10 \\ -5&-4&6&19\end{array} \right]\)
Use the rref( function in the calculator, calling up the matrix variable \([A]\).
rref([A])
Use the MATH --> FRAC option in the calculator to express the matrix elements as fractions.
Evaluate
\[\begin{array}{cc} {\left[ \begin{array}{ccc|c} 1&0&0&-2\\0&1&0&0\\0&0&1&\dfrac{3}{2}\end{array} \right] \rightarrow} & {\begin{align*} x+0y+0z &= -2 \\ y+0z &= 0 \\ z &= \dfrac{3}{2} \end{align*}} \end{array}\]
Thus the solution, which can easily be read from the right column of the reduced row-echelon form of the matrix, is \(\left(-2, 0,\dfrac{3}{2}\right)\).
Example \(\PageIndex{5}\): Applying \(2×2\) Matrices to Finance
Carolyn invests a total of \($12,000\) in two municipal bonds, one paying 10.5% interest and the other paying 12% 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 \(x=\) the amount invested at 10.5% interest, and \(y=\) the amount invested at 12% interest.
\[\begin{align*} x+y&= 12,000\\ 0.105x+0.12y&= 1,335 \end{align*}\]
As a matrix, we have
\(\left[ \begin{array}{cc|c} 1&1&12,000\\0.105&0.12&1,335\end{array} \right]\)
Enter this matrix as matrix variable \([A]\). Use the rref( function, calling up the matrix variable \([A]\).
rref([A])
\(\left[ \begin{array}{cc|c} 1&0&7000\\0&1&5000\end{array} \right]\)
Thus, \($7,000\) was invested at 10.5% interest and \($5,000\) at 12% interest.
Example \(\PageIndex{6}\): Applying \(3×3\) Matrices to Finance
Ava invests a total of \($10,000\) in three accounts, one paying 5% interest, another paying 8% interest, and the third paying 9% interest. The annual interest earned on the three investments last year was \($770\). The amount invested at 9% was twice the amount invested at 5%. How much was invested at each rate?
Solution
We have a system of three equations in three variables. Let \(x\) be the amount invested at 5% interest, let \(y\) be the amount invested at 8% interest, and let \(z\) be the amount invested at 9% interest. Thus,
\[\begin{align*} x+y+z &= 10,000 \\ 0.05x+0.08y+0.09z &= 770 \\ 2x−z &= 0 \end{align*}\]
As a matrix, we have
\(\left[ \begin{array}{ccc|c} 1&1&1&10,000\\0.05&0.08&0.09&770\\2&0&-1&0\end{array} \right]\)
Enter this matrix as matrix variable \([A]\). Use the rref( function, calling up the matrix variable \([A]\).
rref([A])
\(\left[ \begin{array}{ccc|c} 1&0&0&3000\\0&1&0&1000\\0&0&1&6000\end{array} \right]\)
The answer is \($3,000\) invested at 5% interest, \($1,000\) invested at 8%, and \($6,000\) invested at 9% interest.
Exercise \(\PageIndex{4}\)
A small shoe company took out a loan of \($1,500,000\) to expand their inventory. Part of the money was borrowed at 7%, part was borrowed at 8%, and part was borrowed at 10%. 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 the amount borrowed at each rate.
- Answer
-
\($150,000\) at 7%, \($750,000\) at 8%, \($600,000\) at 10%
Media
Access these online resources for additional instruction and practice with solving systems of linear equations using Gaussian elimination.
Key Concepts
- An augmented matrix is one that contains the coefficients and constants of a system of equations. See Example \(\PageIndex{1}\).
- A matrix augmented with the constant column can be represented as the original system of equations. See Example \(\PageIndex{2}\).
- We can use Gauss-Jordan elimination to solve a system of equations. See Example \(\PageIndex{4}\).
- Many real-world problems can be solved using augmented matrices. See Example \(\PageIndex{5}\) and Example \(\PageIndex{6}\).
Contributors and Attributions
-
Jay Abramson (Arizona State University) with contributing authors. Textbook content produced by OpenStax College is licensed under a Creative Commons Attribution License 4.0 license. Download for free at https://openstax.org/details/books/precalculus .