# 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.

[latex]\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}[/latex]

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.

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

**coefficient matrix**to row-echelon form and do back-substitution to find the solution.

- Interchange rows. (Notation: [latex]{R}_{i}\leftrightarrow {R}_{j}[/latex] )
- Multiply a row by a constant. (Notation: [latex]c{R}_{i}[/latex] )
- Add the product of a row multiplied by a constant to another row. (Notation: [latex]{R}_{i}+c{R}_{j}[/latex])

### 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 [latex]A[/latex] with the number 1 as the entry down the main diagonal and have all zeros below.

[latex]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][/latex]

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.

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

### Example 2: Solving a [latex]2\times 2[/latex] System by Gaussian Elimination

Solve the given system by Gaussian elimination.[latex]\begin{array}{l}2x+3y=6\hfill \\ \text{ }x-y=\frac{1}{2}\hfill \end{array}[/latex]

### Solution

First, we write this as an augmented matrix.[latex]\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][/latex]

We want a 1 in row 1, column 1. This can be accomplished by interchanging row 1 and row 2.
[latex]{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][/latex]

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 [latex]-2[/latex], and then adding the result to row 2.
[latex]-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][/latex]

We only have one more step, to multiply row 2 by [latex]\frac{1}{5}[/latex].
[latex]\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][/latex]

Use back-substitution. The second row of the matrix represents [latex]y=1[/latex]. Back-substitute [latex]y=1[/latex] into the first equation.
[latex]\begin{array}{l}x-\left(1\right)=\frac{1}{2}\hfill \\ \text{ }x=\frac{3}{2}\hfill \end{array}[/latex]

The solution is the point [latex]\left(\frac{3}{2},1\right)[/latex].
### Try It 3

Solve the given system by Gaussian elimination.[latex]\begin{array}{l}4x+3y=11\hfill \\ \text{ }\text{}\text{}x - 3y=-1\hfill \end{array}[/latex]

Solution

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

Use**Gaussian elimination**to solve the given [latex]2\times 2[/latex]

**system of equations**.

[latex]\begin{array}{l}\text{ }2x+y=1\hfill \\ 4x+2y=6\hfill \end{array}[/latex]

### Solution

Write the system as an**augmented matrix**.

[latex]\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][/latex]

Obtain a 1 in row 1, column 1. This can be accomplished by multiplying the first row by [latex]\frac{1}{2}[/latex].
[latex]\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][/latex]

Next, we want a 0 in row 2, column 1. Multiply row 1 by [latex]-4[/latex] and add row 1 to row 2.
[latex]-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][/latex]

The second row represents the equation [latex]0=4[/latex]. Therefore, the system is inconsistent and has no solution.
### Example 4: Solving a Dependent System

Solve the system of equations.[latex]\begin{array}{l}3x+4y=12\\ 6x+8y=24\end{array}[/latex]

### Solution

Perform**row operations**on the augmented matrix to try and achieve

**row-echelon form**.

[latex]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][/latex]

[latex]\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}[/latex]

The matrix ends up with all zeros in the last row: [latex]0y=0[/latex]. 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 [latex]y[/latex].
[latex]\begin{array}{l}3x+4y=12\hfill \\ \text{ }4y=12 - 3x\hfill \\ \text{ }y=3-\frac{3}{4}x\hfill \end{array}[/latex]

So the solution to this system is [latex]\left(x,3-\frac{3}{4}x\right)[/latex].
### 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.[latex]\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][/latex]

### Solution

The first row already has a 1 in row 1, column 1. The next step is to multiply row 1 by [latex]-2[/latex] and add it to row 2. Then replace row 2 with the result.[latex]-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][/latex]

Next, obtain a zero in row 3, column 1.
[latex]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][/latex]

Next, obtain a zero in row 3, column 2.
[latex]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][/latex]

The last step is to obtain a 1 in row 3, column 3.
[latex]\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][/latex]

### Try It 4

Write the system of equations in row-echelon form.[latex]\begin{array}{l}\text{ }x - 2y+3z=9\hfill \\ \text{ }-x+3y=-4\hfill \\ 2x - 5y+5z=17\hfill \end{array}[/latex]

Solution

## Licenses & Attributions

### CC licensed content, Specific attribution

- Precalculus.
**Provided by:**OpenStax**Authored by:**OpenStax College.**Located at:**https://cnx.org/contents/[email protected]:1/Preface.**License:**CC BY: Attribution.