Subsection Linear systems of equations
One application of matrices is to solve systems of linear equations. Consider the following system of linear equations
\begin{align}
2 x_1 + 2 x_2 + 2 x_3 \amp = 2 \notag\\
\phantom{9} x_1 + \phantom{9} x_2 + 3 x_3 \amp = 5 \tag{3.3.1}\\
\phantom{9} x_1 + 4 x_2 + \phantom{9} x_3 \amp = 10 \text{.}\notag
\end{align}
There is a systematic procedure called
elimination to solve such a system. In this procedure, we attempt to eliminate each variable from all but one equation. We want to end up with equations such as
\(x_3 = 2\text{,}\) where we can just read off the answer.
We write a system of linear equations as a matrix equation:
\begin{equation*}
A \vec{x} = \vec{b} .
\end{equation*}
\begin{equation*}
\underbrace{
\begin{bmatrix}
2 & 2 & 2 \\
1 & 1 & 3 \\
1 & 4 & 1
\end{bmatrix}
}_{A}
\underbrace{
\begin{bmatrix}
x_1 \\
x_2 \\
x_3
\end{bmatrix}
}_{\vec{x}}
=
\underbrace{
\begin{bmatrix}
2 \\
5 \\
10
\end{bmatrix}
}_{\vec{b}} .
\end{equation*}
If we knew the inverse of \(A\text{,}\) then we would be done; we would simply solve the equation:
\begin{equation*}
\vec{x} = A^{-1} A \vec{x} = A^{-1} \vec{b} .
\end{equation*}
Well, but that is part of the problem, we do not know how to compute the inverse for matrices bigger than \(2 \times 2\text{.}\) We will see later that to compute the inverse we are really solving \(A \vec{x} = \vec{b}\) for several different \(\vec{b}\text{.}\) In other words, we will need to do elimination to find \(A^{-1}\text{.}\) In addition, we may wish to solve \(A \vec{x} = \vec{b}\) even if \(A\) is not invertible, or perhaps not even square.
Let us return to the equations themselves and see how we can manipulate them. There are a few operations we can perform on the equations that do not change the solution. First, perhaps an operation that may seem stupid, we can swap two equations in
(3.3.1):
\begin{align*}
\phantom{9} x_1 + \phantom{9} x_2 + 3 x_3 \amp = 5 \\
2 x_1 + 2 x_2 + 2 x_3 \amp = 2 \\
\phantom{9} x_1 + 4 x_2 + \phantom{9} x_3 \amp = 10\text{.}
\end{align*}
Clearly these new equations have the same solutions
\(x_1,x_2,x_3\text{.}\) A second operation is that we can multiply an equation by a nonzero number. For example, we multiply the third equation in
(3.3.1) by 3:
\begin{align*}
2 x_1 + \phantom{9} 2 x_2 + 2 x_3 \amp = 2 \\
\phantom{9} x_1 + \phantom{99} x_2 + 3 x_3 \amp = 5 \\
3 x_1 + 12 x_2 + 3 x_3 \amp = 30\text{.}
\end{align*}
Finally we can add a multiple of one equation to another equation. For example, we add 3 times the third equation in
(3.3.1) to the second equation:
\begin{align*}
\phantom{(1+3)} 2 x_1 + \phantom{(1+12)} 2 x_2 + \phantom{(3+3)} 2 x_3 \amp = 2 \\
\phantom{2} (1+3) x_1 + \phantom{2}(1+12) x_2 + \phantom{2} (3+3) x_3 \amp = 5+30 \\
\phantom{2 (1+3)} x_1 + \phantom{(1+12)} 4 x_2 + \phantom{(3+3) 2} x_3 \amp = 10\text{.}
\end{align*}
The same \(x_1,x_2,x_3\) should still be solutions to the new equations. These were just examples; we did not get any closer to the solution. We must to do these three operations in some more logical manner, but it turns out these three operations suffice to solve every linear equation.
The first thing is to write the equations in a more compact manner. Given
\begin{equation*}
A \vec{x} = \vec{b} ,
\end{equation*}
we write down the so-called augmented matrix
\begin{equation*}
[ A ~|~ \vec{b} ] ,
\end{equation*}
where the vertical line is just a marker for us to know where the βright-hand sideβ of the equation starts. For example, for the system
(3.3.1) the augmented matrix is
\begin{equation*}
\left[
\begin{array}{ccc|c}
2 & 2 & 2 & 2 \\
1 & 1 & 3 & 5 \\
1 & 4 & 1 & 10
\end{array}
\right] .
\end{equation*}
The entire process of elimination, which we will describe, is often applied to any sort of matrix, not just an augmented matrix. Simply think of the matrix as the \(3 \times 4\) matrix
\begin{equation*}
\begin{bmatrix}
2 & 2 & 2 & 2 \\
1 & 1 & 3 & 5 \\
1 & 4 & 1 & 10
\end{bmatrix} .
\end{equation*}
Subsection Row echelon form and elementary operations
Definition 3.3.1. Elementary Row operations.
The elementary row operations on a matrix are:
-
-
Multiply a row by a nonzero number.
-
Add a multiple of one row to another row.
Example 3.3.2.
Example 3.3.3. .
Subsection Non-unique solutions and inconsistent systems
It is possible that the solution of a linear system of equations is not unique, or that no solution exists. Suppose for a moment that the row echelon form we found was
\begin{equation*}
\left[
\begin{array}{ccc|c}
1 & 2 & 3 & 4 \\
0 & 0 & 1 & 3 \\
0 & 0 & 0 & 1
\end{array}
\right] .
\end{equation*}
Then the last row gives the equation \(0x_1 + 0x_2 + 0x_3 = 1\text{,}\) or \(0=1\text{.}\) That is impossible and the equations are inconsistent. There is no solution to \(A \vec{x} = \vec{b}\text{.}\)
On the other hand, if we find a row echelon form of
\begin{equation*}
\left[
\begin{array}{ccc|c}
1 & 2 & 3 & 4 \\
0 & 0 & 1 & 3 \\
0 & 0 & 0 & 0
\end{array}
\right] ,
\end{equation*}
then there is no issue with finding solutions. In fact, we will find way too many. Let us continue with backsubstitution (subtracting 3 times the second row from the first) to find the reduced row echelon form and letβs mark the pivots.
\begin{equation*}
\left[
\begin{array}{ccc|c}
\mybxsm{1} & 2 & 0 & -5 \\
0 & 0 & \mybxsm{1} & 3 \\
0 & 0 & 0 & 0
\end{array}
\right]
\end{equation*}
The last row is all zeros; it just says \(0=0\) and we ignore it. The two remaining equations are
\begin{equation*}
x_1 + 2 x_2 = -5 , \qquad
x_3 = 3 .
\end{equation*}
Let us solve for the variables that corresponded to the pivots, that is \(x_1\) and \(x_3\) as there was a pivot in the first column and in the third column:
\begin{align*}
\amp x_1 = - 2 x_2 -5 , \\
\amp x_3 = 3\text{.}
\end{align*}
The variable \(x_2\) can be anything you wish and we still get a solution. The \(x_2\) is called a free variable. There are infinitely many solutions, one for every choice of \(x_2\text{.}\) For example, if we pick \(x_2=0\text{,}\) then \(x_1 = -5\text{,}\) and \(x_3 = 3\) give a solution. But we also get a solution by picking say \(x_2 = 1\text{,}\) in which case \(x_1 = -7\) and \(x_3 = 3\text{,}\) or by picking \(x_2 = -5\) in which case \(x_1 = 5\) and \(x_3 = 3\text{.}\)
The general idea is that if any row has all zeros in the columns corresponding to the variables, but a nonzero entry in the column corresponding to the right-hand side
\(\vec{b}\text{,}\) then the system is inconsistent and has no solutions. In other words, the system is inconsistent if you find a pivot on the right side of the vertical line drawn in the augmented matrix. Otherwise, the system is consistent, and at least one solution exists.
If the system is consistent:
-
If every column corresponding to a variable has a pivot element, then the solution is unique.
-
If there are columns corresponding to variables with no pivot, then those are
free variables that can be chosen arbitrarily, and there are infinitely many solutions.
Another way to interpret this idea of free variables is that at the beginning, before you look at the system of equations, all of the variables can be anything, and there are no constraints on them. The equations then give us constraints on these variables, because they give us rules that the variables must satisfy. When we have a row of the augmented matrix that becomes all zeros, it means that the equation that was there is redundant and doesnβt add any constraints to the equations. This may result in an
underdetermined system, which will likely have free variables.
Example 3.3.4. .
Solve the following two systems of equations, or determine that no solution exists, using row reduction:
\begin{align*}
x_1 - \phantom{9} x_2 - 3x_3 \amp = -3 \\
-x_1 - 2x_2 + 4x_3 \amp= 6 \\
x_1 + 5x_2 - 5x_3 \amp= -9\text{.}
\end{align*}
\begin{align*}
x_1 - \phantom{9} x_2 - 3x_3 \amp = -3 \\
-x_1 - 2x_2 + 4x_3 \amp= 6 \\
x_1 + 5x_2 - 5x_3 \amp= 1\text{.}
\end{align*}
Solution.
For the first of these systems, we will set up the augmented matrix and proceed through the process like normal. The augmented matrix is
\begin{equation*}
\left[
\begin{array}{ccc|c}
1 & -1 & -3 & -3 \\
-1 & -2 & 4 & 6 \\
1 & 5 & -5 & -9
\end{array}
\right].
\end{equation*}
Since we already have a \(1\) in the top-left corner of this matrix, we can use it to cancel the entries in the rest of column \(1\text{.}\) We add one copy of row 1 to row 2, and subtract row 1 from row 3 to get the next augmented form matrix as
\begin{equation*}
\left[
\begin{array}{ccc|c}
1 & -1 & -3 & -3 \\
0 & -3 & 1 & 3 \\
0 & 6 & -2 & -6
\end{array}
\right].
\end{equation*}
Looking at the matrix here, we see that row 3 is \(-2\) times row 2. Therefore, if we add two copies of row 2 to row 3, we get the augmented matrix
\begin{equation*}
\left[
\begin{array}{ccc|c}
1 & -1 & -3 & -3 \\
0 & -3 & 1 & 3 \\
0 & 0 & 0 & 0
\end{array}
\right].
\end{equation*}
Therefore, we have a situation where there are only two pivot columns, and the last row is all zeros. Since there are three variables and column 3 is not a pivot column, we can take \(x_3\) as a free variable. If we do that, the second equation tells us that \(-3x_2 + x_3 = 3\text{,}\) or, since we are taking \(x_3\) as a free variable, we can write \(x_2 = -1 + \nicefrac{1}{3}x_3\text{.}\) We can then take the first equation, which says that \(x_1 - x_2 - 3x_3 = -3\) or, by rearranging
\begin{equation*}
x_1 = -3 + x_2 + 3x_3 = -3 + \left(-1 + \frac{1}{3}x_3\right) + 3x_3 = -4 + \frac{10}{3}x_3.
\end{equation*}
This means that for any value of \(t\text{,}\) our solution is determined by
\begin{align*}
x_1 \amp= -4 + \frac{10}{3}t \\
x_2 \amp= -1 + \frac{1}{3}t \\
x_3 \amp= t \text{.}
\end{align*}
The use of \(t\) here is just to separate it from the variable \(x_3\text{.}\) For example, we could pick \(t=3\text{,}\) in which case we would get \(x_1 = 6\text{,}\) \(x_2 = 0\text{,}\) \(x_3 = 3\text{.}\)
For the second version of the problem, we again set up the augmented matrix
\begin{equation*}
\left[
\begin{array}{ccc|c}
1 & -1 & -3 & -3 \\
-1 & -2 & 4 & 6 \\
1 & 5 & -5 & 1
\end{array}
\right].
\end{equation*}
Since the left side matrix part is the same as the previous version, the process of row reducing the matrix is identical to what was done previously. When we carry out this process we get the augmented matrix
\begin{equation*}
\left[
\begin{array}{ccc|c}
1 & -1 & -3 & -3 \\
0 & -3 & 1 & 3 \\
0 & 0 & 0 & 10
\end{array}
\right].
\end{equation*}
In this case, we see that the last row corresponds to the equation \(0 = 10\) so these equations are inconsistent and do not have a solution.
The point of the above example is to illustrate the fact that whether or not a system is inconsistent or has free variables in the solution depends on the right-hand side of the equation, even if the left-hand side has the same coefficients. Weβll see more about why this is in
SectionΒ 3.4.
When \(\vec{b} = \vec{0}\text{,}\) we have a so-called homogeneous matrix equation
\begin{equation*}
A \vec{x} = \vec{0} .
\end{equation*}
There is no need to write an augmented matrix in this case. As the elementary operations do not do anything to a zero column, it always stays a zero column. Moreover, \(A \vec{x} = \vec{0}\) always has at least one solution, namely \(\vec{x} = \vec{0}\text{.}\) Such a system is always consistent. It may have other solutions: If you find any free variables, then you get infinitely many solutions. As mentioned in the last section, this is directly connected to linear independence of the columns of \(A\text{.}\) If there are other solutions, then there are other linear combinations that give \(\vec{0}\text{,}\) and so the columns of \(A\) are linearly dependent. Otherwise, if there are no such solutions outside of \(\vec{x} = \vec{0}\text{,}\) then the columns of \(A\) are linearly independent.
How would we determine this fact? We donβt need to include the zero column on the far right, but we can apply the same operations to the matrix
\(A\) alone. In this case, we either get a pivot column in every column for the row echelon form, in which case the only solution is
\(\vec{x} = \vec{0}\text{,}\) or we get at least one non-pivot column, which means that there are free variables, implying that non-zero solutions exist. This leads to a first equivalence statement we can make about the solution to homogeneous matrix equations.
Theorem 3.3.5.
Let \(A\) be a matrix. The following statements are equivalent (meaning if any one of them is true, so are all of the other ones):
-
The only solution to the matrix equation
\(A\vec{x} = \vec{0}\) is
\(\vec{x} = \vec{0}\text{.}\)
-
The row echelon form of
\(A\) has a pivot element in every column.
-
The reduced row echelon form of
\(A\) is an identity matrix, potentially with rows of zero on the bottom.
-
The columns of
\(A\) are linearly independent.
The set of solutions of
\(A \vec{x} = \vec{0}\) comes up quite often so people give it a name. It is called the
null space or the
kernel of
\(A\text{.}\) One place where the kernel comes up is invertibility of a square matrix
\(A\text{.}\) If the kernel of
\(A\) contains a nonzero vector, then it contains infinitely many vectors (there was a free variable). But then it is impossible to invert
\(\vec{0}\text{,}\) since infinitely many vectors go to
\(\vec{0}\text{,}\) so there is no unique vector that
\(A\) takes to
\(\vec{0}\text{.}\) So if the kernel is nontrivial, that is, if there are any nonzero vectors, in other words, if there are any free variables, or in yet other words, if the row echelon form of
\(A\) has columns without pivots, then
\(A\) is not invertible. We will return to this idea later.