## Performing Row Operations on a Matrix

Now that we can write systems of equations in augmented matrix form, we will examine the various row operations that can be performed on a matrix, such as addition, multiplication by a constant, and interchanging rows.

Performing row operations on a matrix is the method we use for solving a system of equations. In order to solve the system of equations, we want to convert the matrix to row-echelon form, in which there are ones down the main diagonal from the upper left corner to the lower right corner, and zeros in every position below the main diagonal as shown.

$\begin{array}{c}\text{Row-echelon form}\\ \left[\begin{array}{ccc}1& a& b\\ 0& 1& d\\ 0& 0& 1\end{array}\right]\end{array}$

We use row operations corresponding to equation operations to obtain a new matrix that is row-equivalent in a simpler form. Here are the guidelines to obtaining row-echelon form.

1. In any nonzero row, the first nonzero number is a 1. It is called a leading 1.
2. Any all-zero rows are placed at the bottom on the matrix.
3. Any leading 1 is below and to the right of a previous leading 1.
4. Any column containing a leading 1 has zeros in all other positions in the column.

To solve a system of equations we can perform the following row operations to convert the coefficient matrix to row-echelon form and do back-substitution to find the solution.

1. Interchange rows. (Notation: ${R}_{i}\leftrightarrow {R}_{j}$ )
2. Multiply a row by a constant. (Notation: $c{R}_{i}$ )
3. Add the product of a row multiplied by a constant to another row. (Notation: ${R}_{i}+c{R}_{j}$)

Each of the row operations corresponds to the operations we have already learned to solve systems of equations in three variables. With these operations, there are some key moves that will quickly achieve the goal of writing a matrix in row-echelon form. To obtain a matrix in row-echelon form for finding solutions, we use Gaussian elimination, a method that uses row operations to obtain a 1 as the first entry so that row 1 can be used to convert the remaining rows.

### A General Note: Gaussian Elimination

The Gaussian elimination method refers to a strategy used to obtain the row-echelon form of a matrix. The goal is to write matrix $A$ with the number 1 as the entry down the main diagonal and have all zeros below.

$A=\left[\begin{array}{rrr}\hfill {a}_{11}& \hfill {a}_{12}& \hfill {a}_{13}\\ \hfill {a}_{21}& \hfill {a}_{22}& \hfill {a}_{23}\\ \hfill {a}_{31}& \hfill {a}_{32}& \hfill {a}_{33}\end{array}\right]\stackrel{\text{After Gaussian elimination}}{\to }A=\left[\begin{array}{rrr}\hfill 1& \hfill {b}_{12}& \hfill {b}_{13}\\ \hfill 0& \hfill 1& \hfill {b}_{23}\\ \hfill 0& \hfill 0& \hfill 1\end{array}\right]$

The first step of the Gaussian strategy includes obtaining a 1 as the first entry, so that row 1 may be used to alter the rows below.

### How To: Given an augmented matrix, perform row operations to achieve row-echelon form.

1. The first equation should have a leading coefficient of 1. Interchange rows or multiply by a constant, if necessary.
2. Use row operations to obtain zeros down the first column below the first entry of 1.
3. Use row operations to obtain a 1 in row 2, column 2.
4. Use row operations to obtain zeros down column 2, below the entry of 1.
5. Use row operations to obtain a 1 in row 3, column 3.
6. Continue this process for all rows until there is a 1 in every entry down the main diagonal and there are only zeros below.
7. If any rows contain all zeros, place them at the bottom.

### Example 2: Solving a $2\times 2$ System by Gaussian Elimination

Solve the given system by Gaussian elimination.

$\begin{array}{l}2x+3y=6\hfill \\ \text{ }x-y=\frac{1}{2}\hfill \end{array}$

### Solution

First, we write this as an augmented matrix.

$\left[\begin{array}{rr}\hfill 2& \hfill 3\\ \hfill 1& \hfill -1\end{array}\text{ }|\text{ }\begin{array}{r}\hfill 6\\ \hfill \frac{1}{2}\end{array}\right]$

We want a 1 in row 1, column 1. This can be accomplished by interchanging row 1 and row 2.

