3 Systems of Linear Equations and Matrices Copyright

  • Slides: 50
Download presentation
3 Systems of Linear Equations and Matrices Copyright © Cengage Learning. All rights reserved.

3 Systems of Linear Equations and Matrices Copyright © Cengage Learning. All rights reserved.

3. 2 Using Matrices to Solve Systems of Equations Copyright © Cengage Learning. All

3. 2 Using Matrices to Solve Systems of Equations Copyright © Cengage Learning. All rights reserved.

Using Matrices to Solve Systems of Equations In this section we describe a systematic

Using Matrices to Solve Systems of Equations In this section we describe a systematic method for solving systems of equations that makes solving large systems of equations in any number of unknowns straightforward. 3

Using Matrices to Solve Systems of Equations First, some terminology: Linear Equation A linear

Using Matrices to Solve Systems of Equations First, some terminology: Linear Equation A linear equation in the n variables x 1, x 2, . . . , xn has the form a 1 x 1 +. . . + anxn = b. (a 1, a 2, . . . , an, b constants) The numbers a 1, a 2, . . . , an are called the coefficients, and the number b is called the constant term, or right -hand side. Quick Example 1. 3 x – 5 y = 0 Linear equation in x and y Coefficients: 3, − 5 Constant term: 0 4

Using Matrices to Solve Systems of Equations Notice that a linear equation in any

Using Matrices to Solve Systems of Equations Notice that a linear equation in any number of unknowns (for example, 2 x – y = 3) is entirely determined by its coefficients and its constant term. In other words, if we were simply given the row of numbers [2 – 1 3] we could easily reconstruct the original linear equation by multiplying the first number by x, the second by y, and inserting a plus sign and an equals sign, as follows: 2 x + (– 1) y = 3 or 2 x – y = 3. 5

Using Matrices to Solve Systems of Equations Similarly, the equation – 4 x +

Using Matrices to Solve Systems of Equations Similarly, the equation – 4 x + 2 y = 0 is represented by the row [– 4 2 0], and the equation is represented by 6

Using Matrices to Solve Systems of Equations As the last example shows, the first

Using Matrices to Solve Systems of Equations As the last example shows, the first number is always the coefficient of x and the second is the coefficient of y. If an x or a y is missing, we write a zero for its coefficient. We shall call such a row the coefficient row of an equation. If we have a system of equations, for example the system 2 x – y = 3 –x + 2 y = – 4, we can put the coefficient rows together like this: 7

Using Matrices to Solve Systems of Equations We call this the augmented matrix of

Using Matrices to Solve Systems of Equations We call this the augmented matrix of the system of equations. The term “augmented” means that we have included the right-hand sides 3 and – 4. We will often drop the word “augmented” and simply refer to the matrix of the system. A matrix (plural: matrices) is nothing more than a rectangular array of numbers as above. 8

Using Matrices to Solve Systems of Equations Matrix, Augmented Matrix A matrix is a

Using Matrices to Solve Systems of Equations Matrix, Augmented Matrix A matrix is a rectangular array of numbers. The augmented matrix of a system of linear equations is the matrix whose rows are the coefficient rows of the equations. Quick Example The augmented matrix of the system x+y=3 x–y=1 is 9

Using Matrices to Solve Systems of Equations Here is the same operation both in

Using Matrices to Solve Systems of Equations Here is the same operation both in the language of equations and the language of rows. (We refer to the equation here as Equation 1, or simply E 1 for short, and to the row as Row 1, or R 1. ) Multiplying both sides of an equation by the number a corresponds to multiplying the coefficient row by a. 10

Using Matrices to Solve Systems of Equations Now look at what we do when

Using Matrices to Solve Systems of Equations Now look at what we do when we add two equations: All we are really doing is adding the corresponding entries in the rows, or adding the rows. In other words, Adding two equations corresponds to adding their coefficient rows. 11

Using Matrices to Solve Systems of Equations In short, the manipulations of equations that

Using Matrices to Solve Systems of Equations In short, the manipulations of equations that we have seen can be done more easily with rows in a matrix because we don’t have to carry x, y, and other unnecessary notation along with us; x and y can always be inserted at the end if desired. The manipulations we are talking about are known as row operations. 12

Using Matrices to Solve Systems of Equations In particular, we use three elementary row

