If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

### Course: Algebra (all content)>Unit 20

Lesson 3: Elementary matrix row operations

# Matrix row operations

Learn how to perform the matrix elementary row operations. These operations will allow us to solve complicated linear systems with (relatively) little hassle!

## Matrix row operations

The following table summarizes the three elementary matrix row operations.
Matrix row operationExample
Switch any two rows
Multiply a row by a nonzero constant
Matrix row operations can be used to solve systems of equations, but before we look at why, let's practice these skills.

## Switch any two rows

### Example

Perform the row operation ${R}_{1}↔{R}_{2}$ on the following matrix.
$\left[\begin{array}{rrr}4& 8& 3\\ 2& 4& 5\\ 7& 1& 2\end{array}\right]$

### Solution

${R}_{1}↔{R}_{2}$ means to interchange row $1$ and row $2$.
So the matrix $\left[\begin{array}{rrr}4& 8& 3\\ 2& 4& 5\\ 7& 1& 2\end{array}\right]$ becomes $\left[\begin{array}{rrr}2& 4& 5\\ 4& 8& 3\\ 7& 1& 2\end{array}\right]$.
Sometimes you will see the following notation used to indicate this change.
$\left[\begin{array}{rrr}4& 8& 3\\ 2& 4& 5\\ 7& 1& 2\end{array}\right]\stackrel{{R}_{1}↔{R}_{2}\phantom{\rule[-.25em]{0ex}{0ex}}}{\to }\left[\begin{array}{rrr}2& 4& 5\\ 4& 8& 3\\ 7& 1& 2\end{array}\right]$
Notice how row $1$ replaces row $2$ and row $2$ replaces row $1$. The third row is not changed.
Problem 1
Perform the row operation ${R}_{2}↔{R}_{3}$ on the following matrix.
$\left[\begin{array}{rrr}7& 2& 9\\ 6& 4& 1\\ 1& 3& 12\end{array}\right]$

## Multiply a row by a nonzero constant

### Example

Perform the row operation $3{R}_{2}\to {R}_{2}$ on the following matrix.
$\left[\begin{array}{rrr}6& 6& 1\\ 2& 3& 0\\ 4& 5& 9\end{array}\right]$

### Solution

$3{R}_{2}\to {R}_{2}$ means to replace the $2\text{nd}$ row with $3$ times itself.
$\left[\begin{array}{rrr}6& 6& 1\\ 2& 3& 0\\ 4& 5& 9\end{array}\right]$ becomes $\left[\begin{array}{rrr}6& 6& 1\\ 3\cdot 2& 3\cdot 3& 3\cdot 0\\ 4& 5& 9\end{array}\right]=\left[\begin{array}{rrr}6& 6& 1\\ 6& 9& 0\\ 4& 5& 9\end{array}\right]$
To indicate this matrix row operation, we often see the following:
$\left[\begin{array}{rrr}6& 6& 1\\ 2& 3& 0\\ 4& 5& 9\end{array}\right]\stackrel{3{R}_{2}\to {R}_{2}\phantom{\rule[-.25em]{0ex}{0ex}}}{\to }\left[\begin{array}{rrr}6& 6& 1\\ 6& 9& 0\\ 4& 5& 9\end{array}\right]$
Notice here three times the second row replaces the second row. The other rows remain the same.
Problem 3
Perform the row operation $2{R}_{1}\to {R}_{1}$ on the following matrix.
$\left[\begin{array}{cccc}2& 6& 5& 1\\ 7& 4& 8& 0\end{array}\right]$

## Add one row to another

### Example

Perform the row operation ${R}_{1}+{R}_{2}\to {R}_{2}$ on the following matrix.
$\left[\begin{array}{rrr}2& 3& 4\\ 0& 8& 1\end{array}\right]$

### Solution

${R}_{1}+{R}_{2}\to {R}_{2}$ means to replace the $2\text{nd}$ row with the sum of the $1\text{st}$ and $2\text{nd}$ rows.
$\left[\begin{array}{rrr}2& 3& 4\\ 0& 8& 1\end{array}\right]$ becomes $\left[\begin{array}{lll}2& 3& 4\\ 2+0& 3+8& 4+1\end{array}\right]=\left[\begin{array}{rrr}2& 3& 4\\ 2& 11& 5\end{array}\right]$
To indicate this matrix row operation, we can write the following:
$\left[\begin{array}{rrr}2& 3& 4\\ 0& 8& 1\end{array}\right]\stackrel{{R}_{1}+{R}_{2}\to {R}_{2}\phantom{\rule[-.25em]{0ex}{0ex}}}{\to }\left[\begin{array}{rrr}2& 3& 4\\ 2& 11& 5\end{array}\right]$
Notice how the sum of row $1$ and $2$ replaces row $2$. The other row remains the same.
Problem 5
Perform the row operation ${R}_{1}+{R}_{3}\to {R}_{3}$ on the following matrix.
$\left[\begin{array}{rrr}-1& 6& -2\\ -3& 5& 0\\ 7& 2& 1\end{array}\right]$

Challenge problem
Perform the row operation ${R}_{1}+2{R}_{3}\to {R}_{1}$ on the following matrix.
$\left[\begin{array}{rrr}-5& 7& 3\\ -2& -1& 4\\ 8& 8& -6\end{array}\right]$

## Systems of equations and matrix row operations

Recall that in an augmented matrix, each row represents one equation in the system and each column represents a variable or the constant terms.
For example, the system on the left corresponds to the augmented matrix on the right.
SystemMatrix
$\begin{array}{rl}1x+3y& =5\\ 2x+5y& =6\end{array}$$\left[\begin{array}{ccc}1& 3& 5\\ \\ 2& 5& 6\end{array}\right]$
When working with augmented matrices, we can perform any of the matrix row operations to create a new augmented matrix that produces an equivalent system of equations. Let's take a look at why.

