Skip to main content

Section 1.2 Matrices and Elimination

We saw that substitution is one way of solving systems of linear equations, but the method of substituion is not very practical when there are more than 2 or 3 varibables. In this section, we start learning a more generalizable and easy-to-automate way of solving systems of linear equations.

Subsection Prepare

Remark 1.2.1.

Mathematicians often see solutions to given problems and ask “What if \(\ldots\text{?}\)” What are the right kinds of “what if” questions to ask? It’s impossible to know at first, and so mathematicians very often ask wrong questions. That is, they often ask questions and find that the answer isn’t particularly interesting. However, asking enough questions often will result in some good right questions. The answers to “right” questions help us see a bigger picture more clearly and usually lead to something applicable beyond the initial problem. The moral of the story is: don’t be afraid of doing something wrong because mathematicians do it all the time!
Recall that in the previous section, we worked through a few examples of solving linear equations using substitution; that is, we solved for one variable in one equation and substituted the resulting expression into another equation. What is a good question to ask after seeing Example 1.1.8? Here are two possibilities (though not the only two):
  1. Did we really have to call the red balls “\(r\)”? Could we call them “\(q\)”?
  2. What if we had \(60\) balls at the start instead of \(30\text{?}\)
Let’s look at the first question. Would the solution to our problem change if we called the red balls \(q\text{?}\) No, we picked the letter “r” because it made us think of “red”, but we could have picked \(x\text{,}\) \(y\text{,}\) or any other letter instead. The process of solving would have been exactly the same if we used “q” for the number of red balls, and at the end we’d find that \(q = 10\text{,}\) and we would know that this meant that we had \(10\) red balls.
Now let’s look at the second question. Suppose we had \(60\) balls, but the other relationships stayed the same. How would the situation and solution change? Let’s compare the original equations to the new equations.
Original New
\(r+b+g=30\) \(r+b+g=60\)
\(r=2g\) \(r=2g\)
\(b=r+g\) \(b=r+g\)
The process of solving would stay exactly the same, substituting \(2g\) for \(r\) in the third equation to get that \(b=2g+g=3g\text{,}\) and then substituting for both \(r\) and \(b\) in the first equation to get that \(2g+3g+g=60\text{.}\) The only difference is that total is \(6g=60\) instead of \(30\text{,}\) so the value of \(g\) is twice as much, and thus also the values of \(r\) and \(b\) are twice what they had been.
Two conclusions from answering these two questions are:
  • it doesn’t matter what we call our variables, and
  • while changing the constants in the equations changes the solution, they don’t really change the method of how we solve these equations.
In fact, it is a great discovery to realize that all that matters about a linear system are the constants and the coefficients of the equations. By systematically handling these, we can solve any set of linear equations in a way that saves on processing power, whether the processing is being done by a human or by a computer.

Activity 1.2.2. Clickable Areas, Coefficients.

Activity 1.2.3. Clickable Areas, Constants.

Method of Elimination (of Variables).

Let’s return to Example 1.1.8. As we mentioned before, there isn’t just one right way of finding the solution to this system of equations. Here is another way to do it.
First, we rewrite the equations so that all variables are on the left of the equal sign and all constants are on the right. Also, for a bit more consistency, let’s list the variables in alphabetical order in each equation. Therefore we can write the equations as
\begin{equation} \begin{array}{ccccccc} b\amp +\amp g\amp +\amp r\amp =\amp 30\\ \amp -\amp 2g\amp +\amp r\amp =\amp 0\\ -b\amp +\amp g\amp +\amp r\amp =\amp 0 \end{array}\tag{1.2.1} \end{equation}
Now, let’s add the first and last equations together, and write the result as a new third equation. This gives us:
\begin{equation*} \begin{array}{ccccccc} b\amp +\amp g\amp +\amp r\amp =\amp 30\\ \amp -\amp 2g\amp +\amp r\amp =\amp 0\\ \amp \amp 2g\amp +\amp 2r\amp =\amp 30 \end{array}\text{.} \end{equation*}
A nice feature of this is that the only equation with a \(b\) in it is the first equation. One could say that we eliminated the \(b\) from the third equation.
Next let’s multiply the second equation by \(-\frac{1}{2}\text{.}\) This gives
\begin{equation*} \begin{array}{ccccccc} b\amp +\amp g\amp +\amp r\amp =\amp 30\\ \amp \amp g\amp -\amp \frac{1}{2}r\amp =\amp 0\\ \amp \amp 2g\amp +\amp 2r\amp =\amp 30 \end{array} \end{equation*}
Activity 1.2.4. Use equations to eliminate variables.
(a)
    Consider the equations
    \begin{equation*} \begin{array}{ccccccc} b\amp +\amp g\amp +\amp r\amp =\amp 30\\ \amp \amp g\amp -\amp \frac{1}{2}r\amp =\amp 0 \end{array} \end{equation*}
    We want to use the second equation to eliminate the variable \(g\) from the first equation. What step should we take?
  • Multiply the second equation by \(1\) and add to the first equation.
  • This would make the first equation \(b+2g+\frac{1}{2}r=30\text{,}\) which didn’t eliminate the \(g\text{.}\)
  • Multiply the second equation by \(-1\) and add to the first equation.
  • This gives \(b+\frac{3}{2}r=30\text{,}\) which eliminates the \(g\text{.}\)
  • Multiply the second equation by \(2\) and add to the first equation.
  • This makes the first equation \(b+3g=30\text{,}\) which eliminates the \(r\) in the first equation, not the \(g\text{.}\)
