Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Solving system of linear Non- Homogeneous equations

JACOBI’S ITERATION METHOD

Let us consider the system of equations

a 11 x1 + a12 x 2+ a13 x 3=b1

a 21 x1 + a22 x 2+ a23 x 3=b2

a 31 x1 + a32 x 2+ a33 x 3=b3 … … … … … … … … …(1)

Where the coefficients of the diagonal elements are all not equal to zero and large
compared to the other coefficients. Systems of this type are known as diagonally
dominant systems.

The solution to the above system is obtained by iteration method called Jacobi’s iteration
method.

Procedure: Given equations can be written as

1
x 1= [ b −a x −a x ]
a11 1 12 2 13 3

1
x 2= [ b −a x −a x ]
a22 2 21 1 23 3

1
x 3= [ b −a x −a x ] … … … … …..(2)
a33 3 31 1 32 2

Suppose x 1(0 ) , x2( 0) , x 3( 0 ) are the initial approximate values of x1,x2,x3 with satisfy equation
(2). Substituting these values in to the right sides of equations (2), we obtain a system of
first approximation of x1,x2,x3 or first iterates, given by

1
x 1( 1) = [ b −a x ( 0)−a13 x 3(0 ) ]
a11 1 12 2

1
x 2( 1) = [ b −a x (0)−a23 x 3(0 ) ]
a 22 2 21 1

1
x 3 ( 1) = [ b −a x (0 )−a32 x 2(0 ) ] … … … … ..(3)
a 33 3 31 1
Substituting x 1(1) , x 2(1 ) , x 3(1) for x1,x2,x3 in the right sides of equations (2), we obtain the
second iterates, given by

1
x 1( 2) =
a 11
[ b1−a 12 x 2( 1) −a13 x 3(1) ]

1
x 2( 2) = [ b −a x (1)−a23 x 3(1 )]
a 22 2 21 1

1
x 3 ( 2) =
a 33
[ b3−a31 x 1(1)−a32 x 2(1 )] … … … … ..(4)

Proceeding like this we get successive iterates.

The (k+1) iterates are given by

1
x 1(k+1 )=
a11
[ b1 −a12 x 2(k )−a 13 x 3(k ) ]

1
x 2(k+1 )= [ b −a x ( k )−a 23 x 3(k ) ]
a22 2 21 1

1
x 3(k +1)=
a33
[ b 3−a 31 x1( k )−a32 x 2(k ) ]

The process of iteration is stopped when the desired order of approximation is reached or
two successive iterations are nearly the same.

The values of x1,x2,x3 are called solutions of equation (1).

We can extend this method to ‘n’ equations in ‘n’ unknowns. This method is known as
the Jacobi’s iteration method.

Note: In this method, the process of iteration starts with some initial approximation to
the solution, namely x 1(0 ) , x2( 0) , x 3( 0 ) . This initial solution is chosen as zero solution.

Problems
1. Using Jacobi’s iteration method, solve the system of equations 10x+2y+z = 9,
x+10y-z = -22, -2x+3y+10z = 22
Solution: We observe that given system is diagonally dominant.
Then given equations can be written as
1
x= [ 9−2 y −z ]
10
1
y= [ z−x−22 ]
10
1
z= [ 22=2 x−3 y ] … … … … … … … ..(1)
10

Consider the initial solutions x = 0, y = 0, z = 0


Substituting these values in R.H.S of equation (1), we get the first approximate
solution as
1 9
x (1) = [ 9−0−0 ]= =0.9
10 10
1 −22
y (1 )= [ 0−0−22 ] = =−2.2
10 10
1 22
z (1 )= [ 22+ 0−0 ] = =2.2
10 10

Substituting these values in R.H.S of equation (1), we get the second approximate
solution as
1 1 11.2
x ( 2 )= [ 9−2 y (1 )−z (1) ]= [ 9−2 (−2.2 )−2.2 ] = =1.12
10 10 10
1 1 −20.7
y (2 )= [ z (1)−x ( 1)−22 ] = [ 2.2−0.9−22 ]= =−2.07
10 10 10
1 1 30.4
z (2 )= [ 22+ 2 x (1 )−3 y (1) ]= [22+2 ( 0.9 ) −3 (−2.2 ) ] = =3.04
10 10 10

Again, substituting these values in R.H.S of equation (1), we get the third
approximate solution as
1 1 10.1
x (3 )= [ 9−2 y (2 )−z (2 )] = [ 9−2 (−2.07 ) −3.04 ] = =1.01
10 10 10
1 1 −20.08
y (3 )= [ z (2) −x( 2)−22 ]= [ 3.04−1.12−22 ] = =−2.008
10 10 10
1 1 30.45
z (3 )= [ 22+ 2 x (2 )−3 y (2 )] = [ 22+ 2 ( 1.12 )−3 (−2.07 ) ]= =3.045
10 10 10
Again, substituting these values in R.H.S of equation (1), we get the next approximate
solution as

