Lecture 4
Lecture 4
SYSTEM OF LINEAR
EQUATIONS
Lecture 4: (a) Jacobi's method.
method (general).
(b) Gauss Seidel method.
Jacobi’s Method:
Carl Gustav Jacob Jacobi (1804-1851) gave an indirect method for finding the
solution of a system of linear equations, which is based on the successive better
approximations of the values of the unknowns, using an iterative procedure. The
sufficient condition for the convergence of Gauss Jacobi method to solve A x b
is that the coefficient matrix A is strictly diagonally row dominant, that is, if
a11 a12 a1n
a21 a22 a2 n
A
, then
an1 an2 ann
n
aii aij
j 1
j i
It should be noted that this method makes two assumptions. First, the system of
linear equations to be solved, must have a unique solution and second, there should
not be any zeros on the main diagonal of the coefficient matrix A. In case, there
exist zeros on its main diagonal, then rows must be interchanged to obtain a
coefficient matrix that does not have zero entries on the main diagonal.
b1 a a a
x1 0. x1 12 x2 ....... 1,n 1 xn 1 1n xn
a11 a11 a11 a11
b2 a a a
x2 21 x1 0. x2 ....... 2,n 1 xn 1 2 n xn
a22 a22 a22 a22
............................................................................
bn a a a
xn n1 x1 n 2 x2 ....... n ,n 1 xn 1 0. xn
ann ann ann ann
x , x ,................, x ,
1
0
2
0
n
0
which are row substituted to the right hand side of the rewritten equations to obtain
the first approximation as
1
x1 b1 a12 x20 a13 x30 ....... a1n 1 xn01 a1 n xn0
1
a11
1
x2 b2 a21 x10 a23 x30 ....... a2,n 1 xn01 a2 n xn0
1
a22
1
xn bn an 1 x1 0 an 2 x20 ........ an ,n 1 xn01
1
ann
x1 x2 4 x3 9
8 x1 3 x2 2 x3 20
4 x1 11x2 x3 33
8 x1 3 x2 2 x3 20
4 x1 11x2 x3 33
x1 x2 4 x3 9
1
x1 20 3 x2 2 x3
8
1
x2 33 4 x1 x3
11
1
x3 9 x1 x2
4
0 0 0
Let the initial guess be x1 1, x2 1, x3 0 .Then, the first approximation to
the solution is given by
1 1
x1 (20 3 1 2 0) 2.875
8
1 1
x2 33 4 1 0 2.636
11
1 1
x3 9 1 1 1.75
4
Second approximation
2 1
x1 20 3 2.636 2 1.75 3.051
8
2 1
x2 33 4 2.875 1.75 2.114
11
3 1
x3 9 2.875 2.636 0.872
4
Third approximation
x1
3
3.075
x2
3
1.969
x3
3
0.959
Fourth approximation
x1 4 2.999
4
x2 1.969
4
x3
0.989
Fifth approximation
x15 2.991
5
x2 1.999
5
x3
1.008
Sixth approximation
x1 6 2.997
6
x2 2.004
6
x3
1.002
Therefore, x1 3.0, x2 2.0 and x3 1.0, correct to two significant figures.
Gauss Seidel Method
b1 a a a
x1 0. x1 12 x2 ....... 1,n 1 xn 1 1n xn
a11 a11 a11 a11
b2 a a a
x2 21 x1 0. x2 ....... 2,n 1 xn 1 2 n xn
a22 a22 a22 a22
............................................................................
bn a a a
xn n1 x1 n 2 x2 ....... n ,n 1 xn 1 0. xn
ann ann ann ann
If x , x ,......, x be
1
0
2
0
n
0
the initial guess of the solution, which is
arbitrary, then the first approximation to the solution is obtained as
1
x1 b1 a12 x20 a13 x30 ....... a1, n 1 xn01 a1 n xn0
1
a11
1
x21 b a x 1
a x 0
....... a x 0
a x 0
a11
1 21 1 23 3 2, n 1 n 1 2 n n
1
x31 b1 a31 x11 a32 x21 a34 x40 ....... a3,n 1 xn01 a3n xn0
a11
.....................................................................................................
1
xn1 b1 an1 x11 an 2 x21 ......... an ,n 1 xn11
a11
(1) (1)
Please note, while calculating x2 , the value of x1 is replaced by x1 , not by
x1(0) . . This is the basic difference of Gauss Seidel with Jocobi’s method.
The successive iteration’s are generated by the scheme called iteration formulae of
Gauss-Seidel method, which is as follows:
1
x1
1
b1 a12 x2 a13 x3 ....... a1n 1 xn1 a1 n xn
a11
1
x2 1 b2 a21 x1 1 a23 x3 ....... a2 n 1 xn1 a2 n xn
a22
..........................................................................................
1
xn11 bn 1 an 1,1 x1 1 ....... an 1,n 2 xn21 an 1,n xn
an 1,n 1
1
xn
1 1 1 1
b a x a x ....... a x
ann
n n 1 1 n 2 2 n , n 1 n 1
x1 x2 4 x3 9
8 x1 3 x2 2 x3 20
4 x1 11x2 x3 33
8 x1 3 x2 2 x3 20
4 x1 11x2 x3 33
x1 x2 4 x3 9
1
20 3 x2 2 x3
x1
8
1
x2 33 4 x1 x3
11
1
x3 9 x1 x2
4
0 0 0
Let the initial guess be x1 1, x2 1, x3 0 . Then, the first
approximation to the solution is given by
1
x1
1
20 3 1 2 0 2.875
8
x2
1 1
11
1
0 1
33 4 x1 x3 33 4 2.875 0 1.955
11
1 1
4
1 1
1
x3 9 x1 x2 9 2.875 1.955 1.043
4
2nd approximation
2
x1
1
8
20 3 x2
1
2 x 3
1
1
8
20 3 1.955 2 1.043 2.972
2
x2
1
11
1
33 4 x12 x13 33 4 2.972 1.043 2.014
11
2
x3
1
4
9 x2
2
x3
2
1
4
9 2.972 2.014 1.004
3rd approximation
3
x1
1
8
20
3 x 2
2 2 x3
2
1
8
20 3 2.014 2 1.004 3.004
3
x2
1
11
1
33 4 x13 x32 33 4 3.004 1.004 1.999
11
3
x3
1
4
9 x1
3
x 2
3
1
4
9 3.004 1.999 0.999
4th approximation
x1 4 3.00
4
x2 2.00
4
x3
1.00
(1) Use Jacobi’s method to solve the following system of equations, with
x 1,1,1 as initial approximation, correct to 2 significant figures.
0 T
x 10 y 3z 39
10 x 2 y 5 z 26
4 x 5 y 10 z 47
2 x 3 y 10 z 22
10 x 2 y z 9
x 10 y z 22
with x 0 1, 1,1T as starting vector. What is the minimum number of iterations
required, so that the solution is correct to 4 decimal places.
(Ans: True solution 1, 2, 3T ; number of iteration required =17)
3 x 9 y 2 z 11
4 x 2 y 13z 24
4 x 2 y z 8
(5) Do five iterations of each Jacobi’s and Gauss Seidel method to solve
2 x 3 y 7 z 16
3x y z 6
x 5 y 3z 10
with starting initial guess as (x, y, z) = (1,1,1). What is the minimum number of
iterations required, so that the solutions correct to 8 significant figures?