(b)
    Consider the equations
    \begin{equation*} \begin{array}{ccccccc} \amp \amp g\amp -\amp \frac{1}{2}r\amp =\amp 0\\ \amp \amp 2g\amp +\amp 2r\amp =\amp 30 \end{array} \end{equation*}
    We want to use the top equation to eliminate the variable \(g\) from the bottom equation. What step should we take?
  • Multiply the top equation by \(-1\) and add to the bottom equation.
  • This would make the bottom equation \(g+\frac{5}{2}r=30\text{,}\) which didn’t eliminate the \(g\text{.}\)
  • Multiply the top equation by \(2\) and subtract from the bottom equation.
  • This would eliminate the \(g\text{,}\) but to use this method systematically, we’re always going to want to multiply and add, not subtract. Subtracting \(2g\) is the same as adding \(-2g\) though!
  • Multiply the top equation by \(-2\) and add to the bottom equation.
  • This makes the bottom equation \(3r=30\text{,}\) which eliminates the \(g\) from the bottom equation.
Let’s now do both of those steps in a row to eliminate the \(g\) from the first and third equations; multiply the second equation by \(-1\) and add that to the first equation, replacing the first equation with that sum, and multiply the second equation by \(-2\) and add that to the third equation, replacing the third equation. Our new system of equations now becomes
\begin{equation*} \begin{array}{ccccccc} b\amp +\amp \amp \amp \frac{3}{2}r\amp =\amp 30\\ \amp \amp g\amp -\amp \frac{1}{2}r\amp =\amp 0\\ \amp \amp \amp \amp 3r\amp =\amp 30 \end{array} \end{equation*}
We can now multiply the third equation by \(\frac{1}{3}\) and find that \(r=10\text{;}\) let’s make this our new third equation, giving
\begin{equation*} \begin{array}{ccccccc} b\amp +\amp \amp \amp \frac{3}{2}r\amp =\amp 30\\ \amp \amp g\amp -\amp \frac{1}{2}r\amp =\amp 0\\ \amp \amp \amp \amp r\amp =\amp 10 \end{array} \end{equation*}
Now let’s eliminate the \(r\)’s in the first and second equation. To remove the \(r\) in the first equation, let’s multiply the third equation by \(-\frac{3}{2}\) and add the result to the first equation, replacing the first equation with that sum. To remove the \(r\) in the second equation, we can multiply the third equation by \(\frac{1}{2}\) and add that to the second equation, replacing the second equation with that sum. This gives us:
\begin{equation*} \begin{array}{ccccccc} b\amp \amp \amp \amp \amp =\amp 15\\ \amp \amp g\amp \amp \amp =\amp 5\\ \amp \amp \amp \amp r\amp =\amp 10 \end{array}\text{.} \end{equation*}
We have arrived at the same result as when we solved this problem in Example 1.1.8, even though our steps were different.
Why did we need to learn another method (elimination) when our old method (substitution) worked and got the same answer?
Everyone thinks of a different way to solve a system using substitution — Mary might choose a different variable to solve for than John chose, and Alicia might start with a different equation, and Steven might substitute into a different equation. When there are more than 2 or 3 variables, substituting gets really laborious, and it’s not always clear what steps should come next in order to make progress in solving. Elimination can be made into an algorithm, a set of steps to follow in a particular order that will always result in an answer.
 1 
Even if sometimes the answer is that there is no solution, or that there are infinitely many solutions.
This is both comforting and practical; if you have to work a problem by hand, it’s nice to know you’ll be able to complete it as long as you remember the steps, and if you don’t have to work the problem by hand, an algorithm means it’s possible to program a computer to do the steps for you.