${R}_{1}\leftrightarrow {R}_{2}\to \left[\begin{array}{rrr}\hfill 1& \hfill -1& \hfill \\ \hfill 2& \hfill 3& \hfill \end{array}|\begin{array}{rr}\hfill & \hfill \frac{1}{2}\\ \hfill & \hfill 6\end{array}\right]$

We now have a 1 as the first entry in row 1, column 1. Now let’s obtain a 0 in row 2, column 1. This can be accomplished by multiplying row 1 by $-2$, and then adding the result to row 2.

$-2{R}_{1}+{R}_{2}={R}_{2}\to \left[\begin{array}{rrr}\hfill 1& \hfill -1& \hfill \\ \hfill 0& \hfill 5& \hfill \end{array}|\begin{array}{rr}\hfill & \hfill \frac{1}{2}\\ \hfill & \hfill 5\end{array}\right]$

We only have one more step, to multiply row 2 by $\frac{1}{5}$.

$\frac{1}{5}{R}_{2}={R}_{2}\to \left[\begin{array}{rrr}\hfill 1& \hfill -1& \hfill \\ \hfill 0& \hfill 1& \hfill \end{array}|\begin{array}{cc}& \frac{1}{2}\\ & 1\end{array}\right]$

Use back-substitution. The second row of the matrix represents $y=1$. Back-substitute $y=1$ into the first equation.

$\begin{array}{l}x-\left(1\right)=\frac{1}{2}\hfill \\ \text{ }x=\frac{3}{2}\hfill \end{array}$

The solution is the point $\left(\frac{3}{2},1\right)$.

### Try It 3

Solve the given system by Gaussian elimination.

$\begin{array}{l}4x+3y=11\hfill \\ \text{ }\text{}\text{}x - 3y=-1\hfill \end{array}$

### Example 3: Using Gaussian Elimination to Solve a System of Equations

Use Gaussian elimination to solve the given $2\times 2$ system of equations.

$\begin{array}{l}\text{ }2x+y=1\hfill \\ 4x+2y=6\hfill \end{array}$

### Solution

Write the system as an augmented matrix.

$\left[\begin{array}{ll}2\hfill & 1\hfill \\ 4\hfill & 2\hfill \end{array}\text{ }|\text{ }\begin{array}{l}1\hfill \\ 6\hfill \end{array}\right]$

Obtain a 1 in row 1, column 1. This can be accomplished by multiplying the first row by $\frac{1}{2}$.

$\frac{1}{2}{R}_{1}={R}_{1}\to \left[\begin{array}{cc}1& \frac{1}{2}\\ 4& 2\end{array}\text{ }|\text{ }\begin{array}{c}\frac{1}{2}\\ 6\end{array}\right]$

Next, we want a 0 in row 2, column 1. Multiply row 1 by $-4$ and add row 1 to row 2.

$-4{R}_{1}+{R}_{2}={R}_{2}\to \left[\begin{array}{cc}1& \frac{1}{2}\\ 0& 0\end{array}\text{ }|\text{ }\begin{array}{c}\frac{1}{2}\\ 4\end{array}\right]$

The second row represents the equation $0=4$. Therefore, the system is inconsistent and has no solution.

### Example 4: Solving a Dependent System

Solve the system of equations.

$\begin{array}{l}3x+4y=12\\ 6x+8y=24\end{array}$

### Solution

Perform row operations on the augmented matrix to try and achieve row-echelon form.

$A=\left[\begin{array}{llll}3\hfill & \hfill & 4\hfill & \hfill \\ 6\hfill & \hfill & 8\hfill & \hfill \end{array}|\begin{array}{ll}\hfill & 12\hfill \\ \hfill & 24\hfill \end{array}\right]$
$\begin{array}{l}\hfill \\ \begin{array}{l}-\frac{1}{2}{R}_{2}+{R}_{1}={R}_{1}\to \left[\begin{array}{llll}0\hfill & \hfill & 0\hfill & \hfill \\ 6\hfill & \hfill & 8\hfill & \hfill \end{array}|\begin{array}{ll}\hfill & 0\hfill \\ \hfill & 24\hfill \end{array}\right]\hfill \\ {R}_{1}\leftrightarrow {R}_{2}\to \left[\begin{array}{llll}6\hfill & \hfill & 8\hfill & \hfill \\ 0\hfill & \hfill & 0\hfill & \hfill \end{array}|\begin{array}{ll}\hfill & 24\hfill \\ \hfill & 0\hfill \end{array}\right]\hfill \end{array}\hfill \end{array}$

