Blogs, Linear Algebra

Solving a System of Equations

As we begin our study of linear algebra, we will look at a system of equations. Solving such systems is indeed the major topic of the entire course of linear algebra. Eventually, this may get lost as we continue to abstract our findings, but it is important that to remember that the motivation for looking at all of the topics covered in linear algebra is that we are trying to look at solutions of systems of linear equations.

Example

For our first example, we will find the solution to
\begin{align*}
x_{1}-3x_{3}&=-2 \\
3x_{1}+x_{2}-2x_{3}&=5 \\
2x_{1}+2x_{2}+x_{3}&=4.
\end{align*}

The first step we want to take in solving this is to create the coefficient matrix for the given system. That is, we take the coefficient in front of each of the variables and the constants on the right and make a matrix with them. Here we will get
\[\begin{bmatrix}
1 & 0 & -3 & -2 \\
3 & 1 & -2 & 5 \\
2 & 2 & 1 & 4
\end{bmatrix}\] In the first row, we have that the entry in the second column is 0 because there is no \(x_{2}\) term in the first equation.

Equivalent Matrices

The main reason we write a matrix in this case instead of leaving our original system of equations is really just to make it so that we have less to write. We will keep the variables aligned in columns so that we don’t have to rewrite them each time we make changes. But why do we need to make changes?

Well the goal is to take the original system of equations and find an equivalent system (that is it has the same solution set) that is easier to solve. As an example, the system of equations
\begin{align*}
x &= 1 \\
y &=1,
\end{align*}
is much easier to solve than
\begin{align*}
5x+7y&=12 \\
3x-5y&=-2.
\end{align*}
However, if we can show that they are equivalent systems, then we know they have to have the same solutions. That is, if the corresponding matrix was
\[\begin{bmatrix}
1 & 0 & 1 \\
0 & 1 & 1
\end{bmatrix}\] we would be able to solve faster than if we had the matrix
\[\begin{bmatrix}
5 & 7 & 12 \\
3 & -5 & -2
\end{bmatrix}\] but we would indeed get the same solution.

What can we do to the systems of equations to arrive at an equivalent system? The following are things that won’t change the set of solutions of a system of equations.

  • Multiply an equation by a nonzero constant.
  • Add a constant multiple of one equation to another.
  • Switch two equations.

If we do any of these things to one system, we will then have to create a matrix for the new system. Since the systems of equations are the equivalent, we would say these two matrices are equivalent. However, instead of creating a new system then finding a matrix, it is easier to do the calculations using matrices, then converting back to a system so that we know that have arrived at a system of equations that was equivalent to the original. Now, the things we can do to matrices to arrive at equivalent matrices are exactly what the above changes to the system would do to the matrix. That is, we would have equivalent matrices if we did any of the following.

  • Multiply a row by a nonzero constant.
  • Add a constant multiple of one row to another.
  • Switch two rows.

Note that the only distinction is that the rows are taking the place of the equations.

Reducing

Now that we know the rules for creating equivalent matrices, we can actually practice doing so. We now start with
\[\begin{bmatrix}
1 & 0 & -3 & -2 \\
3 & 1 & -2 & 5 \\
2 & 2 & 1 & 4
\end{bmatrix}\]

Recall that our goal is to convert this matrix into an equivalent matrix that hopefully looks something like
\[\begin{bmatrix}
1 & 0 & 0 & a \\
0 & 1 & 0 & b \\
0 & 0 & 1 & c
\end{bmatrix}\] because this will result in an easier system of equations to solve. We then go through, one step at a time converting the original to look like this.

  1. Note that we first want to have a 1 in the first row first column. In order to do this, we would divide the first row by the entry in the first column. Since the entry is a one, this won’t change anything.
  2. Now that the entry in the first row first column is a one, we want everything else in the first column to be a zero. We will need to steps to do this. For the first, we will take the negative of the entry in the second row, multiply this by the first row, then add this to the second row. We would have
    \[-3R_{1}+R_{2} \to R_{2} \\
    \begin{bmatrix}
    1 & 0 & -3 & -2 \\
    0 & 1 & 7 & 11 \\
    2 & 2 & 1 & 4
    \end{bmatrix}.\]

    Now we still need a zero in the third row first column, so we will multiply the first row by the negative of the entry in the third row and add it to the third row.
    \[-2R_{1}+R_{2} \to R_{2} \\
    \begin{bmatrix}
    1 & 0 & -3 & -2 \\
    0 & 1 & 7 & 11 \\
    0 & 2 & 7 & 8
    \end{bmatrix}.\] We have now simplified the first column.

  3. For the next step, we will need to change the entry in the second row second column into a one. In order to do this, we would divide the second row by the entry in the second column. Since the entry is a one, this won’t change anything.
  4. We now need to get zeroes in the rest of the second column. Since the first row second column is a zero, we won’t have to change anything for this. However, we will need to change the third row second column to a zero. Since the entry in the third row second column is a two, we will multiply negative two by the second row and add it to the third. This will give us
    \[-2R_{2}+R_{3} \to R_{3} \\
    \begin{bmatrix}
    1 & 0 & -3 & -2 \\
    0 & 1 & 7 & 11 \\
    0 & 0 & -7 & -14
    \end{bmatrix}.\]
  5. Next, we need to the third row third column to be a one. We therefore divide the third row by -7 and get
    \[\frac{-1}{7}R_{3} \to R_{3} \\
    \begin{bmatrix}
    1 & 0 & -3 & -2 \\
    0 & 1 & 7 & 11 \\
    0 & 0 & 1 & 2
    \end{bmatrix}.\]
  6. In order to get zeroes in the rest of the third column, we will again multiply the third row by the negative of the entry in the respective row and add to the given row. This gives us
    \[3R_{3}+R_{1} \to R_{1} \\
    \begin{bmatrix}
    1 & 0 & 0 & 4 \\
    0 & 1 & 7 & 11 \\
    0 & 0 & 1 & 2
    \end{bmatrix},\] and
    \[-7R_{3}+R_{2} \to R_{2} \\
    \begin{bmatrix}
    1 & 0 & 0 & 4 \\
    0 & 1 & 0 & -3 \\
    0 & 0 & 1 & 2
    \end{bmatrix}\]
    1. We have now converted our matrix into an equivalent matrix in reduced row echelon form, so we are ready to convert this back to a system of equations and solve.

      Solution

      Converting our matrix back to a system of equations just means to reintroduce the variables. We the multiply the number in the given column by the corresponding variables and add them to get the required system. In this case we have
      \begin{align*}
      x_{1} & =4 \\
      x_{2} &=-3 \\
      x_{3}&=2.
      \end{align*}
      Note that this is an extremely simple system to solve, since it explicitly states what each variable is. Furthermore, since we have solved this system, this is also the solution to the original system of equations. We, therefore, get that \(x_{1}=4\), \(x_{2}=-3\) and \(x_{3}=2\).

      Conclusion

      I hope that this helped you as we begin our journey into linear algebra. You will get to manipulate matrices extensively in this class, so any practice now will be very worthwhile. If this helped and you enjoyed it, please share the post with others that may need help with matrices. Also, make sure to subscribe to our YouTube channel so that you will know when the videos for these posts are ready.

1 thought on “Solving a System of Equations”

We'd love to hear your thoughts!

This site uses Akismet to reduce spam. Learn how your comment data is processed.