Activity 1.2.5. Parsons Problem, Elimination vs Substitution.

Solve the linear system
\begin{align*} -3x + 2y\amp = 3\\ 6x + 3y\amp = 8 \end{align*}
using the method of elimination.

Matrices.

We noticed earlier that there is nothing special about the letters \(b\text{,}\) \(g\) and \(r\text{;}\) we could have used \(x\text{,}\) \(y\) and \(z\text{,}\) or \(x_1\text{,}\) \(x_2\) and \(x_3\text{.}\) Our work demonstrating the method of elimination suggests that we don’t actually need to write the variable names at all, as long as we carefully line them up in the system of equations so that we can keep track of what’s being eliminated.
Let’s look again at our system of equations in (1.2.1) and write the coefficients and the constants in a rectangular array. If any variables are missing from any equations, we write that the coefficient is \(0\text{.}\)
\begin{equation*} \begin{array}{ccccccc} b\amp +\amp g\amp +\amp r\amp =\amp 30\\ \amp -\amp 2g\amp +\amp r\amp =\amp 0\\ -b\amp +\amp g\amp +\amp r\amp =\amp 0 \end{array} \quad \Longleftrightarrow \quad \left[\begin{array}{cccc} 1\amp 1\amp 1\amp 30\\ 0\amp -2\amp 1\amp 0\\ -1\amp 1\amp 1\amp 0 \end{array} \right] \end{equation*}
Notice how even the equal signs are gone; we don’t need them, for we know that the last entry in each row is the constant of the corresponding equation.
We call this array we have just created a matrix.
Definition 1.2.6. Matrix.
A matrix is a rectangular array of numbers.
The horizontal lines of numbers form rows and the vertical lines of numbers form columns. A matrix with \(m\) rows and \(n\) columns is said to be an \(m\times n\) matrix (said out loud as “an \(m\) by \(n\) matrix”).
If a matrix corresponds to a linear system of equations such that the last column corresponds to the constants of the system, we call the matrix an augmented matrix.
We tend to use capital letters for matrices (the plural of matrix), such as \(A\text{,}\) \(B\text{,}\) and \(C\text{,}\) and we use lowercase letters with subscripts for the entries within a matrix. That is, \(a_{32}\) means “the number in the third row and second column” of matrix \(A\text{.}\)
All the entries of an \(m\times n\) matrix \(A\) would appear like this:
\begin{equation*} A=\begin{bmatrix} a_{11}\amp a_{12}\amp a_{13}\amp \cdots\amp a_{1n}\\ a_{21}\amp a_{22}\amp a_{23}\amp \cdots\amp a_{2n}\\ a_{31}\amp a_{32}\amp a_{33}\amp \cdots\amp a_{3n}\\ \vdots\amp \vdots\amp \vdots\amp \ddots\amp \vdots\\ a_{m1}\amp a_{m2}\amp a_{m3}\amp \cdots\amp a_{mn} \end{bmatrix} \end{equation*}
Since matrices contain all the important information from a linear system, we are working our way up to solving systems using only augmented matrices. Using matrices saves us from having to write out the variables over and over again, and matrices are also easy for a computer to understand and manipulate. Matrices are important objects in their own right, and in future sections, we will be able to compute with matrices even when we don’t think of them as corresponding to a system of linear equations.

Reading Questions Reading Questions

1. How a matrix is indexed.
In the matrix
\begin{equation*} A=\begin{bmatrix} 2 \amp -1 \amp 3 \amp 5 \\ 0 \amp 3\amp 6\amp -3 \\ 4 \amp -2 \amp 7 \amp 5 \end{bmatrix} \end{equation*}
what is \(a_{23}\text{?}\)
2. Elimination vs. substitution.
Consider the method of substitution used in Section 1.1 and the method of elimination described in this section.
  1. State at least one thing the two methods have in common.
  2. State at least one thing that’s different between the two methods.
3. Reflection.
Enter a response to both of the following tasks:
  1. Ask a question about the material, either about something you’re not sure you fully understand, or a “what if” question.
  2. Give a percentage from 0 to 100 that reflects how confident you are with the material you just read about, and give one sentence as to why you feel that way. 0 means you didn’t actually do the reading and 100 means that everything makes sense so far and you think you are completely ready to engage with the material more deeply.

Worksheet Participate

Elimination.

Solve the linear systems below using the method of elimination.
1.
\begin{align*} 2x_1 + 4x_2 \amp = -6\\ 5x_1 - 5x_2 \amp = 15 \end{align*}
2.
\begin{align*} x_1 + x_2 - x_3 \amp = 1 \\ x_1+ 2x_2 -x_3 \amp = 2\\ x_2+ x_3 \amp = 3 \\ x_2 - x_4\amp = 4 \end{align*}

