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

Applied Mathematics and Computation 161 (2005) 691–696

www.elsevier.com/locate/amc

A new computational algorithm for


solving periodic tri-diagonal linear systems
M.E.A. El-Mikkawy
Faculty of Science, Mathematics Department, Mansoura University, Mansoura 35516, Egypt

Abstract
In this article we present a new efficient computational algorithm for solving periodic
tri-diagonal linear systems. The implementation of the algorithm using Computer
Algebra Systems (CAS) such as MAPLE, MACSYMA, MATHEMATICA and
MATLAB is straightforward. An example is given in order to illustrate the algorithm.
 2004 Elsevier Inc. All rights reserved.

Keywords: Periodic tri-diagonal matrices; Linear systems; Computer algebra systems (CAS)

1. Introduction

It often happens that a matrix has some favorable characteristics. These


characteristics should be taken into account when we consider the develop-
ment of new algorithms for solving problems that involve these kinds of
matrices.
In the current paper, we are going to deal with one of these cases. In more
detail, the main objective of the paper is to develop an efficient algorithm for
solving periodic tri-diagonal linear systems of the form:

Ax ¼ k; ð1:1Þ

E-mail address: mikkawy@yahoo.com (M.E.A. El-Mikkawy).

0096-3003/$ - see front matter  2004 Elsevier Inc. All rights reserved.
doi:10.1016/j.amc.2003.12.114
692 M.E.A. El-Mikkawy / Appl. Math. Comput. 161 (2005) 691–696

where
2 3
d1 a1 0  0 t
6 .. 7
6 b2 d2 a2 . 7 0
6 .. 7 ..
6 7
60 b3 d3 . 0 7 .
A¼6 . .. .. .. .. 7: ð1:2Þ
6 . 7
6 . . . . . 0 7
6 .. .. 7
40 0 . . an1 5
s 0  0 bn dn

x ¼ ðx1 ; x2 ; . . . ; xn ÞT and k ¼ ðk1 ; k2 ; . . . ; kn ÞT .


This linear system of equations frequently appears in many scientific and
engineering areas. A general n  n periodic tri-diagonal matrix A of the form
(1.2) can be stored in 3n memory locations by using three vectors a ¼ ða1 ; a2 ;
. . . ; an1 ; s; tÞ, b ¼ ðb2 ; b3 ; . . . ; bn Þ and d ¼ ðd1 ; d2 ; . . . ; dn Þ. When considering the
system (1.1) it is advantageous to introduce an additional n-dimensional vector
c ¼ ðc1 ; c2 ; . . . ; cn Þ whose first n  1 components are related to the vectors a, b
and d by:

d1 i ¼ 1;
ci ¼ bi
di  ci1 ai1 i ¼ 2; 3; . . . ; n  1: ð1:3Þ

The current article is organized as follows. In Section 2, a best known


algorithm [1], designed for serial implementation, for the solution of the system
(1.1) is given. A new computational algorithm, for the same purpose, is pre-
sented in Section 3. In Section 4, an example is given in order to illustrate the
new algorithm.

2. The Sherman–Morrison algorithm


T
Consider the two vectors z ¼ ðs; 0; 0; . . . ; 0; tÞ and w ¼ ð1; 0; 0; . . . ;
T
0; 1Þ . Consider also the tri- diagonal matrix B defined by:
2 3
d1 þ s a1 0  0 0
6 .. 7
6 b2 d2 a2 . 0 7
6 .. .. 7
6 7
6 0 b3 d3 . 0 . 7
B¼6 . .. .. .. .. 7: ð2:1Þ
6 . 7
6 . . . . . 0 7
6 .. .. 7
4 0 0 . . an1 5
0 0  0 bn dn þ t
M.E.A. El-Mikkawy / Appl. Math. Comput. 161 (2005) 691–696 693

