# Elementary Row Operations

Earlier we learnt that we can solve for unknown variables by substituting arbitrary values for the equation. You can $a_{1}x_{1} + a_{2}x_{2} = b_{1}$ by solving for $x$ or $y$ one at a time.

Now, a system of equations have $m$ equations which we change into a new system having same solution set but simplified and easy to solve. This is achieved by performing row operations on the augmented matrix.

### Row Operations

A row is a linear equation with $n$ unknown variables. You can perform following operations on any row in a system of equations.

• Multiply a row with a scalar i.e., non-zero constant.
• Add one row to another row. You are adding matching terms from one row to another.
• Interchange two rows

Multiply A Row With A Non-Zero Scalar

$A = \begin{bmatrix}1 & 3 & 8 \\ 2 & 1 & 1 \\ 7 & 4 & 1\end{bmatrix}$$A = \begin{bmatrix}1 & 3 & 8 \\ 2 & 1 & 1 \\ 7 & 4 & 1\end{bmatrix}$

Now, $row 1 ( R_{1} )$$row 1 ( R_{1} )$ is $\begin{bmatrix}1 & 3 & 8\end{bmatrix}$$\begin{bmatrix}1 & 3 & 8\end{bmatrix}$ which we multiply by 2.

$R_{1} \times 2 = \begin{bmatrix}1 & 3 & 8\end{bmatrix} \times 2$$R_{1} \times 2 = \begin{bmatrix}1 & 3 & 8\end{bmatrix} \times 2$

$A = \begin{bmatrix}2 & 6 & 16 \\ 2 & 1 & 1 \\ 7 & 4 & 1\end{bmatrix}$$A = \begin{bmatrix}2 & 6 & 16 \\ 2 & 1 & 1 \\ 7 & 4 & 1\end{bmatrix}$

Adding One Row To Another Row

$A = \begin{bmatrix}1 & 3 & 8 \\ 2 & 1 & 1 \\ 7 & 4 & 1\end{bmatrix}$$A = \begin{bmatrix}1 & 3 & 8 \\ 2 & 1 & 1 \\ 7 & 4 & 1\end{bmatrix}$

Row 1 is $\begin{bmatrix}1 & 3 & 8\end{bmatrix}$$\begin{bmatrix}1 & 3 & 8\end{bmatrix}$
Row 2 is $\begin{bmatrix}2 & 1 & 1\end{bmatrix}$$\begin{bmatrix}2 & 1 & 1\end{bmatrix}$

Therefore, we can add row 1 to row2 as
$R_{2} = R_{1} + R_{2} = \begin{bmatrix}2 + 1 & 1 + 3 & 1 + 8\end{bmatrix}$$R_{2} = R_{1} + R_{2} = \begin{bmatrix}2 + 1 & 1 + 3 & 1 + 8\end{bmatrix}$
$R_{2} = R_{1} + R_{2} = \begin{bmatrix}3 & 4 & 9\end{bmatrix}$$R_{2} = R_{1} + R_{2} = \begin{bmatrix}3 & 4 & 9\end{bmatrix}$

$A = \begin{bmatrix}1 & 3 & 8 \\ 3 & 4 & 9 \\ 7 & 4 & 1\end{bmatrix}$$A = \begin{bmatrix}1 & 3 & 8 \\ 3 & 4 & 9 \\ 7 & 4 & 1\end{bmatrix}$

Interchanging Rows

$A = \begin{bmatrix}1 & 3 & 8 \\ 2 & 1 & 1 \\ 7 & 4 & 1\end{bmatrix}$$A = \begin{bmatrix}1 & 3 & 8 \\ 2 & 1 & 1 \\ 7 & 4 & 1\end{bmatrix}$

Row 1 is $\begin{bmatrix}1 & 3 & 8\end{bmatrix}$$\begin{bmatrix}1 & 3 & 8\end{bmatrix}$
Row 2 is $\begin{bmatrix}2 & 1 & 1\end{bmatrix}$$\begin{bmatrix}2 & 1 & 1\end{bmatrix}$

$R_{1} \longleftrightarrow R_{2} = \begin{bmatrix}1 & 3 & 8\end{bmatrix} \longleftrightarrow \begin{bmatrix}2 & 1 & 1\end{bmatrix}$$R_{1} \longleftrightarrow R_{2} = \begin{bmatrix}1 & 3 & 8\end{bmatrix} \longleftrightarrow \begin{bmatrix}2 & 1 & 1\end{bmatrix}$

$A = \begin{bmatrix}2 & 1 & 1 \\ 1 & 3 & 8 \\ 7 & 4 & 1\end{bmatrix}$$A = \begin{bmatrix}2 & 1 & 1 \\ 1 & 3 & 8 \\ 7 & 4 & 1\end{bmatrix}$

### Solving System Of Linear Equations Using Row Operations

The elementary row operations can be used to solve system of linear equations. For example,

Problem #1 : Solve the following system of equations.
------------------------------------------------------------
$2x_1 + 3x_2 + x_3 = 5$$2x_1 + 3x_2 + x_3 = 5$
$5x_1 - 2x_2 + 3x_3 = 6$$5x_1 - 2x_2 + 3x_3 = 6$
$x_1 + 2x_2 - x_3 = 2$$x_1 + 2x_2 - x_3 = 2$

