Skip to main content

Applied Mathematics

Section 1.2 Elementary Row Operations

We now seek a method to solve the above linear systems (and any linear system). Gauss’ method and variations of it are the standard ways that all large linear systems are solved presently. The next section shows how to systematically solve a linear system using rules of algebra that keep linear equations linear.
Consider the following example of two linear equations:
\begin{align} x+2y+3z \amp =6 \tag{1.2.1}\\ -2x+3y-z \amp =4 \tag{1.2.2} \end{align}
We seek to find operations on these equations that keep these equations linear and don’t change the solution. First, the order that we wrote them down doesn’t matter and we could swap these equations as in:
\begin{align*} -2x+3y-z \amp =4 \\ x+2y+3z \amp =6 \end{align*}
The second possible operation is to multiply a single equation by a constant. For example, if we multiply the first equation of (1.2.1) by 2, we get the system:
\begin{align*} 2x+4y+6z \amp =12 \\ -2x+3y-z \amp =4 \end{align*}
The third operation is that we can add two equations and the replace one of the equations with the sum. For example adding (1.2.1) and (1.2.2) and putting the sum in the 2nd row results in
\begin{align*} x+2y+3z \amp =6 \\ -x+5y+2z \amp =10 \end{align*}
A more common operation is to combine the last two operations and that is to multiply an equation by a constant and add to another. If we multiply (1.2.1) by 2 and add to (1.2.2) we get the system:
\begin{align*} x+2y+3z \amp =6 \\ 7y + 5z \amp = 16 \end{align*}

Definition 1.2.1. Elementary Row Operations.

The three operations
  1. Two equations of the linear system are swapped,
  2. An equation is multiplied by a nonzero number,
  3. An equation is replaced by the sum of itself and a multiple of another equation,
are called the elementary row operations of a linear system.

Subsection 1.2.1 Gauss’s Method

The following example shows how to use the elementary row operations seen above to solve a linear system with a technique called Gauss’s Method.
\begin{align*} x -2y + 3z \amp = 6, \\ 2x + 2y\phantom{+3z} \amp = 6, \\ -3x \phantom{+2y}+\phantom{3} z \amp = 0. \end{align*}
If one equation had only one variable, it would be quite easy to find the solution to that equation. The following steps will result in such a system. For example, if the first equation is multiplied by \(-2\) and added to the second equation and the second equation is replaced (which we denote with \(-2R_1+R_2 \rightarrow R_2\)), then the above equations are replaced with
\begin{align*} \amp \amp x -2y + 3z \amp = 6, \\ -2R_1+R_2 \rightarrow R_2\qquad\amp \amp 6 y-6z \amp = -6, \\ \amp \amp -3x \phantom{+2y}+\phantom{3} z \amp = 0. \end{align*}
Next, we’d like to get rid of the \(x\) term in the 3rd equation. We can do that by multiplying the first equation by 3 and adding to the 3rd and writing down this operation as well we get:
\begin{align*} \amp \amp x -2y + \phantom{1}3z \amp = 6, \\ 3R_1+R_3 \rightarrow R_3\quad \amp \amp 6 y-\phantom{1}6z \amp = -6, \\ \amp \amp -6y+10z \amp = 18. \end{align*}
Next we will eliminate the \(y\) term in the 3rd equation. We can do that by adding equations 2 and 3 and putting the result in equation 3.
\begin{align} \amp \amp x -2y + 3z \amp = 6, \notag\\ R_2+R_3 \rightarrow R_3\quad \amp \amp 6 y-6z \amp = -6 \tag{1.2.3}\\ \amp \amp 4z \amp = 12.\notag \end{align}
At this point we can solve for \(z\) in the third equation of (1.2.3) to get \(z=3\text{.}\) From this, plug in \(z=3\) into the second equation of (1.2.3) to get
\begin{align*} 6y -6(3) \amp = -6 \\ 6y \amp = 12 \\ y \amp = 2 \end{align*}
and finally we can use \(z=3\) and \(y=2\) to substitute into the first equation of (1.2.3) to get
\begin{align*} x-2(2)+3(3)\amp = 6 \\ x-4+9\amp = 6 \\ x \amp = 1 \end{align*}
therefore, \(x=1\text{.}\) The point \((1,2,3)\) is a solution to linear system. Because this is the only point that satisfies all equations, this point is unique. We will also use the terminology triple to describe \((1,2,3)\text{.}\)