Using Matrices to Solve Systems of Equations In particular, we use three elementary row operations. Elementary Row Operations Type 1: Replacing Ri by a. Ri (where a 0) In words: multiplying or dividing a row by a nonzero number. Type 2: Replacing Ri by a. Ri b. Rj (where a 0) Multiplying a row by a nonzero number and adding or subtracting a multiple of another row. 13

Using Matrices to Solve Systems of Equations Type 3: Switching the order of the

Using Matrices to Solve Systems of Equations Type 3: Switching the order of the rows This corresponds to switching the order in which we write the equations; occasionally this will be convenient. For Types 1 and 2, we write the instruction for the row operation next to the row we wish to replace. 14

Using Matrices to Solve Systems of Equations Quick Examples Replace R 2 by 3

Using Matrices to Solve Systems of Equations Quick Examples Replace R 2 by 3 R 2. Replace R 1 by 4 R 1 – 3 R 2. Switch R 1 and R 2. 15

Using Matrices to Solve Systems of Equations One very important fact about the elementary

Using Matrices to Solve Systems of Equations One very important fact about the elementary row operations is that they do not change the solutions of the corresponding system of equations. In other words, the new system of equations that we get by applying any one of these operations will have exactly the same solutions as the original system: It is easy to see that numbers that make the original equations true will also make the new equations true, because each of the elementary row operations corresponds to a valid operation on the original equations. 16

Using Matrices to Solve Systems of Equations That any solution of the new system

Using Matrices to Solve Systems of Equations That any solution of the new system is a solution of the old system follows from the fact that these row operations are invertible: The effects of a row operation can be reversed by applying another row operation, called its inverse. Here are some examples of this invertibility. 17

Using Matrices to Solve Systems of Equations Our objective, then, is to use row

Using Matrices to Solve Systems of Equations Our objective, then, is to use row operations to change the system we are given into one with exactly the same set of solutions, in which it is easy to see what the solutions are. 18

Solving Systems of Equations by Using Row Operations 19

Solving Systems of Equations by Using Row Operations 19

Solving Systems of Equations by Using Row Operations Now we put rows to work

Solving Systems of Equations by Using Row Operations Now we put rows to work for us in solving systems of equations. Let’s start with a complicated looking system of equations: We begin by writing the matrix of the system: Now what do we do with this matrix? 20

Solving Systems of Equations by Using Row Operations Step 1 Clear the fractions and/or

Solving Systems of Equations by Using Row Operations Step 1 Clear the fractions and/or decimals (if any) using operations of Type 1. To clear the fractions, we multiply the first row by 6 and the second row by 4. We record the operations by writing the symbolic form of an operation next to the row it will change, as follows. 21

Solving Systems of Equations by Using Row Operations By this we mean that we

Solving Systems of Equations by Using Row Operations By this we mean that we will replace the first row by 6 R 1 and the second by 4 R 2. Doing these operations gives Step 2 Designate the first nonzero entry in the first row as the pivot. In this case we designate the entry – 4 in the first row as the “pivot” by putting a box around it: 22

Solving Systems of Equations by Using Row Operations Step 3 Use the pivot to