The matrix ends up with all zeros in the last row: $0y=0$. Thus, there are an infinite number of solutions and the system is classified as dependent. To find the generic solution, return to one of the original equations and solve for $y$.

$\begin{array}{l}3x+4y=12\hfill \\ \text{ }4y=12 - 3x\hfill \\ \text{ }y=3-\frac{3}{4}x\hfill \end{array}$

So the solution to this system is $\left(x,3-\frac{3}{4}x\right)$.

### Example 5: Performing Row Operations on a 3×3 Augmented Matrix to Obtain Row-Echelon Form

Perform row operations on the given matrix to obtain row-echelon form.

$\left[\begin{array}{rrr}\hfill 1& \hfill -3& \hfill 4\\ \hfill 2& \hfill -5& \hfill 6\\ \hfill -3& \hfill 3& \hfill 4\end{array}\text{ }|\text{ }\begin{array}{r}\hfill 3\\ \hfill 6\\ \hfill 6\end{array}\right]$

### Solution

The first row already has a 1 in row 1, column 1. The next step is to multiply row 1 by $-2$ and add it to row 2. Then replace row 2 with the result.

$-2{R}_{1}+{R}_{2}={R}_{2}\to \left[\begin{array}{rrrrrr}\hfill 1& \hfill & \hfill -3& \hfill & \hfill 4& \hfill \\ \hfill 0& \hfill & \hfill 1& \hfill & \hfill -2& \hfill \\ \hfill -3& \hfill & \hfill 3& \hfill & \hfill 4& \hfill \end{array}|\begin{array}{rr}\hfill & \hfill 3\\ \hfill & \hfill 0\\ \hfill & \hfill 6\end{array}\right]$

Next, obtain a zero in row 3, column 1.

$3{R}_{1}+{R}_{3}={R}_{3}\to \left[\begin{array}{rrrrrr}\hfill 1& \hfill & \hfill -3& \hfill & \hfill 4& \hfill \\ \hfill 0& \hfill & \hfill 1& \hfill & \hfill -2& \hfill \\ \hfill 0& \hfill & \hfill -6& \hfill & \hfill 16& \hfill \end{array}|\begin{array}{rr}\hfill & \hfill 3\\ \hfill & \hfill 0\\ \hfill & \hfill 15\end{array}\right]$

Next, obtain a zero in row 3, column 2.

$6{R}_{2}+{R}_{3}={R}_{3}\to \left[\begin{array}{rrrrrr}\hfill 1& \hfill & \hfill -3& \hfill & \hfill 4& \hfill \\ \hfill 0& \hfill & \hfill 1& \hfill & \hfill -2& \hfill \\ \hfill 0& \hfill & \hfill 0& \hfill & \hfill 4& \hfill \end{array}|\begin{array}{rr}\hfill & \hfill 3\\ \hfill & \hfill 0\\ \hfill & \hfill 15\end{array}\right]$

The last step is to obtain a 1 in row 3, column 3.

$\frac{1}{2}{R}_{3}={R}_{3}\to \left[\begin{array}{rrr}\hfill 1& \hfill -3& \hfill 4\\ \hfill 0& \hfill 1& \hfill -2\\ \hfill 0& \hfill 0& \hfill 1\end{array}\text{ }|\text{ }\begin{array}{r}\hfill 3\\ \hfill -6\\ \hfill \frac{21}{2}\end{array}\right]$

### Try It 4

Write the system of equations in row-echelon form.

$\begin{array}{l}\text{ }x - 2y+3z=9\hfill \\ \text{ }-x+3y=-4\hfill \\ 2x - 5y+5z=17\hfill \end{array}$