Proof.

We will consider only the first operation in this proof. Let’s assume that we swap equations \(i\) and \(j\text{,}\) thus system (\(A\)),
\begin{align*} a_{1,1} x_1 + a_{1,2} x_2 + \cdots + a_{1,n} x_n \amp = b_1 , \\ a_{2,1} x_1 + a_{2,2} x_2 + \cdots + a_{2,n} x_n \amp = b_2, \\ \vdots \qquad \qquad \amp \vdots \\ a_{i,1} x_1 + a_{i,2} x_2 + \cdots + a_{i,n} x_n \amp = b_i, \\ \vdots \qquad \qquad \amp \vdots \\ a_{j,1} x_1 + a_{j,2} x_2 + \cdots + a_{j,n} x_n \amp = b_j, \\ \vdots \qquad \qquad \amp \vdots \\ a_{m,1} x_1 + a_{m,2} x_2 + \cdots + a_{m,n} x_n \amp = b_m, \end{align*}
is transformed to
\begin{align*} a_{1,1} x_1 + a_{1,2} x_2 + \cdots + a_{1,n} x_n \amp = b_1 , \\ a_{2,1} x_1 + a_{2,2} x_2 + \cdots + a_{2,n} x_n \amp = b_2, \\ \vdots \qquad \qquad \amp \vdots \\ a_{j,1} x_1 + a_{j,2} x_2 + \cdots + a_{j,n} x_n \amp = b_j, \\ \vdots \qquad \qquad \amp \vdots \\ a_{i,1} x_1 + a_{i,2} x_2 + \cdots + a_{i,n} x_n \amp = b_i, \\ \vdots \qquad \qquad \amp \vdots \\ a_{m,1} x_1 + a_{m,2} x_2 + \cdots + a_{m,n} x_n \amp = b_m, \end{align*}
Let \((s_1,s_2, \ldots, s_n)\) be a solution of (\(A\)) if it exists and note it may be one of many \(n\)-tuples in the solution. Thus it satisfies each equation of linear system (\(A\)). Since the exact same equations are in (\(B\)) in just a different order, \((s_1,s_2,\ldots,s_n)\) is a solution to (\(B\)). If there is more than one \(n\)-tuple in the solution to (\(A\)), repeat this for every one. If there is no solution to (\(A\)), then there will be no solution to (\(B\)) since it is the same set of equations.
Proof of #2 and #3 above are quite similar and are not shown.

Note 1.2.3.

Although Gauss’ Method is very flexible, generally, one tries to eliminate all \(x_1\) terms in all equations below equation 1, \(x_2\) terms in all equations below equation 2 and so on.

Subsection 1.2.2 Matrices

When we solved a linear system above, you probably noticed that the variables didn’t play much of a role, the coefficients changed and the variables stayed in the same place as we solved for them. Because of this, we will adopt that technique to only works with the coefficients. We first define a matrix that we will use to solve linear systems for the rest of this book.

Definition 1.2.4.

An \(m\) by \(n\) matrix is a rectangular grid of numbers with \(m\) rows and \(n\) columns. The size of a matrix is the pair of number \(m\) and \(n\) and is typically written \(m\) by \(n\) or \(m \times n\text{.}\) Each number of the matrix is called the entry or element.

Example 1.2.5. Matrices.

The following are examples of matrices:
\begin{equation*} \begin{bmatrix} 1 \amp 2 \amp 3 \\ 4 \amp 5 \amp 6 \end{bmatrix} \qquad \begin{bmatrix} \pi \amp 2 \\ -1 \amp 4 \\ 2.5 \amp 7/3 \\ -11 \amp 1000 \end{bmatrix} \qquad \begin{bmatrix} 2 \\ 4 \\ 6 \\ 8 \\ 9 \end{bmatrix} \qquad \begin{bmatrix} 8 \amp -3 \amp 2 \end{bmatrix} \end{equation*}
A common notation for a matrix is to use upper case letters (and often bold), for example \(A\text{,}\) \(B\) and \(C\) are common matrices. The entry or element in the \(i\)th row and \(j\)th column of \(A\) is \(a_{i,j}\text{.}\) Also, the set of all \(m\) by \(n\) matrices is denoted \({\cal M}_{m \times n}\text{.}\)