Note that the matrix B in (2.1) is related to the matrix A in (1.2) by:
A ¼ B  wzT : ð2:2Þ
The Sherman–Morrison algorithm is as follows [1]:
T T
Step 0: Set z ¼ ðs; 0; 0; . . . ; 0; tÞ , w ¼ ð1; 0; 0; . . . ; 0; 1Þ .
Step 1: Form the tri-diagonal matrix B in (2.1).
Step 2: Solve for y1 and y2 the two tri-diagonal linear systems:
By1 ¼ k; By2 ¼ w:
Step 3: Compute
a1
a1 ¼ z T y1 ; a2 ¼ z T y2 ; b¼ :
1  a2
Step 4: Compute the solution
x ¼ y1 þ by2 :

For the validity of the algorithm, the conditions [1] are that B1 exists and
a2 6¼ 1. At this point it should be mentioned that a very reliable computational
algorithm to check the existence of B1 is developed by this author in [2].
3. A new computational algorithm

In this section we are going to formulate a new computational algorithm for


solving periodic tri-diagonal linear systems of the form (1.1). To do this we
begin by considering the LU decomposition [3] of the matrix A in the form:
2 3
d 1 a1 0 ... 0 t
6 .. 7
6 b2 d2 a2 . 0 7
6 7
6 .. .. 7
6 0 b3 d 3 . 0 . 7
6 7
6 . . . . . 7
6 .. .. .. .. .. 0 7
6 7
6 .. .. 7
40 0 . . an1 5
s 20    0 bn dn 3
1 0 0     0 2 c 1 a1 0   v1
3
6 b2 . .
.. 7 ..
6c 1 0 .. 76 7
6 1 76
6 0 c2 a2 . v2 7 7
6 .. .. 7 6 .. 7
6 0 b3 1 . 0 76
. 76 0 0 c3 . 0 v3 7
6 c2 7
¼6 76 . . .. 7:
6 .. . .
6 .
.. .. .. 76 .
7 . .. ... ... a . 7
6 . . . . 0 76 n2 7
6 . 76 . . . 7
40 . 4 . . . . vn1 5
0 b n1
cn2
. 05 . 0 .
h1 h2    hn2 hn1 1 0   0 0 cn
ð3:1Þ
694 M.E.A. El-Mikkawy / Appl. Math. Comput. 161 (2005) 691–696

From (3.1) we obtain


s
m1 ¼ t; h1 ¼ ;
c1
bi
mi ¼  mi1 ; i ¼ 2ð1Þn  2;
ci1
ai1
hi ¼  hi1 ; i ¼ 2ð1Þn  2;
ci
bn1 ð3:2Þ
mn1 ¼ an1  mn2 ;
cn2
1
hn1 ¼ ðbn  hn2 an2 Þ;
cn1
X
n1
cn ¼ dn  hi m i :
i¼1

For the sake of programming it is convenient to set ki ¼ ci1 bi


, li ¼ ai1
ci
,
i ¼ 2ð1Þn  1.
It is not difficult to prove that the LU decomposition (3.1) exists only if
ci 6¼ 0, i ¼ 1ð1Þn  1. Moreover the periodic tri-diagonal linear system (1.1)
possesses a unique solution if, in addition, cn 6¼ 0.
We may now formulate the following result. In fact it is a generalization of
the well-known algorithm due to Thomas [3] for solving tri-diagonal systems.

Algorithm 3.1. To solve the periodic tri-diagonal linear system (1.1), we may
proceed as follows:

Step 0: Set c1 ¼ d1 , m1 ¼ t, h1 ¼ cs1 .


Step 1: Compute

bi
ci ¼ di  ai1 ; i ¼ 2ð1Þn  1;
ci1
bi ai1
mi ¼  mi1 ; i ¼ 2ð1Þn  2; hi ¼  hi1 ; i ¼ 2ð1Þn  2;
ci1 ci
bn1 1
mn1 ¼ an1  mn2 ; hn1 ¼ ðbn  hn2 an2 Þ;
cn2 cn1
X
n1
cn ¼ dn  hi m i :
i¼1

Step 2: Set r1 ¼ k1 , compute r2 ; r3 ; . . . ; rn using

bi X
n1
ri ¼ ki  ri1 ; i ¼ 2ð1Þn  1; rn ¼ k n  hi r i :
ci1 i¼1
M.E.A. El-Mikkawy / Appl. Math. Comput. 161 (2005) 691–696 695

