Gauss Seidel Method
Gauss Seidel Method
1 i 1 n
x1
1 1
(b1 a12 x2 a1n xn )
0 0 k 1
xi bi
aii
aij x aij x
k
j
k
j
a11 j 1 j i 1
1
x2
1
(b2 a21 x10 a23 x30 a2 n xn0 )
a22
1
x1n (bn an1 x10 an 2 x20 ann1 xn01 )
ann
xk+1=Exk+f iteration for Jacobi method
1 i 1 n xk+1=-D-1(L+U)xk+D-1b
bi aij x j aij x j
k 1
xi k k
aii j 1 j i 1 E=-D-1(L+U)
Dxk+1 Lx k Uxk f=D-1b
Jacobi Method with examples
• Consider the two-by-two system x
1
y3
2x y 6 2
x 2y 6 1
• Start with x (1) y (1) 1/ 2 y x3
2
• Simultaneous updating
• New values of the variables are
not used until a new iteration
step is begun
y ( 2)
1 (1) 1 11
x ( 2) y 3 3
2 4 4
y (1)
1 (1) 1 11
y ( 2) x 3 3
2 4 4 x (1) x ( 2)
Jacobi Method
• Con’t
1 ( 2) 11 13
x (3)
y 3 3
2 8 8
1 11 13
y ( 3) x ( 2) 3 3
2 8 8
Jacobi Method
• Consider the three-by-three system
2 x1 x2 x3 1
x1 2 x2 x3 6
x1 x2 2 x3 3
x1 0.5 x2 0.5 x3 0.5
x2 0.5 x1 0.5 x3 3.0
x3 0.5 x1 0.5 x2 1.5
y ( 2)
• A necessary and sufficient
condition for the
convergence of the Jacobi y (1)
method x (1) x ( 2) x
• The magnitude of the largest
eigenvalue of the iteration
matrix C be less than 1
Jacobi method : Example 1
Consider a circuit shown in figure here; currents i1, i2, and i3 are given by
0, x2 0, x3 0 and x4 0.
( 0) ( 0) ( 0) ( 0)
x1
1 1 3
(1)
x1 (0) (0)
0.6000,
10 5 5 (1)
1 1 3 25 x1
(1)
x2 (0) (0) (0)
2.2727,
11 11 11 11 (1)
1 1 1 11 x2
(0)
(1)
x3 (0) (0)
5 10 10 10
1.1000
(1)
3 1 15 x3
(0)
(1)
x4 (0)
8 8 8
1.8750
(1)
x4
Jacobi method : Example 2
1 (1) 1 (1) 3
(2)
x1 x2 x3
10 5 5
1 (1) 1 (1) 3 (1) 25
x3
( 2)
x2 x1 x4
11 11 11 11
1 (1) 1 (1) 1 (1) 11
x1
( 2)
x3 x2 x4
5 10 10 10
3 (1) 1 (1) 15
x2
( 2)
x4 x3
8 8 8
1 ( k 1) 1 ( k 1) 3
x1 x3
(k)
x2
10 5 5
1 ( k 1) 1 ( k 1) 3 ( k 1) 25
x3
(k )
x2 x1 x4
11 11 11 11
1 ( k 1) 1 ( k 1) 1 ( k 1) 11
x1 x4
(k )
x3 x2
5 10 10 10
3 ( k 1) 1 ( k 1) 15
x2 x3
(k )
x4
8 8 8
Jacobi method : Example 2
Results:
iteration 0 1 2 3
15 x20 5 x30 15
x
1
1
7.5
2 2 b Ax1 54.8546
21 4 x10 x30 21 2
x2
1
2.625
8 8
x31 7 4 x10 x20 7.0
Jacobi method : Example 3
15 2.625 5 7
x
1
1 11.3125
2
21 4 7.5 7
x12 0.25
8 b Ax2 208.3761
2
x31 7 4 7.5 2.625 39.625
4) do { 1 jN
a) compute: xi bi Qij x j
A ii j 1
max xi xi
i 1,.., N
b) compute error: err
max bi
i 1,.., N
xi xi
c) update x:
}while err>tol
The rules
We set up the Jacobi iteration but did not ask the question “when
will the Jacobi iteration converge and how fast?”
Definition: N
Theorem:
If the matrix A is diagonally dominant then Ax=b has a unique
solution x and the Jacobi iteration produces a sequence which
converges to x for any initial guess
Informally:
The “more diagonally dominant ” a matrix is the faster it will
converge… this holds some of the time.
Numerical Methods
10 x1 x2 2 x3 6
x1 11x2 x3 3x4 25
2 x1 x2 10 x3 x4 11
3 x2 x3 8 x4 15
The Jacobi and Gauss-Siedel Iterative Techniques
10 x1 x2 2 x3 6 10 x1 x2 2 x3 6
x1 11x2 x3 3x4 25 11x2 x1 x3 3x4 25
2 x1 x2 10 x3 x4 11 10 x3 2 x1 x2 x4 11
3 x2 x3 8 x4 15 8 x4 3x2 x3 15
Jacobi Iterative Method
From the initial approx. 𝒙(𝟎) = (𝟎, 𝟎, 𝟎, 𝟎)𝑻 we 𝒙(𝟏) Change the coeff of LHS to be one by division
0
x1( k 1) ( x2( k ) 2 x3( k ) 6) / 10 0
x ( 0)
x2( k 1) ( x1( k ) x3( k ) 3x4( k ) 25) / 11 0
x3( k 1) ( 2 x1( k ) x2( k ) x4( k ) 11) / 10 0
x4( k 1) ( 3x2( k ) x3( k ) 15) /( 8)
a11 a1n x1 b1
Jacobi iteration for general n:
for i 1 : n an1 ann xn bn
i 1 n
( k 1)
x bi aij x j aij x j
(k ) (k )
i a
j 1 j i 1 ii
end
for i 1 : n
i 1 n
( k 1)
x bi aij x j aij x j
( k 1) (k )
i a
j 1 j i 1 ii
end
The Jacobi and Gauss-Siedel Iterative Techniques
10 x1 x2 2 x3 6 10 x1 x2 2 x3 6
x1 11x2 x3 3x4 25 11x2 x1 x3 3x4 25
2 x1 x2 10 x3 x4 11 10 x3 2 x1 x2 x4 11
3 x2 x3 8 x4 15 8 x4 3x2 x3 15
Example1 Example2
A A
10 -1 2 0 10 -1 2 0
-1 11 -1 3 -1 4 -1 3
2 -1 10 -1 2 -1 4 -1
0 3 -1 8 0 3 -1 2
THM:
A is strictly diagonally dominant GS Convg
The Jacobi and Gauss-Siedel Iterative Techniques
Definition Example1
norm of the vector x = (x1, x2, x3)t gives the length of the
straight line joining the points (0, 0, 0) and (x1, x2, x3).