Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

1.

Solutions of Linear System of Equations

1.1 Gauss-Elimination
1.2 Thomas Algorithm for Tridiagonal System
Consider the system of linear simultaneous algebraic equations given by

Ax = b
where A is a tridiagonal matrix, x = [x1 , x2 , . . . , xn ]T and b = [b1 , b2 , . . . , bn ]T . Hence, we consider a
4 × 4 tridiagonal system of equations given by
   
a12 a13 0 0 x1 b1
 a21 a22 a23 0   x2   b2 
  =  (1.1)
 0 a31 a32 a33   x3   b3 
0 0 a41 a42 x4 b4

Equation (1.1) can be written as

a12 x1 + a13 x2 = b1
a21 x1 + a22 x2 + a23 x3 = b2
a31 x2 + a32 x3 + a33 x4 = b3
a41 x3 + a42 x4 = b4 (1.2)

The system of equations given by Eq. (1.2) is solved using Thomas Algorithm which is described
in three steps as shown below:
Step 1: Set y1 = a12 and compute
ai1 a(i−1)3
yi = ai2 − i = 2, 3, . . . , n
yi−1
b1
Step 2: Set z1 = a12 and compute
14 Chapter 1. Solutions of Linear System of Equations

bi − ai1 zi−1
zi = i = 2, 3, . . . , n
yi
Step 3: xi = zi − ai3yxii+1 i = n − 1, n − 2, . . . , 1, where xn = zn
■ Example 1.1 Solve the following equations by Thomas Algorithm.
3x1 − x2 = 5
2x1 − 3x2 + 2x3 = 5
x2 + 2x3 + 5x4 = 10
x3 − x4 = 1

Solution. Here
   
3 −1 0 0 x1 5
 2 −3 2 0   x2   5 
  = 
 0 1 2 5   x3   10 
0 0 1 −1 x4 1
[a2 , a3 , a4 ] = [2, 1, 1]
[b1 , b2 , b3 , b4 ] = [3, −3, 2, −1]
[c1 , c2 , c3 ] = [−1, 2, 5]
[d1 , d2 , d3 , d4 ] = [5, 5, 10, 1]
ai ci−1
Step 1: Set y1 = b1 = 3 and compute yi = bi − , i = 2, 3, . . . , n
yi−1
a2 c1 2(−1) 7
i = 2, y2 = b2 − = −3 − =−
y1 3 3
a3 c2 1 × 2 20
i = 3, y3 = b3 − = 2− 7 =
y2 −3 7
a4 c3 1.5 55
i = 4, y4 = b4 − = −1 − 20 = −
y3 7
20
d1 5 di − ai zi−1
Step 2: Set z1 = = and compute zi = , i = 2, 3, . . . , n
b1 3 yi
d2 − a2 z1 5 − 2 × 35 5
i = 2, z2 = = 7
=−
y2 −3 7
d3 − a3 z2 10 − 1 − 57

75
i = 3, z3 = = 20
=
y3 7
20
75
d4 − a4 z3 1 − 1 × 20
i = 4, z4 = = 55
=1
y4 − 20
ci xi+1
Step 3: Set xn = zn ; i.e., x4 = z4 = 1 and compute xi = zi − ; i = n − 1, n − 2, . . . , 1
yi
c3 x4 75 5 × 1
i = 3, x3 = z3 − = − 20 = 2
y3 20 7
c2 x3 5 2×2
i = 2, x2 = z2 − =− − 7 =1
y2 7 −3
c1 x2 5 (−1) × 1
i = 1, x1 = z1 − = − =2
y1 3 3
1.2 Thomas Algorithm for Tridiagonal System 15

■ Example 1.2 Solve the following set of tridiagonal set of algebraic equations using Thomas’s
method.
x1 + 4x2 = 10
2x1 + 10x2 − 4x3 = 7
x2 + 8x3 − x4 = 6
x3 − 6x4 = 4

Solution. Here
   

1 4 0 0 x1 10
 2 10 −4 0   x2   7 
  = 
 0 1 8 −1   x3   6 
0 0 1 −6 x4 4
[a2 , a3 , a4 ] = [2, 1, 1]
[b1 , b2 , b3 , b4 ] = [1, 10, 8, −6]
[c1 , c2 , c3 ] = [4, −4, −1]
[d1 , d2 , d3 , d4 ] = [10, 7, 6, 4]
ai ci−1
Step 1: Set y1 = b1 = 1 and compute yi = bi − , i = 2, 3, . . . , n
yi−1
a2 c1 2×4
i = 2, y2 = b2 − = 10 − =2
y1 1
a3 c2 8 − 1(−4)
i = 3, y3 = b3 − = = 8 + 2 = 10
y2 2
a4 c3 1 × (−1) −60 + 1 59
i = 4, y4 = b4 − = −6 − = =−
y3 10 10 10
d1 10 di − ai zi−1
Step 2: Set z1 = = = 10 and compute zi = , i = 2, 3, . . . , n
b1 1 yi
d2 − a2 z1 7 − 2.10 13
i = 2, z2 = = =−
y2 2 2
d3 − a3 z2 6 − 1(−13/2) 6 + 13/2 25
i = 3, z3 = = = =
y3 10 10 20
d4 − a4 z3 4 − 1 × 25/20 55
i = 4, z4 = = =−
y4 −59/10 118
55 ci xi+1
Step 3: Set xn = zn ; i.e., x4 = z4 = − 118 = −0.466 and compute xi = zi − ; i = n − 1, n −
yi
2, . . . , 1
c3 x4 25 (−1)(−55/118)
i = 3, x3 = z3 − = − = 1.203
y3 20 10
c2 x3 13 (−4)1.203
i = 2, x2 = z2 − =− − = −4.094
y2 2 2
c1 x2 4(−4.094)
i = 1, x1 = z1 − = 10 − = 26.376
y1 1

16 Chapter 1. Solutions of Linear System of Equations

1.3 Practice Problem


1. Solve the following equations by Thomas Algorithm.

−2x1 + x2 = −1
x1 − 2x2 + 1x3 = 0
x2 − 2x3 + x4 = 0
x3 − 2x4 = −5

13 17 21 9
Ans: x1 = , x2 = , x3 = , x4 =
5 5 5 5
2. Solve the following equations by Thomas Algorithm.

2x1 + 3x2 = 21
6x1 + 3x2 + 9x3 = 69
2x2 + 5x3 + 2x4 = 34
4x3 + 3x4 = 22

Ans: x1 = 5, x2 = 4, x3 = 2, x4 = 3

1.4 Gauss-Seidel iteration method


1.5 Diagonal dominance and convergence of Gauss- Seidel iteration method

You might also like