Definition 1.2.6.

A matrix with only 1 row is called a row vector. A matrix with only 1 column is called a column vector. The size of a vector is the number of rows (for a column vector) or the number of columns (for a row vector).
The 3rd matrix in ExampleΒ 1.2.5 above is a column vector of size 5. The 4th matrix is a row vector of size 3. Vectors are very important and will see them throughout this book.

Subsection 1.2.3 Matrices and Linear Systems

Let’s look at the following linear system.
\begin{align*} x + 2y \amp = 7, \\ 4x -3 y \amp = 6. \end{align*}
We will write the coefficients of the variables and the right hand side in a matrix called an an augmented coefficient matrix. The following is this matrix for the linear system above.
\begin{equation*} \left[ \begin{array}{rr|r} 1 \amp 2 \amp 7 \\ 4 \amp -3 \amp 6 \\ \end{array} \right] \end{equation*}
and the two rows of the matrix represent the two equations. The first column represents the coefficient of the \(x\) variable, and the second column represents the coefficient of the \(y\) variable. The last column is the right hand sides of the linear system, and the vertical line occurs where the equal sign is in the equations.

Example 1.2.7. Linear System as an Augmented Matrix.

Write down the following linear system as an augmented matrix:
\begin{align*} 3x -2 y + z \amp = 11, \\ 2x + 4y -3z \amp = 2, \\ -4x + y + 4z \amp = 0. \end{align*}
Solution.
\begin{equation*} \left[ \begin{array}{rrr|r} 3 \amp -2 \amp 1 \amp 11 \\ 2 \amp 4 \amp -3 \amp 2 \\ -4 \amp 1 \amp 4 \amp 0 \\ \end{array} \right] \end{equation*}
And the next example shows how to rewrite a matrix as a linear system.

Example 1.2.8. Augmented Matrix as a Linear System.

Write down the following augmented matrix as a linear system:
\begin{equation*} \left[ \begin{array}{rrr|r} 3 \amp 0 \amp -1 \amp 7 \\ -2 \amp 1 \amp 5 \amp 6 \\ 0 \amp 3 \amp 4 \amp 8 \\ \end{array} \right] \end{equation*}
Solution.
In this case, we are doing the opposite of the step above. That is, take a matrix and find the linear system.
Since the matrix has 4 columns, there are 3 variables (the last column is the right hand side). Let’s use \(x\text{,}\) \(y\) and \(z\text{.}\)
\begin{align*} 3x + 0 y - z \amp = 7 \\ -2x + y + 5z \amp = 6 \\ 0x + 3y + 4 z \amp = 8 \end{align*}
Alternatively, we could have used \(x_1,x_2\) and \(x_3\) as variables.

Subsection 1.2.4 Row Operations and Matrices

We can perform the same row operations that we have seen above on matrices.
Row Swap
\(R_i \leftrightarrow R_j\) swaps rows \(i\) and \(j\text{.}\)
Multiply by a number
\(c R_i\) multiplies row \(i\) by \(c\text{.}\) The notation \(c R_i \to R_i\) is also used.
Multiply by a number and add to another
\(cR_i + R_j\) multiplies row \(i\) by \(c\) and adds to row \(j\text{.}\) The notation \(cR_i + R_j \to R_j\) is also used.
In the next section, we will formalize the solving of linear system using matrices, however, the last example here reproduces the same solution technique for the example in SubsectionΒ 1.2.1.

Example 1.2.9.