Step 3: Compute the solution vector x using


rn 1 1
xn ¼ ; xn1 ¼ ðrn1  mn1 xn Þ; xi ¼ ðri  ai xiþ1  mi xn Þ;
cn cn1 ci
i ¼ n  2ð1Þ1:
The new algorithm will be referred to as PERTRI algorithm. Both the
PERTRI algorithm and the Sherman–Morrison algorithm solve the periodic
tri-diagonal linear system (1.1) of order n in linear time. However using the
PERTRI algorithm for solving the system (1.1) is generally preferable. For one
reason, because no associated tri-diagonal linear systems arise when using this
algorithm and for another, because the existence of B1 (see Section 2) does not
necessarily ensures the validity of the Thomas algorithm. The conditions
ci 6¼ 0; i ¼ 1ð1Þn are sufficient for the validity of the PERTRI algorithm. The
advantage of the vector c is now clear.

4. An illustrative example

In this section we are going to give an illustrative example.

Example 4.1. Solve the periodic tri-diagonal linear system of size 12 given by
2 3 2 3
2 1 0 0  1 2
6 1 2 1 0    0 7 607
6 0 1 2 1    0 7 607
6 .. .. 7 6 7
6 0 7 x ¼ 6 .. 7 ð4:1Þ
6 . 0 1 2 . . 7 6.7
4 . .. .. .. 5 405
. . . . 1
1  0 0 1 2 2
by using the PERTRI algorithm.
Solution
We have s ¼ t ¼ 1, ai ¼ biþ1 ¼ 1, i ¼ 1ð1Þ11, di ¼ 2, i ¼ 1ð1Þ12, ki ¼ 0,
i ¼ 2ð1Þ11 and k1 ¼ k12 ¼ 2. The application of the PERTRI algorithm gives:

• c1 ¼ 2, m1 ¼ 1, h1 ¼ 12 (Step 0).
• ðc ; c ; c ; c ; c ; c ; c ; c ; c ; c Þ ¼ 3 4 5 6 7 8 9 10 11 12
2 3 4 5 6 7 8 9 10 11 ; ; ; ; ; ; ; ; ;
2 3 4 5 6 7 8 9 10 11
1 1 1 1 1 1 1 1 1
ðm2 ; m3 ; m4 ; m5 ; m6 ; m7 ; m8 ; m9 ; m10 Þ ¼ ; ; ; ; ; ; ; ;
2 3 4 5 6 7 8 9 10
1 1 1 1 1 1 1 1 1
ðh2 ; h3 ; h4 ; h5 ; h6 ; h7 ; h8 ; h9 ; h10 Þ ¼ ; ; ; ; ; ; ; ;
3 4 5 6 7 8 9 10 11
10 5 1
m11 ¼  ; h11 ¼  ; c12 ¼ ðStep 1Þ:
11 6 3
696 M.E.A. El-Mikkawy / Appl. Math. Comput. 161 (2005) 691–696

• ðr1 ; r2 ; r3 ; r4 ; r5 ; r6 ; r7 ; r8 ; r9 ; r10 ; r11 ; r12 Þ ¼ 2; 1; 23 ; 12 ; 25 ; 13 ; 27 ; 14 ; 29 ; 15 ; 112 ; 13 (Step 2).


• ðx1 ; x2 ; x3 ; x4 ; x5 ; x6 ; x7 ; x8 ; x9 ; x10 ; x11 ; x12 Þ ¼ ð1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1Þ (Step 3).

References

[1] M.M. Chawla, R.R. Khazal, A parallel elimination method for periodic tri-diagonal systems,
Int. J. Comput. Math. 79 (4) (2002) 473–484.
[2] M.E.A. El-Mikkawy, A fast algorithm for evaluating nth order tri-diagonal determinants, J.
Comput. Appl. Math. 166 (2004) 581–584.
[3] M.B. Allen III, E.L. Isaacson, Numerical Analysis for Applied Science, Wiley-Interscience,
John Wiley & Sons, 1997.

You might also like