Main content

## Algebra (all content)

### 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 operation | Example |
---|---|

Switch any two rows | $\left[\begin{array}{rr}{\blueD2} & {\blueD5} &{ \blueD{3}} \\ \greenD{3} &\greenD {4} &\greenD {6} \end{array}\right]\rightarrow\left[\begin{array}{rr} \greenD{3} & \greenD{4} &\greenD {6}\\\blueD{2} &\blueD {5} &\blueD{ 3} \end{array}\right]\\\\~~\\ \\ {\text{(Interchange row 1 and row 2.)}}$ |

Multiply a row by a nonzero constant | $\left[\begin{array}{rr}{\maroonD2} & {\maroonD5} &{ \maroonD3} \\ {3} & {4} & {6} \end{array}\right]\rightarrow\left[\begin{array}{rrr}{\goldD3 \cdot \maroonD2} & {\goldD3 \cdot \maroonD5} &{ \goldD3 \cdot \maroonD3} \\ { 3} & { 4} & { 6} \end{array}\right] \\~\\ {\text{(Row 1 becomes 3 times itself.)}}$ |

Add one row to another | $\left[\begin{array}{rr}{\tealD2} &\tealD5 &{ \tealD{3}} \\ \purpleC{3} &\purpleC {4} &\purpleC {6} \end{array}\right]\rightarrow\left[\begin{array}{rrr} {\tealD2} &\tealD5&{\tealD3}\\\purpleC{3}+\tealD2 & \purpleC{4}+\tealD5 &\purpleC{6} +\tealD3\end{array}\right]\\~~\\ {\text{(Row 2 becomes the sum of rows 2 and 1.)}}$ |

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, start subscript, 1, end subscript, \leftrightarrow, R, start subscript, 2, end subscript on the following matrix.

### Solution

R, start subscript, start color #11accd, 1, end color #11accd, end subscript, \leftrightarrow, R, start subscript, start color #1fab54, 2, end color #1fab54, end subscript means to interchange row start color #11accd, 1, end color #11accd and row start color #1fab54, 2, end color #1fab54.

So the matrix $\left[\begin{array} {rrr}
\blueD4 & \blueD8 & \blueD{3} \\
\greenD2 & \greenD4 & \greenD5 \\
7 & 1 & 2 \end{array} \right]$ becomes $\left[\begin{array} {rrr}
\greenD2 & \greenD4 & \greenD5 \\
\blueD4 & \blueD8 & \blueD{3} \\
7 & 1 & 2 \end{array} \right]$.

Sometimes you will see the following notation used to indicate this change.

Notice how row 1 replaces row 2 and row 2 replaces row 1. The third row is not changed.

## Multiply a row by a nonzero constant

### Example

Perform the row operation 3, R, start subscript, 2, end subscript, right arrow, R, start subscript, 2, end subscript on the following matrix.

### Solution

start color #ca337c, 3, end color #ca337c, R, start subscript, start color #e07d10, 2, end color #e07d10, end subscript, right arrow, R, start subscript, start color #e07d10, 2, end color #e07d10, end subscript means to replace the start color #e07d10, 2, start text, n, d, end text, end color #e07d10 row with start color #ca337c, 3, end color #ca337c times itself.