### Switching any two rows

Equivalent SystemsAugmented matrix
$\begin{array}{rl}1x+3y& =5\\ 2x+5y& =6\end{array}$$\left[\begin{array}{ccc}1& 3& 5\\ \\ 2& 5& 6\end{array}\right]$
$↓$
$\begin{array}{rl}2x+5y& =6\\ 1x+3y& =5\end{array}$$\left[\begin{array}{ccc}2& 5& 6\\ \\ 1& 3& 5\end{array}\right]$
The two systems in the above table are equivalent, because the order of the equations doesn't matter. This means that when using an augmented matrix to solve a system, we can interchange any two rows.

### Multiply a row by a nonzero constant

We can multiply both sides of an equation by the same nonzero constant to obtain an equivalent equation.
In solving systems of equations, we often do this to eliminate a variable. Because the two equations are equivalent, we see that the two systems are also equivalent.
Equivalent SystemsAugmented matrix
$\begin{array}{rl}1x+3y& =5\\ 2x+5y& =6\end{array}$$\left[\begin{array}{ccc}1& 3& 5\\ 2& 5& 6\end{array}\right]$
$↓$
$\begin{array}{rl}-2x+\left(-6\right)y& =-10\\ 2x+\phantom{\left(-\right)}5y& =6\end{array}$$\left[\begin{array}{rrr}-2& -6& -10\\ 2& 5& 6\end{array}\right]$
This means that when using an augmented matrix to solve a system, we can multiply any row by a nonzero constant.

### Add one row to another

We know that we can add two equal quantities to both sides of an equation to obtain an equivalent equation.
So if $A=B$ and $C=D$, then $A+C=B+D$.
We do this often when solving systems of equations. For example, in this system $\begin{array}{rl}-2x-6y& =-10\\ 2x+5y& =6\end{array}$, we can add the equations to obtain $-y=-4$.
Pairing this new equation with either original equation creates an equivalent system of equations.
Equivalent SystemsAugmented matrix
$\begin{array}{rl}-2x-6y& =-10\\ 2x+5y& =6\end{array}$$\left[\begin{array}{rrr}-2& -6& -10\\ 2& 5& 6\end{array}\right]$
$↓$
$\begin{array}{rl}-2x+\left(-6\right)y& =-10\\ 0x+\left(-1\right)y& =-4\end{array}$$\left[\begin{array}{rrr}-2& -6& -10\\ 0& -1& -4\end{array}\right]$
So when using an augmented matrix to solve a system, we can add one row to another.
Concluding challenge problem
A sequence of row operations is performed on the matrix $\left[\begin{array}{rrr}2& 2& 10\\ -2& -3& 3\end{array}\right]$. The table below describes the result of each step in the sequence.
Arrange the row operations according to each step.
Original matrix: $\left[\begin{array}{rrr}2& 2& 10\\ -2& -3& 3\end{array}\right]$

Notice that the original matrix corresponds to $\begin{array}{rl}2x+2y& =10\\ -2x-3y& =3\end{array}$, while the final matrix corresponds to $\begin{array}{rl}x& =18\\ y& =-13\end{array}$ which simply gives the solution.
The system was solved entirely by using augmented matrices and row operations!

## Want to join the conversation?

• how did 5 - 13 ended up being 18 on the last challenge?
statement says "R1 - R2 -> R1"

Maybe a typo?
• R1,3 is 5, while R2,3 is -13. When we subtract R1,3-R2,3, we get 5-(-13)=5+13=18. You had 13 mixed up with -13.
• Is there any way possible to know which operation is best to perform on the matrix first, besides using intuition?
• Usually with matrices you want to get 1s along the diagonal, so the usual method is to make the upper left most entry 1 by dividing that row by whatever that upper left entry is. So say the first row is 3 7 5 1. you would divide the whole row by 3 and it would become 1 7/3 5/3 1/3. From there you use the first row to make the first column have all 0s under that 1. Then repeat this going along the diagonal.
• If you want to apply the same priciples to columns do you us C1 or C2 instead of R1 or R2 or is there some other letter that you should use?
• Technically, yes. On paper you can perform column operations.
However, it nullifies the validity of the equations represented in the matrix. In other words, it breaks the equality. Say we have a matrix to represent:
3x + 3y = 15
2x + 2y = 10, where x = 2 and y = 3

Performing the operation 2R1 --> R1 (replace row 1 with 2 times row 1) gives us
4x + 4y+ = 20 = 4x2 + 4x3 = 20, which works

But if we did 2C2 --> C2 (replace Column 2 with 2 times column 2), we get

3x + 6y = 15 = 3x2 + 6x3 = 15 = 6 + 18 = 15
2x + 4y = 10 = 2x2 + 4x3 = 10 = 4 + 12 = 10

Ridiculous, ain't it? I was wondering the same thing before I saw you question. It's the same reason you can't operate on one side of an equation without doing the same to the other (after all, it's called an EQUAtion; it has to be EQUAL!) Hope this helped :)
• this is so trippy
• Step #1 of the last question appears to have the row operation labeled incorrectly.

Shouldn't it be R1 + R2 --> R2 ??
• Yes, and you're supposed to drag the row operations up/down, so that they match what is done in each step.
• What's a non zero constant?
(1 vote)
• Any number that is not zero is a non-zero constant.
A variable is not a constant as it is an unknown number.
• Why is it not legitimate to multiply a row with zero?
• Um, remember the multiplication property of 0? What happens when you multiply by 0? Everything becomes 0, so you lose any informaiton given in the original problem.