Solving Systems of Equations by Using Row Operations Step 3 Use the pivot to clear its column using operations of Type 2. By clearing a column, we mean changing the matrix so that the pivot is the only nonzero number in its column. The procedure of clearing a column using a designated pivot is also called pivoting. Desired row 2 (the “#”s stand for as yet unknown numbers) Cleared pivot column 23

Solving Systems of Equations by Using Row Operations We want to replace R 2

Solving Systems of Equations by Using Row Operations We want to replace R 2 by a row of the form a. R 2 b. R 1 to get a zero in column 1. Moreover—and this will be important when we discuss the simplex method we are going to choose positive values for both a and b. We need to choose a and b so that we get the desired cancellation. We can do this quite mechanically as follows: a. Write the name of the row you need to change on the left and that of the pivot row on the right. R 2 R 1 Row to change Pivot row 24

Solving Systems of Equations by Using Row Operations b. Focus on the pivot column,

Solving Systems of Equations by Using Row Operations b. Focus on the pivot column, Multiply each row by the absolute value of the entry currently in the other. (We are not permitting a or b to be negative. ) 4 R 2 1 R 1 From Row 2 The effect is to make the two entries in the pivot column numerically the same. Sometimes, you can accomplish this by using smaller values of a and b. 25

Solving Systems of Equations by Using Row Operations c. If the entries in the

Solving Systems of Equations by Using Row Operations c. If the entries in the pivot column have opposite signs, insert a plus (+). If they have the same sign, insert a minus (–). Here, we get the instruction 4 R 2 + 1 R 1, or simply 4 R 2 + R 1 d. Write the operation next to the row you want to change, and then replace that row using the operation: We have cleared the pivot column and completed Step 3. 26

Solving Systems of Equations by Using Row Operations Simplification Step (Optional) If, at any

Solving Systems of Equations by Using Row Operations Simplification Step (Optional) If, at any stage of the process, all the numbers in a row are multiples of an integer, divide by that integer—a Type 1 operation. This is an optional but extremely helpful step: It makes the numbers smaller and easier to work with. In our case, the entries in R 2 are divisible by 13, so we divide that row by 13. (Alternatively, we could divide by – 13. Try it. ) 27

Solving Systems of Equations by Using Row Operations Step 4 Select the first nonzero

Solving Systems of Equations by Using Row Operations Step 4 Select the first nonzero number in the second row as the pivot, and clear its column. Here we have combined two steps in one: selecting the new pivot and clearing the column (pivoting). The pivot is shown below, as well as the desired result when the column has been cleared: We now wish to get a 0 in place of the 3 in the pivot column. 28

Solving Systems of Equations by Using Row Operations Let’s run once again through the

Solving Systems of Equations by Using Row Operations Let’s run once again through the mechanical steps to get the row operation that accomplishes this. a. Write the name of the row you need to change on the left and that of the pivot row on the right: R 1 R 2 Row to change Pivot row b. Focus on the pivot column, Multiply each row by the absolute value of the entry currently in the other: 1 R 1 3 R 2 From Row 1 29

Solving Systems of Equations by Using Row Operations c. If the entries in the

Solving Systems of Equations by Using Row Operations c. If the entries in the pivot column have opposite signs, insert a plus (+). If they have the same sign, insert a minus (–). Here, we get the instruction 1 R 1 + 3 R 2. d. Write the operation next to the row you want to change and then replace that row using the operation. Now we are essentially done, except for one last step. 30

Solving Systems of Equations by Using Row Operations Final Step Using operations of Type

Solving Systems of Equations by Using Row Operations Final Step Using operations of Type 1, turn each pivot (the first nonzero entry in each row) into a 1. We can accomplish this by dividing the first row by – 4 and multiplying the second row by – 1: 31

Solving Systems of Equations by Using Row Operations The matrix now has the following

Solving Systems of Equations by Using Row Operations The matrix now has the following nice form: (This is the form we will always obtain with two equations in two unknowns when there is a unique solution. ) This form is nice because, when we translate back into equations, we get 1 x + 0 y = 3 0 x + 1 y = – 2. 32

Solving Systems of Equations by Using Row Operations In other words, x = 3

Solving Systems of Equations by Using Row Operations In other words, x = 3 and y = – 2 and so we have found the solution, which we can also write as (x, y) = (3, – 2). The procedure we’ve just demonstrated is called Gauss-Jordan reduction or row reduction. It may seem too complicated a way to solve a system of two equations in two unknowns, and it is. However, for systems with more equations and more unknowns, it is very efficient. 33

Solving Systems of Equations by Using Row Operations In Example 1 below we use

Solving Systems of Equations by Using Row Operations In Example 1 below we use row reduction to solve a system of linear equations in three unknowns: x, y, and z. Just as for a system in two unknowns, a solution of a system in any number of unknowns consists of values for each of the variables that, when substituted, satisfy all of the equations in the system. Again, just as for a system in two unknowns, any system of linear equations in any number of unknowns has either no solution, exactly one solution, or infinitely many solutions. There are no other possibilities. 34

Solving Systems of Equations by Using Row Operations Solving a system in three unknowns

Solving Systems of Equations by Using Row Operations Solving a system in three unknowns graphically would require the graphing of planes (flat surfaces) in three dimensions. (The graph of a linear equation in three unknowns is a flat surface. ) The use of row reduction makes three-dimensional graphing unnecessary. 35

Example 1 – Solving a System by Gauss-Jordan Reduction Solve the system x –

Example 1 – Solving a System by Gauss-Jordan Reduction Solve the system x – y + 5 z = – 6 3 x + 3 y – z = 10 x + 3 y + 2 z = 5. Solution: The augmented matrix for this system is 36

Example 1 – Solution cont’d Note that the columns correspond to x, y, z,

Example 1 – Solution cont’d Note that the columns correspond to x, y, z, and the righthand side, respectively. We begin by selecting the pivot in the first row and clearing its column. Remember that clearing the column means that we turn all other numbers in the column into zeros. 37

Example 1 – Solution cont’d Thus, to clear the column of the first pivot,

Example 1 – Solution cont’d Thus, to clear the column of the first pivot, we need to change two rows, setting up the row operations in exactly the same way as above. Notice that both row operations have the required form a. Rc b. R 1 Row to change Pivot row with a and b both positive. 38

Example 1 – Solution cont’d Now we use the optional simplification step to simplify

Example 1 – Solution cont’d Now we use the optional simplification step to simplify R 2: Next, we select the pivot in the second row and clear its column: R 1 and R 3 are to be changed. R 2 is the pivot row. 39

Example 1 – Solution cont’d We simplify R 3. Now we select the pivot

Example 1 – Solution cont’d We simplify R 3. Now we select the pivot in the third row and clear its column: R 1 and R 2 are to be changed. R 3 is the pivot row. 40

Example 1 – Solution cont’d Finally, we turn all the pivots into 1 s:

Example 1 – Solution cont’d Finally, we turn all the pivots into 1 s: The matrix is now reduced to a simple form, so we translate back into equations to obtain the solution: x = 1, y = 2, z = – 1, or (x, y, z) = (1, 2, – 1). 41

Solving Systems of Equations by Using Row Operations Notice the form of the very

Solving Systems of Equations by Using Row Operations Notice the form of the very last matrix in the example: The 1 s are on the (main) diagonal of the matrix; the goal in Gauss-Jordan reduction is to reduce our matrix to this form. 42

Solving Systems of Equations by Using Row Operations Reduced Row Echelon Form A matrix

Solving Systems of Equations by Using Row Operations Reduced Row Echelon Form A matrix is said to be in reduced row echelon form or to be row-reduced if it satisfies the following properties. P 1. The first nonzero entry in each row (called the leading entry of that row) is a 1. P 2. The columns of the leading entries are clear (i. e. , they contain zeros in all positions other than that of the leading entry). 43

Solving Systems of Equations by Using Row Operations P 3. The leading entry in

Solving Systems of Equations by Using Row Operations P 3. The leading entry in each row is to the right of the leading entry in the row above, and any rows of zeros are at the bottom. Quick Examples 44

The Traditional Gauss-Jordan Method 45

The Traditional Gauss-Jordan Method 45

The Traditional Gauss-Jordan Method In the version of the Gauss-Jordan method we have presented,

The Traditional Gauss-Jordan Method In the version of the Gauss-Jordan method we have presented, we eliminated fractions and decimals in the first step and then worked with integer matrices, partly to make hand computation easier and partly for mathematical elegance. However, complicated fractions and decimals present no difficulty when we use technology. 46

The Traditional Gauss-Jordan Method The following example illustrates the more traditional approach to Gauss-Jordan

The Traditional Gauss-Jordan Method The following example illustrates the more traditional approach to Gauss-Jordan reduction used in many of the computer programs that solve the huge systems of equations that arise in practice. 47

Example 7 – Solving a System with the Traditional Gauss-Jordan Method Solve the following

Example 7 – Solving a System with the Traditional Gauss-Jordan Method Solve the following system using the traditional Gauss-Jordan method: 2 x + y + 3 z = 5 3 x + 2 y + 4 z = 7 2 x + y + 5 z = 10. Solution: We make two changes in our method. First, there is no need to get rid of decimals. 48

Example 7 – Solution cont’d Second, after selecting a pivot, divide the pivot row

Example 7 – Solution cont’d Second, after selecting a pivot, divide the pivot row by the pivot value, turning the pivot into a 1. It is easier to determine the row operations that will clear the pivot column if the pivot is a 1. If we use technology to solve this system of equations, the sequence of matrices might look like this: 49

Example 7 – Solution The solution is (x, y, z) = (– 2, 1.

Example 7 – Solution The solution is (x, y, z) = (– 2, 1. 5, 2. 5). cont’d 50