28
Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Embed Size (px)

Citation preview

Page 1: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Systems of Linear Equations

Gaussian EliminationTypes of Solutions

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Page 2: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

A linear equation is an equation that can be written in the form:

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

The coefficients ai and the constant b can be real or complex numbers.

bxaxaxa nn2211

Page 3: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

A linear equation is an equation that can be written in the form:

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

The coefficients ai and the constant b can be real or complex numbers.

A Linear System is a collection of one or more linear equations in the same variables. Here are a few examples of linear systems:

bxaxaxa nn2211

4z2y2x

2zy3x2

1zyx

4xx4x

2xxx2x

1xx2x

532

5432

421

1zy2x

7z7y4x3

Page 4: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

A linear equation is an equation that can be written in the form:

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

The coefficients ai and the constant b can be real or complex numbers.

A Linear System is a collection of one or more linear equations in the same variables. Here are a few examples of linear systems:

bxaxaxa nn2211

4z2y2x

2zy3x2

1zyx

4xx4x

2xxx2x

1xx2x

532

5432

421

1zy2x

7z7y4x3

Any system of linear equations can be put into matrix form: bxA

The matrix A contains the coefficients of the variables, and the vector x has the variables as its components.

For example, for the first system above the matrix version would be:

bxA

4

2

1

z

y

x

221

132

111

Page 5: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Before diving into larger systems we will look at some familiar 2-variable cases. If the equation has two variables we think of one of them as being dependent on the other. Thus we have only one independent variable. A one-dimensional object is a line, so solutions to these two-equation systems can be thought of as the intersection points of two lines. We will generalize this concept when dealing with larger systems.

Consider the following sets of equations:

2yx2

1yx

Page 6: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Before diving into larger systems we will look at some familiar 2-variable cases. If the equation has two variables we think of one of them as being dependent on the other. Thus we have only one independent variable. A one-dimensional object is a line, so solutions to these two-equation systems can be thought of as the intersection points of two lines. We will generalize this concept when dealing with larger systems.

Consider the following sets of equations:

Unique Solution

These two lines intersect in a single point.2yx2

1yx

4 2 2 4

10

5

5

Page 7: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Before diving into larger systems we will look at some familiar 2-variable cases. If the equation has two variables we think of one of them as being dependent on the other. Thus we have only one independent variable. A one-dimensional object is a line, so solutions to these two-equation systems can be thought of as the intersection points of two lines. We will generalize this concept when dealing with larger systems.

Consider the following sets of equations:

Unique Solution

These two lines intersect in a single point.2yx2

1yx

2yx2

2y2x4

4 2 2 4

10

5

5

Page 8: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Before diving into larger systems we will look at some familiar 2-variable cases. If the equation has two variables we think of one of them as being dependent on the other. Thus we have only one independent variable. A one-dimensional object is a line, so solutions to these two-equation systems can be thought of as the intersection points of two lines. We will generalize this concept when dealing with larger systems.

Consider the following sets of equations:

No Solution

Here the lines are parallel, so never intersect.

In this case we call the system inconsistent.

Unique Solution

These two lines intersect in a single point.2yx2

1yx

2yx2

2y2x4

4 2 2 4

10

5

5

1.0 0.5 0.5 1.0

1

1

2

3

4

Page 9: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Before diving into larger systems we will look at some familiar 2-variable cases. If the equation has two variables we think of one of them as being dependent on the other. Thus we have only one independent variable. A one-dimensional object is a line, so solutions to these two-equation systems can be thought of as the intersection points of two lines. We will generalize this concept when dealing with larger systems.

Consider the following sets of equations:

No Solution

Here the lines are parallel, so never intersect.

In this case we call the system inconsistent.

Unique Solution

These two lines intersect in a single point.2yx2

1yx

2yx2

2y2x4

2yx2

4y2x4

4 2 2 4

10

5

5

1.0 0.5 0.5 1.0

1

1

2

3

4

Page 10: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Before diving into larger systems we will look at some familiar 2-variable cases. If the equation has two variables we think of one of them as being dependent on the other. Thus we have only one independent variable. A one-dimensional object is a line, so solutions to these two-equation systems can be thought of as the intersection points of two lines. We will generalize this concept when dealing with larger systems.

Consider the following sets of equations:

No Solution

Here the lines are parallel, so never intersect.

In this case we call the system inconsistent.

Unique Solution

These two lines intersect in a single point.

Infinitely many solutions

The two lines coincide in this case, so they have an infinite number of intersection points.

2yx2

1yx

2yx2

2y2x4

2yx2

4y2x4

4 2 2 4

10

5

5

1.0 0.5 0.5 1.0

1

1

2

3

4

2 1 1 2

2

2

4

6

Page 11: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here are some 3-variable systems.

Each equation represents a plane (a 2-dimensional subset of ℝ3).

