Brain Dump

Elementary Row Operations

Tags
math

Refers to the operations you can perform on simultaneous equations in matrix notation to help solve the simultaneous equation. These include:

  • Multiplying a row by a scalar.
  • Swapping the position of 2 rows.
  • Add a multiple of one row onto another.

Simultaneous Equations

Representing Simultaneous Equations example

First we should establish how you can represent a collection of simultaneous equations in matrices. Consider the simultaneous equations

\begin{align*} x + 4y + z &= 9 & 8x + y + 5z &= 35 & 2x - 2y -z &= 2 \end{align*}

These can equivalently be represented in matrix notation as

\begin{align} \label{eq:sim-eq-matrix-full} \begin{pmatrix}

1 &  4 &  1 \\\\
8 &  1 &  5 \\\\
2 & -2 & -1

\end{pmatrix}

         \begin{pmatrix}
           x \\\\
           y \\\\
           z
         \end{pmatrix}
  &=
    \begin{pmatrix}
      9  \\\\
      35 \\\\
      2
    \end{pmatrix}

\end{align}

To simplify calculations we often remove the variable vector and join the left hand side matrix with the right hand side vector. In the case of eq:sim-eq-matrix-full this would be

\begin{align} \label{eq:sim-eq-matrix} \left( \begin{array}{@ccc|c@}

1 &  4 &  1 & 9  \\\\
8 &  1 &  5 & 35 \\\\
2 & -2 & -1 & 2

\end{array} \right) \end{align}

Solving Simultaneous Equations example

To solve eq:sim-eq-matrix we need to get the far left matrix into the form of the identity matrix. This makes it so that each value on the vector on the right hand side is equivalent to the value of one of the variables \( x, y, z \) etc. We do this using elementary row operations, with descriptions of the operations we do at each step scribbled next to when we've done them.

The general process for this is:

  1. Get a one in the top left hand corner.
  2. Get a 0 in the in the remaining rows of the first column.

    \begin{align} \begin{array}{c}

                       \\\\
    R\_2' = R\_2 - 8 R\_1 \\\\
    R\_3' = R\_3 - 2 R\_1

    \end{array} \left( \begin{array}{@ccc|c@}

    1 &  4 &  1 & 9  \\\\
    8 &  1 &  5 & 35 \\\\
    2 & -2 & -1 & 2

    \end{array} \right) &= \left( \begin{array}{@ccc|c@}

    1 &   4 &  1 &   9  \\\\
    0 & -31 & -3 & -37 \\\\
    0 & -10 & -3 & -16

    \end{array} \right) \end{align}

  3. Get a 1 in the next diagonal along.

    \begin{align} \begin{array}{c} R_2' = \frac{1}{-31} R_2 \end{array} \left( \begin{array}{@ccc|c@}

    1 &   4 &  1 &   9 \\\\
    0 & -31 & -3 & -37 \\\\
    0 & -10 & -3 & -16

    \end{array} \right) &= \left( \begin{array}{@ccc|c@}

    1 &   4 &  1 &   9  \\\\
    0 &   1 & \frac{3}{31} & \frac{37}{31} \\\\
    0 & -10 & -3 & -16

    \end{array} \right) \end{align}

  4. Get a 0 in the in the remaining rows of the second column.

    \begin{align} \begin{array}{c}

    R\_1' = R\_1 - 4 R\_2 \\\\
    \\\\
    R\_3' = R\_3 + 10 R\_2

    \end{array} \left( \begin{array}{@ccc|c@}

    1 &   4 &  1 &   9  \\\\
    0 &   1 &  \frac{3}{31} & \frac{37}{31} \\\\
    0 & -10 & -3 & -16

    \end{array} \right) &= \left( \begin{array}{@ccc|c@}

    1 & 0 &  \frac{19}{31} & \frac{131}{31} \\\\
    0 & 1 &  \frac{3}{31}  & \frac{37}{31} \\\\
    0 & 0 & -\frac{63}{31} & -\frac{126}{31}

    \end{array} \right) \end{align}

  5. Get a 1 in the next diagonal along.

    \begin{align} \begin{array}{c}

    \\\\
    \\\\
    R\_3' = -\frac{31}{63} R\_3

    \end{array} \left( \begin{array}{@ccc|c@}

    1 & 0 &  \frac{19}{31} & \frac{131}{31} \\\\
    0 & 1 &  \frac{3}{31}  & \frac{37}{31} \\\\
    0 & 0 & -\frac{63}{31} & -\frac{126}{31}

    \end{array} \right) &= \left( \begin{array}{@ccc|c@}

    1 & 0 &  \frac{19}{31} & \frac{131}{31} \\\\
    0 & 1 &  \frac{3}{31}  & \frac{37}{31} \\\\
    0 & 0 & 1 & 2

    \end{array} \right) \end{align}

  6. Get a 0 in the in the remaining rows of the third column.

    \begin{align} \begin{array}{c}

    R\_1 = R\_1 - \frac{19}{31} R\_3 \\\\
    R\_2 = R\_2 - \frac{3}{31} R\_3 \\\\
    {}

    \end{array} \left( \begin{array}{@ccc|c@}

    1 & 0 &  \frac{19}{31} & \frac{131}{31} \\\\
    0 & 1 &  \frac{3}{31}  & \frac{37}{31} \\\\
    0 & 0 & 1 & 2

    \end{array} \right) &= \left( \begin{array}{@ccc|c@}

    1 & 0 & 0 & 3 \\\\
    0 & 1 & 0 & 1 \\\\
    0 & 0 & 1 & 2

    \end{array} \right) \end{align}