Parts of a Matrix.

For the matrix \(B=\left[\begin{array}{cccc} 1\amp 1\amp -1\amp 2\\ 2\amp 1\amp 5\amp 7\\ 0\amp -5\amp -3\amp \frac{1}{2}\\ \end{array} \right]\text{,}\) identify the
3.
entry \(b_{32}\text{.}\)
4.
third column.
5.
second row.

6.

If \(A\) is a \(3\times 5\) matrix, how many columns does \(A\) have?

7.

Using variables \(x_1, x_2, \ldots \text{,}\) write the linear system corresponding to the above matrix \(B\text{.}\)

8.

Give the augmented matrix corresponding to the linear system in 2.

9.

Create your own augmented matrix, of any size you choose.

10.

Create your own linear system, with however many variables and equations you choose.

Summary.

  • The method of elimination is a way of solving systems of linear equations that can be made systematic and algorithmic.
  • Matrices are arrays of numbers. Right now, we are most interested in augmented matrices, whose entries correspond to the coefficients and constants of a system of linear equations.
  • Elimination works better than substitution when there are more than 2 or 3 variables, and it is the foundation of future sections of material.

Subsection Practice

Exercise 1.2.1. Two variable elimination.

Use the method of elimination to solve the linear system:
\begin{equation*} \begin{aligned} {3}x+{6}y \amp = {-24}\\ {4}x-{5}y \amp = {33} \end{aligned} \end{equation*}
The solution is \(x=\) and \(y=\).

Exercise 1.2.2. Three variable elimination.

Use the method of elimination to solve the linear system:
\begin{equation*} \begin{aligned} {-3x_{1}-2x_{2}-6x_{3}} \amp = {-48}\\ {-x_{2}-7x_{3}} \amp = {-24}\\ {-2x_{1}-7x_{2}+2x_{3}} \amp = {-31} \end{aligned} \end{equation*}
The solution is \(x_1=\), \(x_2=\) and \(x_3=\).

Exercise 1.2.3. Augmented matrix from 2-variable system.

Write the augmented matrix of the system
\begin{equation*} \begin{aligned} 8x_1+ 4x_2\amp = 25\\ 18x_1- 4x_2\amp = 12\\ -17x_1+ 19x_2\amp = -23 \end{aligned} \end{equation*}

Exercise 1.2.4. Augmented matrix from 3-variable system.

Write the augmented matrix of the system
\begin{equation*} \begin{aligned} {9x+96y+3z} \amp = 37\\ {57y-3z} \amp = -6\\ {-73x+62z} \amp = -47 \end{aligned} \end{equation*}

Exercise 1.2.5. About matrices and augmented matrices.

  1. Consider the matrix.
    \begin{equation*} A= \begin{bmatrix} -4 \amp 1 \amp 8 \amp {4} \amp {8} \\ -9 \amp -7 \amp 2 \amp {-6} \amp {-8}\\ -3 \amp 3 \amp -2 \amp 7 \amp 6 \end{bmatrix} \end{equation*}
    Which of the following correctly describes the matrix above?
    • The matrix is \(3\times 5\text{,}\) with 3 rows and 5 columns.
    • The matrix is \(5\times 3\text{,}\) with 5 rows and 3 columns.
    • The matrix is \(5\times 3\text{,}\) with 5 columns and 3 rows.
    • The matrix is \(3\times 5\text{,}\) with 3 columns and 5 rows.
  2. Now consider an \({3} \times {9}\) matrix \(B\text{.}\) If \(B\) is an augmented matrix, the corresponding linear system has how many variables?

Exercise 1.2.6. Linear system from augmented matrix.

Convert the augmented matrix below to the associated linear system.
\begin{equation*} \begin{bmatrix} -7 \amp 5 \amp -3 \amp {-30} \\ -3 \amp 8 \amp -5 \amp {-23} \\ -6 \amp 0 \amp 1 \amp {-20} \end{bmatrix} \end{equation*}
Use \(x\text{,}\) \(y\text{,}\) and \(z\) for the variables.
The associated linear system is:
Expression containing the variables \(=\) Constants
\(=\)
\(=\)
\(=\)

Exercises Additional Practice

Method of Elimination.

