lesson 9: gaussian elimination
TRANSCRIPT
Lesson 9Gaussian Elimination (KH, Section 1.6)
Math 20
October 10, 2007
Announcements
I Problem Set 4 will be on the course web site today. Due10/17
I Prob. Sess.: Sundays 6–7 (SC B-10), Tuesdays 1–2 (SC 116)
I OH Mon 1–2, Tues 3–4, Weds 1–3 (SC 323)
I Midterm I 10/18, Hall A 7–8:30pm
I Review Session (ML), 10/16, 7:30–9:30 Hall E
Systems of Linear equations
Any set (system) of equations involving one or more variables, inwhich each equation involves a linear combination of the variables.
Example
Here is a single linear equation in one variable:
4x + 2 = 6
SolutionSubtract 2 from each side and you get 4x = 4. Divide both sidesby 4 and you get x = 1.
Systems of Linear equations
Any set (system) of equations involving one or more variables, inwhich each equation involves a linear combination of the variables.
Example
Here is a single linear equation in one variable:
4x + 2 = 6
SolutionSubtract 2 from each side and you get 4x = 4. Divide both sidesby 4 and you get x = 1.
Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007
Page7of17
Systems of Linear equations
Any set (system) of equations involving one or more variables, inwhich each equation involves a linear combination of the variables.
Example
Here is a single linear equation in one variable:
4x + 2 = 6
SolutionSubtract 2 from each side and you get 4x = 4. Divide both sidesby 4 and you get x = 1.
Two equations in two variables
Example
Solve 2x + y = 3, x + 2y = 0.
Solutionx = 2, y = −1.
Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007
Page8of17
Two equations in two variables
Example
Solve 2x + y = 3, x + 2y = 0.
Solutionx = 2, y = −1.
Three equations in three variables
Example
Solve the system of linear equations
2x2 − 3x3 = 4−2x1 + x2 + 2x3 = −6
2x1 + x3 = 0
The more variables you get, the bigger the need for a systematicway of solving systems of linear equations.
Three equations in three variables
Example
Solve the system of linear equations
2x2 − 3x3 = 4−2x1 + x2 + 2x3 = −6
2x1 + x3 = 0
The more variables you get, the bigger the need for a systematicway of solving systems of linear equations.
The Matrix viewpoint on SLEs
A system of m equations in n variables looks like:
a11x1 + a12x2 + . . . + a1nxn = b1
a21x1 + a22x2 + . . . + a2nxn = b2...
.... . .
......
am1x1 + am2x2 + . . . + amnxn = bm
The operative data are the coefficients and the right-hand sides.We can summarize it like this:
a11 a12 . . . a1n
a21 a22 . . . a2n...
.... . .
...am1 am2 . . . amn
x1
x2...xn
=
b1
b2...
bn
, or Ax = b
Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007
Page9of17
The augmented matrix
In fact, we can express the whole system of linear equations in asingle matrix, called the augmented matrix:
a11 a12 . . . a1n b1
a21 a22 . . . a2n b2...
.... . .
......
am1 am2 . . . amn bm
Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007
Page10of17
Operations on systems of equations
Here are some facts about systems of equations.
1. Transposing equations doesn’t change their solution.
2. Scaling an equation doesn’t change its solution.
3. If a set of numbers satisfies two equations, then it also satisfiesthe equation which is one plus a scalar multiple of the other.
A simpler form might be
3’. If a set of numbers satisfies two equations, it satisfies the sumof the two equations.
Operations on systems of equations
Here are some facts about systems of equations.
1. Transposing equations doesn’t change their solution.
2. Scaling an equation doesn’t change its solution.
3. If a set of numbers satisfies two equations, then it also satisfiesthe equation which is one plus a scalar multiple of the other.
A simpler form might be
3’. If a set of numbers satisfies two equations, it satisfies the sumof the two equations.
Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007
Page11of17
Row Operations
The operations on systems of linear equations are reflected in theaugmented matrix, too.
1. Transposing (switching) rows in an augmented matrix doesnot change the solution.
2. Scaling any row in an augmented matrix does not change thesolution.
3. Adding to any row in an augmented matrix any multiple ofany other row in the matrix does not change the solution.
The Process of Gaussian Elimination
We’ll solve the system of linear equations
2x2 − 3x3 = 4−2x1 + x2 + 2x3 = −6
2x1 + x3 = 0
The augmented matrix is 0 2 −3 4−2 1 2 −6
2 0 1 0
Transpose the first and third equations: 0 2 − 3 4− 2 1 2 − 62 0 1 0
←−
←−
2 0 1 0− 2 1 2 − 60 2 − 3 4
Now we can add the first row to the second and get another zeroin that column. 2 0 1 0
− 2 1 2 − 60 2 − 3 4
←−+
2 0 1 00 1 3 − 60 2 − 3 4
Transpose the first and third equations: 0 2 − 3 4− 2 1 2 − 62 0 1 0
←−
←−
2 0 1 0− 2 1 2 − 60 2 − 3 4
Now we can add the first row to the second and get another zeroin that column. 2 0 1 0
− 2 1 2 − 60 2 − 3 4
←−+
2 0 1 00 1 3 − 60 2 − 3 4
We add (-2) times the second row to the third row.2 0 1 00 1 3 − 60 2 − 3 4
←−
−2
+
2 0 1 00 1 3 − 60 0 − 9 16
This matrix is in row echelon form. The corresponding SLE canbe solved by back-substitution.
We add (-2) times the second row to the third row.2 0 1 00 1 3 − 60 2 − 3 4
←−
−2
+
2 0 1 00 1 3 − 60 0 − 9 16
This matrix is in row echelon form. The corresponding SLE canbe solved by back-substitution.
Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007
Page14of17
2 0 1 00 1 3 − 60 0 − 9 16
Since −9x3 = 16, we have x3 = −16
9 . Substituting this into thesecond equation gives
x2 −48
9= −6 = −54
9=⇒ x2 =
−6
9= −2
3.
Finally, we have
2x1 −16
9= 0 =⇒ x1 =
8
9.
More Gaussian Elimination: The “backward pass”
Starting with the last matrix above, we scale the last row by −19 :2 0 1 0
0 1 3 − 60 0 − 9 16
| − 1
9
2 0 1 00 1 3 − 60 0 1 − 16
9
Now we can zero out the third column above that bottom entry,by adding (-3) times the third row to the second row, then adding(-1) times the third row to the first row.2 0 1 0
0 1 3 − 60 0 1 − 16
9
←−−3
+
←−−−−
−1
+
2 0 0 169
0 1 0 − 69
0 0 1 − 169
More Gaussian Elimination: The “backward pass”
Starting with the last matrix above, we scale the last row by −19 :2 0 1 0
0 1 3 − 60 0 − 9 16
| − 1
9
2 0 1 00 1 3 − 60 0 1 − 16
9
Now we can zero out the third column above that bottom entry,by adding (-3) times the third row to the second row, then adding(-1) times the third row to the first row.2 0 1 0
0 1 3 − 60 0 1 − 16
9
←−−3
+
←−−−−
−1
+
2 0 0 169
0 1 0 − 69
0 0 1 − 169
The top row can be scaled by 12 , and we finally have2 0 0 16
90 1 0 − 6
90 0 1 − 16
9
| 12
1 0 0 89
0 1 0 − 69
0 0 1 − 169
This matrix is said to be in reduced row echelon form.
And there you go; the solutions are staring you in the face!
The top row can be scaled by 12 , and we finally have2 0 0 16
90 1 0 − 6
90 0 1 − 16
9
| 12
1 0 0 89
0 1 0 − 69
0 0 1 − 169
This matrix is said to be in reduced row echelon form.And there you go; the solutions are staring you in the face!
Gaussian Elimination
1. Locate the first nonzero column. This is pivot column, andthe top row in this column is called a pivot position.Transpose rows to make sure this position has a nonzero entry.If you like, scale the row to make this position equal to one.
2. Use row operations to make all entries below the pivotposition zero.
3. Repeat Steps 1 and 2 on the submatrix below the first rowand to the right of the first column. Finally, you will arrive ata matrix in row echelon form. (up to here is called theforward pass)
4. Scale the bottom row to make the leading entry one.
5. Use row operations to make all entries above this entry zero.
6. Repeat Steps 4 and 5 on the submatrix formed above and tothe left of this entry. (These steps are called the backwardpass)
Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007
Page15of17
So to solve a SLE:
I Form the augmented matrix.
I reduce this matrix to (R)REF.
I read off the solution.
Meet the Mathematician
I German
I “the prince ofmathematicians”
I Proved FTA four times
I Invented least-squaresmethod
I Predicted motion ofplanets
Carl Friedrich Gauss1777–1855
Questions
Suppose the matrix0 3 −6 6 4 −53 −7 8 −5 8 93 −9 12 −9 6 15
is given as the augmented matrix to a system of linear equations.How do we interpret the solution from the RREF?
1 0 −2 3 0 −240 1 −2 2 0 −70 0 0 0 1 4
Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007
Page16of17
Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007
Page17of17
Questions
Suppose the matrix0 3 −6 6 4 −53 −7 8 −5 8 93 −9 12 −9 6 15
is given as the augmented matrix to a system of linear equations.How do we interpret the solution from the RREF?1 0 −2 3 0 −24
0 1 −2 2 0 −70 0 0 0 1 4
The system of linear equations is
x1 − 2x3 + 3x4 = −24x2 − 2x3 + 2x4 = −7
x5 = 4
orx1 = −24 + 2s − 3t
x2 = −7 + 2s − 2t
x3 = s
x4 = t
x5 = 4
Here s and t can be anything we want and we can construct asolution out of them. x3 and x4 are known as free variables; theycan take any value.We see free variables in the RREF as the columns with no leadingentry.
The system of linear equations is
x1 − 2x3 + 3x4 = −24x2 − 2x3 + 2x4 = −7
x5 = 4
orx1 = −24 + 2s − 3t
x2 = −7 + 2s − 2t
x3 = s
x4 = t
x5 = 4
Here s and t can be anything we want and we can construct asolution out of them. x3 and x4 are known as free variables; theycan take any value.
We see free variables in the RREF as the columns with no leadingentry.
The system of linear equations is
x1 − 2x3 + 3x4 = −24x2 − 2x3 + 2x4 = −7
x5 = 4
orx1 = −24 + 2s − 3t
x2 = −7 + 2s − 2t
x3 = s
x4 = t
x5 = 4
Here s and t can be anything we want and we can construct asolution out of them. x3 and x4 are known as free variables; theycan take any value.We see free variables in the RREF as the columns with no leadingentry.
QuestionWhat if the RREF of the matrix were1 0 −2 3 0 −24
0 1 −2 2 0 −70 0 0 0 0 1
What would be the solutions to the associated system now?
Answer.The bottom row represents the equation 0 = 1, which has nosolution. This system of equations is inconsistent.
QuestionWhat if the RREF of the matrix were1 0 −2 3 0 −24
0 1 −2 2 0 −70 0 0 0 0 1
What would be the solutions to the associated system now?
Answer.The bottom row represents the equation 0 = 1, which has nosolution. This system of equations is inconsistent.