Example 1.3.1. Solve a system with equations and matrices side by side.
Let’s redo the work we did last section in our marbles example, this time side by side with the augmented matrix representing the system. Our first step was to write the equations with all the variables on the left side of the equal sign and in alphabetical order, as we did in Equation (1.2.1).
The words explain how we get from the current set of equations (or matrix) to the one on the next line.
\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}
\end{equation*}
\begin{equation*}
\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*}
Replace equation 3 with the sum of equations 1 and 3.
Replace row 3 with the sum of rows 1 and 3.
\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}
\end{equation*}
\begin{equation*}
\left[\begin{array}{cccc} 1\amp 1\amp 1\amp 30\\ 0\amp -2\amp 1\amp 0\\0\amp 2\amp 2\amp 30
\end{array} \right]
\end{equation*}
Multiply equation 2 by \(-\frac12\text{.}\)
Multiply row 2 by \(-\frac{1}{2}\text{.}\)
\begin{equation*}
\begin{array}{ccccccc}
b\amp +\amp g\amp +\amp r\amp =\amp 30\\
\amp \amp g\amp +\amp -1/2r\amp =\amp 0\\
\amp \amp 2g\amp +\amp 2r\amp =\amp 30
\end{array}
\end{equation*}
\begin{equation*}
\left[\begin{array}{cccc} 1\amp 1\amp 1\amp 30\\ 0\amp 1\amp -\frac12\amp 0\\0\amp 2\amp 2\amp 30
\end{array} \right]
\end{equation*}
Replace equation 1 with the sum of \((-1)\) times equation 2 plus equation 1. Replace equation 3 with the sum of \((-2)\) times equation 2 plus equation 3.
Replace row 1 with the sum of \((-1)\) times row 2 plus row 1. Replace row 3 with the sum of \((-2)\) times row 2 plus row 3.
\begin{equation*}
\begin{array}{ccccccc}
b\amp +\amp \amp \amp 3/2r\amp =\amp 30\\
\amp \amp g\amp -\amp 1/2r\amp =\amp 0\\
\amp \amp \amp \amp 3r\amp =\amp 30
\end{array}
\end{equation*}
\begin{equation*}
\left[\begin{array}{cccc} 1\amp 0\amp \frac32\amp 30\\0\amp 1\amp -\frac12\amp 0\\0\amp 0\amp 3\amp 30
\end{array} \right]
\end{equation*}
Multiply equation 3 by \(\frac13\text{.}\)
Multiply row 3 by \(\frac13\text{.}\)
\begin{equation*}
\begin{array}{ccccccc}
b\amp +\amp \amp \amp 3/2r\amp =\amp 30\\
\amp \amp g\amp -\amp 1/2r\amp =\amp 0\\
\amp \amp \amp \amp r\amp =\amp 10
\end{array}
\end{equation*}
\begin{equation*}
\left[\begin{array}{cccc} 1\amp 0\amp \frac32\amp 30\\0\amp 1\amp -\frac12\amp 0\\0\amp 0\amp 1\amp 10
\end{array} \right]
\end{equation*}
Replace equation 2 with the sum of \(\frac12\) times equation 3 plus equation 2. Replace equation 1 with the sum of \(-\frac32\) times equation 3 plus equation 1.
Replace row 2 with the sum of \(\frac12\) times row 3 plus row 2. Replace row 1 with the sum of \(-\frac32\) times row 3 plus row 1.
\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}
\end{equation*}
\begin{equation*}
\left[\begin{array}{cccc} 1\amp 0\amp 0\amp 15\\0\amp 1\amp 0\amp 5\\0\amp 0\amp 1\amp 10
\end{array} \right]
\end{equation*}
The final matrix contains the same solution information as we have on the left. Recall that the first column of our matrices held the coefficients of the \(b\) variable; the second column held the coefficients of the \(g\) variable, and the third column held the coefficients of the \(r\) variable. Therefore, the first row of the matrix can be interpreted as \(b+0g+0r=15,\) or more concisely, \(b=15.\)