1
x (4 )= [ 9−2 y (3)−z ( 3) ]= 1 [ 9−2 (−2.008 )−3.045 ]= 9.971 =0.9971
10 10 10
1 ( 3) ( 3 )
[ z −x −22 ]= 1 [ 3.045−1.01−22 ] = −19.965 =−1.9965
y ( 4) =
10 10 10
1 1 30.044
z (4 )= [ 22+2 x (3)−3 y ( 3) ] = [ 22+2 ( 1.01 )−3 (−2.008 ) ]= =3.0044
10 10 10

Again, substituting these values in R.H.S of equation (1), we get the next approximate
solution as

1
x (5 )= [ 9−2 y ( 4)−z ( 4 ) ]= 1 [ 9−2 (−1.9965 )−3.0044 ]= 9.9886 =0.9989
10 10 10
1 1 −19.9927
y (5 )= [ z (4 )−x (4 )−22 ]= [ 3.0044−0.9971−22 ] = =−1.9993
10 10 10
1 1 29.9837
z (5 )= [ 22+ 2 x ( 4)−3 y ( 4 ) ]= [ 22+ 2 ( 0.9971 ) −3 (−1.9965 ) ]= =2.9984
10 10 10

Again, substituting these values in R.H.S of equation (1), we get the next approximate
solution as

1
x (6 )= [ 9−2 y ( 5)−z (5 ) ]= 1 [ 9−2 (−1.9993 ) −2.9984 ]= 10.0002 =1.00002=1.0000
10 10 10
1 1 −20.0005
y (6 )= [ z (5 )−x (5)−22 ] = [ 2.9984−0.9989−22 ] = =−2.00005=−2.000
10 10 10
1 1 29.9957
z (6 )= [ 22+2 x (5 )−3 y (5 ) ]= [ 22+2 ( 0.9989 )−3 (−1.9993 ) ] = =2.99957=2.9996
10 10 10
Again, substituting these values in R.H.S of equation (1), we get the next approximate
solution as

1
x (7 )= [ 9−2 y ( 6)−z (6 ) ]= 1 [ 9−2 (−2 )−2.9996 ]= 10.0004 =1.00004=1.0000
10 10 10
1 1 −20.0004
y (7 )= [ z (6 )−x (6 )−22 ] = [ 2.9996−1−22 ] = =−2.00004=−2.000
10 10 10
1 1 30
z (7 )= [ 22+2 x ( 6)−3 y (6 ) ]= [ 22+2 ( 1 )−3 (−2 ) ]= =3
10 10 10

We note that the solutions in the 6th and 7th iterations are nearly equal. So we stop the
iteration process, and take the solution of the system as x = 1,y = -2, z = 3.

2. Solve the equations 5x-y+3z =10, 3x+6y =18, x+y+5z = -10 by Jacobi’s method with
(3,0,-2) as the initial approximation to the solution.

Solution: We observe that given system is diagonally dominant.


⸫ Given equations can be written as
1
x= [ 10+ y−3 z ]
5
1
y= [ 18−3 x ]
6
−1
z= [ 10+ x + y ] … … … … … … … …. (1)
5

The initial approximation to the solution is given as x (0 )=3 , y (0) =0 , z ( 0)=−2


