* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Systems of Linear Equations
Survey
Document related concepts
Transcript
MATH 250 Linear Equations and Matrices 1 Topics • • • • • Preliminaries Systems of Linear Equations Matrices Algebraic Properties of Matrix Operations Special Types of Matrices and Partitioned Matrices • Matrix Transformations 2 Systems of Linear Equations System of m equations in n unknowns a11 x1 a12 x2 a21 x1 a22 x2 a1n xn b1 a2n xn b2 am1 x1 am2 x2 amn xn bm 3 Systems of Linear Equations Comments • If a system has a solution, call it consistent • If a system doesn’t have a solution, call it inconsistent • If b1 b2 bm 0 , the system is called homogeneous. A homogeneous system always has the trivial solution x1 x2 xn 0 • If two systems have the same solution, then they are called equivalent. The solution strategy for linear systems is to transform the system through a series of equivalent systems until the solution is 4 obvious 5 6 Matrices Systems of Equations • Consider a11 x1 a12 x2 a1n xn b1 • Define a21 x1 a22 x2 a2n xn b2 am1 x1 am2 x2 amn xn bm a11 a21 A am1 a12 a22 am 2 a1n a2n amn • Express system as AX B x1 x2 X xn b1 b2 B bm 7 Matrices Systems of Equations • Since the solution of the system involves the a and b values only, will often work with the augmented matrix a 11 a21 am1 a12 a22 am2 a1n b1 a2n b2 amn bm 8 Systems of Linear Equations Elementary Operations on Systems 1) Switch two equations 2) Multiply an equation by nonzero constant 3) Add multiple of one equation to another The application of any combination of elementary operations to a linear system yields a new linear system that is equivalent to the first 9 Inverting a Matrix • Usually not a good idea to compute x=A-1b – Inefficient – Prone to roundoff error • In fact, compute inverse using linear solver – Solve Axi=bi where bi are columns of identity, xi are columns of inverse – Many solvers can solve several R.H.S. at once 10 Solving Linear Systems Using Gaussian Elimination • Write the augmented matrix for the system • Use matrix row operations to simplify the matrix to one with 1s down the diagonal from upper left to lower right, and 0s below the 1s • Write the system of linear equations corresponding to the matrix in step 2, and use back-substitution to find the system’s 11 solutions 12 13 Theorem 1: Equivalent systems and equivalent matrices: If the augmented coefficient matrices of two linear systems are row equivalent, then the two systems have the same solution set. Definition: Echelon Matrix The matrix E is called an echelon matrix provided it has the following two properties: 1. Every row of E that consists entirely of zeros (if any) lies beneath every row that contains a nonzero element. 2. In each row of E that contains a nonzero element, the nonzero element lies strictly to the right of the first nonzero element in the preceding row (if there is a preceding row). 14 Example Use matrices to solve the system 3x + y + 2z = 31 x + y + 2z = 19 x + 3y + 2z = 25 Solution Step 1 Write the augmented matrix for the system. Linear System 3x + y + 2z = 31 x + y + 2z = 19 x + 3y + 2z = 25 Augmented Matrix 3 1 2 31 1 1 2 19 1 3 2 25 Example cont. Solution Step 2 Use matrix row operations to simplify the matrix to one with 1s down the diagonal from upper left to lower right, and 0s below the 1s. Our goal is to obtain a matrix of the form 1 0 0 a 1 0 b d 1 c e f . Our first step in achieving this goal is to get 1 in the top position of the first column. We want 1 in this position. 3 1 1 1 1 3 2 2 2 31 19 25 To get 1 in this position, we interchange rows 1 and 2. (We could also interchange rows 1 and 3 to attain our goal.) 1 3 1 1 1 3 2 2 2 19 31 25 This was row 2; now it’s row 1. This was row 1; now it’s row 2. Example cont. Solution Now we want to get 0s below the 1 in the first column. We want 0 in these positions. 1 3 1 1 1 3 2 2 2 19 31 25 Let’s first get a 0 where there is now a 3. If we multiply the top row of numbers by –3 and add these products to the second row of numbers, we will get 0 in this position. The top row of numbers multiplied by –3 gives -3(1) or –3, -3(1) or –3, -3(2) or –6, -3(19) or –57. Now add these products to the corresponding numbers in row 2. Notice that although we use row 1 to find the products, row 1 does not change. 1 1 2 19 3 + (-3) 1 + (-3) 2 + (-3) 31 + (-3) 1 3 2 25 = 1 0 1 We want 0 in this position. 1 -2 3 2 19 -4 -26 2 25 Example cont. Solution We are not yet done with the first column. If we multiply the top row of numbers by –1 and add these products to the third row of numbers, we will get 0 in this position. The top row of numbers multiplied by –1 gives -1(1) or –1, -1(1) or –1, -1(2) or –2, -1(19) or –19. Now add these products to the corresponding numbers in row 3. 1 1 2 19 0 -2 -4 -26 1 + (-1) 3 + (-1) 2 + (-2) 25+(-19) = 1 0 0 1 -2 2 2 19 -4 -26 0 6 We move on to the second column. We want 1 in the second row, second column. We want 1 in this position. 1 0 0 1 -2 2 2 19 -4 -26 0 6 Example cont. Solution To get 1 in the desired position, we multiply –2 by its reciprocal, -1/2. Therefore, we multiply all the numbers in the second row by –1/2 to get 1 › (0) 0 1 › (-2) 2 2 › (-4) 0 19 › (-26) 6 = 1 0 0 1 1 2 2 2 0 19 13 6 We want 0 in this position. We are not yet done with the second column. If we multiply the top row of numbers by –2 and add these products to the third row of numbers, we will get 0 in this position. The second row of numbers multiplied by –2 gives -2(0) or 0, -2(1) or –2, -2(2) or –4, -2(13) or –26. Now add these products to the corresponding numbers in row 3. 1 0 0+0 1 2 19 1 2 13 2 + (-2) 0 + (-4) 6+(-26) = 1 0 0 1 1 0 2 19 2 13 -4 -20 Example cont. Solution We move on to the third column. We want 1 in the third row, third column. 1 0 0 We want 1 in this position. 1 1 0 2 19 2 13 -4 -20 To get 1 in the desired position, we multiply –4 by its reciprocal, -1/4. Therefore, we multiply all the numbers in the third row by –1/4 to get 1 1 2 19 0 1 2 13 -1/4(0) -1/4(0) -1/4(-4) -1/4(-20) = 1 0 0 1 1 0 2 2 1 19 13 5 We now have the desired matrix with 1s down the diagonal and 0s below the 1s. Step 3 Write the system of linear equations corresponding to the matrix in step 2, and use back-substitution to find the system’s solution. The system represented by the matrix in step 2 is Example cont. Solution 3 1 1 1 1 3 2 2 2 31 19 25 x + y + 2z = 19 y + 2z = 13 z = 5 We immediately see that the value for z is 5. To find y, we back-substitute 5 for z in the second equation. y + 2z = 13 y + 2(5) = 13 y=3 Equation 2 Substitute 5 for x. Solve for y. Finally, back-substitute 3 for y and 5 for z in the first equation: x + y + 2z = 19 Equation 1 x + 3 + 2(5) = 19 Substitute 3 for y and 5 for x. x + 13 = 19 Multiply and add. x=6 Subtract 13 from both sides. The solution set for the original system is {(6, 3, 5)}. 22 23 Gaussian Elimination Definition • A matrix is in echelon form if • Any rows consisting entirely of zeros are grouped at the bottom of the matrix. • The first nonzero element of each row is 1. This element is called a leading 1. • The leading 1 of each row after the first is positioned to the right of the leading 1 of the previous row. • (This implies that all the elements below a leading 1 are zero.) 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 Example 1 Solving the following system of linear equations using the method of Gaussian elimination. x1 2 x2 3 x3 2 x4 1 x1 2 x2 2 x3 x4 2 2 x1 4 x2 8 x3 12 x4 4 Solution Starting with the augmented matrix, create zeros below the pivot in the first column. 2 3 2 1 1 1 2 3 2 1 1 2 2 1 2 R 2 R1 0 0 1 3 1 2 4 8 12 4 R3 (2) R1 0 0 2 8 6 At this stage, we create a zero only below the pivot. 1 2 3 2 1 1 2 3 2 1 0 0 1 3 1 1 0 0 1 3 1 R3 R3 (2) R 2 2 0 0 0 2 4 0 0 0 1 2 Echelon form 45 We have arrived at the echelon form. The corresponding system of equation is x1 2 x2 3x3 2 x4 1 x3 3x4 1 x4 2 We get x3 3(2) 1 x3 5 Substituting x4 = 2 and x3 = 5 into the first equation, x1 2 x2 3(5) 2(2) 1 x1 2 x2 10 x1 2 x2 10 Let x2 = r. The system has many solutions. The solutions are x1 2r 10, x2 r , x3 5, x4 2 46 Example 2 Solving the following system of linear equations using the method of Gaussian elimination, performing back substitution using matrices. x1 2 x2 3 x3 2 x4 1 x1 2 x2 2 x3 x4 2 2 x1 4 x2 8 x3 12 x4 4 Solution We arrive at the echelon form as in the previous example. 2 3 2 1 1 1 2 3 2 1 1 2 2 1 2 0 0 1 3 1 2 0 0 0 1 2 4 8 12 4 Echelon form This marks the end of the forward elimination of variables from equations. We now commence the back substitution using matrices. 47 1 2 3 2 1 0 0 1 3 1 0 0 0 1 2 R1 (2) R 2 R 2 (3) R3 1 2 3 0 5 0 0 1 0 5 0 0 0 1 2 1 2 0 0 10 R1 (3) R 3 0 0 1 0 5 0 0 0 1 2 This matrix is the reduced echelon form of the original augmented matrix. The corresponding system of equations is x1 2 x2 10 x3 5 x4 2 Let x2 = r. We get same solution as previously, x1 2r 10, x2 r , x3 5, x4 2 48