You are on page 1of 3

6-5

Chapter 6

Boundary-Value Problems

6.2 The Thomas Algorithm for Tridiagonal Matrix Equations

Consider the following tridiagonal system of equations


(
(
(
(
(
(
(


n n
n n n
b a
c b a
c b a
c b a
c b
0 0
0 0
0 0
0 0
0 0
1 1 1
3 3 3
2 2 2
1 1


(
(
(
(
(
(
(

n
n
y
y
y
y
y
1
3
2
1

=
(
(
(
(
(
(
(

n
n
r
r
r
r
r
1
3
2
1



where a
i
, b
i
, and c
i
represent the coefficients of y
i-1
, y
i
(the diagonal element), and y
i+1
,
respectively, in the ith equation. Using Gaussian elimination, y
1
can be eliminated from the
system by using the first equation to eliminate y
1
from the second equation. Likewise, the
second equation can be used to eliminate from y
2
the third equation. The process can be
repeated until the nth equation where the elimination of y
n-1
will provide the answer for y
n

since there are only two unknowns y
n-1
and y
n
in this equation. Back substitution to the (n-
1)th equation provides the answer for y
n-1
. In this manner, the solution for y
i
can be obtained
from knowing y
i+1
. The application of Gaussian elimination to a set of linear equations with a
tridiagonal coefficient matrix requires significantly fewer calculations than its application to
a general set of linear equations. This procedure is known as the Thomas algorithm with the
following results:

|
1
= b
1



1
= r
1
/|
1


For i = 2, ., n

|
i
= b
i
(a
i
c
i-1
/|
i-1
)


i
= (r
i
a
i

i-1
)/|
i


y
n
=
n


For j = 1, ., n1

y
n-j
=
n-j
c
n-j
y
n-j+1
/|
n-j


End
6-6
Example 6.2-1 _____________________________________________________

Solve the following set of linear equations
1



(
(
(
(

1 2 0 0
1 1 4 0
0 1 2 1
0 0 3 2
(
(
(
(

4
3
2
1
y
y
y
y
=
(
(
(
(

2
9
2
4


Solution

The values of a
i
, b
i
, c
i
, and r
i
are given as

i a
i
b
i
c
i
r
i

1
2
3
4
0
1
4
2
2
2
-1
-1
-3
-1
1
0
-4
2
9
2

It should be noted that the values of a
1
and c
4
never needed in the calculation. Therefore they
can be assigned any value without affecting the solution. For the elimination steps, we apply
the formula

|
1
= b
1



1
= r
1
/|
1


For i = 2, ., n

|
i
= b
i
(a
i
c
i-1
/|
i-1
)


i
= (r
i
a
i

i-1
)/|
i


|
1
= b
1
= 2


1
= r
1
/|
1
= 4/2

= 2

|
2
= b
2
(a
2
c
1
/|
1
) = 2 1(3)/2 = 3.5


2
= (r
2
a
2

1
)/|
2
= [2 1(2)]/3.5 = 1.14

|
3
= b
3
(a
3
c
2
/|
2
) = 1 4(1)/3.5 = 0.143


3
= (r
3
a
3

2
)/|
3
= [9 4(1.14)]/0.143 = 31

1
Riggs, J. B. An Introduction to Numerical Methods for Chemical Engineers, Texas Tech University Press,
1994, p. 39
6-7


|
4
= b
4
(a
4
c
3
/|
3
) = 1 2(1)/0.143 = 15


4
= (r
4
a
4

3
)/|
4
= [2 2(31)]/(15) = 4

For the back substitution steps, we apply the formula

y
n
=
n


For j = 1, ., n1

y
n-j
=
n-j
c
n-j
y
n-j+1
/|
n-j


y
4
=
4
= 4

y
3
= (
3
c
3
y
4
)/|
3
= [31 1(4)]/0.143 = 3

y
2
= (
2
c
2
y
3
)/|
2
= [1.14 (1)(3)]/3.5 = 2

y
1
= (
1
c
1
y
2
)/|
1
= [2 (3)(2)]/2 = 1

You might also like