We are looking for intersections of these planes.

No Solution

If the system is inconsistent there will be no solutions.

In this case there will be a contradiction that appears during the solution process.

Unique Solution

If the coefficient matrix reduces to the identity matrix there will be a unique (constant) solution to the system.

Infinitely many solutions

If, after row reduction, there are more variables than nonzero rows, the system will have a family of solutions that can be written in parametric form.

4z2y2x

2zy3x2

1zyx

4zy2x

5yx

2zyx

4z5yx4

2zyx2

1z2yx

We will use a procedure called Gaussian Elimination to solve systems such as these.

Page 12: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

4

5

2

121

011

111

4zy2x

5yx

2zyx

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is our first 3x3 system. To start the Gaussian Elimination procedure (also called Row Reduction), form the Augmented Matrix for the system. This is simply the coefficient matrix with the vector from the right-hand-side next to it:

Augmented Matrix

Elementary Row Operations•Add a multiple of one row to another row

•Switch two rows

•Multiply any row by a (nonzero) constant

Performing any of these operations will not change the solutions to the system. We say that systems are “row-equivalent” when they have the same solution set.

We will practice this procedure on the augmented matrix above.

Page 13: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

4

5

2

121

011

111

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is our first 3x3 system.

The first row-reduction step is to get zeroes below the 1 in the upper left.

Page 14: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

2

3

2

230

120

111

