Intro to Gauss Elimination
Contents
Intro to Gauss Elimination#
Return to Systems of Equations#
Now that we understand matrix multiplication, let’s go back to linear systems of equations:
This is an \(mxn\) matrix multiplied by a nx1 vector, resulting in an mx1 vector. An example is the same system of equations we’ve solved before:
We’ve talked a lot about how we were going to use linear algebra to solve systems of equations, so it’s time to actually solve them!
Gauss Elimination#
This is a standard method for solving linear systems. It is not the only way you can do it. Let’s do an example without matrices first:
or
Let’s first solve for one variable, then solve for the other using back substitution
One approach is to multiple first equation by 2, then subtract the second equation:
We can now use this result to find that \(x_1=6\). After some operations, we arrived at the system of equations:
This approach involved manipulation of whole equations, one at a time.
Elementary Operation for Equations#
These are allowed when solving equations:
Interchange of two equations (no effect!)
Addition or subtraction of one equation with another
Multiplication of an equation by a non-zero constant. Q: Why is this only for non-zero?
This is essentially the rules for Gauss elimination but with equations instead of matricies. Let’s do them side by side. The same elementary operations apply to matrices, just substitute “equation” for “row”!
Examples#
Standard system of linear system of equations:
Form the augmented matrix#
First, we represent this as \(\arr{A}\) and \(\vec{b}\)
We then form an augmented matrix \(\arr{\tilde{A}}=[\arr{A}:\vec{b}]\):
Augmented matrix to upper triangular form#
Example procedure for Gauss Elimination
Let’s swap rows two and three
Subtract row 1 from row 2 and replace row 2
Add rows 2 and 3 to replace row 3
This matrix is now in upper triangular form! Only the diagonal and things above it are occupied. Notice it would now be pretty easy to solve this system.
Upper triangular to row echelon form#
Divide row 3 by 2 and row 2 by -4
The matrix is now in “row echelon” or “echelon” form!
The first non-zero entry of each row is 1
Any rows of all zeros must be at the bottom of the matrix
Rows with more leading zeros must be underneath those with less
We could solve this pretty easily but it would still take some algebra. Almost there!
Echelon to reduced row echelon form#
Add rows 2&3 to replace row 2
Add rows 1&3 to replace row 1
Subtract 2x row 2 from row 1 to replace row 1
The “solved” matrix is now in “reduced row echelon form” or “reduced echelon” form.
Satisfies the definition of echelon form
AND the 1st non-zero entry in each row is the only non-zero entry in each column!
Summary of steps#
Convert equations into an augmented matrix
Put the matrix in upper triangular form
Start by converting element \(a_{11}\) to a 1
Use row 1 to convert elements \(a_{j1}\) to zeros
Convert any other elements below the diagonal to zero if possible
Put matrix in echelon form by converting diagonal elements to 1
Put matrix in reduced row echelon form by converting as many elements above the diagonal as possible to zero
In-class example#
Convert the following system of equations to reduced row echelon form
Solution#
Form \([\arr{A}|\vec{b}]\)
\(R_1=1/2R_1\)
\(R_2=R_2-3R_1\) Upper triangular!
\(R_2=-1/7R_2\) Echelon form!
\(R_1=R_1-2R_2\) Reduced echelon!
Final solution:
Last thing: check that this solution works for each equation!
Gauss elimination as a test for linear independence#
In addition to solving sets of linear equations, Gauss elimination is a powerful way to look for linear independence
For example, \(x_1+3x_2=-1\) and \(2x_1+6x_2=-2\) are not linearly independent. That is, they both contain the same information!
For equations and variables, systems can be:
Underdetermined: Less equations than unknowns (m<n)
Overdetermined: More equations that unknowns (m>n)
Determined Same # of equations as unknowns (m=n)
Gauss elimination will work for all of these scenarios
Possible solution scenarios are:
Infinite solutions
A unique solution
No solution
For two unknowns, we can draw this as lines:
For two unknowns, we either have 0, 1, or infinited solutions (can’t have 2 solutions for example)
Examples for underdetermined systems#
Example 1#
Three equations, five unknowns. Suspicious!
Let’s get this to reduced echelon form:
Form \([\arr{A}|\vec{b}]\)
\(R_2=R_2-R_1\), \(R_3=R_3-R_1\)
\(R_3=R_3-R_2\) Echelon form!
Notice that there are extra blocks of zeros in row 2/3. This will lead to infinite solutions!
\(R_1=R_1-R_3\), \(R_2=R_2-R_3\)
\(R_1=R_1-R_2\) Reduced echelon!
This corresponds to the system of equations
This means that the solution vector
for any values \(\alpha, \beta\)!!.
There are an infinite number of solutions, which is usually but not always the case with an underdetermined system!
Example 2#
Let’s do another example!
Two equations, three unknowns
Form \([\arr{A}|\vec{b}]\)
\(R_2=R_2-2R_1\)
\(0\neq 1\), so there is no solution and this is an inconsistent system!!!
Overdetermined systems#
Example 1#
Three equations, two unknowns. Suspicious!
Form \([\arr{A}|\vec{b}]\)
\(R_2=R_2-R_1\), \(R_3=R_3-R_1\)
\(R_3=R_3-1/2R_2\), \(R_2=1/2R_2\)
Note the last equation doesn’t really have any information!
\(R_1=R_1-2R_2\)
The solution is thus \(x_1=-3, x_2=2\). One unique solution!
Example 2#
Four equations, three unknowns. Suspicious!
Form \([\arr{A}|\vec{b}]\)
\(R_2=R_2-2R_1\), \(R_3=R_3-4R_1\), \(R_4=R_4-3R_1\)
\(R_2=-1/5R_2\), \(R_3=R_3-R_2\), \(R_4=R_4-R_2\)
\(R_1=R_1-2R_2\)
This corresponds to
The solution can be written as
Infinite number of solutions!!
Example 3#
Three equations, two unknowns. Suspicious!
Form \([\arr{A}|\vec{b}]\)
\(R_2=R_2-R_1\), \(R_3=R_3+R_1\)
\(R_2=\frac{-1}{2}R_2\), \(R_3=R_3/3\)
\(R_3=R_3-R_2\)
\(0\neq -2/3\). Inconsistent, no solutions!!
Final notes#
Underdetermined systems
Often infinite solutions
Can be infinite, no solution, or one solution
Over-determined system
Often no solution
Can be infinite, no solution, or one solution
Determined system
Often one solution
Can be infinite, no solution, or one solution
Homogeneous systems (when \(\vec{b}=0\)) always has at least one solution! (\(\vec{x}=\vec{0}\))