Substituting these values in R.H.S of equation (1), we get the first approximate
solution as
1 1 1
x (1) = [ 10+ y (0 )−3 z( 0) ]= [ 10+ 0−3 (−2 ) ] = [ 15 ]=3
5 5 5
1 1 1
y (1 )= [ 18−3 x ( 0) ]= [18−3 ( 3 ) ]= [ 9 ] =1.5
6 6 6
−1
z (1 )= [10+ x( 0) + y (0 ) ]= −1 [ 10+3+0 ] =−1 [ 13 ] =−2.6
5 5 5
Substituting these values in R.H.S of equation (1), we get the second approximate
solution as
1 1 1
x (2 )= [ 10+ y (1) −3 z ( 1) ]= [ 10+1.5−3 (−2.6 ) ] = [ 19.3 ] =3.86
5 5 5
1 1 1
y (2 )= [ 18−3 x ( 1) ] = [ 18−3 ( 3 ) ] = [ 9 ] =1.5
6 6 6
−1
z (2 )= [ 10+ x( 1) + y (1 ) ]=−1 [ 10+3+ 1.5 ] = −1 [ 14.5 ] =−2.9
5 5 5
Again, substituting these values in R.H.S of equation (1), we get the third
approximate solution as
1 1 1
x (3 )= [ 10+ y (2 )−3 z ( 2) ]= [ 10+1.5−3 (−2.9 ) ] = [ 20.2 ] =4.04
5 5 5
1 1 1
y (3 )= [ 18−3 x( 2) ] = [18−3 ( 3.86 ) ] = [ 6.42 ]=1.07
6 6 6
−1
z (3 )= [ 10+ x (2) + y (2 ) ]= [ 10+ 3.86+1.5 ] = −1 [ 15.36 ] =−3.072
−1
5 5 5
Again, substituting these values in R.H.S of equation (1), we get the next approximate
solution as
1 1 1
x (4 )= [ 10+ y ( 3)−3 z (3 ) ] = [ 10+1.07−3 (−3.072 ) ]= [ 20.286 ] =4.0572
5 5 5
1 1 1
y ( 4)= [ 18−3 x (3 ) ] = [ 18−3 ( 4.04 ) ] = [ 5.88 ] =0.98
6 6 6
−1
z (4 )= [ 10+ x (3 )+ y (3) ]= −1 [ 10+ 4.04+1.07 ] =−1 [ 15.11 ] =−3.022
5 5 5
Again, substituting these values in R.H.S of equation (1), we get the next approximate
solution as
1 1 1
x (5 )= [ 10+ y (4 )−3 z (4 ) ] = [ 10+0.98−3 (−3.022 ) ]= [ 20.046 ]=4.0092
5 5 5
1 1 1
y (5 )= [ 18−3 x( 4 ) ]= [ 18−3 ( 4.0572 ) ] = [ 5.8284 ]=0.9714
6 6 6
−1
z (5 )= [ 10+ x (4 )+ y (4 ) ]= −1 [ 10+4.0572+0.98 ]= −1 [ 15.0372 ] =−3.00744
5 5 5
Again, substituting these values in R.H.S of equation (1), we get the next approximate
solution as
1 1 1
x (6 )= [ 10+ y (5 )−3 z (5) ] = [ 10+ 0.9714−3 (−3.00744 ) ] = [ 19.99372 ] =3.998744
5 5 5
1 1 1
y (6 )= [ 18−3 x( 5) ]= [18−3 ( 4.0092 ) ]= [ 5.9724 ] =0.9954
6 6 6
−1
z (6 )= [ 10+ x (5) + y (5 ) ]= −1 [ 10+4.0092+0.9714 ] = −1 [ 14.9806 ] =−2.99612
5 5 5
Again, substituting these values in R.H.S of equation (1), we get the next approximate
solution as
1 1 1
x (7 )= [ 10+ y (6 )−3 z (6 )] = [ 10+ 0.9954−3 (−2.99612 ) ]= [ 19.98376 ] =3.996752
5 5 5
1 1 1
y (7 )= [ 18−3 x( 6) ] = [ 18−3 ( 3.998744 ) ]= [ 6.003768 ] =1.000628
6 6 6
−1
z (7 )= [ 10+ x (6 )+ y ( 6) ]= −1 [ 10+3.998744+ 0.9954 ] = −1 [ 14.994144 ]=−2.9988288
5 5 5
Again, substituting these values in R.H.S of equation (1), we get the next approximate
solution as
1 1 1
x (8 )= [ 10+ y (7 )−3 z (7 )] = [10+ 1.000628−3 (−2.9988288 ) ] = [ 19.9971144 ] =3.999423
5 5 5
1 1 1
y (8 )= [ 18−3 x( 7) ]= [ 18−3 ( 3.996752 ) ] = [ 6.009744 ] =1.001624
6 6 6
−1
z (8 )= [ 10+ x (7 )+ y ( 7) ]= −1 [ 10+3.996752+1.000628 ] = −1 [ 14.99738 ] =−2.999476
5 5 5
Again, substituting these values in R.H.S of equation (1), we get the next approximate
solution as
1 1 1
x (9 )= [ 10+ y (8 )−3 z (8 )] = [10+ 1.001624−3 (−2.999476 ) ] = [ 20.000052 ] =4.0000104=4.000
5 5 5
1 1 1
y ( 9)= [ 18−3 x( 8) ]= [ 18−3 ( 3.999423 ) ]= [ 6.001731 ]=1.0002885
6 6 6
−1
z (9 )= [ 10+ x (8 )+ y ( 8) ]= −1 [ 10+3.999423+1.001624 ] =−1 [ 15.001047 ] =−3.0002094
5 5 5
Again, substituting these values in R.H.S of equation (1), we get the next approximate
solution as
1
x (10 )= [10+ y (9 )−3 z ( 9) ]= 1 [ 10+1.0002885−3 (−3.0002094 ) ]= 1 [ 20.0009167 ]=4.000183=4.000
5 5 5
1 1 1
y (10 )= [ 18−3 x ( 9) ] = [18−3 ( 4 ) ] = [ 6 ] =1
6 6 6
−1
z (10)= [10+ x( 9) + y (9 ) ]= −1 [ 10+4 +1.0002885 ] = −1 [ 15.0002885 ] =−3.0000577=−3
5 5 5

We observe that the solutions in the 9th and 10th iterations are nearly equal.
⸫ The solution of the equations are x =4, y = 1, z = -3.

Solve the equations by Jacobi’s method

3. 20x+y-2z =17,3x+20y-z = -18,2x-3y+20z = 25


4. 6y-z+27x= 85,6x+15y+2z = 72, x+y+54z = 110.
5. 5x1-x2 =9, -x1+5x2-x3 = 4, x2-5x3 = 6 by Jacobi’s method with (1.8,0.8,-1.2) as the
initial approximation to the solution. Carry out six steps.

You might also like