You are on page 1of 9

JACOBI ITERATIVE METHOD

Jacobian method or Jacobi method is one the iterative methods for approximating the solution
of a system of n linear equations in n variables. The Jacobi iterative method is considered as an
iterative algorithm which is used for determining the solutions for the system of linear equations
in numerical linear algebra, which is diagonally dominant. In this method, an approximate value
is filled in for each diagonal element. Until it converges, the process is iterated. This algorithm
was first called the Jacobi transformation process of matrix diagonalization. Jacobi Method is
also known as the simultaneous displacement method.

For a system of linear equations:

a11x1 + a12x2 + … + a1nxn = b1 (1)

a21x1 + a22x2 + … + a2nxn = b2 (2)

an1x1 + an2x2 + … + annxn = bn (n)

To find the solution to this system of equations Ax = B, we assume that the system of equations
have a unique solution and there is no zero entry among the diagonal or pivot elements of the
coefficient matrix A.

Now, we shall begin to solve equation (1) for x1, equation (2) for x2 and so on equation (n) for xn,
we get

x1 = 1/a11 [b1 – a12x2 – a13x3 – … – a1nxn]

x2 = 1/a22 [b2 – a21x1 – a23x3 – … – a2nxn]

xn = 1/ann [bn – an1x1 – an3x3 – … – an n – 1xn – 1]

By making an initial guess for the solution x(0) = (x1(0), x2(0), …, xn(0)) and substituting these values
only to the right hand side of the above equations we get first approximations x(1) = (x1(1), x2(1), …,
xn(1)). Continuing this process iteratively we get sequence of approximations {x(k)} such that as k
→ ∞, this sequence converges to exact solution of the system of equation up to a given error
tolerance.
Jacobian Method Example 1:
Solve the system of equations using the Jacobi Method

26x1 + 2x2 + 2x3 = 12.6


(1)

3x1 + 27x2 + x3 = – 14.3


(2)

2x1 + 3x2 + 17x3 = 6.0


(3)

Obtain the result correct to three decimal places.

Solution:

First, check for the convergence of approximations,

26 > 2 + 2

27 > 3 + 1

17 > 2 + 3

Hence, the given systems of equations are strongly diagonally dominant, which ensures the
convergence of approximations.

STEP 1: make coefficients of x1 in equation (1), x2, in equation (2) and x3 in equation (3) one,
STEP 2: make equation x1 x2, x3 subject of formula in equation 1, 2, 3 respectively
STEP 3: write the equations 1 to 3 to get the values of x1 x2, x3
12 .6− 2x2 - 2x 3
26 0 . 48− 0 . 077x 2−0. 077 x 3
x1 = =
−14 .3−3 x 1−x 3
27 −0 . 53− 0 .11x 1 − 0 .037x 3
x2 = =
6−2 x 1 −3 x 2
17 0 . 35− 0 .118x 1 +0 .176 x 2
x3 = =
First Iteration: Let us take the initial approximation, x1(0) = 0, x2(0) = 0 and x3(0) = 0

x1(1) = 0 . 48− 0 . 077(0 )−0. 077 (0) = 0.48462


x2(1) = −0 .53− 0 .11(0)− 0. 037 (0) = – 0.52963

x3(1) = 0 . 35− 0 .118(0 )+0 .176 (0) = 0.35294

Second iteration; we now have x1 = 0.48462, x2 = – 0.52963, x3 = 0.35294

x1(2) = 0 . 48− 0 . 077(−0 . 52963)−0 .077 (0 .35294 ) = 0.49821

x2(2) = −0 . 53− 0 .11(0 .. 48462 )− 0 .037 (0 .35294 ) = – 0. 59655

x3(2) = 0 . 35− 0 .118(0 . 485 )+0. 176( -0.5296 ) = 0.38939

Third iteration; we now have x1 = 0.49821, x2 = – 0. 59655 x3 = 0.38939

x1(3) = 0 . 48− 0 . 077(−0 . 59655)−0 .077 (0 .38939 ) = 0.50006

x2(3) = −0 . 53− 0 .11(0 . 49821)− 0 . 037(0 . 38939) = – 0. 59941

x3(3) = 0 . 35− 0 .118(0 . 49821)+0 . 176(-0. 59655 ) = 0.39960

