Gauss-Seidel method Dr. Motilal Panigrahi
Solving system of linear equations We discussed Gaussian elimination with partial pivoting Gaussian elimination was an exact method or closed method Now we will discuss an open method or iteration method
Gauss Seidel method Gauss Seidel method, also known as the Liebmann method or the method of successive displacement It is an iterative method It is named after the German mathematicians Carl Friedrich Gauss and Philipp Ludwig von Seidel, and is similar to the Jacobi method.
Gauss Seidel method First we discuss the method and then we will discuss when the solution converges or diverges. As noted in the previous slide, method of successive displacement means first we assume with an initial solution and then we displace the values successively.
Gauss Seidel method We are given a system of equation Ax = b Say x = x 1, x 2,, x n T First we make two assumptions, (i) the diagonal of the matrix is nonzero, that is a ii 0, For i = 1,2,, n (ii) The system has a solution.
Gauss Seidel method We write the given system Ax = b (1) in the following way x 1 = b 1 a 12 x 2 a 1n x n a 11 2.1 x 2 = b 2 a 21 x 1 a 23 x 3 a 2n x n a 22 2.2 x n = b n a n1 x 1 a n2 x 2 a nn 1 x n 1 a nn 2. n
Gauss Seidel method We start with an initial values x 1 = 0, x 2 = 0,, x n = 0 Then we use the equations (2.1) to (2.n) successively. That in the first iteration Eqn (2.1) will give the value of x 1 (1), we use this value of x 1, and the other previous values of x i s, in Eqn(2.2) to get x 2 (1). Then values x1 (1), x2 (1) and the other previous values of x i s, in Eqn(2.3) to get x 3 (1) and so on till we get xn (1).
After first iteration We have got x 1 (1), x2 (1),, xn (1). Then we start the second iteration. And so on.
But when should we stop? Again as we were doing previously, calculate the percentage relative error for each variable and find the maximum among them which should be less than a tolerance values.
Does the Method always converge? No. It depends whether the system is diagonally dominant or not? If diagonally dominant then it converges.
Diagonally Dominant A system a 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2 a n1 x 1 + a n2 x 2 + + a nn x n = b n is said to be diagonally dominant if it satisfy a ii > a i1 + a i2 + + a i,i 1 + a i,i+1 + + a in For each i = 1,2,, n
That is a ii n > j=1,j i a ij For i = 1,2,, n Then we say that system is diagonally dominant.
Example 1 Solve using Gauss-Seidel method 8x 3y + 2z = 20 4x + 11y z =33 6x + 3y + 12z = 35
Answer The system in the given example is diagonally dominant, as 8x 3y + 2z = 20 8 > 3 + 2 = 5 4x + 11y z =33 11 > 4 + 1 = 5 6x + 3y + 12z = 35 12 > 6 + 3 = 9
Rewriting the equations, we get 8x 3y+2z=20 x = 20+3y 2z 8 4x+11y z=33 y = 33 4x+z 11 6x+3y+12z=35 z = 35 6x 3y 12 (1.a) (1.b) (1.c)
Initial values assigned x (0) = 0, y (0) = 0, z (0) = 0 Now use equation (1.a), which gives
First iteration x (1) = 20+3y(0) 2z (0) y (1) = 33 4x 1 +z (0) 2.090909 8 11 z (1) = 35 6x 1 3y (1) 12 = 20 8 = 2.5 = 33 4 2.5+0 11 = = 35 6 2.5 3 2.090909 12 = 1.1439394
Second iteration x (2) = 20+3 2.090909 2 1.1439394 y (2) = z (2) = 8 33 4 2.998106 +1.1439394 11 35 6 2.998106 3 2.013774 12 =2.998106 = 2.013774 = 0.91417
i=0 i=1 i=2 i=3 i=4 i=5 i=6 x (i) = 0 2.5 2.998106 3.026623 3.016512 3.0166 3.016768 y (i) = 0 2.090909 2.013774 1.982516 1.985607 1.985964 1.985891 z (i) = 0 1.143939 0.91417 0.907726 0.912009 0.911875 0.91181
Percentage error calculation i=2 i=3 i=4 i=5 i=6 %ea(x) 16.61402 0.942195 0.335179 0.00293 0.005546 %ea(y) 3.830369 1.576674 0.155661 0.017986 0.003675 %ea(z) 25.13419 0.709894 0.469584 0.014639 0.007174
Example 2 Solve using Gauss-Seidel method 10x 2y + z = 12 3x + 9y z =21 2x + 3y + 8z = 30
Answer The system in the given example is diagonally dominant, as 10x 2y + z = 12 10 > 2 + 1 = 3 3x + 9y z =21 9 > 3 + 1 = 4 2x + 3y + 8z = 30 8 > 2 + 3 = 5
Rewriting the equations, we get 10x 2y + z = 12 x = 12+2y z 10 3x+9y z=21 y = 21 3x+z 9 2x+3y+8z=30 z = 30 2x 3y 8 (2.b) (2.c) (2.a)
Initial values assigned x (0) = 0, y (0) = 0, z (0) = 0 Now use equation (2.a), (2.b), (2.c), which gives
i=0 i=1 i=2 i=3 i=4 i=5 i=6 x (i) = 0 1.2 1.314167 1.379892 1.372959 1.373259 1.373268 y (i) = 0 1.933333 2.198056 2.161946 2.163935 2.163945 2.163933 z (i) = 0 2.725 2.597188 2.594297 2.595284 2.595206 2.595208
Percentage error calculation i=2 i=3 i=4 i=5 i=6 %ea(x) 8.687381 4.763103 0.504966 0.021792 0.000716 %ea(y) 12.04347 1.670253 0.091956 0.000458 0.000555 %ea(z) 4.921189 0.111406 0.038032 0.003026 7.87E-05