# Elementary Row Operation/Examples/Operations on Arbitrary Matrix/Swap r1 and r2

## Example of Elementary Row Operation

Let $\mathbf A$ be the matrix:

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

Let the elementary row operation $e$ be applied to $\mathbf A$, where $e$ is defined as:

$e := r_1 \leftrightarrow r_2$

Then $\mathbf A$ is transformed into:

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

## Proof

From Elementary Row Operation: $r_1 \leftrightarrow r_2$, the elementary row matrix $\mathbf E$ corresponding to $e$ is:

$\mathbf E = \begin {pmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end {pmatrix}$
 $\ds \map e {\mathbf A}$ $=$ $\ds \mathbf E \mathbf A$ $\ds$ $=$ $\ds \begin {pmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end {pmatrix} \begin {pmatrix} 1 & 2 & 3 & 4 \\ 2 & -1 & 1 & 0 \\ -2 & 3 & 1 & 1 \end {pmatrix}$ $\ds$ $=$ $\ds \begin {pmatrix} 2 & -1 & 1 & 0 \\ 1 & 2 & 3 & 4 \\ -2 & 3 & 1 & 1 \end {pmatrix}$

$\blacksquare$