Forth iteration; we now have x1 = 0.50006, x2 = – 0. 59941, x3 = 0.39960

x1(4) = 0 . 48− 0 . 077(−0 . 59941)−0 . 077 (0. 39960 ) = 0.50000

x2(4) = −0 . 53− 0 .11(0 .50006 )− 0 . 037(0 . 39960) = – 0. 59999

x3(4) = 0 . 35− 0 .118(0 . 49821)+0 . 176(-0. 59655 ) = 0.39989

Fifth iteration; we now have x1 = 0.50000, x2 = – 0. 59999, x3 = 0.39989

x1(4) = 0 . 48− 0 . 077(−0 . 59999)−0. 077 (0 .39989 ) = 0.50001

x2(4) = −0 . 53− 0 .11(0 .50000 )− 0 . 037(0 .39989 ) = – 0. 60000

x3(4) = 0 . 35− 0 .118(0 . 49821)+0 . 176(-0. 59655 ) = 0.40000

kth iteration 0 1 2 3 4 5

x1 0.000 0.48462 0.49821 0.50006 0.50000 0.50001

x2 0.000 – 0.52963 – 0. 59655 – 0.59941 – 0.59999 – 0.60000


x3 0.000 0.35294 0.38939 0.39960 0.39989 0.40000

After the fifth iteration, we get |x1(5) – x1(4)| = |0.50001 – 0.50000| = 0.00001

|x2(5) – x2(4)| = | – 0.6 + 0.59999| = 0.00001

|x3(5) – x3(4)| = | 0.4 – 0.39989| = 0.00011

Since, all the errors in magnitude are less than 0.0005, the required solution is

x1 = 0.5, x2 = – 0.6, x3 = 0.4.

EXAMPLE 2

Solve the following system of linear equations using iterative Jacobi method.
4x1 + 2x2 – 2x3 = 0
x1 – 3x2 – x3 = 7
3x1 – x2 + 4x3 = 5
Solution:
Given,
4x1 + 2x2 – 2x3 = 0 (1)
x1 – 3x2 – x3 = 7 (2)
3x1 – x2 + 4x3 = 5 (3)

STEP 1: make coefficients of x1 in equation, x2, in equation (2) and x3 in equation (3) one,
STEP 2: make equation x1 x2, x3 subject of formula in equation 1, 2, 3 respectively
STEP 3: write the equations 1 to 3 to get the values of x1 x2, x3
0− 2x 2 + 2x3 1 1
0− x2 + x3
4 2 2
x1 = =
7−x 1 + x 3 7 1 1
− − x 1− x 3
−3 3 3 3
x2 = =
5−3 x 1 + x 2 5 3 1
− x 1+ x 2
4 4 4 4
x3 = =
First iteration; make the initial guess x1 = 0, x2 = 0, x3 = 0.
1 1
− (0 ) + (0 )
2 2
So, x1(1) = =0
7 1 1
− − (0 ) − (0 )
3 3 3
x2(1) = = – 2.3
5 3 1
− (0 )+ (0)=1. 25
4 4 4
x3(1) =
Second iteration; we now have x1 = 0, x2 = – 2.3, x3 = 1.25
Repeating,
1 1
− (-2. 3 ) + (1. 25 )
2 2
x1(2) = = 1.79
7 1 1
− − (0 ) − (1 .25 )
3 3 3
x2(2) = = – 2.75
5 3 1
− (0 )+ (-2.3 )
4 4 4
x3(2) = = 0.6667
Third iteration; we now have x1 = 1.79, x2 = – 2.75, x3 = 0.6667
1 1
− (-2. 75 ) + (0 .667 )
2 2
x1(3) = = 1.7083
7 1 1
− − (1 .79 ) − (0 . 6667 )
3 3 3
x2(3) = = – 1.95
5 3 1
− (1. 79 )+ (-2.75 )
4 4 4
x3(3) = = - 0.7812
it is not converging

x k=0 k=1 k=2 k=3

x1(k) 0 0 1.7917 1.7083

x2(k) 0 -2.333 -2.75 -1.9583

x3(k) 0 1.25 0.6667 -0.7812