Solve the linear system
\begin{align*} x -2y + 3z \amp = 6, \\ 2x + 2y\phantom{+3z} \amp = 6, \\ -3x \phantom{+2y}+\phantom{3} z \amp = 0. \end{align*}
by first writing as an augmented coefficient matrix and then performing elementary row operations on the matrix.
Solution.
First, the augmented coefficient matrix is
\begin{equation*} \left[\begin{array}{rrr|r} 1 \amp -2 \amp 3 \amp 6 \\ 2 \amp 2 \amp 0 \amp 6 \\ -3 \amp 0 \amp 1 \amp 0 \end{array}\right] \end{equation*}
Now perform the same elementary row operations as above. We first seek to change the second row, first column to a 0
\begin{equation*} -2 R_1 + R_2 \to R_2 \qquad \left[\begin{array}{rrr|r} 1 \amp -2 \amp 3 \amp 6 \\ 0 \amp 6 \amp -6 \amp -6 \\ -3 \amp 0 \amp 1 \amp 0 \end{array}\right] \end{equation*}
and notice that this is the matrix representation of the second step in the solution listed in SubsectionΒ 1.2.1. Next, we seek to change the 3rd row, first column from \(-3\) to a 0.
\begin{equation*} 3 R_1 + R_3 \to R_3 \qquad \left[\begin{array}{rrr|r} 1 \amp -2 \amp 3 \amp 6 \\ 0 \amp 6 \amp -6 \amp -6 \\ 0 \amp -6 \amp 10 \amp 18 \end{array}\right] \end{equation*}
And since we seek to get only a single variable in the third row, only one more step is needed.
\begin{equation*} R_2 + R_3 \to R_3 \qquad \left[\begin{array}{rrr|r} 1 \amp -2 \amp 3 \amp 6 \\ 0 \amp 6 \amp -6 \amp -6 \\ 0 \amp 0 \amp 4 \amp 12 \end{array}\right] \end{equation*}
At this point, if we return the augmented matrix to a set of equations, we get
\begin{align*} x - 2y + 3z \amp = 6 \\ 6y - 6z \amp = -6\\ 4z \amp = 12 \end{align*}
and we can get the same solution using the same steps as above to get \(z=3, y=2, x=1\) .
We will see in the next section that actually if we continue working with the matrix, we can more easily find the solution as well as find solutions for a broader range of linear systems.

Subsection 1.2.5 Geometry of Linear Systems of 2 variables

If we consider only linear systems with two variables, then each equation is just a line, which we can graph on a set of axes. We are going to examine the geometry of linear systems of two variables.
First, we are going to look at three linear systems that each have different types of solutions. We can see the solutions by looking at the graphs.
  • The graph of each line in the linear system
    \begin{equation} \begin{aligned} x + 2 y \amp = 5, \\ 2x - 3 y \amp = -4, \end{aligned}\tag{1.2.4} \end{equation}
    Figure 1.2.10. Plot of two intersecting lines
    The solution of the system is the point at which they cross. In this case it looks like the point \((1,2)\) or \(x=1\) and \(y=2\text{.}\) This is an example where there is only one solution (or a unique solution).
  • If we graph the lines in the linear system
    \begin{equation} \begin{aligned} 3x + 7 y \amp= 10, \\ 6 x + 14 y \amp= 5, \end{aligned}\tag{1.2.5} \end{equation}
    we get
    Figure 1.2.11. Plot of two parallel lines
    As you can see, it doesn’t appear that the lines cross anywhere. In fact, they don’t because the lines are parallel. This is an example of a linear system with no solution.
  • The linear system
    \begin{equation} \begin{aligned} x + 2 y = 5, \\ 2x + 4 y = 10, \end{aligned}\tag{1.2.6} \end{equation}
    has the following graph for each line
    Figure 1.2.12. A plot of two equivalent lines
    It appears that there is only one line. This is because both lines have the same graph. Each point on the line is a solution to the linear system and since there are an infinite number of such points, this is an example of a linear system with infinite number of solutions.
You can see if you have two lines, each with two variables, the example in (1.2.4) is what happens if the two slopes are different. In this case, there is one (or a unique) solution.
In the other two cases as in equations (1.2.5) and (1.2.6), both sets of lines have the same slope. In the case of (1.2.5) the lines have different \(y\)-intercepts, and therefore the lines are parallel and thus there is no solution to the linear system. In the case of (1.2.6), both the slope and \(y\)-intercepts are equal, so the lines are equal and thus any point on the line is a solution, and this system has an infinite number of solutions.