Math 1410, Spring 2020

Gaussian Elimination

February 4, 2020

Sean Fitzpatrick
University of Lethbridge

Recap

Warm-up

What can you say about the set of solutions to each pair of equations below? (You might find it helpful to sketch the lines.)

  1. \begin{align*} x - 2y \amp = 5\\ -4x + 8y \amp =-10 \end{align*}

  2. \begin{align*} 4x + y \amp =6\\ 12x + 3y \amp =18 \end{align*}

  3. \begin{align*} 3x-y \amp =4\\ x+2y \amp =2 \end{align*}

Elementary row operations

The augmented matrix

If we're going to be solving lots of linear systems (and we are), then it gets tedious quickly to keep track of all the variables.

A “key idea”: write only the coefficients, and keep track of variables by position. We organize everything in a rectangular array, called a matrix.

Example:

System of equations:

\begin{equation*} \begin{matrix}2x \amp - \amp y \amp + \amp 4z \amp = \amp 7\\-5x \amp + \amp 7y \amp + \amp 8z \amp = \amp 11\\3x \amp - \amp 2y \amp + \amp 81z \amp = \amp 12\end{matrix} \end{equation*}

Augmented matrix:

\begin{equation*} \bam{ccc|c}2 \amp -1 \amp 4 \amp 7\\-5 \amp 7 \amp 8 \amp 11\\3 \amp -2 \amp 81 \amp 12\eam\text{.} \end{equation*}

From matrix to system

It's important to be able to convert in both directions:

Example:

Write down the system (in variables \(x_1,x_2,x_3,x_4\)) corresponding to the augmented matrix

\begin{equation*} \left[\begin{array}{cccc|c}3 \amp -2 \amp 1 \amp 4 \amp 6\\1 \amp 0 \amp 2 \amp -7 \amp 12\\0 \amp 3 \amp 4 \amp 0 \amp -38\end{array}\right]\text{.} \end{equation*}

Elementary row operations

There are three elementary operations on the rows of a matrix, corresponding to the elementary operations on equations:

  1. Swap any two rows: write \(R_i\leftrightarrow R_j\)

  2. Multiply a row by a nonzero constant (rescale): write \(cR_j\to R_j\)

  3. Add a multiple of one row to another: write \(R_i+cR_j \to R_i\)

Gaussian elimination

There is a standard algorithm for solving a system using row operations:

  • By swapping rows and/or rescaling, get a 1 in row 1, column 1.

    (This is possible unless column 1 consists entirely of zeros.)

  • By adding multiples of row 1 to the other rows, create zeros in all other entries of column 1.

  • Move to row 2, column 2, and repeat (until you reach the last row or column).

Example

For the system below, write down the augmented matrix, and use Gaussian elimination to simplify.

\begin{equation*} \begin{matrix} 2x \amp - \amp 4y \amp + \amp 2z \amp = \amp 8\\ x \amp- \amp 3y \amp - \amp z \amp = \amp 5\\ -x \amp + \amp 2y \amp + \amp z \amp = \amp 3 \end{matrix} \end{equation*}
Then, solve the system, if possible.

Avoiding pitfalls

  • Be careful of minus signs!

  • Once first column looks like \(\bbm 1\\0\\0\\ \vdots \\0\ebm\text{,}\) stop using \(R_1\text{!}\)

  • To get next leading one, either divide, or use rows below.

Reduced row-echelon form

RREF

How do we know when to stop the algorithm?

  • Gaussian elimination works down and to the right, creating zeros and leading ones.

  • Once each row “starts” with a leading one (first nonzero entry), and leading ones in lower rows are to the right of leading ones in higher rows, (only zeros below each leading one) you're in row-echelon form.

  • Row-echelon form is not unique. From any REF you can probably solve by back-substitution.

  • Eliminating non-zero entries above each leading one leads to reduced row-echelon form. This is unique, and as simplified as possible.

Examples

Which matrices are in REF? RREF? If neither, what's the next step?

\begin{equation*} \bbm 2 \amp 1 \amp 0\\0\amp 1\amp 2\\0\amp 0\amp 1\ebm \qquad \bbm 1 \amp 0 \amp -2\\0\amp 1 \amp 3\\0\amp 0\amp 0\ebm \qquad \bbm 1\amp 0 \amp 1\\0\amp 0\amp 1\\0\amp 0\amp 0\ebm \end{equation*}
\begin{equation*} \bam{ccc|c}1\amp 0 \amp 2\amp 3\\0\amp 1\amp -1\amp 1\\0\amp 0\amp 0\amp 1\eam \qquad \bam{cccc|c}0 \amp 1\amp 0\amp 0\amp -2\\0\amp 0\amp 1\amp 1\amp 3\\0\amp 0\amp 0\amp 2\amp 1\\0\amp 0\amp 0\amp 0\amp 0\eam \end{equation*}

Gauss-Jordan Elimination

  • Forward steps: perform Gaussian elimination to reach row-echelon form.

    • You could solve by back substitution at this stage.

    • (If there's no solution, you should already be able to tell.)

    • Back substitution can be tricky if there are parameters involved.

  • Backward steps: starting with right-most leading one, create zeros above, working up and to the left.

Examples

Example 1

Solve the system:

\begin{equation*} \begin{array}{ccccccc} 2x\amp - \amp y\amp +\amp 4z\amp =\amp 3\\ x \amp - \amp y\amp +\amp 2z\amp =\amp -2\\ -2x\amp + \amp 3y \amp - \amp z\amp =\amp 0 \end{array} \end{equation*}

Example 2

Solve the system:

\begin{equation*} \begin{array}{ccccccc} x\amp - \amp 2y \amp + \amp 3z\amp = \amp 4\\ 2x\amp - \amp 3y \amp +\amp 4z \amp = \amp -1\\ x \amp -\amp 3y \amp + \amp 5z \amp = \amp 13 \end{array} \end{equation*}