In the following exercises, solve the systems of linear equations using the method of elimination.
1.
\begin{align*} x + y - z \amp = 1 \\ 2x + y \amp = 2\\ y + 2z\amp = 0 \end{align*}
Answer.
\(x =1,\ y=0,\ z=0\)
2.
\begin{align*} x - y + z\amp = 1\\ 4x - 5y + 2z\amp = 0 \\ 2x + 6y - z\amp = -4 \end{align*}
Answer.
\(x = -1, y=0,z=2\)

Linear System to Augmented Matrix.

In the following exercises, convert the given system of linear equations into an augmented matrix.
3.
\begin{equation*} \begin{array}{ccccccc} 3x\amp +\amp 4y\amp +\amp 5z\amp =\amp 7\\ -x\amp +\amp y\amp -\amp 3z\amp =\amp 1\\ 2x\amp -\amp 2y\amp +\amp 3z\amp =\amp 5 \end{array} \end{equation*}
Answer.
\begin{equation*} \left[\begin{array}{cccc} 3\amp 4\amp 5\amp 7\\-1\amp 1\amp -3\amp 1\\2\amp -2\amp 3\amp 5\\ \end{array} \right] \end{equation*}
4.
\begin{equation*} \begin{array}{ccccccc} 2x\amp +\amp 5y\amp -\amp 6z\amp =\amp 2\\ 9x\amp \amp \amp -\amp 8z\amp =\amp 10\\ -2x\amp +\amp 4y\amp +\amp z\amp =\amp -7 \end{array} \end{equation*}
Answer.
\begin{equation*} \left[\begin{array}{cccc} 2\amp 5\amp -6\amp 2\\9\amp 0\amp -8\amp 10\\-2\amp 4\amp 1\amp -7\\ \end{array} \right] \end{equation*}
5.
\begin{align*} x_1 +3x_2-4x_3 + 5x_4 \amp = 17 \\ -x_1+4x_3+8x_4 \amp = 1\\ 2x_1+3x_2+4x_3+5x_4\amp = 6 \end{align*}
Answer.
\(\left[\begin{array}{ccccc} 1\amp 3\amp -4\amp 5\amp 17\\-1\amp 0\amp 4\amp 8\amp 1\\ 2\amp 3\amp 4\amp 5\amp 6 \end{array} \right]\)
6.
\begin{align*} 3x_1 -2x_2\amp = 4 \\ 2x_1 \amp = 3\\ -x_1+9x_2\amp = 8\\ 5x_1-7x_2\amp = 13 \end{align*}
Answer.
\begin{equation*} \left[\begin{array}{ccc} 3\amp -2\amp 4\\ 2\amp 0\amp 3\\-1\amp 9\amp 8\\5\amp -7\amp 13\\ \end{array} \right] \end{equation*}

Augmented Matrix to Linear System.

In the following exercises, convert the given augmented matrix into a system of linear equations. Use the variables \(x_1\text{,}\) \(x_2\text{,}\) etc.
7.
\(\left[\begin{array}{ccc} 1\amp 2\amp 3\\ -1\amp 3\amp 9\\ \end{array} \right]\)
Answer.
\(\begin{array}{rl} x_1+2x_2=\amp 3\\ -x_1+3x_2=\amp 9 \end{array}\)
8.
\(\left[\begin{array}{ccc} -3\amp 4\amp 7\\ 0\amp 1\amp -2\\ \end{array} \right]\)
Answer.
\(\begin{array}{rl} -3x_1+4x_2=\amp 7\\ x_2=\amp -2 \end{array}\)
9.
\(\left[\begin{array}{ccccc} 1\amp 1\amp -1\amp -1\amp 2\\ 2\amp 1\amp 3\amp 5\amp 7\\ \end{array} \right]\)
Answer.
\(\begin{array}{rl} x_1+x_2-x_3-x_4=\amp 2\\ 2x_1+x_2+3x_3+5x_4=\amp 7 \end{array}\)
10.
\(\left[\begin{array}{ccccc} 1\amp 0\amp 0\amp 0\amp 2\\ 0\amp 1\amp 0\amp 0\amp -1\\ 0\amp 0\amp 1\amp 0\amp 5\\ 0\amp 0\amp 0\amp 1\amp 3 \end{array} \right]\)
Answer.
\(\begin{array}{rl} x_1=\amp 2\\ x_2=\amp -1\\ x_3=\amp 5\\ x_4=\amp 3 \end{array}\)
11.
\(\left[\begin{array}{cccccc} 1\amp 0\amp 1\amp 0\amp 7\amp 2\\ 0\amp 1\amp 3\amp 2\amp 0\amp 5\\ \end{array} \right]\)
Answer.
\(\begin{array}{rl} x_1+x_3+7x_5=\amp 2\\ x_2+3x_3+2x_4=\amp 5 \end{array}\)