# Matrix Row Operations

There are 3 basic operations used on the rows of a matrix when you are using the matrix to solve a system of linear equations . The goal is usually to get the left part of the matrix to look like the identity matrix .

The three operations are:

• Switching Rows
• Multiplying a Row by a Number

## Switching Rows

You can switch the rows of a matrix to get a new matrix.

$\begin{array}{rrr}\hfill \left[\begin{array}{rrrr}\hfill 2& \hfill 3& \hfill -2& \hfill 6\\ \hfill 0& \hfill 0& \hfill 3& \hfill -6\\ \hfill 1& \hfill 0& \hfill 2& \hfill -3\end{array}\right]& \hfill \to & \hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 2& \hfill 3& \hfill -2& \hfill 6\\ \hfill 0& \hfill 0& \hfill 3& \hfill -6\end{array}\right]\end{array}$

In the example shown above, we move Row $1$ to Row $2$ , Row $2$ to Row $3$ , and Row $3$ to Row $1$ . (The reason for doing this is to get a $1$ in the top left corner.)

## Multiplying a Row by a Number

You can multiply any row by a number. (This means multiplying every entry in the row by the same number.)

$\begin{array}{rrr}\hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 2& \hfill 3& \hfill -2& \hfill 6\\ \hfill 0& \hfill 0& \hfill 3& \hfill -6\end{array}\right]& \hfill \stackrel{{R}_{3}:\frac{1}{3}{R}_{3}}{\to }& \hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 2& \hfill 3& \hfill -2& \hfill 6\\ \hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]\end{array}$

In this example, we have multiplied Row $3$ of the matrix by $\frac{1}{3}$ . (This gives us the $1$ we need in Row $3$ , Column $3$ .)

You can also add two rows together, and replace a row with the result.

For example, in the matrix that resulted in the last example, we can add rows $2$ and $3$ together, entry by entry:

$\begin{array}{l}\hfill \underset{_}{\begin{array}{rr}\hfill & \hfill \left[\begin{array}{rrrr}\hfill 2& \hfill 3& \hfill -2& \hfill 6\end{array}\right]\\ \hfill +& \hfill \\ \hfill & \hfill \left[\begin{array}{rrrr}\hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]\end{array}}\\ \hfill \begin{array}{rr}\hfill & \hfill \left[\begin{array}{rrrr}\hfill 2& \hfill 3& \hfill -1& \hfill 4\end{array}\right]\end{array}\end{array}$

Then, we replace Row $2$ with the result.

$\begin{array}{rrr}\hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 2& \hfill 3& \hfill -2& \hfill 6\\ \hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]& \hfill \stackrel{{R}_{2}:\text{\hspace{0.17em}}{R}_{2}+{R}_{3}}{\to }& \hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 2& \hfill 3& \hfill -1& \hfill 4\\ \hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]\end{array}$

We said there were only three operations, and there are. But by using the last two operations in combination, we can add whole multiples of rows to other rows, to make things go faster.

Back up a step, so we have the matrix:

$\left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 2& \hfill 3& \hfill -2& \hfill 6\\ \hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]$

Now instead of just adding Row $2$ + Row $3$ , add Row :

$\begin{array}{l}\hfill \underset{_}{\begin{array}{rr}\hfill & \hfill \left[\begin{array}{rrrr}\hfill 2& \hfill 3& \hfill -2& \hfill 6\end{array}\right]\\ \hfill +& \hfill \\ \hfill & \hfill \left[\begin{array}{rrrr}\hfill 0& \hfill 0& \hfill 2& \hfill -4\end{array}\right]\end{array}}\\ \hfill \begin{array}{rr}\hfill & \hfill \text{\hspace{0.17em}}\text{\hspace{0.17em}}\left[\begin{array}{rrrr}\hfill 2& \hfill 3& \hfill 0& \hfill 2\end{array}\right]\end{array}\end{array}$

Then replace Row $2$ with the result.

$\begin{array}{rrr}\hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 2& \hfill 3& \hfill -2& \hfill 6\\ \hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]& \hfill \stackrel{{R}_{2}:\text{\hspace{0.17em}}{R}_{2}+2{R}_{3}}{\to }& \hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 2& \hfill 3& \hfill 0& \hfill 2\\ \hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]\end{array}$

This way, we get a $0$ in Row $2$ , Column $3$ .

We can do this again to get a $0$ in Row $2$ , Column $1$ . Here, we multiply Row $1$ by $-2$ , add it Row $2$ , and replace Row $2$ with the result.

$\begin{array}{rrr}\hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 2& \hfill 3& \hfill 0& \hfill 2\\ \hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]& \hfill \stackrel{{R}_{2}:\text{\hspace{0.17em}}-2{R}_{1}+{R}_{2}}{\to }& \hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 0& \hfill 3& \hfill -4& \hfill 8\\ \hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]\end{array}$

We'll show a few more steps, to get the $3×3$ identity matrix on the left (and thus solve the system).

The next step is to add to get a $0$ in Row $2$ , Column $3$ .

$\begin{array}{rrr}\hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 0& \hfill 3& \hfill -4& \hfill 8\\ \hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]& \hfill \stackrel{{R}_{2}:\text{\hspace{0.17em}}{R}_{2}+4{R}_{3}}{\to }& \hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 0& \hfill 3& \hfill 0& \hfill 0\\ \hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]\end{array}$

Next, we need a zero in Row $1$ , Column $3$ .

$\begin{array}{rrr}\hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 2& \hfill -3\\ \hfill 0& \hfill 3& \hfill 0& \hfill 0\\ \hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]& \hfill \stackrel{{R}_{1}:\text{\hspace{0.17em}}{R}_{1}-2{R}_{3}}{\to }& \hfill \left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 0& \hfill 1\\ \hfill 0& \hfill 3& \hfill 0& \hfill 0\\ \hfill 0& \hfill 0& \hfill 1& \hfill -2\end{array}\right]\end{array}$

The last step is just an application of the second operation, multiplying a row by a number.

$\left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 0& 1\\ \hfill 0& \hfill 3& \hfill 0& 0\\ \hfill 0& \hfill 0& \hfill 1& -2\end{array}\right]\stackrel{\frac{1}{3}{R}_{3}}{\to }\left[\begin{array}{rrrr}\hfill 1& \hfill 0& \hfill 0& 1\\ \hfill 0& \hfill 1& \hfill 0& 0\\ \hfill 0& \hfill 0& \hfill 1& -2\end{array}\right]$

We now have the solution as ordered triple $\left(1,0,-2\right)$ .

Important Note: If the equations represented by your original matrix represent identical or parallel lines, you will not be able to get the identity matrix using these row operations. In this case, the solution either does not exist or there are infinitely many solutions to the system.