Solution:
-------------
First we need to convert the system of equation into augmented matrix.

$A = \begin{bmatrix}2 & 1 & 1 & 4\\ 2 & -2 & 3 & 3\\ 1 & 2 & -1 & 2\end{bmatrix}$$A = \begin{bmatrix}2 & 1 & 1 & 4\\ 2 & -2 & 3 & 3\\ 1 & 2 & -1 & 2\end{bmatrix}$

-> INTERCHANGE ROW 1 WITH ROW 3

$R_3 \longleftrightarrow R_1 = \begin{bmatrix} 1 & 2 & -1 & 2\\ 2 & -2 & 3 & 3\\ 2 & 1 & 1 & 4\end{bmatrix}$$R_3 \longleftrightarrow R_1 = \begin{bmatrix} 1 & 2 & -1 & 2\\ 2 & -2 & 3 & 3\\ 2 & 1 & 1 & 4\end{bmatrix}$

-> SUBTRACT ROW 2 FROM ROW 3

$R_3 = R_3 - R_2 = \begin{bmatrix}2-2 & 1+2 & 1-3 & 4-3\end{bmatrix}$$R_3 = R_3 - R_2 = \begin{bmatrix}2-2 & 1+2 & 1-3 & 4-3\end{bmatrix}$

$A = \begin{bmatrix} 1 & 2 & -1 & 2\\ 2 & -2 & 3 & 3\\ 0 & 3 & -2 & 1\end{bmatrix}$$A = \begin{bmatrix} 1 & 2 & -1 & 2\\ 2 & -2 & 3 & 3\\ 0 & 3 & -2 & 1\end{bmatrix}$

-> MULTIPLY R_1 BY 2

$A = \begin{bmatrix} 2 & 4 & -2 & 4\\ 2 & -2 & 3 & 3\\ 0 & 3 & -2 & 1\end{bmatrix}$$A = \begin{bmatrix} 2 & 4 & -2 & 4\\ 2 & -2 & 3 & 3\\ 0 & 3 & -2 & 1\end{bmatrix}$

-> SUBTRACT ROW 1 FROM ROW 2

$R_2 = R_2 - R_1 = \begin{bmatrix}2-2 & -2-4 & 3+2 & 3-4 \end{bmatrix}$$R_2 = R_2 - R_1 = \begin{bmatrix}2-2 & -2-4 & 3+2 & 3-4 \end{bmatrix}$

$A = \begin{bmatrix} 2 & 4 & -2 & 4\\ 0 & -6 & 5 & -1\\ 0 & 3 & -2 & 1\end{bmatrix}$$A = \begin{bmatrix} 2 & 4 & -2 & 4\\ 0 & -6 & 5 & -1\\ 0 & 3 & -2 & 1\end{bmatrix}$

-> MULTIPLY ROW 3 BY 2

$A = \begin{bmatrix} 2 & 4 & -2 & 4\\ 0 & -6 & 5 & -1\\ 0 & 6 & -4 & 2\end{bmatrix}$$A = \begin{bmatrix} 2 & 4 & -2 & 4\\ 0 & -6 & 5 & -1\\ 0 & 6 & -4 & 2\end{bmatrix}$

-> SUBTRACT ROW 2 FROM ROW 3

$R_3 = R_2 - R_2 = \begin{bmatrix}2 & 4 & -2 & 4\\ 0 & -6 & 5 & -1\\ 0 & 0 & 1 & 1\end{bmatrix}$$R_3 = R_2 - R_2 = \begin{bmatrix}2 & 4 & -2 & 4\\ 0 & -6 & 5 & -1\\ 0 & 0 & 1 & 1\end{bmatrix}$

Convert the matrix back to system of equations.

$2x_1 + 4x_2 + -2x_3 = 4$$2x_1 + 4x_2 + -2x_3 = 4$
$-6x_2 + 5x_3 = -1$$-6x_2 + 5x_3 = -1$
$x_3 = 1$$x_3 = 1$

Now we will use something called back-substitution and find $x_1$ and $x_2$.

Given the following
$2x_1 + 4x_2 + -2x_3 = 4$$2x_1 + 4x_2 + -2x_3 = 4$
$-6x_2 + 5x_3 = -1$$-6x_2 + 5x_3 = -1$
$x_3 = 1$$x_3 = 1$

Solve for $x_2$$x_2$
$-6x_2 + 5(1) = -1$$-6x_2 + 5(1) = -1$
$-6x_2 + 5 - 5 = -1 - 5$$-6x_2 + 5 - 5 = -1 - 5$
$-6x_2 = -6$$-6x_2 = -6$
Therefore, $x_2 = 1$$x_2 = 1$

Solve for $x_1$$x_1$
$2x_1 + 4(1) - 2(1) = 4$$2x_1 + 4(1) - 2(1) = 4$
$2x_1 + 4 - 2 = 4$$2x_1 + 4 - 2 = 4$
$2x_1 + 2 = 4$$2x_1 + 2 = 4$
$2x_1 + 2 - 2 = 4 - 2$$2x_1 + 2 - 2 = 4 - 2$
$2x_1 = 2$$2x_1 = 2$
$x_1 = 1$$x_1 = 1$

In the next post, we will discuss more about how to solve the system of linear equations using row operations.