lesson 9: gaussian elimination

42
Lesson 9 Gaussian Elimination (KH, Section 1.6) Math 20 October 10, 2007 Announcements I Problem Set 4 will be on the course web site today. Due 10/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

Upload: matthew-leingang

Post on 15-Jun-2015

6.943 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Lesson 9: Gaussian Elimination

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

Page 2: Lesson 9: Gaussian Elimination

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.

Page 3: Lesson 9: Gaussian Elimination

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.

Page 4: Lesson 9: Gaussian Elimination

Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007

Page7of17

Page 5: Lesson 9: Gaussian Elimination

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.

Page 6: Lesson 9: Gaussian Elimination

Two equations in two variables

Example

Solve 2x + y = 3, x + 2y = 0.

Solutionx = 2, y = −1.

Page 7: Lesson 9: Gaussian Elimination

Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007

Page8of17

Page 8: Lesson 9: Gaussian Elimination

Two equations in two variables

Example

Solve 2x + y = 3, x + 2y = 0.

Solutionx = 2, y = −1.

Page 9: Lesson 9: Gaussian Elimination

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.

Page 10: Lesson 9: Gaussian Elimination

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.

Page 11: Lesson 9: Gaussian Elimination

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

Page 12: Lesson 9: Gaussian Elimination

Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007

Page9of17

Page 13: Lesson 9: Gaussian Elimination

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

Page 14: Lesson 9: Gaussian Elimination

Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007

Page10of17

Page 15: Lesson 9: Gaussian Elimination

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.

Page 16: Lesson 9: Gaussian Elimination

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.

Page 17: Lesson 9: Gaussian Elimination

Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007

Page11of17

Page 18: Lesson 9: Gaussian Elimination

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.

Page 19: Lesson 9: Gaussian Elimination

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

Page 20: Lesson 9: Gaussian Elimination

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

Page 21: Lesson 9: Gaussian Elimination

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

Page 22: Lesson 9: Gaussian Elimination

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.

Page 23: Lesson 9: Gaussian Elimination

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.

Page 24: Lesson 9: Gaussian Elimination

Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007

Page14of17

Page 25: Lesson 9: Gaussian Elimination

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.

Page 26: Lesson 9: Gaussian Elimination

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

Page 27: Lesson 9: Gaussian Elimination

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

Page 28: Lesson 9: Gaussian Elimination

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!

Page 29: Lesson 9: Gaussian Elimination

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!

Page 30: Lesson 9: Gaussian Elimination

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)

Page 31: Lesson 9: Gaussian Elimination

Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007

Page15of17

Page 32: Lesson 9: Gaussian Elimination

So to solve a SLE:

I Form the augmented matrix.

I reduce this matrix to (R)REF.

I read off the solution.

Page 33: Lesson 9: Gaussian Elimination

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

Page 34: Lesson 9: Gaussian Elimination

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

Page 35: Lesson 9: Gaussian Elimination

Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007

Page16of17

Page 36: Lesson 9: Gaussian Elimination

Math 20 - October 10, 2007.GWBWednesday, Oct 10, 2007

Page17of17

Page 37: Lesson 9: Gaussian Elimination

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

Page 38: Lesson 9: Gaussian Elimination

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.

Page 39: Lesson 9: Gaussian Elimination

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.

Page 40: Lesson 9: Gaussian Elimination

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.

Page 41: Lesson 9: Gaussian Elimination

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.

Page 42: Lesson 9: Gaussian Elimination

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.