R)1(RR

R)1(RR

4

5

2

121

011

111

13*3

12*2

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is our first 3x3 system.

The first row-reduction step is to get zeroes below the 1 in the upper left.

Page 15: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

2

3

2

230

120

111

R)1(RR

R)1(RR

4

5

2

121

011

111

13*3

12*2

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is our first 3x3 system.

The first row-reduction step is to get zeroes below the 1 in the upper left.

For the next step we want to get a zero in the bottom-middle spot. For hand-calculations I like to keep entries integers as much as possible, so I would do 2 steps here-multiply row 3 by 2, then add (-3) times row 2. This can be done together:

Page 16: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

2

3

2

230

120

111

R)1(RR

R)1(RR

4

5

2

121

011

111

13*3

12*2

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is our first 3x3 system.

The first row-reduction step is to get zeroes below the 1 in the upper left.

5

3

2

100

120

111

RR5

3

2

100

120

111

R3R2R2

3

2

230

120

111

3*323

*3

Next step is to multiply (-1) through row 3, then use row 3 to get zeroes in column 3.

For the next step we want to get a zero in the bottom-middle spot. For hand-calculations I like to keep entries integers as much as possible, so I would do 2 steps here-multiply row 3 by 2, then add (-3) times row 2. This can be done together:

Page 17: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

2

3

2

230

120

111

R)1(RR

R)1(RR

4

5

2

121

011

111

13*3

12*2

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is our first 3x3 system.

The first row-reduction step is to get zeroes below the 1 in the upper left.

5

3

2

100

120

111

RR5

3

2

100

120

111

R3R2R2

3

2

230

120

111

3*323

*3

Next step is to multiply (-1) through row 3, then use row 3 to get zeroes in column 3.

5

4

3

100

010

011

RR

5

8

3

100

020

011

RRR

RRR

5

3

2

100

120

111

221*

232*2

31*1

After dividing row two by 2, the last step is to add row 2 to row 1.

For the next step we want to get a zero in the bottom-middle spot. For hand-calculations I like to keep entries integers as much as possible, so I would do 2 steps here-multiply row 3 by 2, then add (-3) times row 2. This can be done together:

Page 18: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

2

3

2

230

120

111

R)1(RR

R)1(RR

4

5

2

121

011

111

13*3

12*2

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is our first 3x3 system.

The first row-reduction step is to get zeroes below the 1 in the upper left.

5

3

2

100

120

111

RR5

3

2

100

120

111

R3R2R2

3

2

230

120

111

3*323

*3

Next step is to multiply (-1) through row 3, then use row 3 to get zeroes in column 3.

5

4

3

100

010

011

RR

5

8

3

100

020

011

RRR

RRR

5

3

2

100

120

111

221*

232*2

31*1

After dividing row two by 2, the last step is to add row 2 to row 1.

5

4

1

100

010

001RRR

5

4

3

100

010

011 21*1

This matrix is in “Reduced Echelon Form” (REF)

For the next step we want to get a zero in the bottom-middle spot. For hand-calculations I like to keep entries integers as much as possible, so I would do 2 steps here-multiply row 3 by 2, then add (-3) times row 2. This can be done together:

Page 19: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

4zy2x

5yx

2zyx

The solution to this system is a single point: (1,4,5)

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Unique Solution

If the coefficient matrix reduces to the identity matrix there will be a unique (numerical) solution to the system.

5

4

1

100

010

001 Here is the reduced matrix. Notice that the left part has ones along the diagonal and zeroes elsewhere. This is the 3x3 Identity Matrix. In this case the solution is staring us in the face.

The solution represents the common intersection point of the three planes represented by the equations in the system.

Page 20: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is the next system. The basic pattern is to start at the upper left corner, then use row operations to get zeroes below, then work counterclockwise until the matrix is in REF.

4

2

1

221

132

111

422

232

1

zyx

zyx

zyx

Page 21: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is the next system. The basic pattern is to start at the upper left corner, then use row operations to get zeroes below, then work counterclockwise until the matrix is in REF.

3

0

1

310

310

111

RRR

R2RR

4

2

1

221

132

111

4z2y2x

2zy3x2

1zyx

13*3

12*2

Page 22: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is the next system. The basic pattern is to start at the upper left corner, then use row operations to get zeroes below, then work counterclockwise until the matrix is in REF.

3

0

1

310

310

111

RRR

R2RR

4

2

1

221

132

111

4z2y2x

2zy3x2

1zyx

13*3

12*2

3

0

1

000

310

111

RRR3

0

1

310

310

111

23*3

Page 23: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is the next system. The basic pattern is to start at the upper left corner, then use row operations to get zeroes below, then work counterclockwise until the matrix is in REF.

3

0

1

310

310

111

RRR

R2RR

4

2

1

221

132

111

4z2y2x

2zy3x2

1zyx

13*3

12*2

3

0

1

000

310

111

RRR3

0

1

310

310

111

23*3

At this point you might notice a problem. That last row doesn’t make sense. It might help to write out the equation that the last row represents.

It says 0x+0y+0z=3.

Are there any values of x, y and z that make this equation work? (the answer is NO!)

This system is called INCONSISTENT because we arrive at a contradiction during the solution procedure. This means that the system has no solution.

Page 24: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

This line is the intersection of a pair of the planes

This line is the intersection of a different pair of the planes

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

No Solution

If the system is inconsistent there will be no solutions.

In this case there will be a contradiction that appears during the solution process.

This is the reduced matrix (actually we could go one step further and get a zero up in row 1). Notice that we got a row of zeroes in the left part of the augmented matrix. When this happens the system will either be inconsistent, like this one, or we will have a free variable (infinite # of solutions).

4z2y2x

2zy3x2

1zyx

3

0

1

000

310

111

Page 25: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

4z5yx4

2zyx2

1z2yx

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is another system. Work through the row-reduction procedure to obtain the REF matrix.

Page 26: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

4z5yx4

2zyx2

1z2yx

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is another system. Work through the row-reduction procedure to obtain the REF matrix.

0

0

1

000

330

211

RRR0

0

1

330

330

211

R4RR

R2RR

4

2

1

514

112

211

23*313

*3

12*2

This time there is a row of zeroes at the bottom. However there is no contradiction here.

The bottom row represents the equation 0x+0y+0z=0. This is always true!

Continue with row reduction by dividing row 2 by -3, then get a zero in row 1.

0

0

1

000

110

101RRR

0

0

1

000

110

211 21*1 Reduced Echelon Form

Page 27: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

4z5yx4

2zyx2

1z2yx

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Here is another system. Work through the row-reduction procedure to obtain the REF matrix.

0

0

1

000

330

211

RRR0

0

1

330

330

211

R4RR

R2RR

4

2

1

514

112

211

23*313

*3

12*2

This time there is a row of zeroes at the bottom. However there is no contradiction here.

The bottom row represents the equation 0x+0y+0z=0. This is always true!

Continue with row reduction by dividing row 2 by -3, then get a zero in row 1.

0

0

1

000

110

101RRR

0

0

1

000

110

211 21*1 Reduced Echelon Form

Now that we have the reduced matrix, how do we write the solution? A good place to start is to write the system of equations represented by the reduced matrix:

0zy

1zx

0

0

1

000

110

101

This is two equations in 3 unknowns. The free variable is z.

This means that z can be any value, and the system will have a solution.

Page 28: Systems of Linear Equations Gaussian Elimination Types of Solutions Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

4z5yx4

2zyx2

1z2yx

This system has a 1-parameter solution: it is a line in ℝ3.

Prepared by Vince Zaccone

For Campus Learning Assistance Services at UCSB

Infinitely many solutions

If, after row reduction, there are more variables than nonzero rows, the system will have a family of solutions that can be written in parametric form.

0zy

1zx

0

0

1

000

110

101

To write down the solution, we can rearrange the equations so that they are solved in terms of the free variable (z).

0

0

1

t

1

1

1

x

0zz

0zy

1zx

Here I have written the solution in vector form (re-naming the parameter ‘t’ instead of ‘z’). For each value of t there is a corresponding point on the line.

Notice that is similar to the typical equation of a straight line : y=mx+b.