Inverting a Matrix

You can also use elementary row operations to invert a matrix. This works much like simultaneous equations except we equate it to the identity matrix instead of the output of the simultaneous equation. For example lets try to invert the matrix \[ \begin{pmatrix}1 & -1 & 1 \\ 2 & 3 & 1 \\ 5 & 4 & 3\end{pmatrix} \]

\begin{align} & \left( \begin{array}{@ccc|ccc@}

1 & -1 & 1 & 1 & 0 & 0 \\\\
2 &  3 & 1 & 0 & 1 & 0 \\\\
5 &  4 & 3 & 0 & 0 & 1

\end{array} \right) \
\begin{array}{c}

\\\\
R\_2' = R\_2 - 2 R\_1 \\\\
R\_3' = R\_3 - 5 R\_1

\end{array} & \left( \begin{array}{@ccc|ccc@}

1 & -1 & 1 & 1 & 0 & 0 \\\\
0 &  5 & -1 & -2 & 1 & 0 \\\\
0 & 9 & -2 & -5 & 0 & 1

\end{array} \right) \
\begin{array}{c}

R\_2' = \frac{1}{5} R\_2

\end{array} & \left( \begin{array}{@ccc|ccc@}

1 & -1 & 1 & 1 & 0 & 0 \\\\
0 &  1 & -\frac{1}{5} & -\frac{2}{5} & \frac{1}{5} & 0 \\\\
0 & 9 & -2 & -5 & 0 & 1

\end{array} \right) \
\begin{array}{c}

R\_1' = R\_1 + R\_2 \\\\
{} \\\\
R\_3' = R\_3 - 9 R\_2

\end{array} & \left( \begin{array}{@ccc|ccc@}

1 & 0 &  \frac{4}{5} & \frac{3}{5} & \frac{1}{5} & 0 \\\\
0 & 1 & -\frac{1}{5} & -\frac{2}{5} & \frac{1}{5} & 0 \\\\
0 & 0 & -\frac{1}{5} & -\frac{7}{5} & -\frac{9}{5} & 1

\end{array} \right) \
\begin{array}{c}

{} \\\\
{} \\\\
R\_3 = -5 R\_3

\end{array} & \left( \begin{array}{@ccc|ccc@}

1 & 0 &  \frac{4}{5} & \frac{3}{5} & \frac{1}{5} & 0 \\\\
0 & 1 & -\frac{1}{5} & -\frac{2}{5} & \frac{1}{5} & 0 \\\\
0 & 0 & 1            & 7 & 9 & -5

\end{array} \right) \
\begin{array}{c}

R\_1' = R\_1 - \frac{4}{5} R\_3 \\\\
R\_2' = R\_2 + \frac{1}{3} R\_3 \\\\
{}

\end{array} & \left( \begin{array}{@ccc|ccc@}

1 & 0 & 0 & -5 & -7 & 4 \\\\
0 & 1 & 0 & 1 & 2 & -1\\\\
0 & 0 & 1 & 7 & 9 & -5

\end{array} \right) \end{align}