$\left[\begin{array} {rrr}
6 & 6 & 1 \\
\goldD{2} & \goldD{3} & \goldD{0} \\
4 & 5 & 9 \end{array} \right]$ becomes $\left[\begin{array} {rrr}
6 & 6 & 1 \\ \maroonD{3}\cdot \goldD{2} &\maroonD{3}\cdot \goldD{3} &\maroonD{3}\cdot \goldD{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:

Notice here three times the second row replaces the second row. The other rows remain the same.

## Add one row to another

### Example

Perform the row operation R, start subscript, 1, end subscript, plus, R, start subscript, 2, end subscript, right arrow, R, start subscript, 2, end subscript on the following matrix.

### Solution

R, start subscript, start color #01a995, 1, end color #01a995, end subscript, plus, R, start subscript, start color #aa87ff, 2, end color #aa87ff, end subscript, right arrow, R, start subscript, 2, end subscript means to replace the 2, start text, n, d, end text row with the sum of the start color #01a995, 1, start text, s, t, end text, end color #01a995 and start color #aa87ff, 2, start text, n, d, end text, end color #aa87ff rows.

$\left[\begin{array} {rrr}
\tealD2 & \tealD{3} &\tealD{ 4}\\
\purpleC0 & \purpleC8 & \purpleC1 \end{array} \right]$ becomes $\left[\begin{array} {lll}
\tealD2 &{\tealD3} &{ \tealD4}\\
\tealD2+\purpleC0 & \tealD3+\purpleC8 & \tealD4 +\purpleC1 \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:

Notice how the sum of row 1 and 2 replaces row 2. The other row remains the same.

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

System | Matrix |
---|---|

$\begin{aligned} 1x+3y &=5\\2x+5y &=6\end{aligned}$ | $\left[\begin{array}{cc:c}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 Systems | Augmented matrix |
---|---|

$\begin{aligned} \blueD1x+\blueD3y &=\blueD{5} \\\greenD{2}x+\greenD{{5}}y &=\greenD{6} \end{aligned}$ | $\left[\begin{array}{cc:c}\blueD1&\blueD3&\blueD5\\\\\greenD2&\greenD5&\greenD6\end{array}\right]$ |

\downarrow | |

$\begin{aligned}\greenD{2}x+\greenD{{5}}y &=\greenD{6}\\ \blueD1x+\blueD3y &=\blueD{5} \end{aligned}$ | $\left[\begin{array}{cc:c}\greenD2&\greenD5&\greenD6\\\\\blueD1&\blueD3&\blueD5\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 Systems | Augmented matrix |
---|---|

$\begin{aligned} \maroonD1x+\maroonD3y &=\maroonD5 \\2x+5y &=6\end{aligned}$ | $\left[\begin{array}{cc:c}\maroonD1 & \maroonD3 &\maroonD5 \\2&5&6\end{array}\right]$ |

\downarrow | |

$\begin{aligned}\goldD{-2}x+(\goldD{-6})y &=\goldD{-10} \\2x+\phantom{(-)}5y &=6\end{aligned}$ | $\left[\begin{array}{rr:r}\goldD{-2}&\goldD{-6}& \goldD{-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, equals, B and C, equals, D, then A, plus, C, equals, B, plus, D.

We do this often when solving systems of equations. For example, in this system $\begin{aligned}-2x-6y &=-10 \\ {2}x+{{5}}y &={6}\end{aligned}$,
we can add the equations to obtain minus, y, equals, minus, 4.

Pairing this new equation with either original equation creates an equivalent system of equations.

Equivalent Systems | Augmented matrix |
---|---|

$\begin{aligned} -2x-6y &=-10\\2x+5y &=6\end{aligned}$ | $\left[\begin{array}{rr:r}-2&-6&-10\\2&5&6\end{array}\right]$ |

\downarrow | |

$\begin{aligned}-2x+(-6)y &=-10\\\purpleC0x+(\purpleC{-1})y &=\purpleC{-4} \end{aligned}$ | $\left[\begin{array}{rr:r}-2&-6&-10\\\purpleC0&\purpleC{-1}&\purpleC{-4}\end{array}\right]$ |

So when using an augmented matrix to solve a system, we can

**add one row to another**.Notice that the original matrix corresponds to $\begin{aligned} 2x+2y &={10} \\
{-2}x-3y &={ 3} \end{aligned}$, while the final matrix corresponds to $\begin{aligned} x&=18 \\
y&=-13 \end{aligned}$ 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?(0 votes)- 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.(17 votes)

- Is there any way possible to know which operation is best to perform on the matrix first, besides using intuition?(19 votes)
- 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.(17 votes)

- 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?(2 votes)
- 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 :)(12 votes)

- Step #1 of the last question appears to have the row operation labeled incorrectly.

Shouldn't it be R1 + R2 --> R2 ??(4 votes)- Yes, and you're supposed to drag the row operations up/down, so that they match what is done in each step.(4 votes)

- 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.(8 votes)

- Why is it not legitimate to multiply a row with zero?(2 votes)
- 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.(5 votes)

- Can one also use any of these row operations to add in a new row? This could prove useful in operations where the matrices need to have the same dimensions.(3 votes)
- No, row operations can only manipulate existing rows.(3 votes)

- Is there only one correct method of using row

operations on a specific matrix to solve a system of equations?(3 votes)- As long as you make as many columns that only have a 1 in them it doesn't really matter how you solve it. Making them a diagonal is just mostly used since it's systematic and is easy to keep track of since the answers are all the way on the right, so starting at the left makes it so you can go column by column.(2 votes)

- So is the point of this just to solve for x and y at the same time? It seems a little unnecessary to me, since we already know how to solve systems of equations, and just about as quickly, without learning how to read matrices. It just seems like we don't need this . . .(3 votes)
- Matrix stuff does get its own uses, this is more like an intro to them to then later use in linear algebra and calculus. Among other places.(2 votes)

- 7) challenge problem, first row, third column in the matrix: why would the answer be -9? shouldn't 2*(-6) be +12 and then with the 3 added equal 15?(0 votes)
- 2*(-6) actually equals -12. It is the same as taking (-6) + (-6) which is the same as -6 -6 which equals -12.(9 votes)