GAUSS-SEIDEL METHOD
The Guass-Seidel method is a improvisation of the Jacobi method. This method is named after
mathematicians Carl Friedrich Gauss (1777–1855) and Philipp L. Seidel (1821–1896). This
modification often results in higher degree of accuracy within fewer iterations.

In Jacobi method the value of the variables is not modified until next iteration, whereas in Gauss-
Seidel method the value of the variables is modified as soon as new value is evaluated. For
instance, in Jacobi method the value of xi(k) is not modified until the (k + 1)th iteration but in
Gauss-Seidel method the value of xi(k) changes in in kth iteration only.

Example 2:

Solve the system of equations using the Gauss-Seidel Method

45x1 + 2x2 + 3x3 = 58

–3x1 + 22x2 + 2x3 = 47

5x1 + x2 + 20x3 = 67

Obtain the result correct to three decimal places.

Solution:

First, check for the convergence of approximations,

45 > 2 + 3

22 > – 3 + 2

20 > 5 + 1
Hence, the given system of equations are strongly diagonally dominant, which ensures the
convergence of approximations. Let us take the initial approximation, x 1(0) = 0, x2(0) = 0 and x3(0) =
0

58− 2x 2 −3x3
45 1 .2889− 0. 044x 2− 0 . 0667x 3
So, x1 = =
47 +3 x1 −2 x 3
22 2 .1364 +0 .1364x 1 − 0 . 09091x 3
x2 = =
67−5 x1 −x 2
20 3 .35− 0 .25x 1 −0 .05 x 2
x3 = =
First iteration; make the initial guess x1 = 0, x2 = 0, x3 = 0.

1 .2889− 0. 044 (0 )− 0.0667 (0)


x1(1) = = 1.28889

2 .1364 +0 .1364 (1. 28889 )− 0 .09091( 0)


x2(1) = = 2.31212

3 .35− 0 .25 (1 . 28889)−0 .05 (2. 31212)


x3(1) = = 2.91217.
Second iteration;

1 .2889− 0. 044 (2. 31212) - 0. 0667(2 .91217 )


x1(2) = = 0.99198

2 .1364 +0 .1364 (0 . 99198)− 0 . 09091(2 .91217 )


x2(2) = = 2.00689

3 .35− 0 .25 (0. 99198 )−0 . 05(2 . 00689)


x3(2) = = 3.00166.
Third iteration;

1 .2889− 0. 044 (2. 00689 ) - 0. 0667(3 . 00166 )


x1(3) = = 0.99958

2 .1364 +0 .1364 (0 . 99958)− 0 . 09091(3 . 00166)


x2(3) = = 1.99979

3 .35− 0 .25 (0. 99958 )−0 . 05(1 . 99979)


x3(3) = = 3.00012
Forth iteration;
1 .2889− 0. 044 (1. 99979 ) - 0. 0667(3 . 00012)
x1(4) = = 1.0000

2 .1364 +0 .1364 (0 . 99958)− 0 . 09091(3 . 00166)


x2(4) = = 1.9999

3 .35− 0 .25 (1 . 0000)−0 .05 (1. 9999 )


x3(4) = = 3.0000

Likewise there will be modification in approximation with each iteration.

kth iteration 0 1 2 3 4

x1 0.000 1.28889 0.99198 0.99958 1.0000

x2 0.000 2.31212 2.00689 1.99979 1.99999

x3 0.000 2.91217 3.00166 3.00012 3.00000

After the fourth iteration, we get |x1(4) – x1(3)| = |1.0000 – 0.99958| = 0.00042

|x2(4) – x2(3)| = |1.99999 + 1.99979| = 0.00020

|x3(4) – x3(3)| = | 3.0000 – 3.00012| = 0.00012

Since, all the errors in magnitude are less than 0.0005, the required solution is

x1 = 1.0, x2 = 1.99999, x3 = 3.0.

Rounding to three decimal places, we get x1 = 1.0, x2 = 2.0, x3 = 3.0.

Practice Problems

1. Solve the system of equations using both Jacobi and Gauss-Seidel Method

5x1 – 2x2 + 3x3 = –1

–3x1 + 9x2 + x3 = 2

2x1 – x2 – 7x3 = 3
Obtain the result correct to three decimal places.

2. Solve the system of equations

x1 – 5x2 = –4

7x1 – x2 = 6.

You might also like