Gauss Seiddel Method
Total Page:16
File Type:pdf, Size:1020Kb
Gauss-Jordan Elimination Method The following row operations on the augmented matrix of a system produce the augmented matrix of an equivalent system, i.e., a system with the same solution as the original one. • Interchange any two rows. • Multiply each element of a row by a nonzero constant. • Replace a row by the sum of itself and a constant multiple of another row of the matrix. For these row operations, we will use the following notations. • Ri ↔ Rj means: Interchange row i and row j. • αRi means: Replace row i with α times row i. • Ri + αRj means: Replace row i with the sum of row i and α times row j. The Gauss-Jordan elimination method to solve a system of linear equations is described in the following steps. 1. Write the augmented matrix of the system. 2. Use row operations to transform the augmented matrix in the form described below, which is called the reduced row echelon form (RREF). (a) The rows (if any) consisting entirely of zeros are grouped together at the bottom of the matrix. (b) In each row that does not consist entirely of zeros, the leftmost nonzero element is a 1 (called a leading 1 or a pivot). (c) Each column that contains a leading 1 has zeros in all other entries. (d) The leading 1 in any row is to the left of any leading 1’s in the rows below it. 3. Stop process in step 2 if you obtain a row whose elements are all zeros except the last one on the right. In that case, the system is inconsistent and has no solutions. Otherwise, finish step 2 and read the solutions of the system from the final matrix. Note: When doing step 2, row operations can be performed in any order. Try to choose row opera- tions so that as few fractions as possible are carried through the computation. This makes calculation easier when working by hand. 1 Example 1. Solve the following system by using the Gauss-Jordan elimination method. x + y + z = 5 2x + 3y + 5z = 8 4x + 5z = 2 Solution: The augmented matrix of the system is the following. 1 1 1 5 2 3 5 8 4 0 5 2 We will now perform row operations until we obtain a matrix in reduced row echelon form. 1 1 1 5 1 1 1 5 R2−2R1 2 3 5 8 −−−−−→ 0 1 3 −2 4 0 5 2 4 0 5 2 1 1 1 5 R3−4R1 −−−−−→ 0 1 3 −2 0 −4 1 −18 1 1 1 5 R3+4R2 −−−−−→ 0 1 3 −2 0 0 13 −26 1 1 1 1 5 13 R3 −−−→ 0 1 3 −2 0 0 1 −2 1 1 1 5 R2−3R3 −−−−−→ 0 1 0 4 0 0 1 −2 1 1 0 7 R1−R3 −−−−→ 0 1 0 4 0 0 1 −2 1 0 0 3 R1−R2 −−−−→ 0 1 0 4 0 0 1 −2 From this final matrix, we can read the solution of the system. It is x = 3, y = 4, z = −2. 2 Example 2. Solve the following system by using the Gauss-Jordan elimination method. x + 2y − 3z = 2 6x + 3y − 9z = 6 7x + 14y − 21z = 13 Solution: The augmented matrix of the system is the following. 1 2 −3 2 6 3 −9 6 7 14 −21 13 Let’s now perform row operations on this augmented matrix. 1 2 −3 2 1 2 −3 2 R2−6R1 6 3 −9 6 −−−−−→ 0 −9 9 −6 7 14 −21 13 7 14 −21 13 1 2 −3 2 R3−7R1 −−−−−→ 0 −9 9 −6 0 0 0 −1 We obtain a row whose elements are all zeros except the last one on the right. Therefore, we conclude that the system of equations is inconsistent, i.e., it has no solutions. Example 3. Solve the following system by using the Gauss-Jordan elimination method. 4y + z = 2 2x + 6y − 2z = 3 4x + 8y − 5z = 4 Solution: The augmented matrix of the system is the following. 0 4 1 2 2 6 −2 3 4 8 −5 4 3 We will now perform row operations until we obtain a matrix in reduced row echelon form. 0 4 1 2 2 6 −2 3 R1↔R2 2 6 −2 3 −−−−−→ 0 4 1 2 4 8 −5 4 4 8 −5 4 2 6 −2 3 R3−2R1 −−−−−→ 0 4 1 2 0 −4 −1 −2 2 6 −2 3 R3+R2 −−−−→ 0 4 1 2 0 0 0 0 1 2 6 −2 3 4 R2 −−−→ 0 1 1/4 1/2 0 0 0 0 2 0 −7/2 0 R1−6R2 −−−−−→ 0 1 1/4 1/2 0 0 0 0 1 1 0 −7/4 0 2 R1 −−−→ 0 1 1/4 1/2 0 0 0 0 This last matrix is in reduced row echelon form so we can stop. It corresponds to the augmented matrix of the following system. ( 7 x − 4 z = 0 1 1 y + 4 z = 2 We can express the solutions of this system as 7 1 1 x = 4 z, y = 2 − 4 z. Since there is no specific value for z, it can be chosen arbitrarily. This means that there are infinitely many solutions for this system. We can represent all the solutions by using a parameter t as follows. 7 1 1 x = 4 t, y = 2 − 4 t, z = t Any value of the parameter t gives us a solution of the system. For example, 1 t = 4 gives the solution (x, y, z) = (7, − 2 , 4) 7 t = −2 gives the solution (x, y, z) = (− 2 , 1, −2). 4 Example 4. Solve the following system by using the Gauss-Jordan elimination method. A + B + 2C = 1 2A − B + D = −2 A − B − C − 2D = 4 2A − B + 2C − D = 0 Solution: We will perform row operations on the augmented matrix of the system until we obtain a matrix in reduced row echelon form. 1 1 2 0 1 1 1 2 0 1 1 1 2 0 1 2 −1 0 1 −2 R2−2R1 0 −3 −4 1 −4 R3−R1 0 −3 −4 1 −4 −−−−−→ −−−−→ 1 −1 −1 −2 4 1 −1 −1 −2 4 0 −2 −3 −2 3 2 −1 2 −1 0 2 −1 2 −1 0 2 −1 2 −1 0 1 1 2 0 1 1 1 2 0 1 R4−2R1 0 −3 −4 1 −4 R4−R2 0 −3 −4 1 −4 −−−−−→ −−−−→ 0 −2 −3 −2 3 0 −2 −3 −2 3 0 −3 −2 −1 −2 0 0 2 −2 2 1 1 2 0 1 1 1 2 0 1 − 1 R R2↔R3 0 −2 −3 −2 3 2 2 0 1 3/2 1 −3/2 −−−−−→ −−−−→ 0 −3 −4 1 −4 0 −3 −4 1 −4 0 0 2 −2 2 0 0 2 −2 2 1 1 2 0 1 1 1 2 0 1 R3+3R2 0 1 3/2 1 −3/2 2R3 0 1 3/2 1 −3/2 −−−−−→ −−→ 0 0 1/2 4 −17/2 0 0 1 8 −17 0 0 2 −2 2 0 0 2 −2 2 1 1 2 0 1 1 1 2 0 1 − 1 R R4−2R3 0 1 3/2 1 −3/2 18 4 0 1 3/2 1 −3/2 −−−−−→ −−−−→ 0 0 1 8 −17 0 0 1 8 −17 0 0 0 −18 36 0 0 0 1 −2 1 1 2 0 1 1 1 2 0 1 R3−8R4 0 1 3/2 1 −3/2 R2−R4 0 1 3/2 0 1/2 −−−−−→ −−−−→ 0 0 1 0 −1 0 0 1 0 −1 0 0 0 1 −2 0 0 0 1 −2 1 1 2 0 1 1 0 0 0 1 R − 3 R 2 2 3 0 1 0 0 2 R1−2R3,R1−R2 0 1 0 0 2 −−−−−→ −−−−−−−−−−−→ 0 0 1 0 −1 0 0 1 0 −1 0 0 0 1 −2 0 0 0 1 −2 From this final matrix, we can read the solution of the system. It is A = 1,B = 2,C = −1,D = −2. 5 Chapter 04.08 Gauss-Seidel Method After reading this chapter, you should be able to: 1. solve a set of equations using the Gauss-Seidel method, 2. recognize the advantages and pitfalls of the Gauss-Seidel method, and 3. determine under what conditions the Gauss-Seidel method always converges. Why do we need another method to solve a set of simultaneous linear equations? In certain cases, such as when a system of equations is large, iterative methods of solving equations are more advantageous. Elimination methods, such as Gaussian elimination, are prone to large round-off errors for a large set of equations. Iterative methods, such as the Gauss-Seidel method, give the user control of the round-off error. Also, if the physics of the problem are well known, initial guesses needed in iterative methods can be made more judiciously leading to faster convergence. What is the algorithm for the Gauss-Seidel method? Given a general set of n equations and n unknowns, we have a11 x1 + a12 x2 + a13 x3 + ... + a1n xn = c1 a21 x1 + a22 x2 + a23 x3 + ... + a2n xn = c2 . an1 x1 + an2 x2 + an3 x3 + ... + ann xn = cn If the diagonal elements are non-zero, each equation is rewritten for the corresponding unknown, that is, the first equation is rewritten with x1 on the left hand side, the second equation is rewritten with x2 on the left hand side and so on as follows 04.08.1 04.08.2 Chapter 04.08 c1 − a12 x2 − a13 x3 − a1n xn x1 = a11 c2 − a21 x1 − a23 x3 − a2n xn x2 = a22 cn−1 − an−1,1 x1 − an−1,2 x2 − an−1,n−2 xn−2 − an−1,n xn xn−1 = an−1,n−1 cn − an1 x1 − an2 x2 − − an,n−1 xn−1 xn = ann These equations can be rewritten in a summation form as n c1 − ∑ a1 j x j j=1 j≠1 x1 = a11 n c2 − ∑ a2 j x j j=1 j≠2 x2 = a22 .