Professional Documents
Culture Documents
ms6021 Thomas
ms6021 Thomas
W. T. Lee∗
MS6021, Scientific Computation, University of Limerick
The Thomas algorithm is an efficient way of solving tridiagonal matrix systems. It is based on LU decompo-
sition in which the matrix system M x = r is rewritten as LU x = r where L is a lower triangular matrix and
U is an upper triangular matrix. The system can be efficiently solved by setting U x = ρ and then solving first
Lρ = r for ρ and then U x = ρ for x. The Thomas algorithm consists of two steps. In Step 1 decomposing the
matrix into M = LU and solving Lρ = r are accomplished in a single downwards sweep, taking us straight
from M x = r to U x = ρ. In step 2 the equation U x = ρ is solved for x in an upwards sweep.
Row 4. Row 6
a4 x3 + b4 x4 + c4 x5 = r4 a6 x5 + b6 x6 = r6
Use a4 times row 3 of the matrix to eliminate the first term Use a6 times row 5 to eliminate the first term.
a4 (x3 + γ3 x4 = ρ3 ) a6 x5 + a6 γ5 x6 = a6 ρ5
Row 5 a5 x4 + b5 x5 +c5 x6 = r5
1 γ1 0 0 0 0 x1 ρ1
a5 × Row 4 a5 x4 + a5 γ4 x 5 = a5 ρ4 0
1 γ2 0 0 0 x ρ
2 2
New Row 5 (b5 − a5 γ4 ) x5 +c5 x6 = r5 − a5 ρ4 0
0 1 γ3 0 0 x3 ρ3
=
0 0 0 1 γ4 0
Divide through by (b5 − a5 γ4 ) to get x4 ρ4
0 0 0 0 1 γ5 x5 ρ5
c5 r5 − a5 ρ4 0 0 0 0 0 1 x6 ρ6
x4 + x5 =
b5 − a 5 γ 4 b5 − a 5 γ 4
We can rewrite this as
c5 r5 − a5 ρ4
x5 + γ5 x6 = ρ5 , γ5 = , ρ5 = .
b5 − a 5 γ 4 b5 − a 5 γ 4
3
Row 5: x5 + γ5 x6 = ρ5 . Row 1: x1 + γ1 x2 = ρ1 .
Rearrange to get: x5 = ρ5 − γ5 x6 . Rearrange to get: x1 = ρ1 − γ1 x2 .
1 γ1 0 0 0 0 x1 ρ1 1 γ1 0 0 0 0 x1 ρ1
0 1 γ2 0 0 0 x ρ 0 1 γ2 0 0 0 x ρ
2
2 2
2
0 0 1 γ3 0 0 x3 ρ3 0 0 1 γ3 0 0 x3 ρ3
= =
0 0 0 1 γ4 0 0 0 0 1 0
x4 ρ4 γ4 x4 ρ4
0 0 0 0 1 γ5 x5 ρ5 0 0 0 0 1 γ5 x5 ρ5
0 0 0 0 0 1 x6 ρ6 0 0 0 0 0 1 x6 ρ6