Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John...

210
Methods of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John Wiley & Sons, Inc., New York London

Transcript of Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John...

Page 1: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Methods of

Mathematical .Analysis

and Computation

by John G. HerriotProfessor of Mathematics

and Computer Science

Stanford University

John Wiley & Sons, Inc., New York London

Page 2: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

COPYRIGHT Q 1963 BY JOHN WILEY & SONS, INC.

All Rights Reserved. This Book or Any PartThereof Must Not Be Reproduced in Any Formwithout the Written Permission of the Publisher.

LIBRARY OF CONGRESS CATALOG CARD NUMBER : 63-11434

PRINTED IN THE UNITED STATES OF AMERICA

Page 3: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Foreword

The plan for a series of monographs on airplane and missile structuresoriginated in the Structures Subcommittee of the National AdvisoryCommittee for Aeronautics. Industry members of the Committee saw aneed for comprehensive volumes covering specialized fields in which newinformation was becoming available in articles appearing in a largenumber of technical and scientific journals, in research technical notes ofthe NACA, and in company reports. Details of the plan were workedout after John Wiley and Sons and the editor reached an agreement onthe site of the volumes and the selection of the topics and authors. Partof the research that was needed to produce the volumes was supportedfinancially by the Office of Naval Research of the U.S. Navy.

The book series addresses itself primarily to practicing engineers andbeginning research men who wish to acquire competence in a specializedfield of structural analysis. It is hoped that the volumes will also proveuseful as textbooks in college courses.

NICHOLAS J. HOFFEDITOR

Page 4: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John
Page 5: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Editor's Preface

The first volume in the series on Airplane, Missile, and SpacecraftStructures presents the mathematical methods that are most useful toengineers engaged in structural analysis. The selection of the topicsrecognizes the modern trend in stress analysis toward an increased use ofthe electronic digital computer. Particular attention is paid therefore tothe development of numerical methods in every chapter whether ittreats interpolation, integration, matrices, Fourier series, or differentialequations.

The author, Professor John G. Herriot of Stanford University, isAssociate Director of Stanford's Computation Center. In this capacity,in teaching students of engineering, and in his earlier experience incarrying on research in the Ames Aeronautical Laboratory of the NationalAdvisory Committee for Aeronautics, he has had many opportunities todevelop an appreciation of the engineer's point of view. Many numericalexamples contribute to his lucid presentation of the subject.

Stanford, CaliforniaJane 27, 1962

N. J. H.

vii

Page 6: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John
Page 7: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Preface

This book is intended to provide the aircraft engineer with an intro-duction to some subjects of mathematics which are frequently not includedin the traditional courses of calculus and engineering mathematics. Theremay be some overlap, but it is hoped that much of the material will beoutside these courses. In keeping with the rapid development of high-speed automatic computers and their widespread use, there is considerableemphasis on numerical methods, although this is not, strictly speaking,a book on numerical analysis. There is also a considerable body ofmaterial not numerical in nature. The ultimate responsibility for thechoice of material lies with the author, but acknowledgment is dueProfessor N. J. Hoff, the editor of the series, for his helpful advice in theselection of the topics included.

Chapter 1 covers the subject of interpolation and the finite differencecalculus. Although difference methods are not as widely used with modernhigh-speed computers as they were when most calculations were done byhand or with a desk calculator, the material of Chapter 1 is importantbecause it provides the tools for deriving in Chapter 2 the formulas ofnumerical integration and differentiation. These formulas are useful inthemselves and are also used extensively in the later chapters as a basisfor various numerical methods of solution of differential equa-tions.

Because the engineer frequently encounters the problem of solvingequations of various types, Chapter 3 describes some of the more usefulmethods for solving equations.

Many problems in engineering lead to systems of simultaneous linearequations, and so the engineer needs an acquaintance with matrix theoryin order to deal with such problems. Chapter 4 provides an introductionto matrix theory and describes several useful methods of solving sys-tems of simultaneous linear equations, inverting matrices, and finding

11

Page 8: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

X Preface

characteristic values and vectors. In all cases the emphasis is onmethods suitable for high-speed automatic computers.

Chapter 5 begins with some commonly used analytical methods ofsolving ordinary differential equations and concludes with a number ofuseful numerical methods for obtaining such solutions. Chapter 6 gives abrief treatment of Fourier series with applications to the solution of avariety of problems. Chapter 7 gives an introduction to the use of finite-difference methods that are widely used in the solution of partial differentialequations.

I wish to thank Professor Max Anliker, who read Chapters 3 and 4and made several useful suggestions.

JOHN G. HERRIOTStanford, CaliforniaJanuary, 1963

Page 9: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Contents

chapter 1 Interpolation 1

1.1 Introduction 1

1.2 Difference Notation 21.3 Newton's Forward-Difference Formula 41.4 Newton's Backward-Difference Formula 71.5 Central-Difference Formulas 101.6 Lagrangian Interpolation 141.7 Inverse Interpolation 191.8 The Error in Polynomial Approximation 20

chapter 2 Numerical Differentiation and Integration 22

2.1 Introduction 222.2 Numerical Differentiation 222.3 Numerical Integration 252.4 Integration Formulas by the Method of Undetermined

Coefficients 292.5 Error Estimates 30

chapter 3 Roots of Equations 34

3.1 Introduction 343.2 General Iterative Methods 343.3 Method of False Position (Regula Falsi) 363.4 Newton-Raphson Method 393.5 Simultaneous Equations 41

A

Page 10: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

xli Contents

3.6 Application to Polynomial Equations 423.7 Character of the Roots of a Polynomial Equation 47

cha ter 4 Simultaneous Linear E u ti d M t i 52p q a ons an r cesa

4.1 Linear Equations, Vectors, and Matrices 524.2 Matrix Multiplication 574.3 Transpose, Inverse, and Adjoint Matrices 614.4 Solution of Linear Equations 644.5 Gaussian Elimination 674.6 Gauss-Jordan Elimination 714.7 The Crout Method of Elimination 734.8 Gauss-Seidel Iteration 794.9 Characteristic Numbers and Vectors of a Matrix 804.10 The Cayley-Hamilton Theorem 834.11 Properties of the Characteristic Numbers and Vectors of

a Matrix 864.12 The Calculation of the Characteristic Numbers and

Vectors of a Matrix 924.13 The Power Method 934.14 Deflation 1034.15 Real Symmetric Matrices 1074.16 Real Nonsymmetric Matrices 110

chapter 5 Solution of Ordinary Differential Equations 112

5.1 Introduction 1125.2 First-Order Equations. Existence Theorem 1145.3 Linear Differential Equations with Constant Coefficients 1205.4 General Linear Differential Equations 1255.5 Integrating Factors and the Adjoint Equation 1275.6 Linear Differential Equations. Green's Function 131

5.7 Numerical Solutions 1375.8 Starting the Solution 1405.9 Milne's Method 1455.10 Adams' Method 1475.11 Runge-Kutta Method 1495.12 Systems of Equations; Equations of Higher Order 151

Page 11: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Contents xiii

chapter 6 Fourier Series 155

6.1 Introduction 1556.2 Calculation of the Coefficients 1566.3 Examples of Fourier Series 1576.4 Half-Range Series 161

6.5 Change of Interval 1626.6 Application of Fourier Series to Solution of Ordinary

Differential Equations 1626.7 Solution of the Heat Equation by Means of Fourier

Series 1656.8 Double Fourier Series 1686.9 Application of Double Fourier Series to a Rectangular

Plate Problem 1696.10 The Two-Dimensional Heat Conduction Problem 171

chapter 7 Numerical Solution of Partial Differential Equations 173

7.1 Introduction 173

7.2 Hyperbolic Equations 175

7.3 Parabolic Equations 180

7.4 Elliptic Equations 186

References 191

Index 193

Page 12: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John
Page 13: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

chapter 1 Interpolation

1.1 INTRODUCTION

In most scientific work, functions are encountered which are co:i-veniently expressed in the form of tables. Such tables usually list values ofthe function (ordinates) corresponding to certain abscissas, the abscissasbelonging to some range. In some cases the function can also be expressedby means of a formula, a differential equation, or in some other manner,whereas in other cases the values of the tabulated function may be ob-tained empirically. Clearly a table can contain values corresponding toonly a finite number of abscissas. Interpolation may be defined as aprocess for finding values of the function for abscissas which do not appearin the table by making use of the tabulated values of the function. Anyfurther available information about the function is reserved for estimatingthe error involved in the process. Strictly speaking, the term interpolationshould be used only when the abscissas lie within the range of the tabulatedabscissas. Otherwise, the usual term is extrapolation.

Let us denote the function under consideration by f (z). Then f (X)is tabulated for certain values of x. We seek to construct an interpolatingfunction I(x) which agrees with certain of the tabulated values of f (x)'and to use this function I(x) to calculate an approximate value of f (x)for other values of x.t Thus, if (xo, fo), (xi, fi), . , (x,,, are correspond-ing pairs of values of x and fix), we should have I(xo) = fo, I(x7)fi, , I(x,,,) = f,,. Because of their simplicity, polynomials are widelyused for this purpose. For many reasonably smooth functions, this pro-cedure is very satisfactory.

We begin by considering the case in which the tabular values are givenfor equally spaced values of x. For this case the method of finite differencesprovides a very convenient means for determining the interpolating poly-nomial.

1

Page 14: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

2 Interpolation

1.2 DIFFERENCE NOTATION

Let f (x) be tabulated for uniformly spaced abscissas, with spacing h.We define the first forward difference O f (x) by the equation

Of(x) =f(x + h) -f(x) (1.2.1)the spacing h being implied in A. If we want to indicate the spacingspecifically, Ah may be used in place of A.

Suppose thatf(x) is tabulated at x, = xo + sh, where s takes on integralvalues. Let f (x,) = f,. Then we have

Af(xs) = f(xs + h) -1(x3)or

of. = fs+i - f,. (1.2.2)

We define also the second forward difference as

i2f (x) = Of (x + h) - Af (x); (1.2.3)in general we define the rth forward difference as

IX'f (x) = A -lf (x + h) - 0'-i f(x). (1.2.4)

For example we have

Osfa = Q'ajs+l -

Ar-i etc.fs = fs+ fs,

TABLE 1.1xo fo

Afo

xi fi AZfo

Afi A$fo

xa f2 A2fi A4fo

Aft A3fi '

x$ fs

x4 f4

Af a

(1.2.5)

(1.2.6)

Thus, given a table of values, we can form a difference table such as thatshown in Table 1.1. Each entry in the difference table is the difference ofthe adjacent entries in the column to the left.

Page 15: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Difference Notation 3

Example 1. Form a difference table for f (x) = sin x with the entries forx = 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8:

x f(x) of A2f oaf L14f

0.2 0.198679685

0.3 0.29552 -2959390 - 94

0.4 0.38942 -389 3

9001 - 910.5 0.47943 -480 8 (1.2.7)

8521 -830.6 0.56464 -563 2

7958 -810.7 0.64422 -644

7314

0.8 0.71736

Note that in writing the columns of differences it is convenient to omitthe decimal point as no confusion can arise. It is not desirable to carrythe formation of higher differences beyond the point where they becomeirregular. Thus in this example, differences beyond the fourth would notnormally be used.

By successive substitutions using equations (1.2.2) and (1.2.5) we easilyfind that

A$fo= J2 -2fi+fo,08,10 = fa - 3fs + 3f1 - fo,

and we deduce that in general

Arfo = fr - (r)fr-i+

(-1)k(k)f'-k + ... + (_1)rfo

= j(_l)k(kk-o \\

(1.2.8)

Here we have used the binomial coefficients

1).(1.2.9)

k r!This formula can easily be established by mathematical induction.

In a similar manner, using (1.2.2) and (1.2.5) repeatedly, we obtain

A = A + Ofo+f2=fo+21fo+A2fo,fa=fo+ 3Wfo+3A$fo+Dafo,

Page 16: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

4 Interpolation

and we deduce that in general

frrod (kr),&kfo+...

Akfo (1.2.10)k-e k

Regarding A as a symbolic operator defined by equation (1.2.1), we canwrite (1.2.10) in the symbolic form

Jr = (I + )'fo (1.2.11)

If we introduce the operator E defined byEf(x) = f(x + h), (1.2.12)

wr see from (1.2.1) that A = E - 1 or E = I + A, and we can write(1 -2.8) in the symbolic form

0'.fo = (E - I)'fa. (1.2.13)Next we note that

Ax"=(x+h)n-x"

+ ()h2xn_2+

... + h", (1.2.14)

which is a polynomial of degree n -- 1. Since the result of operating withA on the sum of any finite number of terms is the same as the sum of theresults obtained by operating with A on each of the terms, we see that ifP(x) is a polynomial of degree n, then AP(x) is a polynomial of degreen - 1. Repeated application of this result shows that A."P(x) is a poly-nomial of degree 0 and hence constant, and that A'P(x) = 0 for r > n.

1.3 NEWTON'S FORWARD-DIFFERENCE FORMULA

Suppose that the function f(x) has values f{ at the tabular pointsxt = xo + ih, i = 0, 1, , n. It is known that there is precisely onepolynomial of degree n which takes on the values ft at x,, i = 0, 1, , n.We wish to find this interpolating polynomial. It is convenient to make thetransformation

X = x0 + hs. (1.3.1)

Then s = 0, 1, , n at the tabular points. We seek a polynomial I(s)of degree n such that I(s) = s = 0, 1, , n. An obvious way toproceed would be to let

I(s) = co + cls + cgs2 + .. + co". (1.3.2)

Page 17: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Newton's Forward-Difference Formula 5

We could then set s = 0, 1, - - - , n in turn and obtain n + 1 equations inthe n + I unknowns c1. These equations could be solved for the c., butthe work would be tedious. We note that we desire to express the poly-nomial I(s) in terms of the differences Afj. Now if we attempt to formdifferences of I(s) using (1.3.2), we see by equation (1.2.14) that thesedifferences do not assume a simple form.

However, if we introduce the factorial polynomials defined by theequation

s(")=s(s-- 1)(s-2)...(s--n+ 1), n== 1, n = 0 (1.3.3)

we easily see that

ASO) _ (S + I)"" - sM(s+ 1)s(s- 1)...(s-n+2)-s(.s- 1} (s-n-+- 1)

=s(s- 1 -(s-n + 1)J

n.0-1), (1.3.4)

where we have chosen h, the interval of differencing, to be 1. We note thatthe rule for differencing s(") is completely analogous to the rule for dif-ferentiating s" with respect to s. We also note that the binomial coeffi-cients are closely related to the factorial polynomials for we have

(SS(r.)

n) - n!In addition,

(1.3.5)

0(s) = ns(n-1)

- (n-1).S (1.3.6)

n n!

Now since s(' is a polynomial of degree n in s, it is easily seen that anypolynomial of degree n in s can be expressed as a linear combination offactorial polynomials or indeed binomial coefficients. Hence instead ofusing (1.3.2) we shall write

I(s) =a. + al (1 ) +

as(Z) + ... +. ak (k) + ... + ar ( ) . (1.3.7)

We have only to determine convenient expressions for the ak. If s = 0,1(0) = a0. But 1(0) = fo and so ao = fo. We have, on using equation(1.3.6)

s s s sAI(s)=a1+a2 '(5) +,() +.....+.ak(.k-1) +...+a"(n-1

Page 18: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

6 Interpolation

On setting s = 0 we see thatAI(0) = a,.

But since 1(0) = fo, 1(1) = f,, we see that AI(0) = Afq,.and so a, = Afo.Again using (1.3.6) we have

A2I(s)=a2+as(1) +...+akfkS2) +...+a-(ns2)'

and hence a2 = A21(0) = A2fo.Continuing this procedure we see that

Akl(s)= ak + ak+ l

(1) + ... + an1n s J,

and henceak Ak1(0) = A fo.

Substitution of these results into (1.3.7) gives

1(s)=f°+ (')Afo+ (2) A2f + ...+ (ks) Yfo + - - - +

(S)Anfo.

This is the interpolating polynomial desired and it can be expressed interms of x by making use of (1.3.1). We use this polynomial as an approxi-mation to f, for nonintegral s. We then write approximately

f, fo + () Alo + (2S)A2f0 +

... + (k) AkfO +... + () A-fO

(1.3.8)

This is Newton's forward-difference formula. We note that if s is a non-

negative integer r, (1.3.8) is the same as (1.2.10) because (k) = 0 if

k > r. Here and in the sequel we use the symbol s:w to indicate that twomembers are approximately equal. The error committed in using (1.3.8)as an approximation to the true value f(xo + sh) will be discussed inSection 1.8. The symbol ;s signifies the omission of the error term.

We note that (1.3.8) makes use of the top line of the difference table(1.2.6). We also note that the coefficient of Afo involves s -- 0 and that 0is the first tabular value of s. The coefficient of A$fo involves (s -- 0)(s - 1);0 and I are the first two tabular values of s, which are also just the onescorresponding to the ordinates involved in the previous difference Afo.Each successive difference involves one additional ordinate, and eachcoefficient involves the values of s corresponding to the ordinates involvedin the previous difference.

Page 19: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Newton's Backward-Difference Formula 7

Since it involves differences at the beginning of a table, Newton'sforward formula is appropriate for interpolation in this region.

The coefficients of Newton's forward formula have been extensivelytabulated in the literature, for example by Davis [4]. Other tabulationsare listed in the Index of Mathematical Tables [6].

1.4 NEWTON'S BACKWARD-DIFFERENCE FORMULA

For interpolation near the end of a table, care must be taken to ensurethat the differences called for in the interpolation formula can be obtainedfrom the table. These differences will involve the ordinates at the end ofthe table. It will be convenient to denote the last abscissa by xo and theprevious abscissas by x_1, x_ 2 , " . . The corresponding values off (x) are

fo, f_l, f_s, . Again making the transformation x = xo + sh, we notethat s is negative for the points under consideration. It is then appropriateto seek the interpolating polynomial in the form

I(s)= ao

+al

(1) + as (s 21) .+ as (s 3 2) + .. .

+ ak(s+k-1) + ... + an(s+n-1). (1.4.1)

By setting s = 0, 1(0) = ao. But 1(0) = fp and hence ao = fo. Becauseof (1.3.6) we have

AI(s)= al 4 as

(S+1

l )

On settings = -1 we have

since for this s,

+ as(s22) +...

+ ak(s+k-1)k-i

Al(- 1) = al,

.+.... + a,(s+n-1).

n-1

s+k-1k-1 )=o.

But 6J(- 1) = fo - f_x = Af_1, and so a, = Af_1. Again using (1.3.6) wehave

s+2 s+k-1'A$1(s)=as+aa( )+.+ak(k-2

)++(s+n;1)n-2

Page 20: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

8 Interpolation

We find thata2 = 0=!(-2) _ AEfa

Continuing this procedure we see that

WI(s) = at + aL-.i(s i k) + ... + a, (S

nnk-1),

and hence J l /ax=zkl(-k)=Okfk

Substituting these results into (1.4.1) we obtain

+ .. .I(s) fo + (IS) Af l + (s 1) WY

+ (5+1) Alf(--'-')o+'+

nf-r. (1.4.2)

We use this as an approximation to f,. This is one form of Newton'sbackward-difference formula. We note that the differences involved arethose along the bottom line of the difference table :

x-4 f-.Oft

xa f-3 A 2f_4

Af8 A3f4x s f-2 Asf-s Q*f-.a (1.4.3)

X-1

Lf2

Afl

aAeff-2 8Asf-

xo fo

Equation (1.4.2) can be written in a more convenient form by introducing anew notation of backward differences. Here we write

Vf(x) = f(x) -f(x - h),pri(x) = V"-If(x) - pr-1 f(x - h). (1.4.4)

We find at once that

VIf A2f,21. . . . . . . . . . . . . . . . . . . . . . . . . .

r V'r-1 1 r-1 rv f, = r-f, -" Q f.-1 = r-f.-rl 1 ' .-r = fi-r

Page 21: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Newton's Backward-DWerence Formula

The difference table (1.4.3) may therefore be written in the form

x-4 f_4

X-3 f_3

x-2

x-i

f-s

f-i

xo fo

Vf-3

Vf_2

Vf-1

V!0

V2fa

iV2f..

vsfo

Vsfz

Vf0

9

V4f0 (1.4.5)

Note that the difference table is not changed-it is merely a differentnotation.

Making use of the backward-difference notation, instead of (1.4.2) wecan write

f OW A + ()vf0 (s+l)f+ .. .

+ (s+k---1) k (s+fl_l)nj.k n

o. (1.4.6)

The coefficient of Vkf0 in this formula is seen to be

(s,!-k--1i =s(s+ 1)

k

1) k

k!

= (_1)k((_1)k()..

If we set t = -s, we can write Newton's backward-difference formula inthe form

f-e "v A -(t)vj.0 + (t)v2f0_-...

+ (-1)k(k)Vkfo +... + (-1)-(n)Vnfo. (1.4.7)

Example 2. Using the difference table of example 1, calculate sin 0.27and sin 0.74.

Page 22: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

10 Interpolation

Since 0.27 lies near the beginning of the table, Newton's forward-difference formula is appropriate. We choose x0 = 0.2, It = 0.1, ands = 0.7. Then we have approximately

sin 0.27 P,4 0.19867 + 0.7(0.09685) + (0.7)(-0.32

) (-0.00295)

+ (0.7)(-0.3)(-1.3) (-0.00094)6

+ (0.7)(-0.3X-1.3)(-2.3) (0.00003)24

= 0.19867 + 0.067795 + 0.000310 - 0.000043 - 0.000001

= 0.266731 = 0.26673

which is correct to five places.Since 0.74 lies near the end of the table, we use Newton's backward-

difference formula. We choose xo = 0.8, h = 0.1, and t = 0.6. We have

sin 0.74 0.71736 - (0.6)(0.07314) +(0.6)

20.4)

(-0.00644)

(0.6)(-0.4)(-1.4)6

(-0.00081)

+ (0.6)(-0.4)(-1.4)(-2.4) (0.00002)

24

0.71736 - 0.043884 + 0.000773 + 0.000045 - 0.000001

= 0.674293 = 0.67429

which is correct to five places.

1.5 CENTRAL-DIFFERENCE FORMULAS

For interpolation at a point x, it is desirable to have available a formulain which the successively introduced ordinates correspond to abscissaswhich are as near as possible to x. If x is near the beginning of the table,Newton's forward-difference formula serves this purpose as well aspossible. If x is near the end of the table, Newton's backward-differenceis appropriate. Otherwise, it is convenient to start with the abscissa x0nearest to x, then to introduce xl and x_1, then x2 and x_2, and so forth.

Page 23: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Central-Difference Formulas 11

We again make the transformation x .- xo + hs. To introduce thevalues of f(x) corresponding to s = 0, 1, -1, 2, -2, - , we shall writethe interpolating polynomial in the form

1(s) = ao + al(l)+ a2(2) +

a3(S3 1) +

a4(s41) + .. .

+a (+2k1) +a2,+i(2+1) +.... (1.5.1)

We proceed to determine convenient expressions for the ak. On using(1.3.6) repeatedly we find that

AI(s) = al + a2(1) +a3 (S

2

1)+ a4(S 3

1) + .. .

+ a (s+k--1) + a (s+k ...Zk 2k-1 Ex+ 2k +

A21(s) = a2 + a3S+1

2)+ a4 S+1

2

) + .. .

+ aEk (s2kk 21) + a,+, (2k--1) + ... , (1.5.2)

A2*I(s) = a2k + a i (s

1

k) + ...,

(s+k)

If in equation (1.5.1) we set s = 0 and in equations (1.5.2) we setrespectively s = 0, -1, , -k, -k, , we obtain

ao = 1(0) = fo,al = AI(0) = Afo,a2=A2J(-1)=A2f-,,

ask = AZk1(-k) = A9" f_%,

a

Substituting these values into (1.5.1) we obtain Gauss's forward formula

.. .fd fo + (i) Afo + (2) A2f1 +(H-i)

A3f1+

s+k-1 s+k 2x++ ( 2k

A f-k + (2k+1) A f -k + .... (1.5.3)

Page 24: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

12 Interpolation

In order to write this formula in a more convenient form we introduce thenotation of central differences. We write

Nx) =.f (x + h) - P x - 146,f (x) = d'-lf (x + 4h) - d'-1f (x - 0). (1.5.4)

We note that dfk = Bf (xk) generally does not involve tabulated ordinates.However the second central difference

32 k = of (xk + 4n)-/

af(xk --/4h) {_ [f (xk +

h)-J (xk)] - [ (xk) - J (xk h))

=fk+l - 2f + fk-1 = Agfk-1does involve tabular entries and the same is true of all central differences62%. of even order. We also note that

afk+% =fkl -fk = Afk,and more generally as"'+lfk+w involves only tabulated ordinates. Wealso note that

dfs = fi - f0 = Afo, 6f-q _ .fo .".1-i = A.f1+

61fo=fi-2fo+f-l=&sf-,,

and in general +1 = -U+1d f4 o l-k,

a11f0 = AZkf k

We then write Gauss's forward formula (1.5.3) in the form

(s (s -I-1

6 2 aaf0+ (.V3a'f%+...

s+k+

(s+k_1)d f0 +

(2k+ 1

} aak+t ff + .... (1.5.5)

This formula utilizes the differences lying on the forward zigzag pathindicated in the following difference table.

X-2 f-8af_%

X-1 f -I dsf-1

df - 5s\ / dsf w\xo to

]rd=fo 61fo (1.5.6)'` ale \I'd'f

xl ft d=fi

df%X2 fa

Page 25: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Central-Difference Formulas 13

In a completely similar way, introducing the ordinates correspondingto s = 0, -1, 1, -2, 2, , we obtain Gauss's backward formula

()r (')of0 (11f + ' 4 + 2+ 3 J 63f, +...

+(6

f0 + (7) 6U+if 3f + .. . (1.5.7)

This formula utilizes the differences lying on the backward zigzag pathindicated in the previous difference table (1.5.6).

Neither of Gauss's formulas is used often in practice, but if we form theiraverage we obtain a very useful formula known as Stirling's formula.Since this formula clearly involves the means of the odd differences, it isconvenient to introduce the notation

af(x)=2Cf (x+ ) +f(x-2)J

so that, for example,

WO = j(bfs + 8f-u) _ j(fi -f-1), (1.5.8)

4(asf s + a'1-%)

_ i(fs -f-2) - (x -f-l)- (1.5.9)

With this notation Stirling's formula may be written

(')o3f0+...faI%$ fo+()+)or0+ s

3

+ J 2k 11)8 f0+(2k+1)1A

a(1.5.10)

or

S s(s2 - 10) 9 s$(s2 - 12) 4 ...21aEf+ 3!µafo+

4!afo +

+s2(s2- 1$)...[ss-(k- 1)$]621(2k) !

0

+s(s$-1$)...( _k$)1A a'"°+Yo+....(2k + 1)!

The coefficients in this formula have been tabulated in the literature.See, for example, Davis [4]. For other tabulations the Index of Mathe-matical Tables [6] should be consulted.

Page 26: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

14 Interpolation

Example 3. Using the difference table of example 1, calculate sin 0.43.Since 0.43 lies near the middle of the table, Stirling's formula is appro-

priate. We choose xo = 0.4, h = 0.1, and s = 0.3. Then we have approxi-mately

sin 0.43. 0.38942 + 0.3 (0.09390

z0.09001) + (0. )2 (-0.00389)

+ (0.3)(0.09 - 1) (-0.00094 - 0.00091 + (0.3)2(0.09 - 1) (0.00003)6 2 24

0.38942 + 0.027587 - 0.000175 + 0.000042 - 0

= 0.416874 -= 0.41687.

Many tables provide central differences of even orders (usually 62and SS) in addition to the tabulated functional values. In order to inter-polate in such tables it is convenient to use Everett's formula which maybe written in the following form :

f8 Pw (1 - s)fo +((1-3)+1)

62fo +((1-s)+2) 6fo + .. .

+Sfi+ (31)g2fi+ (s52) 6411-F.... (1.5.11)

We note that the values and differences from two consecutive lines of thetable are involved, and that the coefficients of one line are obtained byreplacing s by I - s in those of the other line. We omit the proof ofEverett's formula, merely remarking that it may be deduced from Gauss'sforward formula (1.5.5) by replacing the odd differences in terms of evendifferences of lower order. Davis [4) has also tabulated coefficients forEverett's formula.

There are a number of other interpolation formulas involving differenceswhich are useful in special circumstances These may be found in bookson numerical analysis such as Hildebrand [12].

1.6 LAGRANGIAN INTERPOLATION

For many purposes, it is desirable to express the interpolating poly-nomial explicitly in terms of the ordinates involved rather than in termsof their differences. In the derivation of such formulas we need notassume that the abscissas are equally spaced.

We seek a polynomial I(x) of degree n, which assumes the values

Page 27: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Lagrangian Interpolation 15

fo, fl, , f for the n + 1 distinct abscissas x0, x1, , x,,. We writeit in the form

I(x) =folo(x) +f111(x) + ...+f1(x) _ fili(x) (1.6.1)i-0

where 10(x), ,1 (x) are polynomials of degree n or less which are to bedetermined. It is easily seen that I(x) will indeed take on the value f, whenx = xi if 12(x2) = 1 and 12(x,) = 0 when j 0 i. It is convenient to introducethe so-called Kronecker delta

We may then express the desired properties of 12(x) in the form

12(x1)=ail (i= 0,1,...,n; j=0,1,...,n). (1.6.2)

Since 12(x) is a polynomial of degree n which vanishes for x = x0, x1, - ,

xi+1+ ' ' , x,,, it must take the form

11.(x) = C2(x - x0) ... (x - x._1)(x "- xi+1) ... (x - xn).Making use of the requirement that 12(x2) = 1, we easily find Ci, and so wemay write the desired Lagrangian coefficient function in the form

12(x)= (x- x0)...(x- xi-1)(x- xi+1)...(x- xn)(1.6.3)

(xi -- x0) ... (xi - xi_1)(xi - xi+1) ... (xi - X.)If the values of 12(x) given by (1.6.3) are substituted in (1.6.1), Lag-

range's interpolation formula is obtained.

Example 4. Write down the interpolation polynomial of degree 2 relevantto the data

x

AX)

0 1 3

2 -1 1

Also find the approximate value off (x) at x = 2.We have at once

1(x)2 (0 - 1)(0-3) (1 - 0)(1 - 3) (3 -0)(3- 1)=I(x-1)(x -3)+jx(x-3)+kx(x- 1)='xs-'Vx+2.

Page 28: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

16 Interpolation

Reduction to this final form would not be necessary for actual numericalinterpolation. In order to find 1(2), which furnishes an approximationto f(2), either the first or second form may be used. Thus

1(2) = a(2 - 1)(2 --- 3) + J(2)(2 - 3) + 1(2)(2 -- 1)

=-$--1+8=-3If in equation (1.6.3) we make a linear transformation of the variable

x=a+hs, x;=a+hs;,where a and h are constants we obtain

1(x) _(s - so) ... (s - si-1)(s - si+i) ... (s - sA) (1.6.4)

(s{ -- so) ... (s, - si-1)(s, -' si+1) ... (s.- sn)Thus the form of 1;(x) is invariant under such a transformation.

It is often convenient to choose a and h in such a way that the dimension-less variable s, which measures distance from a in units of h, takes onconvenient values at the tabular points being used in a particular inter-polation.

Example 5. Calculate an approximate value of sin 0.34 using thefollowing data

x

sin x

0 0.30 0.40

0 0.29552 0.38942

We let x 0.30 + 0. Is, so that at the tabular points s takes on thevalues -3, 0, 1, and at the desired value s = 0.4. Then

sin (0.30 + 0.1s)(s - 0)(s - 1) (0) + (s + 3)(s - 1) (0.29552)

(-3)(-4) (3)(-1)

+ (s + 3)(s - 0) (0.38942)(4)(1)

andI-114-1.1.8208(s + 3)(s - 1) + 1.16826(s + 3)s]

sin 0.34 Pt% i [-1.18208(3.4)(-0.6) + 1.16826(3.4)(0.4)]

0.33336.

The true value of sin 0.34 is 0.33349.

In the case where the abscissas are uniformly spaced, the Lagrangiancoefficients assume a simpler form and have been extensively tabulated.

Page 29: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Lagrangian Interpolation 17

Formulas involving an odd number of ordinates are the most often usedand it is convenient to denote the abscissas by x_.m, , x_l, xo' X1, , xM.

If the uniform spacing between abscissas is h, we may write

x = xo + hs, x, = xo -t h;,

so that s takes on the values -m, , -1, 0, 1, , m at the tabularpoints. Then (1.6.4) reduces to

1=(x) =

(s-m+1)(s-m)(i+m)(i+m-1). (i-m+1)(i-m)

As an example, we take the case of 3 points. Then m = 1 and w-. obtain

L-1(s) =s(s js(s -- 1),

(-1)(-2)_(s1)(s-1)=-

(1)(-1)(sa (1,6.6)

Lo(s)

+ -

Li(s) _(s + 1)(s)

(2)(1)its(s + 1).

To illustrate the use of a table of Lagrangian coefficients for interpolationwe give Table 1.2 which is computed directly from (1.6.6).

TABLE 1.2

Lagrange Three-Point Interpolation

S L_1(s) Lo(s) L1(s)

0.0 0.00 1.00 0.00 0.0

0.1 -0.045 0.99 0.055 -0.1

0.2 -0.08 0.96 0.12 -0.2

0.3 -0.105 0.91 0.195 -0.30.4 -0.12 0.84 0.28 -0.40.5 -0.125 0.75 0.375 -0.50.6 -0.12 0.64 0.48 -0.6

0.7 -0.105 0.51 0.595 -0.7

0.8 -0.08 0.36 0.72 -0.80.9 -0.045 0.19 0.855 -0.9

1.0 0.00 0.00 1.00 -1.0

L1(s) Lo(s) L-1(s') I s

Page 30: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

18 Interpolation

From (1.6.6) we see at once that L1(-s) = L_1(s), Lo(-s) = Lo(s). Thusfor negative values of s, which are to be read from the right-hand column,the column labels at the foot of the table are to be used.

Example 6. Calculate approximate values of sin 0.44 and sin 0.34 usinga three-point Lagrangian interpolation formula and the following data:

x 0.30 0.40 0.50

sin x 0.29552 0.38942 0.47943

In both cases the central tabular point is x = 0.40. For x = 0.44,we have s = 0.4 and hence

sin 0.44 (-0.12)(0.29552) + (0.84)(0.38942) + (0.28)(0.47943)

= 0.42589.

For x = 0.34, we have s = -0.6 and hence

sin 0.34 (0.48)(0.29552) + (0.64)(0.38942) + (-0.12)(0.47943)

= 0.33355.

The true values are sin 0.44 = 0.42594 and sin 0.34 = 0.33349.

By choosing m = 2 or 3 in (1.6.5), we obtain the 5-point or 7-pointLagrangian interpolation coefficients. These, among others, have beentabulated under the sponsorship of the National Bureau of Standards[23].

We see that Lagrange's formula of interpolation has the advantage overdifference formulas in that we may interpolate without first constructinga difference table. The work is relatively simple when the abscissas areuniformly spaced, especially if the tabulated coefficients are used. It hasthe disadvantage of requiring us to decide in advance the degree of thepolynomial needed to obtain the desired accuracy. For difference for-mulas, the degree of the interpolating polynomial increases as each addi-tional term in the series is added, and we can stop when it is clear thatadditional terms will be sufficiently small that they will not affect the resultto the accuracy desired. Another advantage of Lagrange's formula is thatit can be used when the abscissas are not uniformly spaced, whereas thedifference formulas of this chapter are applicable only when the abscissasare uniformly spaced. The case of nonuniformly spaced abscissas can alsobe studied by generalizing the concept of a difference and introducingdivided differences. This is done, for example, by Hildebrand [12],but will not be discussed in this book.

Page 31: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Inverse Interpolation 19

1.7 INVERSE INTERPOLATION

So far we have been concerned with the problem of direct interpolation,which consists in finding a value of y = f (a) for some x other than thevalues of x for which f (x) is tabulated. The problem of inverse inter-polation consists in finding a value of x corresponding to a specified valueof y other than the tabulated values. Now if y = f (x), then in any intervalin which f'(x) exists and does not vanish, a unique inverse functionx = f-1(y) exists. Hence inverse interpolation is direct interpolation ofthe inverse function. In other words we need only interchange the rolesof x and y in our previous discussion. Even if the abscissas are uniformlyspaced, however, the values of y will not in general be equally spaced, sothat the difference methods of this chapter are not applicable. On theother hand, Lagrange's formula is available and may be used con-veniently.

The use of Lagrange's formula assumes that the inverse function j 1(y)can be satisfactorily approximated by a polynomial in y. If f' (x) vanishesnear the point where the inverse interpolation is to be carried out, thederivative of the inverse function becomes infinite near this point, and sothe inverse function cannot be accurately represented by a polynomial.In this case the following procedure may be used.

Suppose that the value y of y for which the corresponding value ofof x is desired lies between two consecutive tabulated values yo = f (xo)and yl = f (xl). If yo and x1 are sufficiently close together and if f'(x) # 0for the interval between x0 and x1, linear inverse interpolation may be usedto obtain a first approximation xu" to x. One possible formula for thiscalculation is

X(1) = 1

Y1 - Yo x1 y1 - y

We may then use any method of direct interpolation based on yo, yl, anda suitable number of additional known ordinates to compute an approxi-mate value of f(x(')) = y(1). Then g will he between y(1) and yo or betweenya> and yl. A linear inverse interpolation based on whichever of thesepairs of values is separated by y produces a second approximation x(2)to Y. Again direct interpolation is used to calculate an approximate valueof f(x(2)) = y(2). A third linear inverse interpolation based on y(1) and y(2)or on the closest pair of available values of y which are separated by yyields a third approximation x(s) to Y. The process is continued until an xis reached which by direct interpolation gives y.

Page 32: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

20

1.8 THE ERROR IN POLYNOMIAL APPROXIMATION

Interpolation

In Lagrange's formula of interpolation and in the various interpolationformulas involving differences, the function under consideration wasapproximated by a polynomial of specified degree. It is desirable toobtain some information concerning the error which is introduced by theuse of such an approximation. If a function which is known at n + 1points is approximated by a polynomial of degree n, no estimate of theerror is possible unless some additional properties of the function areknown. These additional properties may take various forms. Valuqs atadditional points might be known, or estimates of certain derivatives mightbb known, or it might only be known that the function was sufficientlysmooth so that the polynomial approximation gives a good picture of thefunction. If values at additional points are known and if the abscissasof all the known points are uniformly spaced, higher differences can becalculated, and these may be used to obtain an estimate of the error. If thebehavior of certain derivatives is known, we can give more precise estimatesof the error involved.

We suppose that f (x) possesses continuous derivatives up to order n + 1and let I"(x) denote the interpolating polynomial whose values at x0,xx, . , x agree with the values off(x) at these points. Then the error inapproximating f (x) by 1.(x) is

E(x) = f(z) -- I"(x). (1.8.1)If we let

,r(x) - (x -- xo)(x - xl) ... (x - M.) J1.8.2)

then, since both E(x) and ir(x) vanish for x = x0, x1, . - , x", and 17(x)vanishes for no other value of x, we can find a function K(x) such that

E(x) = K(x),r(x). (1.8.3)

In the following discussion we consider x to be arbitrary but fixed, andx 10 x1. Consider the function

F(t) - E(t) - K(x)1r(t) f(t) -- I"(t) -- K(x),r(t). (1.8.4)

Let I denote the closed interval determined by the greatest and least ofx0, x1, , x", x. Then F(t) vanishes for n + 2 distinct points, xo, x1, ,

x,,, x. By Rolle's well-known theorem (which may be found in any goodstandard calculus text) F'(t) vanishes at least n + 1 times inside I, F"(t)at least n times, , and hence, finally, F("+1)(t) vanishes at least onceinside I. Let one such point be denoted by E. Then from (1.8.4) we obtain

0 = 1n"+r}($) - (1.8.5)

Page 33: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Error in Polynomial ApproxInation 21

But since 1"(t) is a polynomial of maximum degree n, its (n + 1)th deriv-ative is identically zero. Also, when multiplied out, ,r(t) starts with theterm t"+1 followed by terms of lower degree, and so 7r"-+1)(t) = (n + 1)!Substitution of these values in (1.8.5) yields the result

K(x) = 1 Jc"'(e).(n + 1)!

If we substitute this result back into (1.8.3) we obtain

E(x) ` I(1.8.6)(n + 1)!

for some in the interval I where I is determined by the largest and smallestof the numbers xa, x1, , x,a, x. In the foregoing proof it was assurhad thatx was different from x0, x1, , x, but otherwise arbitrary. It is clear,however, that (1.8.6) is valid also if x = x0, x1, , x", because both sidesof the equation vanish.

Example 7. Find a bound for the error in the calculation of sin 0.34 inexample 5.

In example 5, quadratic interpolation based on three points was used.Hence n = 2. Here f(x) = sin x, and f"'(x) _ -cos x, so that f"(E)does not exceed 1 in magnitude. Thus

I E(x)I SI06)

0.000136 S 0.00014.31

Note that the actual error in the calculation in example 5 was 0.00013,so that this bound is a good one.

Page 34: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

chapter 2 Numerical

differentiation and integration

2.1 INTRODUCTION

In this chapter we consider the problem of finding the derivative orintegral of a functionf(x) which is not given in explicit mathematical formbut for which pairs of values (xo, fo), (x1, f1), - , (x,., are known.Even if the function is given in explicit form, it may be difficult or impos-sible to integrate. An obvious procedure is first to calculate the inter-polating polynomial and then to differentiate or integrate it in place of

f (x). It maybe hoped that this procedure will provide a reasonable approxi-mation to the desired derivative or integral. Since the curve of the approxi-mating function will oscillate about the curve of f (x), it is evident that,even though the curves may remain close together, the slopes of the twocurves may be appreciably different. It should also be observed that if theordinates, used in the calculation of the derivatives, are quite close to-gether, the round-off errors or errors in observation of alternating signcould have a marked effect on the calculation of the derivatives sincedifferences of such ordinates will enter into the calculation. On the otherhand, since integration is essentially an averaging or smoothing process,it may be expected that the error in integration will be small even whenthe interpolating polynomial provides only a fairly good approximationto AX).

2.2 NUMERICAL DIFFERENTIATION

Any of the forms of the interpolating polynomials obtained in Chapter 1may be differentiated to obtain formulas for numerical differentiation.

22

Page 35: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Numerical Differentiation 23

if the derivative is desired at a point x, it seems reasonable to supposethat the polynomials passing through an equal number of points aboveand below 'x will give the most accurate approximation to the derivative.For this reason, differentiation of the central-difference formulas may beexpected to give the best results. If we recall that x = x0 + hs, so thatdx = h ds, and if we differentiate Stirling's formula (1.5.10'), we obtain

fI(x)

hµ 6 f 0 + s62fo -I-

3s23f 1µ631o-F

4s3 4' 2s64fo

5s4- 15s2+4+ 5! µ661o+...1 (2.2.1)

No attempt is made to give an expression for the error involved in thisformula. We most often desire to obtain the derivative at one of the tabu-lated points, and unless the desired point is near the beginning or end of thetable, it may be denoted by xo corresponding to s = 0. If we set s = 0in (2.2.1) we obtain

f'(xo) fh

[/AOfo - 6 µ631o + 3,0 µ661o - ...1. (2.2.2)

It is frequently desirable to express this formula in terms of the tabularvalues f, on either side of f0. If we use a quadratic approximation to f (x),we omit all terms involving differences of third and higher order. Theapproximation then becomes

f'(xo)'Wh

µ6fo - 2h(f1 - f-1) (2.2.3)

on using (1.5.8). A more accurate formula is obtained by retaining third-order differences, but neglecting differences of fifth and higher order.If we make use of (1.5.8) and (1.5.9) to express µ6f0 and µ63f0 in terms ofordinates, we easily find that

f'(xo) f12h

1_f2 + 8fi - 8f_1 +.f 2l. (2.2.4)

In a similar manner formulas involving more ordinates may be obtainedby retaining more differences in (2.2.2).

Under certain circumstances, one in particular being if the derivative isdesired at a tabular point near the beginning or end of the table, it isdesirable to have a formula for finding the derivative at a tabular pointother than x0. For example, by setting s = I in (2.2.1) we obtain

Pxi)h

µ6f0 + 8gfo + 3 631o12 6410 20

fi6gfo -F ...1.

(2.2.5)

Page 36: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

24 Numerical DifferenthHon and Integration

If we neglect differences of third and higher order and express pafo anda=fo in terms of ordinates, we find that

f'(xi)f 2h (3fi T- 4fe + f_1). (2.2.6)

In a similar manner, neglecting differences of fifth and higher order weobtain

f '(xi)11 (3fs + 10fi - 18fe + 6fi - f-2). (2.2.7)

Proceeding in a similar manner we may obtain the following usefulformulas :

f'(x') Ad 2h(-fl +4fo- 3fi), (2.2.8)

f'{x 1O+ 18f 3(f - 6 2 2 9o - f 9),f_i -: f112h

. . )(

4825 36 16 3' fi + fo -fp - f_2),f f_1 +(xa) F-v12h

( (2.2.10)

(-3f + 16 36 48 25f'( ) 22 2 112 f1 - f1 - f_2).fo +s

1x 2 h( . . )

We note that formulas (2.2.3), (2.2.6), and (2.2.8) may be described asthree-point formulas for the derivatives, whereas formulas (2.2.4), (2.2.7),(2.2.9), (2.2.10), and (2.2.11) are five-point formulas for the derivatives.Formulas involving more ordinates could be obtained by retaining moredifferences in (2.2.1). It will be noted that the symmetric formulas (2.2.3)and (2.2.4) are simpler than the others, and it can be shown that they arealso more accurate. For this reason they should be preferred wheneverpossible.

If the derivative is desired at a tabulated point in a table which is nottoo close to the beginning or end of the table, it will always be possible tochoose the desired point as xo and use points on either side of xo as informulas (2.2.3) and (2.2.4). If the derivative is desired at a tabulatedpoint very near the beginning or end of the table, however, one of theother formulas would be necessary. For example, to find the derivativeat the first table entry by a five-point formula, we could use formula(2.2.11) with xo chosen as the third argument in the table.

It has been pointed out earlier that in interpolating near the beginningor end of a table it is appropriate to use Newton's forward or backwardinterpolation formula. We might therefore expect to obtain approximateformulas for derivatives by differentiating either of these formulas. Such

Page 37: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Numerical Integration 25

formulas would, of course, involve the ordinary forward or backwarddifferences instead of central differences as in (2.2.1).

Such formulas might be convenient if these differences were availahk.If these differences are expressed in terms of ordinates, we obtain exactlythe same formulas as were derived earlier in this section except that thenotation is different, that is, the abscissas and ordinates are numberedfrom a different origin. For these reasons we omit any further discussionof such formulas.

In all of the foregoing discussion we have assumed that the abscissasare uniformly spaced. If this is not the case, then we may differentiateLagrange's interpolation formula (1.6.1) with respect to x yielding

nf'(x) ti fill (x) (2.2.12)

ie0

where, as usual, f; = f(xj), and 1;(x) is given by (1.6.3).Formulas (2.2.3), (2.2.4), and (2.2.6) to (2.2.11) may be obtained from

(2.2.12) by specializing to the case of uniformly spaced abscissas.Following is an example of the use of some of these formulas.

Example 1. Given the following table off (x) = sin x, find the derivativeof sin x at x = 0.5 and x = 0.3.

X

sin x

0.3 0.4 0.5 0.6 0.7

0.29552 0.38942 0.47943 0.56464 0.64422

Here h = 0.1 and we can use formulas (2.2.3) and (2.2.4) for xo = 0.5.From (2.2.3), f'(0.5) %%s 0.8761. From (2.2.4),f'(0.5) ;:w 0.8775. The truevalue is 0.87758. To calculate f'(0.3) we may use formula (2.2.8) withxo = 0.4 and formula (2.2.11) with xo = 0.5. From (2.2.8), f'(0.3)0.9584 and from (2.2.11), f'(0.3) 0.9552. The true value is 0.95534.

2.3 NUMERICAL INTEGRATION

To obtain formulas for approximating the value of the integral of a func-tion over an interval from a to b, we may break up the interval from ato b into a number of smaller subintervals and approximate f (x) by apolynomial over each of these subintervals. These polynomials are easilyintegrated, and the results can be combined to give an approximation tothe desired integral.

We first seek to develop formulas to accomplish the integration over oneof these subintervals over which f (x) is approximated by a polynomial.Whether the abscissas are uniformly spaced or not, we can always use

Page 38: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

26 Numerical Differentiation and Integration

Lagrange's interpolation formula to write down the interpolating poly-nomial in the form

fi(x) =.fo(x) + fill(x) + ... .

where 1;(x) are given by equation (1.6.3). Then

af 1(x) dx = fo f .10(x) dx +.fx f bli(x) + ... + fn f I.W.ba

a a

b

(2.3.1)

This formula is to be used as an approximation forJ.

f (x) dx. Since eacha

b

f 1{(x) dx is a number which depends only on the abscissas xo, xl, , xa

used and is independent of the functional values fo, fi, J. we observethat the approximate integration formula is expressed as a linear com-bination of the functional values involved. Thus in order to derive anapproximate integration formula we have only to determine the constantswhich appear as multipliers of the desired functional values. Althoughthese constants could be determined by actually evaluating the integrals ofthe Lagrangian coefficients which appear, this is usually rather tedious.

We proceed to illustrate other methods which are more convenient forthe evaluation of these constants, at least in the case in which the abscissasare uniformly spaced. First let us find a formula involving only twofunctional values fo and fl corresponding to xo and xl = xo + h and

giving an approximation to f . f (x) dx. We might use Newton's forward-

difference formula to approximate f (x) in the form

f' ^ `.fo + s ofo,

where, as usual, s = (x - xo)/h. Then

f xf(x)dx J1(fo+stfo)hdsxo 0

hfo+1hAfo

= 2 (fo + A). (2.3.2)

This is the basic formula of the trapezoidal rule.

Next let us find an approximate formula forX1f

(x) dx which involvesfz ,

Page 39: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Numerical Integration 27

the three functional values f_1,fo,f1 corresponding to x_1 = xo -- h, xo,xi = xo + h. Clearly, Stirling's central difference formula is appropriatehere. Thus we write approximately

f. fo+sµafo+ Zb2.f0.

Then

fx 11 f(x) dx md F1l (f. + sfsofo 2 &2fo) h ds

=2hfo+h3a2fo

= 2hfo + 3 (fi - 2fo+f 1)

=

3

(f-i + 4fo + fi). (2.3.3)

This is the well-known formula of Simpson's rule.Instead of using a single polynomial to approximate f(x) over the

entire range (a, b), we may divide (a, b) into subranges and approximatef(x) by a different polynomial over each subrange. If we subdivide (a, b)into n subranges of length h and apply the two-point formula (2.3.2) toeach subrange, we obtain the so-called trapezoidal rule,

(x) dx ti h(fo + fi + fs + ... . fn-i +f.) (2.3.4)ibf

where fo = f (a), fk = f (a + kh), f,, = f (h), and h = (b - a)/n. Thisformula corresponds to replacing the graph off(x) by a series of straight-line segments joining the ends of adjacent ordinates and hence the areain question is replaced by a sum of trapezoids. This formula is a verysimple one but its accuracy is not high. By choosing h small, however, wecan get good results.

If we subdivide (a, b) into n/2 subranges of length 2h, where n is even,and apply the three-point formula (2.3.3) to each subrange, we obtainSimpson's rule in the form

f f(x)dx3(fo+4f1+2f2+4f3+...+ 4fn_2 + 2f.-2 + 4f,-i + f.) (2.3.5)

where again fo = f (a), fit = f (a + kh), f = f (b), and h = (b - a)/n.This formula corresponds to replacing the graph of f(x) by a parabolain each subrange. The accuracy of Simpson's rule is usually greater than

Page 40: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

28 Numerical Differentiation and Integration

that of the trapezoidal rule, and also its weighting coefficients are relativelysimple. For these reasons it is perhaps one of the most widely used of allformulas of numerical integration. By taking h sufficiently small, we canget any desired accuracy, provided the number is of ordinates which areneeded does not become so large as to introduce round-off errors as aserious source of error.

For calculations by hand or with a desk calculator, the use of a largenumber of ordinates entails a prohibitive amount of labor. In such caseswe may wish to have more accurate integration formulas even if these mayinvolve more complicated coefficients. On an electronic computer,however, calculations using a large number of ordinates present no seriousproblem (unless round-off considerations enter), so it is usually moreconvenient to use a simple formula like Simpson's rule with a small valueof h than it is to use a more complicated and more accurate formula witha larger value of h. Hence these more complicated formulas are not usedas much as they once were.

Because a need for hand calculation may sometimes arise, however,we give without proof two celebrated formulas involving respectively fourand seven ordinates. Newton's three-eighths rule may be written in theform

f(x)dxs s3h (fo+3f1+3f$+fs) (2.3.6)

A celebrated formula notable for the simplicity of its coefficients isWeddle's rule:

j f(x)dxf 10(.f_4-+-5f.2+.ft+6f0+fi+Sf:+A).'r- a

(2.3.7)

Both of these formulas may be applied to the evaluation of an integralover an interval (a, b) by dividing in n/3 subranges of length 3h or n/6subranges of length 6h respectively. In the former is must be a multiple of3, and in the latter is must be a multiple of 6.

r.0.s 7

Example 2. Use the data. of example 1 to calculateJ

sin x dx by theo

trapezoidal rule and by Simpson's rule, using h = 0.1.Using the trapezoidal rule we find that

f,o.

7

sin x dx fs 0.10(0.29552) + 0.38942 0.47943

+ 0.56464 + }(0.64422))

0.190336 = 0.19034.

Page 41: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Method of Undetermined Coefficients 29

Simpson's rule givesr07Io s sin x dx me 31 [0.29552 + 4(0.38942) + 2(0.47943)

J + 4(0.56464) + 0.644223

= 1.1904947 = 0.19049.

The true value is cos 0.3 - cos 0.7 = 0.19050.

2.4 INTEGRATION FORMULAS BY THE METHODOF UNDETERMINED COEFFICIENTS

All the foregoing formulas of integration are said to be of closed typebecause they involve the ordinates at the ends of the interval of integration.Formulas of open type which involve ordinates at interior points of theinterval of integration but do not involve the ordinates at the ends of theinterval may also be obtained. Such formulas may be obtained as beforeby dividing the interval of integration in n equal parts by inserting n -- 1equally spaced abscissas and approximating f (z) by the polynomial ofdegree n -- 2 which coincides with f (x) at the n -- I interior points, andapproximating the desired integral by integrating the resultant polynomial.Open formulas are used principally in the numerical integration of differ-ential equations.

As has been noted, open formulas may be obtained by proceeding in amanner similar to that followed in deriving the closed formulas. There isanother method, however, the method of undetermined coefficients, whichcan be used to derive many formulas of integration, whether closed oropen. We illustrate this method by using it to derive a useful openformula. This method may be used to derive integration formulas in-volving any specified ordinates (and in addition any specified values ofderivatives) of the integrand. For example, suppose that, as usual,xo, xi, xs, xa, x* denote uniformly spaced abscissas with spacing h. Weseek a formula of the form

f(x)dxs.sAlf.1 +A:fs+AJ5.

This is clearly an open formula since it does not involve fo and f,. Sincethere are three constants to be determined, we may impose three condi-tions on this formula. We shall require that the formula give the exactvalue of the integral when f(x) is a polynomial of zeroth, first, or seconddegree. There will, in general, be an error if f (x) is a polynomial of higherdegree. Clearly, the constant coefficients A1, As, As will, not be altered by

Page 42: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

30 Numerical Differentiation and Integration

a change in the origin of coordinates. We therefore choose x2 = 0 so thatxa = -2h, xl = -h, xs h, x4 = 2h. Imposing the condition that theformula shall be exact when f(x) = 1, x, and x2, we find that

AZ+As,

x dx = 0 = -hAi -{- 0 As + hAg,fF x2dx=

vh 3

From the second equation we see that Al = As, and from the thirdequation we obtain Al = As = 8h13. The first equation then yields A2-0/3. The final formula becomes

":f(x) dx =43

(2f1 - f2 -l- 2fs). (2.4.1)

It is a simple matter to verify that this formula is also exact for f(x) = xsbut not forf(x) = x4. Thus we obtain in a certain sense, a bonus, in thatthe formula is exact for polynomials of degree one higher than might beexpected on the basis of the number of conditions which could be imposedfor the determination of Al, A2, and A3.

Formulas (2.3.2), (2.3.3), and (2.3.6) could be derived by the method ofundetermined coefficients, but the method used in the previous section isprobably simpler. Formula (2.3.7) could not be derived in this way as it isa rather ingenious modification of the formula which would result byimposing the condition that the formula be exact forf(x) = 1, x, . , x8.

(See, e.g., Hildebrand [12].) The method of undetermined coefficients isvery useful if we want to derive a formula of integration involving or-dinates different from those which appear in the standard formulas ofintegration. We may include values of first and higher derivatives in suchformulas if this is desirable. We may then impose as many conditions asthere are constants appearing in the desired formula. It should also bementioned that the method may also be used to derive appropriate for-mulas for derivatives as well. Indeed all of the formulas of Section 2.2could be obtained in this way.

2.5 ERROR ESTIMATES

Since all of the formulas of differentiation and integration have beenderived on the assumption that f (x) could be approximated by a poly-nomial of low degree, it is clear that they will be exact whenever f(x)

Page 43: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Error Estimates 31

coincides with the interpolating polynomial used, but in other cases therewill be an error introduced. For example, in deriving Simpson's rule(2.3.3) we approximated f (x) by a polynomial of degree 2, and so if f (x)is such a polynomial, the integration formula will be exact. But, it iseasily verified that the formula is also exact if f (z) = x3, and hence it isexact for any third degree polynomial. However, if f (x) = xs, we findthat the error introduced is given by

E-hx'dx3(+h°+4.0+h')256256156.

We note that if f(x) = x4, then fv(x) = 4! It follows at once that iff(x) = xa/4! then f i°(x) = 1. If we apply Simpson's rule to the functionf(x) = x'/4!, we find at once that the error is -h5/90.

We might guess that the error introduced when integrating by Simpson'srule any function f (x) having at least four continuous derivatives would be

6E = - 90(2.5.1)

where $ is some value in the range of the integration.This is indeed a special case of a more general result concerning the

error term in formulas of numerical integration. Each of the formulas ofintegration which have been derived in this chapter is exact for poly-nomials up to a certain degree but is not exact for polynomials of higherdegree. If E(f) denotes the error in a particular formula of integration,there is a number n depending on the formula in question such thatE(xm) = 0 for m S n but E(x"+1) # 0. For a large class of integrationformulas which includes formulas (2.3.2), (2.3.3), (2.3.6), and (2.4.1),discussed in this chapter, it can be shown that if f (z) has a derivative ororder n + 1 in the range involved in the formula, then the error is given by

x"+1E(f) = f("+1)(E)E

L J(n + 1)!

(2.5.2)

where E lies between the greatest and least values of x involved in the

integration formula (see Milne [19]).In Simpson's rule, n = 3, and formula (2.5.1) follows at once from

formula (2.5.2) since we have just shown that

4! 90

By applying formula (2.5.2) in a similar manner to the integrationformulas (2.3.2), (2.3.6), and (2.4.1), we can obtain the error terms for

Page 44: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

32 Namalcal Dlffawathtion and Integration

these formulas. For convenience of reference we list these formulas withtheir error terms:

f (x) dx = 2 (fe +f1) - 2f"(t:),

J= f(x) dx 3 (J_i + 4fo +fi) -h5fIV(e),90

(2.5.3)

(2.5.4)

af f(x) dx -

8(fo + 3fi + 3f: + fa) - 8Q f i°(e), (2.5.5)

e

f f(x) dx - 43(2f1 -f9 + 2fa) +

145sfi°(e).(2.5.6)

Since Weddle's rule is obtained by modifying another formula in aningenious fashion, the expression for its error consists of two terms. Itmay be written in the form

Jf (x) d x = 0 (f-a + 5f-$ +f-1 + 6fo + fi + 5fs + fs)

40fVi() - -! h-9f' (2.5.7)

1400

It should be noted that the formulas such as (2.5.4), (2.5.6), and (2.5.7),which involve an even number of subintervals, may be written either in asymmetric form involving ordinates on either side of xo as in (2.5.4) and(2.5.7) or in a nonsymmetric form as in (2.5.6). The form will be the samein either case-only the numbering of the ordinates will be changed.

For formulas (2.3.4) and (2.3.5), which were obtained by applicationof formulas (2.3.2) and (2.3.3) over a series of subranges, the error termsbecome --(nh3/12)f"(4) for (2.3.4) and -(nh6/184)fi"(f) for (2.3.5).

It is also of interest to observe that formula (2.5.2) may be used to findthe error terms for many of the differentiation formulas of Section 2.2.For convenience of reference we list the following differentiation formulaswith their error terms.

Three-point formulas :a

f '(x-z) ` 2h

(_fl + 4f0 -- 3/1) f ,"(j),

z

f'(xo) -2h

(A = f-.s) - 6 f,'(),

9

f '(xz) =Zit

(3fx -' 4fo + 1-1) + f'"().

Page 45: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Error Estimates 3s

Five-point formulas :4

f'(x-s) '12h

(-312 + 16f1 - 36fo + 48f-1 -- 25f-2) + S;`(

12h(f2 - 6fi + 18fo - 10f1 - 3f-2) - d

4

f'(xo) =12h

(--fe + 8fi -' 8f-1 + f-2) + 30ra),

12h(3f$ + 10f1 - 18fo + 6f-1 - f-z) - 20f°(),

a

f'(xs) '12h

(25f2 -- 48f1 + 36fo - 16f_1 + 3f s) + S f ` (r)

It should be pointed out that each a lies between the extreme valves ofthe abscissas involved in that formula. An examination of these formulasreveals that when the derivative is to be calculated at the central point,not only is the formula simpler than others involving the same ordinatesbut also the error term is smaller. Thus the central formula should bechosen whenever a choice is possible.

Page 46: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

chapter 3 Roots ofequations

3.1 INTRODUCTION

The solution of transcendental equations or algebraic equations ofdegree higher than two is usually impractical by direct analytical methods.To find the roots of such an equation the first step is usually to find someapproximation to the root by rough graphical methods or otherwise fromknown properties of the roots of the equation. Thus if we seek the rootsof the equation

f (X) = 0we might plot the function

y =f(x)and determine approximately where the graph crosses the x-axis. Havingfound an approximate value of a root, we then make use of some recur-rence relation to generate a sequence of successive approximations which,under suitable conditions, will converge to the root. By this means we mayobtain the value of the root to any desired accuracy.

In this chapter we discuss some of the methods for carrying out thisprocedure for one equation in one unknown. We also indicate how thesemethods can be applied to the solution of two simultaneous equations.

3.2 GENERAL ITERATIVE METHODS

We wish to consider the problem of finding a real root of the real equa-tion f (X) = 0. (3.2.1)

We can always rewrite (3.2.1) in the formx = F(x) (3.2.2)

34

Page 47: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

General Iterative Methods 35

and indeed often in many different ways. If we have found an approxima-tion zo to a root a of (3.2.1), we can use the recurrence relation

zk+i = F(zk) (3.2.3)

to generate a sequence of approximations to a. The convergence ordivergence of this sequence of approximations may depend on the partic-ular form chosen for F(x). To study this situation we note that since ais a root of (3.2.1) we have F(a) = a and consequently

a - zt.1 = F(a) - F(zk) _ (a - zk)F'(srk) (3.2.4)

where k lies between zk and a, if we assume that F(x) possesses a contin-uous derivative over that range. If the sequence of approximations zkconverges to a, then F'(ek) w F'(a) for sufficiently large k, say for k Z ko.For such k we find that

a - zk ,. (a - zw)[F'((X)lk-ko

and consequently a - zk - 0 as k -> oo, only if IF'(a)( < 1.Thus in order that the iteration converge to x = a, it is necessary

that IF'(x)( < 1 in a neighborhood of x = a.It is also clear that if (F'(a)f < I and if the initial approximation is

sufficiently near to a, the sequence of iterates will indeed converge to a.In the special case in which F'(a) = 0, the nature of the convergencedepends on the behavior of the higher derivatives of F(x) hear x = a.

Example 1. Find the real root of x3 - 2x - 5 = 0.A rough graph of the function f (x) = x3 - 2x - 5 shows that the only

real root of the equation x3 - 2x - 5 = 0 lies between 2 and 3 and is near2. If we rewrite the equation in the form

xs - 5x=2

we may try the recurrence formula

43 -- 52

If we start with zo = 2, we obtain the sequence zl = 1.5, z$ = -0.8125,z3 = -2.7682, - . If we start with zo = 2.1, we obtain the sequencezi = 2.1305, z2 = 2.3352, z3 = 3.8671, - . It is clear that neither of thesesequences is converging and the reason is easily found. We have writtenthe equation in the form (3.2.2) with

F(x)=x3'-52

Page 48: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

36 Roots of Equations

Npw F'(x) = 3x2/2, which is 6 when z = 2. Another possible way ofwriting the equation in the form (3.2.2) is to choose

x2-- 2But again when x is near 2, F'(x) is considerably larger than 1. If, however,we write the equation in the form

x=(2x+5)",choosing F(x) = (2x + 5)11, we find that

F'(x) = 2

3(2x + 5)'ti 0.16 1

when x = 2. We therefore expect convergence if we use the recurrenceformula

zx,-a = (2zk + 5)1x.

If we start with zo = 2, we obtain the sequence zi -_- 2.0801, z2 = 2.0924,z8 = 2.0942, z4 = z6 = 2.0945 when four decimal places are retained.The true value is 2.094551 to six places.

3.3 METHOD OF FALSE POSITION (REGULA FALSO

Suppose that we have found an approximation to a root off(x) = 0 bygraphical or other means as indicated in Section 3.1. One of the oldestand most generally applicable methods for improving the approximationis the method of false position. If we have found two values of x, sayx = a and x = b, for which f(a) and f(b) have opposite signs, we can becertain that there is at least one root of f(x) = 0 between x = a and x = bbecause the graph of f (x) must cross the x-axis between the two points.We may then replace the actual curve f(x) between the two points by astraight line and take the point c where this line crosses the x-axis as anapproximation to the root of the equation. The typical situation is shownin Fig. 3.1 and from the geometry of that figure we have

_ f(a) = f(b) - f(a)

c -- a b -aso that

c=a...-b --

a f(a). (3.3.1)f(b) --f(a)

Since f(a) and f(b) are of opposite signs, f(c) must be opposite in sign toone of them, and so we may apply the same procedure again for a stillbetter approximation to the root a.

Page 49: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Method of False Position

Fig. 3.1.

37

We see that at each step we are using linear inverse interpolation asdescribed in Section 1.7. It is clear that the procedure is certain to con-verge, although the rate of convergence may be slow.

It is instructive to express the method of false position in the form of arecurrence formula of the type

J(zk)xk+l=zk -Yk

In such a recurrence formula the ideal choice of yk would be a value thatmakes zk+1 = at. To achieve this desirable result we would have to choose

0 - f (zk)Yk -

- zk

This is seen to be the slope of the secant joining Pkfzk, f(zk)] and (x, 0).Unfortunately this slope is not known unless the root a is already known,which it is not. We should choose Yk in such a way that this situation isapproximated at each stage of the calculation. In the method of falseposition, we see from (3.3.1) that yk is to be chosen as the slope of thesecant joining Pk and the most recently determined point at which theordinate differs in sign from that at PA:.

Page 50: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

38 Roots of Equations

We note that (3.3.2; is a special case of (3.2.3) in which we have written

F(x) - x - (x)f(x) (3.3.3)

where &) is a function such that 4p(zk) = 1/yk. The explicit definition ofa function po(x) which assumes the chosen value 1/yk is obviously un-necessary here.

Example 2. Find the real root of x3 - 2x -- 5 = 0 by the method offalse position.

If we start with zo = 2.0 and zi = 2.2, the next four iterates are shownin Table 3.1.

zk

TABLE 3.1

f(zk) Yk -f(zk)IYk

2.0 -1.02.2 1.248 11.24 -0.1112.089 -0.0618 11.80 0.00522.0942 -0.00392 11.83 0.000332.0945 -0.000575 11.83 0.000052.09455

As in this example, Vk often changes slowly after the first few steps.There would be some saving of labor if from some stage onward yk wereassigned a constant value instead of being recalculated at each stage.The rate of convergence would be reduced only slightly if this were done.

In Table 3.1, z4 was obtained by interpolation based on z3 and zl,following the preceding description of the method. If, however, the lasttwo abscissas available are used, then z4 may be obtained by extrapolationbased on z3 and z5. Here, y3 = 11.13 and z4 = 2.09455, which is a slightlybetter approximation. It can be shown that choice of yk as the slope of thesecant Pk_1Pk will yield a more rapidly convergent sequence if the sequencedoes converge. Unfortunately, the convergence of the resulting sequencecannot be guaranteed if extrapolation is required.

To study the convergence situation for the general recurrence formula(3.3.2), we observe that since f (a) = 0 we have

xk)a - zk+l - a _., -"t -f a) - r

yk

= (a - zk) [1 - f ( k)] (3.3.4)L yk

where fk is between zk and a. In order that zk -- a, it will be necessary

Page 51: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Newton-Raphson Method 39

that 1 - [ be smaller in magnitude than unity. This means thatfor convergence of zk to a we shall have to have

0 < f ,((X) < 2VA:

for sufficiently large k.Since the error in zk+i is in general approximately proportional to the

error in zk as is shown by (3.3.4), we call the method under discussion afirst-order process. Formula (3.2.4) shows that the method of Section3.2 is in general also a first-order process.

3.4 NEWTON-RAPHSON METHOD

In formula (3.3.2), a reasonable choice for yk would be the slope of thetangent to the graph of f(x) at Pk(zk, f(zk)]. The recursion formula thenbecomes

Zk+l = zk --f zk)

(3.4.1)

f (zk)

This is the basic formula of the Newton-Raphson method. Formula(3.4.1) is a special case of formula (3.2.3) with

F(x)=x- f( jx

Since f(a) = 0, it is clear that F(a) = at. Moreover,

=1 -

f'(x) f (x)f"( = f(x)f"(x)F'(x)

-f ,(X) + U'(x)]a [f '(x)]$

so that P(a) = 0. Thus, if zk - at, the convergence is more rapid thanfor the methods of Sections 3.2 and 3.3. In other words, the Newton-Raphson method is a process of higher than first-order. To investigatethe behavior of the error a - zk more closely, we first expandf(x) aboutthe iterate zk using Taylor's series with a remainder,

/ ttAX)(x) = f (zk) + (x - zk)f'(zk) + (x - ZO f"(sk)

where $k lies between zk and a, under the assumption that f "(x) is contin-uous in that interval. Next we set x = a, note that f(a) = 0, and solvefor f (zk), obtaining

f(zk) = -(a - zk)f '(zk) -(a - zk)J"(Sk)

Page 52: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

40

We substitute this into (3.4.1) and obtain

Roots of Equations

- (a - zk)f _(zk) _ (a - zk)s fn(k)= at - za - zk+ f k

J'(zk)

- i(z - zk)$ .f (k).f (zk)

If zk -* a, then for sufficiently large k we have

at - zk+1 ti - (a -- zk)2f"(a)PO

We note that the error in zk+i is approximately proportional to thesquare of the error in zk, when k is large. We say that the Newton-Raphson method is a second-order process. It appears that the number ofcorrect decimal places will be approximately doubled at each stage.

It must be emphasized that the Newton-Raphson method will notalways produce a convergent sequence. Difficulties are likely to be en-countered if f'(x) = 0 near a root or if the graph of f(x) has inflectionpoints between zk and a. If a trial root is sufficiently close to at, convergencewill occur provided f'(a) 0 0.

Since the Newton-Raphson method is a second-order process whereasthe method of false position is a first-order process, one might think thatthe former would always be the more advantageous method to use. Itshould be noted, however, that in the Newton-Raphson method each stageof the iteration requires the calculation of two quantities, namely f (zt)and f'(z,Y). If we were to advance the subscript of zk once for each evaluationrequired, we would conclude that the equivalent order of the Newton-Raphson process is only V2 = 1.414. For the method of false position,only one new evaluation is required at each stage. If we use the modifiedmethod in which yk is chosen as the slope of the secant P,t_jPk at eachstage, we can show that the order of the process is }(V + 1) = 1.618.Thus, in this sense, the modified method of false position may be said to besuperior to the Newton-Raphson method. The method of false positionwould also be preferred whenever the derivative of the function f(x)is either difficult or impossible to compute. Where the derivative is easilyfound, the Newton-Raphson method is a very satisfactory procedure.

Example 3. Find the real root xi - 2x _ 5 = 0 by the Newton-Raphsonmethod.

Since f(x) = x3 - 2x - 5, we have at once that f'(x) = 3x2 - 2. Ifwe start with zo = 2.0, the next three iterates are shown in Table 3.2.

Page 53: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Simultaneous =Equations 41

TABLE 3.2

zk f (zic) f '(zk) f(zk)lf'(=k)

2.0 -1.0 10.0 0.102.10 0.061 11.23 -0.00542.0946 0.000542 11.162 -0.000048562.09455144

The last value is correct to six decimal places.

As an interesting application of the Newton-Raphson method, we derivean iterative procedure for finding the square root of a number A. Tofind the square root of A we have only to solve the equation x2 -- A = 0.Applying formula (3.4.1) to this equation we find at once that

zk" -- Azk -

zk + A--)2(

, zk

This is the required iteration formula for the square root, and it providesa very convenient and rapid means of calculation. When square roots areneeded in the course of a calculation on an electronic computer, this is themethod which is most frequently used.

3.5 SIMULTANEOUS EQUATIONS

The methods of the previous sections may be extended to the solutionof two or more simultaneous equations.

Suppose that we wish to solve the two simultaneous equations

f (Z' y) = 0, g(x, y) = 0. (3.5.1)

These equations may be rewritten in the formx = F(x, y), y = G(x, y) (3.5.2)

and usually in many different ways. If by graphical or other means we canfind an approximate solution (xo, ya), we may then use the recurrenceformulas

xk+r = F(xr, yr), yr+i = G(xt, yr) (3.5.3)

to obtain a sequence of points (xe, %). It can be shown that if the partialderivatives of F and G satisfy the conditions

IF:1 + IFWI < 1, 1GZI + I

Page 54: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

42 Roots of Equations

near the solution (a, 9), and if (x,,, yo) is sufficiently close to (a, fi), thenthe sequence of points (xk, yk) will converge to the point (a, j9).

We may also derive an analogue of the Newton-Raphson method fortwo simultaneous equations. If (a, i) is a solution we may expand

floc, fl) andg(a, 5/) about the point (xk, yk) by means of Taylor's series :

0 = f (a, fl) = f (xk, A) + (a - x k)fx(xk, yk) + (ft - Yk)fv(xk, yk) + ... ,

0 = 9(a, N) = g(xk, yk) + (a - xk)gm(xk, yk) + (9 - yk)gv(xk, Yk) + ... .

(Note that in these equations the subscript k is an integer but the sub-scripts x and y denote partial differentiation with respect to z and y.)Replacing (a, P) by the approximation (xk+i, yk+1), writing Axk = xk+1 -- xkand Ayk = yk+1 - yk, and neglecting all nonlinear terms in Axk and Ayk,we obtain the equations

Axkfx(xk, yk) + Aykfy(xkl Yk) = f(xk, yk),Axkgx(xk, yk) + Aykgti(xk, yk) = -g(xk, Yd-

These simultaneous linear equations may now be solved for Axk and Ayk,and these corrections are then added to xk and yk to obtain the nextapproximations xk+1 and yk+1

3.6 APPLICATION TO POLYNOMIAL EQUATIONS

Although the specific example solved in Sections 3.2-3.4 was a poly-nomial equation, the methods of these sections are not restricted toequations of this type but may be applied to any algebraic or transcen-dental equation. Since the solution of such equations introduces no newdifficulties, a numerical example was not included.

The Newton-Raphson method is particularly convenient for poly-nomial equations because the polynomial and its derivative can beevaluated readily by the process of synthetic substitution which will nowbe explained.

We consider a polynomial equation f(x) = 0 where

f(z) = aox" + alx"'1 + ... + an-ix + a". (3.6.1)

Let us dividef(x) by a linear factor x - z. We obtain a quotient boxn-1 +b1xn-2 + - + b,r1 and a remainder R. We may write

f (x) = (x - z)(box"-1 + b1x,2 + ... + b,,_1) + R. (3.6.2)

It should be noted that the coefficients bo, b1, - , b,,_i and R depend on z.If we set x = z in (3.6.2) we obtain

R = f(z). (3.6.3)

Page 55: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Application to Polynomial Equations 43

Thus f (z) is the remainder on division of f (x) by x - z. To obtain aconvenient method for the calculation off(z) we proceed to introduce theidea of synthetic division in the following way. If we equate the co-efficients of xn, xn-1, , x, x° in (3.6.1) and (3.6.2) we obtain

ao = bo, a1 = b1 - zbo, a2 = b2 - zb1, ... ,

an-1 = bn-1 - zb,,-2, an = R - zbn-1

These relations may be rewritten in the form

bo = ao, b1 = a1 + zbo, b2 = a2 + zb1,

an-1 + zb,,-,, R = an + zbn-1,

or more compactly

bk=ak+zbk-1, k=0, 1,2,...,nb_1 = 0, R = bn. (3.6.4)

If the quotient in (3.6.2) is again divided by x - z we haveb1xn-1 + blxn-2 + ... + bn-2x

+ bn-1 =(x - z)(coxn-2 + clan-s +...+ R'. (3.6.5)

Consequently

f (X) _ (x - z)2(coxn-2 + f, clan-s + ... + c,,_2) + R'(x - z) + R.

It follows thatf'(z) = R'.

Thus f'(x) is the remainder on dividing the quotient in (3.6.2) by x - z.It is also evident that the c's in (3.6.5) are related to the b's as the b's arerelated to the a's and hence

ck = bk + zCk-1, k - 0, 1, 2, ... , n - 1c_1 = 0, R' = cn-1. (3.6.6)

For actual calculation it is convenient to arrange the entries in thefollowing form :

ao a1 a2 as ... a,,-s an_1 an Lzbo zb1 zb2 zbn-s zbn-2 zbn-1

bo b1 b2

zcO zc1

b3

zc2

bn-2zCn--3

bn--1ZCn-2

bn

CO c1 C2 C$ ...CA-2 CA-1

Page 56: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

44 Roots of Equations

The coefficients of the equation are written in order in the first row, zerocoefficients being supplied where a power ofx is missing, and the value ofthe argument is shown at the extreme right. The b,, are calculated in orderby adding the two numbers above them. The cc are found similarly.

Example 4. For f (x) = xs - 2x - 5, evaluate f (2) and f'(2) by syntheticdivision.

1 0 -2 -5E.

2 4 4

1 2 2 -1 = f(2)2 8

1 4 10 -f'(2)

The values agree with those shown in the example of Section 3.4.

If one of the roots of the polynomial equation f(x) = 0 is to be foundusing the Newton-Raphson procedure, starting with the initial approxima-tion z, the next approximation z1 is

z1=z- b .

cn-1

The process will be repeated with z replaced by z1. This procedure forapplying the Newton-Raphson method with the polynomial and its deriv-ative evaluated by synthetic division is sometimes called the Birge-Vietamethod.

When we have found a root of the equation so that R = b is effectivelyreduced to zero, then bo, b1, . , are (approximately) the coefficientsof the reduced polynomial equation, of degree n - 1, whose roots are theremaining roots of f(x) = 0.

The procedure just described can also be applied to the problem offinding the complex roots of polynomial equations provided a complexstarting value is used. Since the calculations involve complex. arithmetic,however, they are likely to become very tedious. If the coefficients of theequation are all real, it is well known that the roots occur in conjugatecomplex, pairs. To each such pair of roots will correspond a real quadraticfactor x2 + px + q of f(x). We now explain the Bairstow method inwhich a sequence of successive approximations to a quadratic factor isgenerated.

If the polynomial with real coefficients

f(x) = aaxw + alx+.-i + ... + a,1x + a

Page 57: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Application to Polynomial Equations 45

is divided by the quadratic expression x2 + px + q, we obtain

f(z) = aox" + a1x" + ... + a,,-Iz + a"

(x2 + px + q)(boxn-2 + bix'"-3 + ... + b,,-sx + bn-2) + Rx + S.

(3.6.7)

Now both R and S are functions of p and q. The condition that x2 +px + q be a factor off (z) is that

R = R(p, q) = 0, S = S(p, q) = 0. (3.6.8)

We are therefore confronted with the problem of solving two simultaneousequations for p and q. In Section 3.5 an analogue of the Newton-Raphsonmethod was described for doing this. If Ap and Aq are the corrections tobe added to the trial values p and q, the equations to be solved are

AP M + Aq LRR + R = 0

as SAP +Aqq+S=0. (3.6.9)

We need a simple procedure for the evaluation of R and S and the neces-sary derivatives.

If we equate coefficients of like powers of x in the two members of(3.6.7), we obtain

ao==bo, ai=b1+pbs, a2=b2+pb1+gbo,as = b$ + pb3 + gb1,. ...,

a"-2 = b,2 + Pb"--3 + qb"-s,

a" = S+ qbn-$.

If we set

ax = At + pbk--1 + gbk-s, ... ,

a"-1 = R + Pb,- + qb.-s,

b-1= b_2 = 0,

R = bn-1,

S=bn+Pbn-1,

(3.6.10)

(3.6.11)

then we obtain from (3.6.10)

bk = ak °- Pbk-1 - qbk--2, k = 0, 1, 2, ... , n. (3.6.12)

Thus if the b's are calculated from (3.6.12) we obtain R and S.

Page 58: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

46 Roots of Equations

It can be shown (see Hildebrand [12]) that the necessary derivativesrequire the calculation of the following quantities:

c_i = c_2 = 0,

Ck=bk-pck-1-gck-z, k =

0 - Pcn-2 - qcn-sIf the first of equations (3.6.9) is multiplied by p and subtracted from thesecond of these equations, the equations for the determination of Op andA q finally reduce to

Cn-2 Op + cn_3 Oq = bn_i

Cn-1 Ap + c,2 Oq = bn. (3.6.14)

The calculations can be conveniently arranged as follows :

ao bo co

a1 bi c1

a2 bQ cs

an-4 bn-4 Cn-4

bn-3 Cn-3

an_2 bn_2 C,,,-2

an-1

a,,

bn_1

b,,

e.-1

Each element in the b-column (including and each element in the c-column (except the last one en-1) is calculated by subtracting from theelement to its left p times the last calculated element above it and q timesthe next-to-last element above it. The element en-1 is calculated in thesame way except that the element to its left is replaced by zero.

To solve the equations (3.6.14) it is convenient to compute

D = Can-8 - e.-lc.-,,

D9 = bn_icn_2 - bncn-S,

from which we obtain

DQ = bnCn_3 - bn-1Cn-1,

Op=D, tiq= D .

Example 5. Find the roots of the quartic equation

x4-7x$+32x$--31x+25=0.

Page 59: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Character of the Roots 47

We attempt to find a quadratic factor of the form x2 + px + q. Westart with the approximation p = q = 0. The first three stages in applyingthe Bairstow method appear as shown in Table 3.3. Thus this iterationgives p = -0.999975 and q -== 0.999973 which are very close to the truevalues of p = -1 and q = 1.

If we solve the corresponding quadratic equation

xs - 0.999975x + 0.999973 = 0

we find that x = 0.499988 ± 0.8660171 which are very close to the true

TABLE 3.3

P, q = 0, 0 -0.8, 0.8 -0.99, 0.99

1 1 I 1 1 1 1

-7 -7 -7 -6.20 -5.40 -6.01 -5.0232 32 32 26.24 21.08 25.0601 19.1003

-31 -31 0 -5.08 21.18 -0.2406 23.879125 25 -0.02 -0.0477

D -D9, Do ,AP, Aq =

1024-817, 824-0.8,0.8

559-107, 107-0.19,0.19

484.7-4.835,4.834-0.009975,0.009973

roots (1 ± iV'-3)/2. The other roots of the original quartic equation can befound by solving the quadratic equation corresponding to the quotientobtained by dividing the original equation by the quadratic factor justfound. The first three entries in the b-column in the previous schemeprovide approximations to the coefficients of this quotient. Thus whenp = -0.99 and q = 0.99 we obtain the quotient x= - 6.01x + 25.0601which is very close to the true factor xs - 6x + 25. If we carried thecalculation out for p = -0.999975 and q = 0.999973 we would find thefactor x2 - 6.000025x + 25.000152. The corresponding roots are3.000013 ± 4.000010i which are very close to the true roots 3 f 4i.

3.7 CHARACTER OF THE ROOTS OF A POLYNOMIALEQUATION

In this section we consider a polynomial equation

f(x) = aox" + alx"-' + ... + a,a_ix + a = 0, (3.7.1)

all of whose coefficients are real. Then it is well known that its roots maybe real or complex and that the complex roots occur in complex conjugate

Page 60: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

48 Roots of Equations

pairs. Before applying the methods of the previous section for the cal-culation of the roots of an equation, it is frequently convenient to obtainsome preliminary information concerning the character and location of theroots.

A convenient procedure for obtaining such information is providedby Descartes' Rule of Signs which we shall now explain. We observethe signs of the coefficients of the equation (3.7.1) written in order ao,al, - - , a,,. If a,-, and a{ have opposite signs, we say that they presenta variation of sign. We proceed to count the number of variations of signin the sequence of coefficients. If some of the coefficients are zero, theyare disregarded in counting the number of variations. We may then statethe classical theorem known as

DESCARTES' RULE OF SIGNS. The number of positive real roots of theequation (3.7.1) with real coefficients is never greater than the number ofvariations of sign in the sequence of its coefficients a0, a1, , a,,, and, ifit is less, then it is less by an even integer.

A proof of this result can be found in any standard textbook on thetheory of equations. (See, e.g., Uspensky (18, pp. 121-1241.)

By replacing x by -x in equation (3.7.1), we may obtain informationconcerning the number of negative real roots.

Example 6. Use Descartes' rule of signs to obtain information con-cerning the roots of the equation

f(x)=x8-2x3+x2-3x- 1 =0.There are three variations of sign, and so there may be one or three

positive real roots, Changing x into -x we havef(-x) =xs+2x3+x2+3x- 1.

There is just one variation of sign, and so there is exactly one negative realroot. The total number of real roots does not exceed four, and so thereare at least two complex roots.

In many dynamical problems we encounter motions which can bedescribed by formulas of the type constant - el, where A is often obtainedas a root of a polynomial equation with real coefficients. Such a motionis stable if the exponent A has no positive real part. To determine whethersuch a motion is stable, we have only to determine whether any of theroots of the corresponding polynomial equation have real parts that arepositive. For a system to be stable, it is necessary that none of the rootshas a positive real part. We therefore seek necessary and sufficient con-ditions on the coefficients of the polynomial equation so that the real partsof all of its roots are negative.

Page 61: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Character of the Roots 49

For a cubic equation

a0A3 + a122 + a22 + as = 0, (3.7.2)

the conditions can be obtained from well-known elementary propertiesof the roots. We assume that ao > 0, since this can always be achievedby dividing the equation by -1 if necessary. Let Al, Aa, A3 denote theroots of the equation (3.7.2). Then, since the left side of (3.7.2) is equal to

ao(A - A,)(A - A2)(A -we have

Al-+-AQ-} 4=-a1 (3.7.3)a0

+A2A3-hAaAl=a"_= (3.7.4)

AlAEA3 = -sa

.

ao

(3.7.5)a0

To obtain necessary conditions on the coefficients, we assume that thereal parts of Al, As, As are all negative. In case the roots are all real andnegative, it is at once obvious from (3.7.3).-(3.7.5) that a1 > 0, a$ > 0,a3 > 0. In case two of the roots, say As and A3, are complex, then A$a + ifl, A3 = a - i19, and hence A.aAa = as + NRa > 0 and A. + As =2a < 0. Moreover, Al is real and negative, Hence from (3.7.3) we havea1 > 0 and from (3.7.5) a3 > 0. Now (3.7.4) may be rewritten in the form

18(22+23)+44 =a2>ao

and it is clear that ; > 0. Thus for all the roots to have negative realparts it is necessary that a1 > 0, ; > 0, as > 0 when as > 0. Theseconditions are not sufficient, however.

To obtain an additional necessary and sufficient condition we assumeao > 0, a1 > 0, a2 > 0, as > 0. Then one of the roots, say Al, must bereal and negative. Suppose that as is very large compared to a1 and ;;(3.7.2) becomes approximately a023 + a3 - 0 and hence Al szt -(aa/ao,A$ F-:s --(a3/ao)'4(,, As Ps -(a3/ao) a3 where 0) _ (-1 + iV)/2, one ofthe cube roots of unity. Thus A$ and A$ have positive real parts. Now ifwe diminish a3, keeping a1 and aQ fixed, eventually the real parts of AZand 4 will become negative, and we pass through a value of as for whichthe real parts are zero and hence As and A$ are pure imaginary. If we writeA$ _ Pi, substitute the value in (3.7.2), and equate real and imaginaryparts, we obtain

-a0#'+ a2fl = 0

-al#2 + a3 = 0.

Page 62: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

50

Eliminating # we obtain

or

as - a2

a1 ao

Roots of Equations

ao

Regarding ao, al, and a2 fixed, we observe that the roots are continuousfunctions of aa. Hence ? and .18 will have a positive real part if

and a negative real part ifaaao > alaa

asao < a1a2.

Thus we have shown that necessary and sufficient conditions that all theroots have negative real parts are al > 0, as > 0, a3 > 0, alga - aoaa > 0.

For equations of higher degree, a convenient procedure for determiningwhen all of the roots have a negative real part has been given by Routh.

We make ao > 0 and arrange the coefficients of (3.7.1) in two rows thus:

ao a2 a4 as as ...ai as a6 a, a9

We then form a new row by cross multiplication in the following manner :

ala2 - aoas, a1aa - aoas, alas - aoa,, alas - aflaa, .

Next we form a fourth row by operating on the last two rows in exactlythe same manner. Proceeding in this manner from row to row, the num-ber of terms in each row will gradually decrease and we stop when noterm is left. (Note that the first two rows are, of course, finite, becausethere are only a finite number of coefficients in the polynomial equation.)Then for the real parts of all the roots to be negative, it is necessary andsufficient that the terms of the first column should all be positive.

To formulate the foregoing rule for the calculation of the various rowswe denote the first two rows as

a00 a10 a20 MW a40

MOIL all a21 a31 a4l

Then the third row isaft a12 a22 a22 142

where

aoo 0i+1.0

a01 at+1.1

I=0,1,2,.. .

Page 63: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Character of the Roots

In general the jth row is

«Oi ali 11 131 a4iwhere

«O,i-2 ai+1,i-2

51

I ao, i-1 ai+1, i-1 I

Then for the real parts of all the roots of a polynomial equation of degreen to be negative, it is necessary and sufficient that ac0i > 0, j = 0, 1,2, ,n.

The so-called test determinants Ti which essentially appear in the firstcolumn of the scheme above may be written down explicitly in the follow-ing form :

To -aco=ao,

T3 aco3 =

T1=aol=a1,

a1 a0 0

as

as a4 a3

as a1 e

i=0,1,2, .

T2=a02=

T4=ac04-a1

I

I a7 ae ab a4 I

and so on. Any coefficient whose subscript exceeds n, the degree of theequation under consideration, is to be replaced by zero. It may be re-marked that if T,1 = 0, then the nth degree equation has either a pair ofpurely imaginary roots or a pair of equal and opposite real roots.

For example, n = 3 for the cubic equation, and we have

To = a0, T1 = al, T2 =a1 ao

a1 ao

I a3 a2

a1 a0 0 0

a3 a2 a1 a0

a5 a4 a3 as

= a1a2 - aa3,a3 a2

a1 a0 0

T3 = a3 as a1 = a3T3.

1 0 0 ailIt is easily seen that the positivity of these quantities is equivalent to theconditions previously obtained.

An alternative discussion of the Routh procedure may be found inFrazer, Duncan, and Collar [8, pp. 154-155].

Page 64: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

chapter 4 Simultaneous

linear equationsand matrices

4.1 LINEAR EQUATIONS, VECTORS, AND MATRICES

Many problems in engineering, physics, applied mathematics, and otherfields lead to systems of simultaneous linear equations. For example, insolving an elliptic partial differential equation, such as Laplace's equation,we frequently cover the region under study with a rectangular net and seekto find the values of the solution at the lattice points of the net. If wereplace the differential equation by an approximating difference equation,we are led to a system of simultaneous linear equations in a large numberof unknowns. In problems in many fields, including aircraft structuralanalysis, the complicated interactions between the various quantities understudy can be represented by systems of linear equations,

A system of n linear equations in n unknowns may be written in theform

auxi + axa + + alx b,,

aylxl + aaxs + ... + bs (4.1.1)

a convenient notation for writing such systems andfor studying them, we proceed to define vectors and matrices.

The reader is familiar with the concept of a vector in 2-space and in3-space. Such vectors have two or three components respectively. This

52

Page 65: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Linear Equations, Vectors, and Matrices 53

concept may be generalized to n-space if we define a vector to be a set ofn real numbers which may be written in the form

xi

x2

x= (4.1.2)

LrnJIndeed we may permit the xi to be complex numbers. We remind thereader that a real number is a special case of a complex number in whichthe imaginary part is zero. In Sections 4.1 to 4.8 we shall consider onlyvectors with real components; in Sections 4.9 to 4.16 the vectors may havecomplex components. The vector in equation (4.1.2) is called a columnvector. If n numbers are arranged in a horizontal array,

x = (x29 x299 x12)9 (4.1.3)

x is called a row vector. Lower-case letters such as x, y, z or a, b, c willbe used to designate vectors. The quantities x; are called the componentsof x, whereas n is called the dimension of the vector x. One-dimensionalvectors are called scalars.

It will be recalled that in 2-space and 3-space vectors are equal if andonly if their components are equal, and that the operation of vector addi-tion of two vectors is accomplished by adding corresponding components.Multiplication of a vector by a scalar means that each component ismultiplied by the same real number.

If these concepts are generalized to n-space, we are led to the followingformal definitions. Two vectors x and y are equal if and only if their com-ponents are equal, that is x, = yc for i = 1, 2, - - -, n. The sum of twovectors, x and y, is denoted by x + y and is defined to be

(4.1.4)

Lx- + ii,JAddition is commutative and associative. In other words, x + y = y + x

Page 66: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

54 1laar Equations and Matrices

and x + (y + z) _ (x + y) + z. Multiplication of a vector x by a scalarci is defined by means of the relation

cixi

cix = xcl =

'_cix+.J

(4.1.5)

In real 2-space and 3-space the length of a vector x has an obviousgeometric meaning, and this length, denoted by lxi, can be computed asthe square root of the sum of the squares of the components of x. Inaddition, the scalar product or dot product of two vectors x and y isdefined to be lxi iyI cos 0 where 0 is the angle between the two vectors.This dot product can be shown to be equal to xiyi + xsys in 2-space orxlyi + xsys + xsys in 3-space.

These notions can be generalized to n-space. The inner product orscalar product of two vectors x and y is written (x, y) and is defined bythe relation

(x, Y) = x{yr. (4.1.6)i-1

This is a scalar function of x and y. We call

nr-1

the length of the vector x, and denote it by Jxl. It is clear that the lengthof a vector is zero if and only if all of its components x{ are zero. Thevector whose components are all zero is called the zero vector and isdenoted by 0. Thus 101 = 0 and Jxi > 0 if x 0 0.

In 2-space and 3-space, two vectors are said to be orthogonal if theangle 0 between them is 90°, that is, if their dot product is zero. Thus inn-space, two vectors x and y are said to be orthogonal if and only if(x, Y) = 0.

Thus far we have assumed that the vectors have real components.To generalize the definition (4.1.6) for vectors with complex components,we have only to replace y{ by y,, the complex conjugate of y{. We shallneed this form of (4.1.6) in Section 4.11.

If ci, cE, , c,,, are scalars, then the vectory = clxi cex2 + - .. + Cmxt

Page 67: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Linear Equations, Vectors, and Matrices 55

is said to be a linear combination of the vectors x', xs, - , x'". Note thatwe have used superscripts to distinguish different vectors; the notationmust not be confused with the familiar notation used for powers orexponents.

Vectors x1, x2, , x'" are called linearly dependent if there exist scalarconstants c1, c2, , cm, not all zero, such that the equation

C1x1+c2e+...+Cmxm=0

'holds. Otherwise the vectors x', x$, , x" are said to be linearlyindependent. This may also be expressed by saying that the vectorsxi, x2, , x'" are linearly independent if and only if any relation ofthe form

C1x1 + C2x2 + ... + Cmxm = 0

implies that c1 = c2 = = c," = 0.If the vectors xl, x2, - , xm are linearly dependent, at least one of them

will be a linear combination of the others, for at least one of the con-stants, say ck, is different from zero and so

xk=_Clxl_,..._Ck

Ck_1 xk--1 - C.##1 xk+1 - ... r. C. xm.Ck Ck Ch

Next we introduce the concept of a matrix. An array of mn real (orcomplex) numbers written in the form

all a12 * , * aln

A=a21 a22 ... a2,,

(4.1.7)

La,"1 a,,i2 ... amxJ

will be called a matrix. The quantities a,, are called the elements of A.The matrix has m rows and n columns. We refer to ail, a,,, , a,,, asthe ith row of A and to au, am, , amt as the jth column. Matrices willbe denoted by upper case letters such as X, Y, Z or A, B, C. The shorthandnotation

A = (au) (4.1.8)

is often convenient. If m = n, the matrix is square. Here n is called theorder of the matrix.

Two matrices are equal if and only if their elements are equal. The sumof two matrices A and B is denoted by A + B and is defined by

A+B=(a.,+be,). (4.1.9)

Page 68: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

56 Linear Equations and Matrices

Multiplication of a matrix A by a scalar cl is defined by the relation

c1A = Act = (c1a,) (4.1.10)

The determinant associated with a square matrix A is one whose ele-ments are those of the matrix (without disarrangement) and is denoted byIAI or Iai,I. This determinant is a scalar quantity which is a function ofthe elements a,,. It may be defined by forming all possible products con-sisting of one element from each row and each column, affixing an appro-priate sign to each product, and adding. The order of a determinant isthe number of rows and columns of the associated square matrix. Todescribe a more convenient procedure for the evaluation of a determinant,we begin with a determinant of order 2. The definition here is

all a12

a21 an= a11a2s - axsa,1.

The value of a determinant of order 3 may be written in terms of deter-minants of order 2 by expanding the determinant in terms of the elementsof any column (or of any row). For example, we have

all a12 a,$

an as,, an all a,, a. - a1$a81 an + au an an

ass axis a31 aas as1 ana81 an asa

(4.1.11)

where the expansion is in terms of the first row. The determinantal coeffi-cients of ±a,, in the foregoing expansion are called minors and thecoefficients of the au are known as cofactors.

In general, the expansion of a determinant of order n in terms of theelements of any column (or of any row) will involve determinants of ordern - 1, and so determinants of any order can be evaluated inductively.If in the matrix A we delete the ith row and jth column, the determinantwhose elements are the remaining elements of A is called the minor ofau. The cofactor Au of the element a{, is obtained by ' multiplying theminor of a by (-1)'+'. The rule for evaluating the determinant IAIin terms of the elements of the ith row may then be written

I AI = i a;kAik. (4.1.12)b-1

For reference we state some of the elementary properties of determinants :

(a) If two columns (or two rows) of a determinant are interchanged,the value of the determinant is changed in sign.

Page 69: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Matrix Multiplication 57

(b) If two columns (or two rows) of a determinant are identical, thevalue of the determinant is zero.

(c) If every element of a column (or a row) is multiplied by the samenumber, the determinant is multiplied by that number.

(d) If the rows and columns of a determinant are interchanged withoutchanging the order in which they occur, the value of the determinant isunchanged.

(e) If to the elements of any column (or row) are added the correspc.nd-ing elements of any other column (or row), each multiplied by the samearbitrary number, the value of the determinant is unchanged.

(f) The sum of products of each element of a row (or column) by thecofactor of the corresponding element of another row (or column) is zero.Thus we have

n

la.tAsk=O i; ,ik-1

akiAks = 0 i Oj.k-1

If we combine these results with (4.1.12) and the corresponding ;.esult forcolumns, we may write the following relations:

n

aaAix = I AI o11,k-1

n

lak{Aks = IAI 6:s,

(4 1.13)

where 8,1 denotes the Kronecker delta which takes the value 1 wheni=jand0when i,j.

4.2 MATRIX MULTIPLICATION

To introduce the concept of matrix multiplication, we begin by con-sidering a linear transformation of a vector x into a vector y. Such a lineartransformation may be written in the form

n

Jf 1 (4.2.1)1-1

where the coefficients a5 are real (or complex) quantities. If we writethe relation between x and y given by (4.2.1) in the form

y = Ax, (4.2.2)

Page 70: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

58 Linear Equations and Matrices

then (4.2.1) and (4.2.2) define the multiplication of a vector x by a squarematrix A. In other words, the vector by matrix product Ax is a vector ywhose components are given by (4.2.1). For example, the linear transfor-mation given by

yl = 3xi + 2x2

ys = 2x1 - 4x2may be written in the form

Fyi [3 2 xl

ys 2 -4 x2

Next we wish to define the product of a matrix by a matrix. We considera second linear transformation

x = Bz (4.2.3)

which converts the components of z into the components of x. We wishto express the components of y in terms of the components of z, where,as above, y = Ax. We may write (4.2.3) in the form

xi = bikzk, .1 = 1, 2, - , n. (4.2.4)k-1

If we substitute (4.2.4) into (4.2.1) we obtain

y: =7a,,(jbnezk)

=±(aiii.im)zi.jk-1

1-1

If we now introduce a new matrix C = (c$k) defined by

(4.2.5)

c" = aiibik, it k = It 2, ... , n, (4.2.6)i-1

we may write

Since formallyy=Cz.

y = Ax = A(Bz) = (AB)z,

we are led to define the product of B by A as

C = AB, (4.2.7)

where C is determined by (4.2.6). Note carefully the order in which theproduct is written. The product AB is referred to either as B premultipliedby A or as A postmultiplied by B.

Page 71: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Matrix Multiplication 59

To illustrate how the matrix product defined in (4:2.7) is formed weconsider the transformations

Fy1 3

Y 2and

We may express yi and y2 in terms of z1 and zs in the following way:

yi = 3x1 + 2x2 = 3(z1 - 2z8) + 2(2x1 + z8) = [3(1) + 2(2)]x1

+ [3(-2) + 2(1)]z8 = 7z1 - 4z$

Y2 = 2x1 - 4x8 = 2(x1 - 2x2) - 4(2x1 + zz) = [2(1) - 4(2)]x1

+ [2(-2) - 4(1)]z8 = -6z1 - 8x8.

In matrix notation this can be written as

1YY

1 3 2

2 -41 -22 1

zi

zE

7 -4 z1

-6 -8 z

We note that the element in the first row and first column of the productmatrix is the sum of the products of corresponding elements from the firstrow of the left matrix and the first column of the right matrix. The otherelements of the product are found similarly.

It is important to point out that matrix multiplication is not com-mutative. In other words, in general

AB 56 BA.

It is a simple matter to construct examples to exhibit this behavior. Forexample, if

A-1 -1

B =2 -3

2 3 1 -1then

1 -2 -4 - 11AB = 7 -9

BA

-1 -4If AB = BA, we shall say that A and B commute.

Page 72: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

60 Linear Equations and Matrices

It is easily shown directly from the definition that matrix multiplicationis associative. In other words, for all A. B, and C we have

(AB)C = A(BC).

We remark that in determinant theory it is shown that the determinantof it product of two matrices is equal to the product of the determinantsof the multiplied matrices: IABI = JAI JBI.

We give an additional example to illustrate matrix multiplication.

Example 1. Find the product AB of the matrices

A=4 2 -1

3 -7 1

-_2 4 -3-

2 3 2

B = -3 0 -1L 1 5 1

The element in the ith row and jth column of AB is obtained by addingthe products of corresponding elements of the ith row of A and the jthcolumn of B. For example, the element in the second row and thirdcolumn is

(3)(2) + (-7)(-1) + (1)(1) = 14.

Carrying out the calculation of the other elements in a similar fashion,we find that

AB =

1 7 5

28 14 14

-11 -9 -3In this discussion of matrix multiplication we have restricted ourselves

to square matrices. But, the rule for forming the elements of the productmatrix which is given by (4.2.6) is also applicable to rectangular matricesprovided the number of columns of matrix A equals the number of rowsof matrix B. Thus if A is an m x n matrix and B is an n x p matrix,then C will be an m x p matrix, and in (4.2.6) i will vary from 1 to mwhile k ranges from 1 to p.

Example 2. Find the product CD of the matrices

2 3 2 1C = 4 2 -1

D= -3 0 -1 -23 -7 1

1 5 1 3

Page 73: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Transpose, Inverse, and Adjoint Matrices 61

Since C is a 2 x 3 matrix and D is a 3 x 4 matrix, the product can beformed and is a 2 x 4 matrix. Proceeding as in example 1 we easily findthat

CD =1 7 5 -3

28 14 14 20

4.3 TRANSPOSE, INVERSE, AND ADJOINT MATRICES

If we interchange the rows and columns of a matrix A, we obtain thetranspose matrix which we shall denote by AT. The notation A' is alsoused by many authors. Thus if

all a12 ... aln

A=

then

AT =

... a2na21

La,1 amt ' ' ' amn_

am11all all

a12 a22 amt (4.3.1)

Laln a2n am,JThe following rule for a transpose product is of interest:

(AB)7 = BTAT. (4.3.2)

To prove this we note that the element in the ith row and jth column ofthe matrix (AB)' is equal to the element in thejth row and ith column ofthe matrix AB by the 'definition of a transpose matrix. By (4.2.6) thiselement is seen to be

aikbM.k-1

Since this may be rewritten in the form

bkcask,w-1

and since the bkc are the elements of the ith row of BT, and ask are theelements of the jth column of AT, it follows that this expression is theelement in the ith row and jth column of the matrix BT AT .

A matrix A is said to be symmetric if and only if

A - AT.

Page 74: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

62 Linear Equations and Matrices

This condition may also be written as

A square matrix A is said to be a diagonal matrix if all the elementsother than those on the principal diagonal are zero, that is, if a,, = 0 fori # j. If in a diagonal matrix all the elements on the principal diagonalare 1, the matrix is called the unit matrix or identity matrix and denotedby I. Thus

I=

1 0 .. 00 1 ... 0

LO 0 ... 1J

From the definition of multiplication in (4.2.6) we see at once that

AI=IA=A.For example, it is clear that

(4.3.3)

(4.3.4)

3 2 1 0 1 0 3 2 3 2=2 -4 0 1 0 1 2 -4 2 -4

A square matrix A is said to be nonsingular if its determinant is notequal to zero. Otherwise it is, of course, singular.

We now introduce the concept of an inverse matrix. The inverse of thesquare matrix A is denoted by A-1 and is defined by the relation

AA`" = I. (4.3.5)For example, if

and if

then clearly

A=

A'1-r, -111

2 1 a_ 1 0

1 -1 a -1 0 1

It is at once clear that if A-1 exists, then A is nonsingular. For if Awere singular, then IAA = 0. But this is impossible because from AA-1= Iit follows that CAI IA--11 = 1.

We therefore assume that A is nonsingular and show how to constructthe inverse matrix. We first define the adjoint matrix as the transpose of

Page 75: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Transpose, Inverse, and Adjoint matrices 63

the matrix of the cofactors of A. It will be denoted by adj (A). Then

adj (A) =

Ail A21

A12 A22

Ani I

Ana(4.3.6)

LAS. A2,,... A.. I

Example 3. Find the adjoint of the matrix

A=2 0 7

-1 4 5

3 2 1

First we calculate the cofactors of A. For example

-1 5A1$= - =16.

3 1

The adjoint matrix is found to be

-6 14 -28adj (A) = 16 -19 -17

L-14 -4 8

Before defining the inverse of A, we first show that if C = adj (A), then

AC = (A(I. (4.3.7)

The element in the ith row and jth column of AC is by (4.2.6) given byn

a,,Ark = aaAn + a,,Al + ...+ AinAink-1

But from the rules (4.1.13) for expansion of determinants this is known tobe (A( if i = j and 0 if i ,& j. This proves (4.3.7).

The reader may wish to verify equation (4.3.7) for the matrix A ofexample 3. It will be found that

r 2 0 7 -6 14 -28A adj (A) = -1 4 5 16 -19 -17

L 3 2 1 -14 -4 8--110 0 0 1 0 0

0 -110 0= -110 0 1 0

0 0 -110 0 0 1

We note that 1A1 = -110.

Page 76: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

64 Linear Equations and Matrices

In a similar manner we can also prove that

CA = IAI I. (4.3.8)

Now we see at once that the inverse A-i is given by

A-'= C = 1 adj (A) (4.3.9)JAI IAI

for

AA-1=A I C= 1 AC=1.JAI IAI

Moreover we also note thatA-1A = I (4.3.10)

which follows from (4.3.8)

Example 4. Find the inverse of the matrix A of example 3.The adjoint of A was found in example 3. The determinant is JAJ =

2(-6) + 7(- 14) = -110. Hence the inverse matrix is

Sb - b6 1S

A-i = - ria adj (A) = ao 11110 21110

a5 a -ssIt is easily verified that the product of A and A-' is I.

We remark that a matrix A is called an orthogonal matrix if A-' = 4TAn example of an orthogonal matrix is furnished by the matrix whoserows are the direction cosines of three mutually perpendicular Axesreferred to three fixed mutually perpendicular axes. One such matrix is

A= 1 1

0

1

2 2 j2

1 1 1

I- 2_ 2

- ,T2JWe leave it to the reader to show that AAA' = L

4.4 SOLUTION OF LINEAR EQUATIONS

We began this chapter by introducing a system of n linear equations inn unknowns. With the notation and rules for operating on matrices which

Page 77: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Solution of Linear Equations 65

have been developed, the system of equations (4.1.1) may be written in themore convenient form

Ax b (4.4.1)

where A is a square matrix of order n and x and b are column vectors.If we assume that A is nonsingular and if we premultiply this equation bythe inverse matrix A-', we obtain

or, on using (4.3.10),A-'Ax = ,

x = A-1b, (4.4.2)

which gives formally the solution of the equations. If we make use of(4.3.9), we have

x = adj (A)b.JAI

(4.4.3)

On taking account of the definition of adj (A) given in (4.3.6), we can write

1x; = _.._ Ak bk,IAIk-

i=1,2, ,n.

We note that the sum appearing in this formula is just the expansion of thedeterminant of the matrix obtained by replacing the ith column of A by thecolumn vector b. If we denote this determinant by Di and IAA by D, wehave

i= (4.4.4)

which is the familiar Cramer's rule.For example if n = 3, the equations represented by (4.4.1) may be

written out at length in the form

auxl+a,x5+aaxs=blanxl + a2xt + aaxs = bs

a3x1 + a+ a=b8.In this case

D=all

a31

a3,

an an

a. a.,

an an

Page 78: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

66

and

bi a12 ais

b2 a22 a2s

bs a32 ass

xs =

Linear Equations and Matrices

1x2 =

D

all bi ais

a21 b2 a2,

a31 b3 ass

7

all ais bi

a21 a22 b2

a31 as2 bs

Thus in (4.4.4) we have a set of formulas which might be used to findthe solution of the system of equations (4.1.1), and in (4.3.9) and (4.3.6)we have a specific method for the calculation of the inverse matrix. In bothcases the evaluation of a number of determinants is required. Unfor-tunately, unless n is quite small, the evaluation of determinants is a verytedious and inefficient procedure, and so the methods just mentioned forsolution of equations and inversion of matrices are very undesirable. Inthe following four sections we proceed to describe alternative methodswhich are to be preferred for such calculations. The methods to be de-scribed are suitable both for desk calculators and for high speed electroniccomputing machines.

Before proceeding to these alternative methods, we mention briefly thesituation if A is singular. We first introduce the notion of rank. WhenA is nonsingular, the value of its associated determinant is, by definition,not zero. In this case, if the determinant is of order n, it is said to be ofrank n. In the contrary case in which A is singular, the associated de-terminant has the value zero and the order of the nonvanishing minor ofhighest order is said to be the rank of the determinant. To define the rankof an m x n matrix we note that we can set up determinants by striking out(if necessary) certain rows and columns from the matrix. The determinantof highest order that can be so formr d has an order equal to the lesser ofthe two numbers m and n if m and n are unequal, or equal to their com-mon value if m and n are equal. The highest rank of the determinants ofhighest order is said to be the rank of the matrix.

In addition to the matrix A associated with the system (4.1.1) we shallbe interested in the augmented matrix obtained by adjoining the columnvector b at the right of the matrix A, thus forming a matrix of n rows andn + I columns.

The nonsingularity of the matrix A is equivalent to the statement thatthe rank of A is n and in this case we saw that the system (4.1.1) possessesa unique solution given by (4.4.4).

Page 79: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Gaussian Elimination 67

If A is singular, there are two possibilities:

(a) If the rank of the augmented matrix is greater than the rank ofA, the system (4.1.1) has no solutions.

(b) If the ranks of the augmented matrix and of the matrix A are bothequal to n - r, there are an infinite number of solutions expressible interms of r arbitrary parameters.

In the following sections we shall be concerned with the case in whichA is nonsingular.

4.5 GAUSSIAN ELIMINATION

A simple and convenient method for obtaining the solution of thesystem (4.1.1) is Gauss's method of systematic elimination. We first dividethe first equation by all. The resulting equation is multiplied by an andsubtracted from the second equation of (4.1.1), thus eliminating x1 fromthis equation. In a similar manner x1 is eliminated from all succeedingequations. The system (4.1.1) then takes the form

x1 + a12'xa + ays x3 + ... +

a x2 + anx3 + ... + b2'(4.5.1)

Next we divide the modified second equation which appears in (4.5.1)by as and use the result to eliminate x$ from the succeeding equations.By repeating this procedure, we successively eliminate x3, x4, , xr-1If the determinant of the coefficients is not equal to zero, we obtain asystem of equations equivalent to the original system except for theeffects of any round-offs committed and which is of the form

x1+a14a;+a13n;+... bl"x2+a23nx3+...+a2,"x,=btn

. . . . . . . . . . . . . (4.5.2)'I n

x,,_1 + an-l.,,x, = ++-1,.x -

The solution is completed by working backward from the last equation toobtain successively x,,, xs, x1.

Page 80: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

68 Linear Equations and Matrices

It is instructive to describe this elimination procedure in the languageof matrix operations. We have already noted that the system (4.1.1) canbe written in the more convenient form

Ax = b. (4.5.3)

The operation of eliminating the unknown x1 from the equations isequivalent to multiplying the matrix equation (4.5.3) on the left by thematrix L1 where

1

all

0 0

0 ... 0 0

as1 0 ... 0 1

Oil

(4.5.4)

Such a matrix, in which every element above the principal diagonal is zero,is called a lower triangular matrix. We note also that L1 has all its off-diagonal nonzero elements in the first column. It is easily seen that ifboth sides of (4.5.3) are premultiplied by L1, the result is the same as(4.5.1).

Similarly we see that the elimination of x2 from the remaining equationsis equivalent to multiplication by another lower triangular matrix L,,all of whose off-diagonal nonzero elements are in the second column andwhich indeed differs from the identity matrix only in the second column.The successive elimination of xx, , x,, is equivalent to successivemultiplication by lower triangular matrices Ls, , L,1. Making thecoefficient of x equal to one is also equivalent to multiplication by alower triangular matrix L,,. The resulting system (4.5.2) clearly involvesan upper triangular matrix, that is, a matrix in which all elements belowthe principal diagonal are zero. It may be written in the form

Ux = b", (4.5.5)

where U is an upper triangular matrix.It is readily verified that the product of lower triangular matrices is again

a lower triangular matrix, so that the reduction of (4.5.3) to the form(4.5.5) is actually accomplished by multiplication by a single lowertriangular matrix L where,

L = LSL1.

Thus U = LA and V = Lb.

Page 81: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Gaussian Elimination 69

We have already noted that the equation (4.5.5), or equivalently thesystem (4.5.2) can be solved by a step-by-step procedure obtaining suc-cessively x,,, - - , x8, x1.

It should also be noted that the elimination procedure is a convenientone for the inversion of a matrix. If A-' is the inverse of a matrix A, then

AA-' = I. (4.5.6)

If I; denotes the vector consisting of the ith column of I and if A; ' issimilarly related to A`', then it follows from (4.5.6) that

AAi°'=I;, i= 1,2,---,n.Thus to find each column of A-', we have only to solve a system of equa-tions of the same form as (4.5.3). If L denotes the lower triangular matrixsuch that LA = U is upper triangular, we obtain from (4.5.6) that

UA"' = LI = L. (4.5.7)

This the elements of A-' are obtained by a simple step-by-step procedure,ipvolving "back substitution" just as in the solution of (4.5.2). It is alsoworth noting that the inversion of an upper triangular matrix is par-ticularly simple, ipvolving, as it does, merely this simple step-by-stepprocedure without the necessity of introducing L (which is, of course,I here).

In the preceding discussion it has been assumed that the equations areoperated on in the order in which they are given, without rearrangingthem. It may happen that at some stage of the procedure the diagonalelement which is used as a "pivot" to eliminate a variable from thesubsequent equations is zero. Consequently, it is impossible to use it as adivisor in the elimination process. This difficulty may be overcome byrearranging the equations so as to place a nonzero element in this position.More frequently it may happen that at some stage of the calculation apivot element is small but not exactly zero. If a small element is used asa divisor, it, of course, yields large quotients and may very well introducelarge errors into the calculated results. It is desirable to rearrange theequations in such a manner as to avoid division by small diagonal elements.One way in which this may be done is by searching for the largest elementin the column involved at each stage and using this largest element as"pivot" for the elimination of the corresponding unknown. In solvinglarge systems of equations, the large number of arithmetic operationsinvolved may introduce considerable round-off error into the solutions.Indeed these round-off errors may grow to the point that the solutionsbecome meaningless; searching for the largest pivots as described pre-viously is an effective way to minimize such errors. Unfortunately many

Page 82: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

70 Linear Equations and Matrices

matrix inversion codes employed on electronic computers use straight-forward elimination without searching for the largest pivots because it issimpler to write a code in this way; the results obtained when such codesare used to solve large systems are often unsatisfactory. It is stronglyrecommended that this procedure of searching for largest pivots beincorporated in matrix inversion codes which make use of eliminationmethods.

Example 5. Find the solution of the following system of equations by themethod of elimination:

3x1 + 2x2 + 7x3 = 4

2x1 + 3x2 + x3 = 5

3;+4x2+xa=7.We shall use the method without rearranging the equations. The first

equation is divided by 3 and used to eliminate x1 from the succeedingequations. On rounding all entries to four decimals, we obtain

xi + 0.6667x2 + 2.3333x$ = 1.3333

1.6666x$ - 3.6666x3 = 2.3334

1.9999x2 - 5.9999x3 = 3.0001.

Next we divide the second equation by 1.6666 and use it to eliminate xafrom the third equation. If we also divide the resulting third equation bythe coefficient of ;, we obtain,

x1 + 0.6667x$ + 2.3333; = 1.3333

xa - 2.2000x3 = 1.4001

x8 = -0.1250.

By working backward in this system we find that xa = -0.1250, x2 _1.1251, and x1 = 0.8749.

Since the coefficients in these equations were such simple numbers, allcalculations could have been carried out exactly, using rational numbers,and we would have found xa x2 and x1 = j. But in mostpractical problems, the coefficients will be given to a certain number ofdecimal places and the calculations will be carried out with roundednumbers. We preferred to illustrate this situation in our calculations.

Page 83: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Gauss-Jordan Elimination 71

It is instructive to observe that the elimination of x1 could have beenaccomplished by multiplying the matrix equation on the left by thematrix L1 where

1 0 0

-0.6667 1 0

-1 0 1

as in equation (4.5.4). In a similar way the elimination of xg could beeffected by multiplication by the matrix

r1 0

Ls =

07

0 1 01.6666

0 -1.2 1

Finally, making the coefficient of x8 equal to unity could be done bymultiplication by the matrix

Le =

1 0 0

0 1 0

0 011

.6

Thus we see that the reduction to upper triangular form is equivalent tomultiplication of the original matrix equation on the left by the matrix

10 0

3

L = L$LZL1 = -0.4 1 01.6666

0.125 0.75 - 11.6

4.6 GAUSS-JORDAN ELIMINATION

The elimination method described in the preceding section may bemodified in a convenient fashion. At the kth stage, we use the kth equa-tion to eliminate x,t from the preceding equations as well as from thefollowing equations. This reduces the matrix A to a diagonal matrix (one

Page 84: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

72 Linear Equations and Matrkes

having nonzero elements on the principal diagonal only) which is indeedthe identity matrix I. Thus the solution of the equations is obtainedwithout the necessity of a back substitution.

In the language of matrix operations, this procedure is equivalent tomultiplying the system Ax = b sequentially by matrices, each of whichdiffers from the identity only in a single column.

The first stage of the Gauss and Gauss-Jordan eliminations are identicalboth consisting in multiplying A by Ll given by (4.5.4) and yielding (4.5.1).At the second stage, however, the Gauss-Jordan method requires multi-plication by the matrix

J2 =

0 . 01

0 0 04222'

0 - aa2 I ... 0(4.6.1)

a22

whereas the matrix L2 required in the Gaussian elimination is the same as(4.6.1) with the element in the first row, second column, replaced by 0.We note that J2 differs from the identity matrix only in the second column.The successive elimination of x3, x42, - - , x is equivalent to successivemultiplication by matrices J3, J4, - - , J,,, which. are such that Jk differsfrom the identity matrix only in the kth column. It will be convenient todefine Jl to be identical with L1. Thus the system (4.5.3) is reduced to theform

x = J.J._l ... J2Jlb.From this it follows that

J2J1A = Iso that

A--1=J.Jn-1...JrJj-

Thus the inverse matrix is generated by applying the successive trans-formations represented by J1, J2, , J to the identity matrix. This is avery effective method for calculating the inverse of a matrix. It lendsitself very well to programming on a high-speed electronic computer, sincethe procedure is a very iterative one because the operations performed areof the same form at each stage of the operation.

Page 85: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Crout Method of Elimination 73

4.7 THE CROUT METHOD OF ELIMINATION

A convenient method for carrying out the Gaussian elimination de-scribed in section 4.5 was devised by Crout [3]. In this method the re-cording of the intermediate equations or arrays is avoided, and only thefinal values of the coefficients which appear in (4.5.2) together with suchauxiliary data as are necessary for their calculation are written down.These auxiliary data are placed in the positions which would be occupiedby zeros or ones in the array (4.5.2). The values of the xi are obtained bycarrying out the back solution as in the Gaussian elimination method.

We first write down the augmented matrix of the system of equationsAx = b. For convenience in writing the formulas needed in the Croutmethod we shall denote the elements of the column vector b by a,,,,+1.The augmented matrix of the system then takes the form

Fall a12 a13

M=a21

a1, a1.n+1

a2n2,rr+-1

asl

a22 a2,

an ass ' ' ' a3,, as,,,+1

Lan, ant an3 ' ' ' ann an,n-f1r

(4.7.1)

The next step in the Crout procedure then consists of writing down amodified matrix of the same dimensions,

M'=

al a,,' aln' at,

aEl 4221 a28 a2n a2.n+1

asl' an' 4233' asn' a,',,+,

and ant ai,4 ann a'.,+

(4.7.2)

by following the procedure which is described below. From this matrixis obtained a solution column vector x whose elements are the requiredvalues of x1, x$, , x,,, that is

x= (4.7.3)

LxnJ

Page 86: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

74 Linear Equations and Matrices

Each entry in (4.7.2) and (4.7.3) is obtained from previously calculateddata by a continuous sequence of operations which can be carried outwithout the tabulation of intermediate data.

We now describe in detail how the elements of (4.7.2) are to be obtained.

1. The elements of the first column of M' are identical with the cor-responding elements of M.

2. The elements of the first row of M' (excepting all') are each obtainedby dividing the corresponding element of M by all. Thus

aii = ail,a1,' = als/aii,

i=1.

3. Next the remaining elements of the second column are each cal-culated by subtracting from the corresponding element of M the productof the element in the first column of the corresponding sow of M' and theelement at the head of the second column of M'. Thus

ail = aia - ail'a12 , i=2,3,- ,n.4. Next the elements in the second row to the right of the principal

diagonal are each calculated by subtracting from the corresponding ele-ment of M the product of the element in the first column of the second rowof M' and the element at the head of the corresponding column of M',followed by a division by the diagonal element in the second row of M'.Thus

au=(a2,-azi'au)last, j=3,4,...,n+ 1.

5. The remaining elements in the third column are calculated by theformula

ail - ai3 - aii ass' - ai$ aS2 ,

The procedure is similar to that in 3, except that there are two productterms to be subtracted. Note that the elements entering into the productsare taken from the row and column in which the element being calculatedlies.

6. The elements in the third row to the right of the principal diagonalare calculated by a procedure similar to 5, followed by a division by thediagonal element in the third row of M'. Thus

aai' = (ass - asi'au - a39'a2a')/ass, j=4,5,---,n+ 1.7. The procedure just described is continued calculating alternately

the remaining elements of the successive columns and rows until the arrayis filled.

Page 87: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Croat Method of Elimination 75

8. The rule for obtaining each element of M' may be described asfollows :

(a) Each element on or below the principal diagonal of M' is ob-tained by subtracting from the corresponding element of M the productsof elements of M' in the row to the left and in the column above the desiredelement, taking the products in order, that is, first in row by first incolumn, second in row by second in column, etc.

(b) Each element to the right of the principal diagonal of M' iscalculated by the procedure described in a, followed by a division by thediagonal element in its row of M.

When all the elements of M' have been obtained, the elements of thesolution column x are determined in the order x,,, x,, , , x8, xi, fromfoot to head. The element x,, is identical with xn l is obtained bysubtracting from an_1,,, .1, the product of x,, and Each succeedingelement x; is obtained by subtracting from the corresponding elementa,.n+i the products of the previously found xi and the correspondingelements of the ith row of M'. (Only elements to the right of the principaldiagonal will enter into this calculation.)

The preceding instructions are completely described by the equations

i--latl' = aj5 - Lr a;k'ak,' i Z j (4.7.4)

k-1

1i-l

a; f' = _ [aij -' a;kakr'j i < j (4.7.5)a;, k-l

x; = a{.R+i - a:k'xk. (4.7.6)k-i+l

In these equations, i ranges from 1 to n and j ranges from 1 to n + 1.In many practical problems leading to systems of linear equations, it

turns out that the matrix A of the system is symmetric. By consideringthe steps in the calculation of M', it is easily seen that pairs of elements inM' which are symmetrically situated with respect to the principal diagonalare identical except for division by the diagonal element. Thus consider-able labor may be saved, because each element below the diagonalcan be recorded as the dividend involved in the calculation of the sym-metrically placed element before the required division by the diagonalelement is performed.

It is easily seen that the elements to the right of the principal diagonalin M' are just the elements which appear in corresponding positions of theaugmented matrix of (4.5.2) obtained by Gaussian elimination. Theother elements of M' are necessary intermediate data tabulated in spaceswhich would normally be occupied by ones and zeros.

Page 88: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

76 Linear Equations and Matrices

We see that ask' is the number by which the kth equation would bedivided in Gaussian elimination before that equation is used to eliminatexk from the succeeding equations. Moreover, all of the other operationsin the calculation of M' leave the value of the determinant of A unchanged.Consequently the value of the determinant of the original coefficientmatrix A is the product of the diagonal elements of Mi', namely,a12 a22' - - - a--'. Thus the Crout method furnishes a convenient methodfor the evaluation of any numerical determinant.

The final solution can be checked by substitution back into the originalequations. It is often desirable, however, to carry on a continuous checkof the calculations as they are performed. This can be done by adjoiningto the right of M a check column, each of whose elements is the sum of theelements in the corresponding row of W. The check column in M' isobtained from the check column in M in exactly the same manner as isany column to the right of the diagonal and is calculated along with eachrow of M. The check consists in the fact that each element in the checkcoluriln of M' should exceed by unity the sum of the elements in its rowof M' lying to the right of the diagonal element. If we also calculate a setof x's corresponding to the new right-hand column, each of these newx's will exceed by unity the corresponding original x values.

Example 6. Find the solution of the system of equations of example 3using the Crout method. Carry a check column.

The original augmented matrix with check column is

3 2 7 4

2 3 1 5

3 4 1 7

The modified matrix is found to be

3 0.6667 2.3333 1.3333 5.33332 1.6666 -2.2000 1.4001 0.20003 1.9999 -1.6001 - 0.1250 0.8749

if we use equations (4.7.4) and (4.7.5) or the preceding rules 1 to 8. Thusthe first column of the original matrix is copied without change. Theelements of the first row (except 3) are divided by 3, the diagonal element.Next, the remaining elements of the second column are calculated. Theyare 3 - 2(0.6667) = 1.6666 and 4 -- 3(0.6667) = 1.9999. Then theelements in the second row to the right of the principal diagonal arecomputed. For example, the fourth element in the second row is [5 --2(1.3333)1(1.6666 = 1.4001. The other two are, found similarly, Next,the remaining element of the third column is seen to be 1 - 3(2.3333)- 1.9999(-2.2000) = -1.6001. Finally, the elements in the third row

Page 89: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Grout Method of Elimination 77

to the right of the principal diagonal are cal:;uiated. For example, thefifth element in the third row is [15-3(5.3333')-1.9999(0:2000)]/(-1.6000)= 0.8749. The other one is found similarly. TO get the solutions of thesystem we first observe that x3 = ---0,1250 which appears as the fourthelement of the third row. Using the other entries in the fourth column wefind that x2 = 1.4001 - (-2.2000)x3 .= 1.1251 and zi = 1.3333 - 2.3333x3

0.6667x_, = 0.8749. The corresponding values of the check solutionsare found in the same way from the fifth column to be 0.8 749, 2.1248,and 1.8753. As expected, they are seen to be approximately one greaterthan the corresponding solutions of the system.

The computational error check indicates errors in the fourth decimalplace which are undoubtedly due to round-off errors. We could securegreater accuracy by carrying more decimals in the calculations or moreconveniently by an iterative procedure which will now be described.

If we denote the approximate solutions of the system (4.4.1) by. i, ,

z,, substitution of these values into the left members of (4.1.1) Yieldsright-hand members bi, b2, . , bn which should be close to bl, b2, , 6n.Then aiixi + a12x2 t ... + anlxn = bi

. . . . . . . . . . . . (4.7.7)

anixi + an2x2 + .. annxn = bn.

Now the true solutions satisfy (4.1.1). If we let

axk = xk - xk, abk = bk - bk (4.7.8)

we obtain by subtraction

all 8xi + a128x2 +.....i- and axn = obi................... (4.7.9)

ant axl +a.2 ax2 + ... + an,, 8xn = 6bn.

Thus we see that the corrections Ax,,, - - , bx,, satisfy a set of equationswhich differ from (4.1.1) only in that each bk is replaced by the residual 6bk.The Crout method is particularly convenient in this situation since wehave only to calculate a new right-hand column leaving all other columnsunchanged.

There is no certainty that this iteration procedure will converge, but inmany cases it does so and provides an efficient method for improving theaccuracy of a solution by successive iteration, carrying along more andmore significant figures only in the calculation of the residuals.

In example 4 the residuals corresponding to the approximate solutionsobtained are found to be

8bi +0.0001, bbl- -0.0001, Oh3 = --0.0001.

Page 90: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

78 Linear Equations and Matrices

The approximate corrections are found to be

8x3 = 0, 8x2 = --0.0001, 8x1 = +0.0001,

yielding the improved values

xa = -0.1250, x$ = 1.1250, x1 = 0.8750.

These happen to be exactly correct.The Crout method also provides a convenient method for the calculation

of the inverse matrix. As noted in section 4.5, each column of the inverseis obtained by solving a system of equations in which the right-handmembers are a column of the identity matrix. Thus in place of a singlecolumn containing the elements af,,,+1, in (4.7.1) we insert the square array

1 0 ... 0

0 1 ... 0

0 0 ... 1

(4.7.10)

and treat each column of this array as we treated the rightmost column inthe Crout procedure. If xl(i), x2(1), - - - , xn(1) denote the solutions cor-responding to the jth column of (4.7.10), the inverse matrix A-' is

zl(1) z,(2) . . . T,(n)

x2(1) x2(2) 2(n)

xn(1) xn(2) ... xn(n).

A check column can be included if desired, and the rules given for itsuse apply as stated.

The determination of the inverse matrix is particularly desirable whenthe system (4.1.1) or (4.4.1) is to be solved for many distinct sets of right-hand members for, since x = A-ib by (4.4.2), each solution x is ob-tained by a matrix multiplication of the column vector consisting of theright-hand members of the system by the inverse matrix.

Example 7. Find the inverse of the matrix

3 2 7

A= 2 3 1

L3 4 1

using the Crout method.

Page 91: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Gauss-Seidel Iteration 79

The original array takes the form

3 2 7 1 0 02 3 1 0 1 0

3 4 1 0 0 1.

The modified array is found to be

3 0.6667 2.3333 0.3333 0 02 1.6666 -2.2000 -0.4000 -0.6000 03 1.9999 -1.6001 0.1250 0.7499 -0.6250

and the inverse matrix is

0.1250 -3.2497 2.3750-0.1250 2.2498 -1.3750

0.1250 0.7499 -0.6250.

4.8 GAUSS-SEIDEL ITERATION

Many practical problems lead to systems of linear equations which canbe ordered in such a way that the coefficient of xk in the kth equation islarge in magnitude compared with all other coefficients in that equation.In other words, the elements not on the principal diagonal of the matrixare smaller than the elements on this diagonal. Indeed, in many problems,such as the solution of elliptic partial differential equations by differencemethods, the linear equations which arise have the property that many ofthe off-diagonal elements are zero and the nonzero elements are locatednear the principal diagonal. To solve such systems of equations, it isconvenient to rewrite them in the form

xl =I (b1 - a18x2 - a13x3 - ... - alnxn)all

x2 - 1 (b2 - aS1x1 _. a23x3 - ... - a2nxn)a22

(4.8.1)

xn = 1 (bn - anlxl - an2x2 - ... -

an initial approximation of zero for each of the zi. Ifthe unknowns in the right-hand members of (4.8.1) are replaced by zero,we obtain the approximation

(1) - b1 (1) - b2 (1) - bitxl ,x2 - _,...,xn -all a22 aan

Page 92: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Linear Equations and Matrices

wlcre the superscript (1) denotes that this is the first (nontrivial) approxi-n;i on. These values are again substituted into the right-hand memberst i'4,8. 1) obtaining second approximations x12?, z = 1, 2, . , n. This

Substitution procedure is repeated until the approximations in successivecycles agree to the desired accuracy. The iteration may or may notconverge.

If the iterative procedure does converge, it may frequently be acceleratedb' 3 ;placing each unknown in each right-hand member by its most recentlycalculated approximation rather than by the approximation afforded bythe preceding cycle. Here the rate of convergence depends on the orderin v;hich the x's are modified. If the equations are taken in the naturalorder as given in (4.8.1), this procedure is often called Gauss-Seideliteration.

4.9 CHARACTERISTIC NUMBERS AND VECTORS OF A MATRIX

In many branches of applied mathematics, problems arise in which wegeed to find numbers 2 and nonzero vectors x associated with a matrix Asuch that

Ax = Ax. (4.9.1)

Examples which may be mentioned are problems in the dynamical theoryof oscillations, problems of conditioned maxima and minima, problemsof correlation between statistical variables, determination of principalaxes of quadrics, and the solution of differential and other operationalequations.

Equation (4.9.1) may be rewritten in the form

(A -- AJ)x = 0. (4.9.2)

For example, if .4 is of order 3, equation (4.9.2) may be written out atlength in the forum

(aa: ° A)x1 + a1zx2 + alax3 = 0

a22x1 + (122 -- 2)x2 + a23x3 = 0

a81x1 + a38x2 ± (a33 -- 1)x3 = 0.

It is clear that x = 0 is always a solution of (4.9.2). But we are interestedin finding nonzero vectors x which satisfy (4.9.1) or (4.9.2). According toSection 4.4 such nonrero solutions will exist only if

JA-AJl=0. (4.9.3)

The left member of this equation is clearly a polynomial in A, and it iscalled the characteristic polynomial (or characteristic function) of the

Page 93: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Characteristic Numbers and Vectors di

matrix A. Equation (4.9.3) is called the characteristic, or secular, equationof the mattix A. The roots of the characteristic equation are called thecharacteristic numbers (or proper numbers, proper values, latent roots,eigenvalues) of the matrix A. The spectrum of the matrix is the set of itscharacteristic numbers. Corresponding to each characteristic number Athere is at least one nonzero vector x which satisfies (4.9.2). Any suchvector is called a characteristic vector (proper vector, latent vector,eigenvector) associated with the characteristic number A. Note that evenif the elenients of A arc real, A and x may be complex.

Example 8. Find the characteristic numbers and the characteristic vectorsof the matrix

A= 5

L 2

The characteristic equation of A is

2 3 -- 2i

by equation (4.9,3). It is easily seen to reduce to

A?+A-2=0whose roots are clearly I and --2. Thus the characteristic values of Aare I and --2. To find the characteristic vector corresponding to I we haveto find a nonzero solution of the equation

Ax=xor

-4-A +-50

-4x1 - Sx2 = xl2x1+3x2-= x2.

Both of these equations yield x1 .- X2. Hence C-1] is a characteristic

vector of A corresponding to the characteristic value 1. In the same way

we find that1-52] is a characteristic vector corresponding to the charac-

teristic value -2.

It is clear that if x is a characteristic vector associated with A, then forall c 0 0, cx is also a characteristic vector associated with the samecharacteristic number A. Moreover, if several characteristic vectors of amatrix correspond to some one characteristic number, any linear com-bination of them will also be a characteristic vector associated with thesame characteristic number. It can be shown that the number of linearly

Page 94: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

82 Linear Equations and Matrices

independent characteristic vectors associated with the same characteristicnumber does not exceed the multiplicity of the number (as a zero of thecharacteristic polynomial). We might suppose that to a k-fold zero of thecharacteristic polynomial there correspond k linearly independent charac-teristic vectors. But this need not be true. Indeed the number of linearlyindependent vectors may be less than the multiplicity of the characteristicnumber.

This is exhibited by considering the matrix

13 0A =

1 3

Then IA - All = (A - 3)2, so that A = 3 in a double zero of the charac-teristic polynomial. The system of equations for determining the charac-teristic vector is

3x1 = 3x1

xl + 3x2 = 3x2.

Thus xl = 0 and so all the characteristic vectors of the matrix are (0, x2) _x2(0, 1). So here only one linearly independent vector is associatedwith a double root.

The direct calculation of the characteristic function involves a largeamount of labor, especially in the case of matrices of high order. If wewrite

9KA) = IA -- AIj = (- l)"[A" - P, An-1 - P2A"-2 p"1, (4.9.4)

thenPi = au + a22 + ... + a.., (4.9.5)

P. = (-1)"-1 JAS. (4.9.6)

To express the remaining px we need to introduce the notion of principalminor of a determinant. A principal minor of a determinant is a minorwhose principal diagonal elements are on the principal diagonal of thedeterminant. With this definition the coefficient pt is the sum of all theprincipal minors of order k of the determinant of the matrix A multipliedby (-The number of such minors equals the number of combina-tions of n things taken k at a time. From well-known results in the theoryof equations we have

Al+A2+...+A"= P'=all+ass+...+a"", (4.9.7)

a14 ... A. _ (- I)"Vlp" = JAI. (4.9.8)

The quantity pl = all + an + + a"" is called the trace of the matrixA and is denoted by tr(A).

Page 95: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Cayley-Hamilton Theorem 83

Example 9. Find the characteristic function of the matrix

2 1 3

-1 -2 4

3 1 6

The characteristic function is

T(2) _ -(2s - Pl2a - Pt2 - Ps)where pi = 2 - 2 + 6 = 6 by equation (4.9.5) and ps = JAI = 1 byequation (4.9.6). To find ps we need the principal minors of order 2.We obtain at once

2 1

-1 -2

2 3

3 6

-2 4

1 6

-(-3 + 3 - 16) = 16

Thus the characteristic function of A is

97(2) = ---(2s - 622 - 162 - 1).

4.10 THE CAYLEY-HAMILTON THEOREM

1

Section 4.2 defines the product of two matrices A and B. If A is asquare matrix, the product AA can be computed, and we denote it by AA.In a similar manner we define the positive integral power of a matrix Aby writing

(4.10.1)

n factors

Since matrix multiplication obeys the associative law, how the parenthesesin this product are placed makes no difference and so we omit them. Fromthe definition it is clear that

AWAn = Am+nn

(.4"')" = Amn

Thus powers of the same matrix are commutative.We also define A° to be I.An expression of the form

c°A" + c1An-' + ... + cj,

(4.10.2)

Page 96: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

84 Linear Equations and Matrices

where co, cl, , c,,, are real (or complex) numbers, is called a matrixpolynomial. This matrix polynomial may be regarded as the result ofreplacing the variable A in an algebraic polynomial

COA" + cl1"-1 + ... + Cnby the matrix A.

Since the powers of a matrix are commutative, the rules for operatingwith matrix polynomials are the same as those for operating with algebraicpolynomials, at least insofar as addition and multiplication are concerned.

We now show that the following remarkable relation, known as theCayley-Hamilton theorem, holds for any square matrix.

THEOREM (Cayley-Hamilton). If p(A) is the characteristic polynomial[equation (4.9.4)] of the square matrix A, then p(A) = 0. In other words,a square matrix satisfies its own characteristic equation.

To prove this result we consider the matrix B which is the adjoint of thematrix A - Al. It is clear that each cofactor in the determinant IA - Albis a polynomial in A of degree not exceeding n - 1. Hence the adjointmatrix may be represented as an algebraic polynomial with matrix co-efficients, that is, in the form

B = B.-.1 + B.-2A +.... + BOA"-1,

where Ba are matrices independent of A. On making use of(4.3.8), we have

(B.-1 + Bn_2A + ... + BnA"-1)(A - Al) = iA - AI I

= (- l)ne[A" - PAn-1 - P2An-2 Pn] I

with the notation of (4.9.4). This equation is equivalent to the system ofequations

B"-1A = 1)"+lpnl

Bn-2A - Bn_1 = (-1)"+lpn_1I

Bo A - B1 = (- 1)n+1p11

-Bo = (-1)nI.

If we multiply these equations on the right by I, A, A2, , A'-1, A",respectively, and add, we obtain on the left side a matrix all of whoseelements are zero and on the right

(-1)"[-P"I - p::_1A - pn_2A2 - .. -P1An-1 + A"] = ip(A).

Thus gv(A) = 0, as was to be proved.

Page 97: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Cayley-Hamilton Theorem 85

The Cayley-Hamilton theorem may be used to express --,y power ofa square matrix A of order n in terms of 1, A, A2, nips, t ::,rr3

q'(A) = (-- l)"[A" _ p1A"-1

we obtain

ThereAn = p,,4 n-1 + p2A"-2 + , .. + p" ,A + p,1.

A'+1 = A"A = pIA" + p2An---1 + ... + P"-1A2 + p,,A= pifp1A"--1 + p2A"--2 + ... + p,-,A + p,11

+ p2A"-x + ... + p"-i A2 + bnA

= (pie + p2)An-1 + (Plpz + P3)An + .. .

+ (pipx--1 + P")A + Pip"z

Proceeding in this way, we may express each of A"+2, 4 3, . . . in termsof1,A, A2,...,A".

For the matrix A of example 9, we saw that

T(A) = --(Is -- 6A2 - 16A - 1).

Hence we have at once

ThenA'=6A2+16A+I.

A4 = 6A$ + 16A2 + A = 52A2 + 97A + 61,

As = 52A3 + 97A2 + 6A = 409A2 + 838A + 521,

and so on.The Cayley-Hamilton theorem shows that for a given square matrix A

there exists a polynomial (for example, the characteristic polynomial) forwhich the matrix A is a zero. But the characteristic polynomial is not theonly such polynomial having this property; for if V(A) has such a property,so has any polynomial divisible by y'(A). The polynomial of lowest degreehaving the property that the matrix A is a zero of it is called the minimumpolynomial of the matrix A.

We now show that the characteristic polynomial is divisible by theminimum polynomial.

If we divide the characteristic polynomial 9 Q) by the minimum poly-nomial V(A), we obtain a quotient q(A) and a remainder r(A); the degreeof r(A) must be less than the degree of p(A), We have the relation

T(A) = VQ)g(A) + r( W.

If we substitute A for A in this equation, we obtain

r(A) = q ,(A) - w(A)q(A) = 0.

Page 98: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

86 Linear Equations and Matrices

Thus the matrix A is a zero of the polynomial r(2), contradicting the factthat V(2) is the minimum polynomial.. It follows that r(2) - 0, andconsequently V(A) divides 97(A).

It can also be shown that every characteristic number is a zero of theminimum polynomial. (See, e.g., Householder [14].)

4.11 PROPERTIES OF THE CHARACTERISTIC NUMBERSAND VECTORS OF A MATRIX

We first note that a matrix A and its transpose AT have identicalcharacteristic polynomials and hence identical spectra. This follows fromthe fact that

JAT-2IJ=JA-2I)since a determinant is not altered when its rows and columns are inter-changed.

Before obtaining further properties of the characteristic numbers andvectors, we need a property of the inner product. We now assume thatthe elements of a matrix A and the components of a vector x may be com-plex. We must remember that in the definition of the inner product givenby equation (4.1.6), y, must be replaced by y,, the complex conjugate ofy,. 'Thus

(x, Y) = xryt

If A is a square matrix, we denote by A the matrix whose elements are thecomplex conjugates of the corresponding elements of A, and by A* thetranspose of A We have

A*_AT. (4.11.1)

We shall prove that for any vectors x and y

(Ax, y) = (x, A *y). (4.11.2)

It follows at once from the modified form of (4.1.6) and from (4.2.1) thatn n

(Ax, y) _ a,,x, yt

If we interchange the order of summation we find that

n n n n

(Ax, y) = I xi la+iyi = I xi kitty,t-1 =-x s-i -i

= (x, A*y)

since the element at, * of A* is equal to d,l.

Page 99: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Properties of Characteristic Numbers and Vectors 87

We now consider a real square matrix. Since the characteristic poly-nomial will have real coefficients, the characteristic numbers that are notreal will occur in complex conjugate pairs. If A, and A. denote distinctcharacteristic numbers of the matrix A, then 1 the complex conjugate ofA is also a characteristic number of A and hence also of AT. Let x' be thecharacteristic vector of A associated with A, and y' the characteristicvector of AT associated with X,. We shall show that x' and y' are orthog-onal.

We first note that(Ax', y') _ (Ax', y') = 2,(x', y`).

On the other hand, since the matrix A is real, we have A* = AT and hencefrom (4.11.2)

(Ax", y') = (x', AT y') = (x', .ay') = A,(x', y').

It follows that2,(x', y') = A,(,', y'),

and since A. j4 A, we find that (x', y') = 0, as was to be proved.For a real symmetric matrix we now show that all its characteristic

numbers are real. Let A and x be a characteristic number and vector,respectively. Then we have

(Ax, x) = (Ax, x) = A(x, x).

On the other hand, since A is real and symmetric we have A* = AT = A,and hence from (4.11.2)

(Ax, x) _ (x, ATx) - (x, Ax) = (x, Ax) = I(x, x).

It follows thatA(x, x) = AX, x),

and since (x, x) > 0 we see that A = 1, that is, A is real.Since the characteristic numbers of a real symmetric matrix are always

real, it follows that vectors with real components can always betaken as thecharacteristic vectors; the components will be found by solving a linearhomogeneous system with real coefficients.

Since the transpose of a real symmetric matrix A is identical with A,the characteristic vectors of AT are indentical with those of A. Remember-ing also that the characteristic numbers are real, we see that the resultconcerning orthogonality proved earlier is considerably simplified. Weobserve that for a real symmetric matrix the characteristic vectors asso-ciated with distinct characteristic numbers are orthogonal.

Page 100: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

98 Linear Equations and Matrices

If A is a real symmetric matrix and x is a real vector, then

(Ax, x) = S a;kxixk. (4.11.3), k=1

This is seen to be a homogeneous polynomial of the second degree in thevariables x1, x2, , x and is called the quadratic form associated withthe matrix A. The quadratic form is said to be positive-definite if its, -,ues are positive for any real values of x1, x2, , x not all zero simul-t..ric:ously.

We shall show that if the quadratic form associated with the matrix A ispo; ,itive-definite, the characteristic numbers of A are all positive: Letx be a real characteristic vector associated with A, a characteristic numberof A. Now since the quadratic form is positive-definite, (Ax, x) > 0. Butsince

we find that(Ax, x) = (::x, x) = A(x, x),

(Ax,x)(x, x)

Since both numerator and denominator of this fraction are positive, wesee that A > 0.

In order to give a simple criterion for recognizing when a quadraticform is positive-definite, we introduce the notion of the discriminant ofthe form. If A is the matrix associated with the form, the discriminant ofthe quadratic form is the determinant A,, = JAI; here n denotes the orderof the determinant, which is the num'ner of rows (or coium.ns) of Wedenote by the discriminant of .he quadratic form. obtained from(Ax, x) by setting x = 0. de tcs the ¢iscriminant of the quadraticform obtained by setting x,, _ :r.,,_; = 0 and in, general A, derotes thediscriminant of the quadratic f o,m obtained by setting x = x,t_i =

= x,+1 = 0. Then, it can bi shown that a necessary and sufficientcondition that the quadratic form bt positive-definite is that all the dis-

eriminants A1, A2, , An shall be positive. (See, e.g., Frazer, Duncan,and Collar [8, pp. 30-32].)

Thus, for example, for a quadratcc; form involving four Variables theassociated niatrix is

a1,

a 27

ul., a13 aJt

a23 a24

a33 a34

U43 a44 1

Page 101: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Properties of Characteristic Numbers and Vectors 89

where a;, = a1,. The quadratic form4

(Ax, x) = I a,,xtx,0-1

will be positive-definite if and only if

ill> 0, all a12> 0,

a21 a22

all a12 a12

a21 a22 a23 > 0, IAI>0.

I a31 a32 a33

For complex matrices, instead of the quadratic form one deals withthe Hermitian form, which may be written

n(Ax, x) = a,;x r; (4.11.4)

.,j=1

where it is assumed that a;t = a,;. A matrix A for which aft = a;; iscalled an Hermitian matrix and has associated with it an Hermitian form.We first note that all values of an Hermitian form are real. This is easilyseen by noting that

(Ax,x)_(x,A*x)=(x,Ax)_(Ax,x).if all the values of an Hermitian form are positive, it is called positive-definite. It can be shown that the characteristic numbers of an Hermitianmatrix are real and that if the associated Hermitian form is positive-definite the characteristic numbers are positive.

Two matrices A and B are said to be similar if there exists a nonsingularmatrix C such that

B = C-'AC. (4.11.5)

Matrix B is said to be obtained from matrix A by a similarity transforma-tion.

We now show that similar matrices have the same characteristic functionand consequently the same characteristic numbers. If A and B are similarmatrices, we have

IB - All = IC-'AC - All = IC-1AC AC `ICj.

= ICI IA - 2If idI - IA - All.Moreover, if x and y are characteristic vectors of the matrices A and B.respectively, associated with the same characteristic number 2, we have

y = C.-'x.For if Ax = Ax, then

By = (C-'AC)(C-1x) = C--'Ax = C-';.x = Ay.

Page 102: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

90 Linear Equations and Matrices

Since diagonal matrices are particularly convenient for calculation, itis of interest to inquire whether any matrix can be reduced to diagonalform by a similarity transformation. We state without proof some usefulresults in this direction. Further details may be found in Frazer, Duncan,and Collar [8, Chapter 3] and Faddeeva [5, Chapter 11.

First, suppose that all the characteristic numbers, Al, A2, , A,,, of amatrix A are distinct. Then .1 will have n distinct linearly independentcharacteristic vectors. Moreover, if Wis the matrix whose columns are thecharacteristic vectors, then

W-'A W=A

where A is the diagonal matrix

FA, 0 ... 0

A=

(4.11.6)

LO 0 ...AnJ

Thus A can be reduced to diagonal form by a similarity transformation.If any of the characteristic numbers of a matrix are of multiplicity

greater than one, but to each characteristic number there correspond asmany linearly independent characteristic vectors as its multiplicity, thematrix may be reduced to diagonal form and equation (4.11.6) is againvalid. This is the case, in particular, for real symmetric matrices. Wehave already noted that the characteristic vectors associated with distinctcharacteristic numbers of a real symmetric matrix are orthogonal. Nowthe linearly independent characteristic vectors associated with a singlecharacteristic number of multiplicity greater than one can be chosen to beorthogonal. Consequently, for a real n x n symmetric matrix it is possibleto find it orthogonal characteristic vectors.

For the general case of multiple characteristic numbers, transformationto diagonal form is not always possible by a similarity transformation. Todescribe the Jordan canonical form into which every matrix may betransformed by a similarity transformation, we first introduce thedefinition of a canonical box which is a matrix of the following form

As 0 0 ... 0 01 A; 0 0 0

T=0 1 A; 0 0

L0 0 0 ... 1 A;J

Page 103: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Properties of Characteristic Numbers and Vectors 91

All elements on the principal diagonal are 2=. All elements on the firstsubdiagonal (i.e., the elements directly under the principal diagonal) areunits. All other elements are zero.

A canonical box cannot be simplified by using a similarity transforma-tion. Its minimum polynomial is identical with its characteristic poly-nomial and is (A - 2)-i where ms is the order of the hox. Thus thecanonical box has the sole multiple characteristic number A. It has onlyone linearly independent characteristic vector. An example exhibitingthis was given in Section 4.9.

The Jordan canonical form is a quasi-diagonal matrix composed ofcanonical boxes:

TI 0 0 0

0 T2 0 0

0 0 T3 0

0 0 0 T;J

Here each Tk is a canonical box and each 0 represents a matrix all of whoseelements are zero. This notation exhibits the matrix in question partitionedinto submatrices of which those on the principal diagonal are Tk and allother submatrices are zero matrices. For example, if

2 0 04 0

T, = 1 2 0 Ta T3 =1 4

0 1 2

the Jordan canonical form would be

r2 0 0 0 0 0-

1 2 0 0 0 0

rTi 0 00 1 2 0 0 0

0 Ts 00 0 0 -3 0 0

0 0 Ts_ _0 0 0 0 4 0

LO 0 0 0 1 4J

The A, appearing in the various boxes are characteristic numbers of theoriginal matrix as well as of the canonical matrix. It is possible that thesame number A, appear in several canonical boxes. The multiplicity

of the orders of the boxes in whichit appears as a diagonal element. The number of linearly independent

Page 104: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

92 Linear Equations and Matrices

characteristic vectors associated with it equals the number of boxes inwhich it appears. If each characteristic number appears in only one box,the minimum polynomial coincides with, the characteristic polynomial.In the foregoing example, 2, -3, 4 are characteristic values of order 3.1, and 2 respectively. Associated with each characteristic value is justone linearly independent characteristic vector.

We note that a diagonal matrix is a special case of the Jordan canonicalform in which all of the canonical boxes are of order 1.

As already mentioned, every matrix can be brought into the Jordancanonical form by a similarity transformation. We omit any discussionof how this canonical form can actually be calculated for a given matrix.Our discussion is intended only to show what situations may occur withrespect to the characteristic numbers and vectors of a matrix.

4.12 THE CALCULATION OF THE CHARACTERISTIC NUMBERSAND VECTORS OF A MATRIX

We turn now to a description of methods which may be used for theactual calculation of the characteristic numbers and characteristic vectorsof a given matrix. We recall that the characteristic numbers are the zerosof the characteristic polynomial which is given by (4.9.4) in the form

T(A) = jA - All _ (-l)n0n '_ 1 -- p2A"-' P").

We might attempt to calculate the coefficients pi in this polynomial bydirect evaluation of the determinants entering into their definition, andthen proceed to solve the equation gq(A) = 0 to find the characteristicnumbers. To find the characteristic vectors, we would then have to solvethe set of linear equations (4.9.2) after substituting each characteristicnumber in turn for R. Except for matrices of very low order, this methodis not recommended since it involves a very large amount of labor andyields rather limited accuracy.

In many problems of applied mathematics, only a few characteristicnumbers of greatest modulus (or absolute value) are required. In such acase an iterative method, sometimes called the power method, may beused conveniently to find the characteristic number of greatest modulusas well as its associated characteristic vector. This method is describedin Section 4.13. If we want to find further characteristic numbers andvectors, we need a deflation procedure in which the original matrix isreplaced by a matrix of lower order which does not have the knownnumber and vector among its characteristic numbers and vectors. Thedeflation procedure is described in Section 4.14. Methods for obtaining

Page 105: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Power Method 93

all of the characteristic numbers and characteristic vectors of a real sym-metric matrix are discussed in Section 4.15. Section 4.16 discusses thisproblem for the case of a real nonsymmetric matrix.

4.13 THE POWER METHOD

To describe the power method in a simple manner, we shall at firstassume that the dominant characteristic number is real and that to eachcharacteristic number correspond as many linearly independent charac-teristic vectors as its multiplicity. We recall that in this case the matrixmay be reduced to diagonal form by a similarity transformation. We alsorecall that real symmetric matrices are included in this class of matrices.

Let Al, A2, - , A. be the characteristic numbers of the matrix A.arranged in order of diminishing modulus (some of them perhaps equal);let xl, x', , - , x" be the characteristic vectors corresponding to them.This set of vectors can be chosen to be linearly independent. Indeed ii allthe numbers A, are distinct, the x are determined up to a multiplicativeconstant; but if two or more of the characteristic numbers are equal, anylinear combination of the characteristic vectors corresponding to thesenumbers is again a characteristic vector.

An arbitrary vector y may be represented uniquely in the form

y = alxl + a2x2 + ... + a"x", (4.13.1)

where the numbers ai are constants. Some of these constants may bezero but we shall restrict the vector y by assuming that al 0 0.

We now form the sequence of vectors

Ay, A2y, ... , Aky, .

We call the vector Aky the kth iterate of the vector y by the matrix A.It is clear that

Ay = alAlxl + a2A2x2 + ... + a"A"x", (4.13.2)

and in generalAky _ a1Al'xl + a24'30 + ....1.. a"A"kx". (4.13.3)

Now if JAII > 122I Z IAs1 Z ... Z IA"I, ultimately the term Alk willdominate, and the vector Aky will be essentially in the direction of x1.Since Aky will be approximately a1Alkxl and Ak+ly will be approximatelya1Ai+1x1, we see that Al is given approximately by the ratio of the lengthsof Ak+1y and Aky or of corresponding components of these vectors.

In carrying out the iterations in practice, it is desirable to compute theratio for several of the components of Ak+ly and Aky. If these ratios agree

Page 106: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

94 Linear Equations and Matrices

reasonably well, their common value will be close to A1. The rapidity ofthe convergence of the iterative process depends on the magnitude of theratio As/AI and may be very slow if this ratio is near to 1 in magnitude.In computing the iterates, it is usually convenient to normalize the vectorsby dividing the components of the vectors being iterated by the first orlargest component or by the length of the vector in order to avoid growthof the components. Thus if µk is the normalizing factor, we obtain asequence yk = 4u Aky, and to find Ai we must take the ratio of the com-ponents of the vectors Ayk and yk. In choosing the initial vector y, wemay have the misfortune to choose a vector for which the coefficient al in(4.13.1) is zero or very close to zero. In this case, at the first steps of theiteration the dominant term will depend on A2 if a9 0 0. But even if alis exactly zero, rounding errors will introduce the term dependent on Al.At first this term will have a very small coefficient, but this coefficient willgrow as the iterations proceed, and satisfactory results may be obtainedeven with this unfortunate choice of y. If this does not happen we shouldstart again with a different initial vector y.

Example 10. Find the characteristic number of largest modulus and theassociated characteristic vector of the matrix

r2 3 2

A= 4 3 5

L3 2 9

We choose as an initial vector, y, the vector all of whose componentsare unity and proceed to form the sequence of iterates Aky:

7

12

14

78 900

134 1569

171 2041

10589

118512

24207

125128

218927

286654

1480345

2590563

3393124

If we take the ratios of the components of A`y and Aay, we obtain

1480345 = 11.8306,125128

2590563 = 11.8330,218927

3393124 = 11.8370.286654

Page 107: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Power Method 96

Any of these is a good approximation to the true value of Al which is11.8354. If we normalize the vectors A5y and Asy by dividing each com-ponent by the first component we obtain the vectors

1 1

1.7496 1.7500 .

2.2909 2.2991

Either of these vectors provides a good approximation to the characteristicvector associated with Al. We note that the convergence of the iterates isquite rapid in this example. This is because the other characteristicnumbers are 3.0293 and -0.8646, which are well separated from A1.(This example stems from Aitken [1, p. 272].)

If the dominant characteristic value is multiple with multiplicity r,that is, Al = A$ = = Ar, IA,I > then we have

Ay = A1(alx1 + a2x2 + ... + a xr) + a,+lA,+lxr+l + ... + an lnx"

andAky = A1k(aixl + azx2 + ... + a,xr) + ar+iAr+lx`+1 + ... +

Since a1x1 + a2x3 + - - - + a,xr is again a characteristic vector, we seethat, as before, Al is given approximately by the ratio of correspondingcomponents of the vectors Ak+ly and Aky. We obtain no information con-cerning the multiplicity of the characteristic number however, but we doobtain one characteristic vector corresponding to A. Here, by startingwith different initial vectors, we arrive, generally speaking, at differentcharacteristic vectors.

Next, if Al = -A8, I2 I > IA31, we have

Ay = Al(alxl - asx2) + A3a3x3 + + Aapx",

A2y = A1I(alx1 + a2x$) + A33a3x3 + . + A 2anx",

and generally

Aaky = A1ak(alx1 + aax2) + A3ua3x3 + ... + A.2kanx*,

A 1y = Ar1(alxl - a$xs) + A33k+1a3x3 + . - + Ask+la,,xri

Here, two successive iterates cannot be used for the determination of A.We observe, however, that A12 is given approximately by the ratio ofcorresponding components of the vectors Aak+$y and A'y or of A'k+1yand A$k'ly. Now neither of the vectors Aaky nor A?k+ly will approximatethe characteristic vectors x1 or x2. But we can obtain these characteristic

Page 108: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

96 Linear Equations and Matrices

vectors if we consider the sequence of vectors Aky + AIAk_1y and Aky -AIAk-'y for we have

Aky + A1.411y

= 2aiAlkx' + a3()3 + At)As 1x3 + . + an(A +and

Aky A1Ak-'y

2a2(-A1)kx2 + a3(4 - A1)A3--ix3 + ... + a"(A" - A1)2 lx"

The first term is the dominant one in each case. The ratios of the com-ponents of these vectors will, respectively, approach the ratios of thecomponents of the vectors x' and x2 associated with the characteristicnudibers Al and A2.

If we relax the condition that the dominant characteristic number bereal, and, if we assume that A is a real matrix, it follows that A2 = 1,the complex conjugate of ).t, and x2 = z'. Thus the first two characteristicnumbers are equal in magnitude. If we assume that 1A11 = 1A21 > 1As1,we can proceed in a manner quite similar to that described previously. Ifwe choose an arbitrary vector

y = a1x' + a211 + a3x3 + ... + (4.13.4)we have

Ay = a1Alx' + a2A1x' + a3Asx3 + ....+ af,A"x" (4.13.5)and

Aky = a1A1kx' + a21,ki' + a3Askx3 +.... + a"A"kx". (4.13.6)

If the iteration proceeds far enough the terms involving A3, - , An willbe small compared to the first two, but the vector Aky will never converge.To find Al. we follow a method suggested by Aitken [1, p. 277]. We letA, = re'° so that ,1 = re-0. Then the dominant part of any componentof Aky may be written in the form

it, = alrke"c + asrke-.kec

where c denotes the corresponding component of x'. If we recall thateika = cos kO + i sin k8 we can write instead

ftk = rk(cl cos kB + c2 sin k6)

where c1 and c2 are constants independent of k. Alternatively this maybe written in the form

jut = rkco cos (k8 + E) (4.13.7)

where co and e are independent of k. The presence of the factorcos (k8 -1- E) in (4.13.7) is what causes the failure to converge. Each

Page 109: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Power Method 97

component will exhibit an irregularly oscillating sign, By making use ofyk, /2k+1, µk+2, ,uk+3, however, we may eliminate co and c and determine rand 0, that is, A,. We firs note that

At /4k+1

2k+1 ,uk+2

cos (k0 + E) cos [(k + 1)0 + E] I2k+.

C;Ur cos [(IC + 1)0 + E] cos [(k + 2)0 + E] I

jcor'+2(cos 20 -- 1). (4.13.8)

If the equation (4.13.8), with k + I replacing k, is divided by equation(4.13.8), we obtain

ruk+1 tuk-4 2

r2 =

In addition we observe that

ruk+2 fLk+3

luk /k4-11

I/4ki-1 luk±2 I

(4.13.9)

rµk + r 1µk+8 = rk+lco {cos (k0 + E) + cos f(k + 2)0 + Ell

2cork+l cos [(k + 1)0 + E] cos 0

= 2Uk+i cos 0so that

cos 0 = rfak + r^',Lk+2 (4.13.10)2µk4 1

Thus, we have equations for determining both r and 0, and from theseboth Al and 2, = X1 can be found.

We can find the components of the characteristic vectors associated withthese characteristic numbers by considering the combination

Ak+1y-- %t1Aky (4.13.11)

which can be obtained easily from the sequence of iterates Aky. This isseen by considering the dominant part of Aky given by equation (4.13.6).We have approximately

Ak+ly _, 11Aky = a1(4+1 - 11"11)x1

a1A1k()1 - x1)x1, (4.13.12)

Thus we obtain a certain complex multiple of x1, We can obtain a nor-malized form for x' with first component unity by dividing the othercomponents through by this number.

Instead of using (4.13.9) and (4.13.10) to find r and 0 and then com-puting 11 = reiB, we may proceed in a simpler manner, although the results

Page 110: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

98 Linear Equation* and Matrices

may be somewhat less accurate. The following procedure is suggested byBodewig [2]. By considering only the dominant parts of (4.13.6), we haveapproximately

Aky = a1Axkxl +

Ak+ly a1A tx1 + a2Ak+'Xx

Ak+2Y aAx 2x' + a$4-2X1

Clearly Al and 11 are roots of the quadratic equation

As+aA+b=0 (4.13.13)

where a = -Ax - 11, b = Ax, x. Hence we have at once

Ak+2y + aAk+ly + bAky = 0. (4.13.14)

If we substitute the various components of these vectors we obtain nequations for the determination of these two unknown numbers a and b.Any pair of the equations can be used and several pairs should be usedto see if consistent values of a and b are obtained. If the values are notconsistent, the iteration of y by A should be carried further. If the valuesof a and b are consistent, then Ax and X are found as the roots of theequation (4.13.13).

Example 11. Find the two conjugate complex characteristic numbers andtheir characteristic vectors for the matrix

3 1 -2

A=f -3 -2 2

4 -2 2

.

We choose as an initial vector y, the vector all of whose componentsare unity and form the sequence of iterates Aky:

1

1

r 2 _5 _51 -126 253-

-3 8 43 83 -336

4 22 8 -274 -1218

2859 7558

-2523 -5035

L -752 14978

F-12317-1

17352

70258

-1601151 r-4506701

142763

56544

307907

-812898

Page 111: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Power Method 99

We observe that the signs of the components vary irregularly, whichsuggests the existence of a pair of conjugate complex characteristic num-bers. If the characteristic numbers are Al = rei° and A. = Ai = re-'e,we can use (4.13.9) to calculate r2 and (4.13.10) to find cos 6.

Using the first components of the vectors A7 y, Asy, A9y, and A10y, wefind from (4.13.9) that r2 = 14.7489. Similarly, using the second and thirdcomponents of these vectors we find that r2 = 14.7450 and 14.7483,respectively. Averaging these values of r2 and taking the square root, weobtain r = 3.8402. Now from (4.13.10) we obtain from the three sets ofcomponents the values cos 8 = 0.5142, 0.5142, 0.5140. Thus we takecos 0 = 0.5141. It follows that sin 0 = 0.8577. We then have

Al = r(cos 8 + i sin 0) = 1.9742 + 3.2937i.

We then find that-450670 -160115

A10y - 1A9y = 307907 - (1.9742 - 3.29371) 142763

-812898 56544

-134570.9670 - 527370.77551

26064.2854 + 470218.49311

L-924527.1648 + 186238.97281

If this vector is normalized by dividing the second and third componentsby the first, we obtain

1.0000

xI = -0.8490 - 0.16721

0.08844 - 1.73051

If we use the alternative method for the calculation of Al, then from(4.13.14) we obtain

-450670 - 160115a - 12317b = 0

307907 + 142763a + 17352b = 0

-812898 + 56544a + 70258b = 0.

Solving these equations in pairs, we obtain for a the three values -3.9489,-3.9492, and -3.9494 or taking the average we may use a = -3.9492.Similarly for b we obtain 14.7450, 14.7485, and 14.7487 and we take theaverage, namely b = 14.7474. Substituting these values in (4.13.13) wehave

A2 - 3.9492A + 14.7474 = 0

Page 112: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

100 Linear Equations and Matrices

from which we obtain21 = 1.9746 + 3.29371,

which is almost the same as the value obtained by the other method.

If the matrix A is a complex matrix, the characteristic numbers andcharacteristic vectors will, in general, be complex. If complex arithmeticis used in place of real, the power method can still be used. If the modulusof the dominant characteristic value is not repeated, that is, if no othercharacteristic number lies on the circle with center at the origin on whichthe dominant number lies, the method will work with Aky convergingto x1, a complex vector, and the ratio of the components of Ak+ly and Akyconverging to A.

The power method will be most successful when the modulus of one ofthe characteristic numbers is considerably greater than the modulus of anyother characteristic number, for the convergence of the iteration procedurewill be rapid. But when two or more characteristic numbers are nearlyequal or exactly equal in modulus, the convergence of the procedure isusually slow or fails altogether. For these reasons, blind application ofthe method is to be avoided. It is a useful method provided it is usedcarefully and the results are watched.

When convergence is slow, it may be possible to accelerate the conver-gence by various devices. One method is based on the fact that if Al is acharacteristic number of the matrix A, then A1k is a characteristic numberof the matrix All. Moreover, if A is the dominant characteristic number,A1k will be more dominant than i,l. Using equation (4.9.7), we have

;411 +)ok+...+A k.

Successive powers of the matrix A: A2, A4. A8, A16, , are computed.For sufficiently large k, A12k will be the dominant term, and we haveapproximately

21 = kk

tr(A2k). (4.13.15)

To find approximately the characteristic vector x1, we have only to formA.2ky where y is an arbitrary vector and k is sufficiently large. It would bedesirable also to calculate Ax1 as a check that k was sufficiently large.

Instead of extracting the root we might begin the usual iteration of anarbitrary vector using the constructed powers. For example, we mightcompute A8y and then A16y = A8(A8y). An approximate value of Almight then be obtained as the ratio of the components of Ally and A16y.

Another acceleration method is Aitken's 62-process, which is applicableonly if All A2, A. are all real and 1221 > 1A3f We have seen that anapproximation to 11 can be found by taking, for example, the ratio of any

Page 113: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Power Method 101

component of Ak+'y and Aky where y is an arbitrary vector. We may thusobtain a sequence of numbers z,rwhich will approach A. If the convergenceof this sequence to 2 is slow, we may form from this sequence anothersequence P(z) where

zk zk+i

zk+i zx+2

zk -- 27-k+1 + zx+2(4.13.16)

Then Aitken [1, p. 291], showed that the convergence of P(zk) to AI willbe much more rapid than that of zk. Thus the error in using P(zk) as anapproximation to ,li will be considerably less than the error would be ifzk, zk+l, or 7-k+2 were used to approximate A1. A proof of this result mayalso be found in Faddeeva [5, p. 215jj. The same procedure can be appliedto the sequences for the components of the characteristic vector ir, orderto compute them.

For practical computations the operation P possesses a very convenientproperty which may be expressed in the form

P(zk + c) = c + P(zk) (4.13.17)

where c is any constant Thus before employing the 82-pr::ess we cansubtract any convenient constant from the numbers zk, Zk+2. Themost convenient constant is, of course, the part consisting of the digitswhich these numbers possess in common. Thus the 63-process can beapplied to the later differing digits only.

Example 12. Apply Aitken's 62-process to improve the value of L foundin example 10. In addition, improve the characteristic vector.

IA example 10, using the ratio of the first components of Aey and A5ywe found z5 = 11.8306 as an approximation to 2.i. Similarly, using thevectors A5y, A4y and A'y, A3y we find z4 = 11.8168, and z3 = 11,7657.Using (4.13..16) and (4.13.17) we find a better approximation to) to be

13060 1168 0. .11.7000+-0.0656 - 2(0.1168) + 0.1306

11.8357.

Use of the second and third components of these vectors yields theapproximations 11.8352 and 11.8354, respectively. The average of thethree approximations is 11.8354 which happens to be correct to fourplaces of decimals.

0.0656 0.1168

Page 114: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

102 Linear Equatlens and Matrices

Normalizing the last three iterates found in example 10, we find thefollowing approximations to the characteristic vector z1:

p1.0000 1.0000 1.0006-

1.7482 1.7496 1.7500

2.2861 2.2909 2.2921

Applying the 8E-process to each of the sequences of components we obtaina better approximation, namely

XI =

1.0000

1.7502

2.2926

Another method for improving the convergence of the power methodhas been suggested by Wilkinson [25, 26]. We observe that if Aj is acharacteristic number of the matrix A, then A, -p is a characteristicnumber of the matrix A - pl and that the associated characteristic vectoris the same for A as for A - pL By suitable choice of p it may be possibleto make one of the characteristic numbers of A - pI, say A, -- p, dominant.This possibility exists because the largest of the ratios

AP An P

A, P, A, P

can be made smaller than the largest of the ratios

A2 A

If in applying the usual power method, that is, p = 0, convergence isslow, the iteration is continued using the matrix A - pl with suitablychosen p. If it is known that all the characteristic numbers are positiveor that the negative ones are very small relative to the positive ones,Wilkinson suggests choosing p somewhat larger than one-third of theapproximate value of A, found by the preceding iteration process. Anotheruse of the method is in the calculation of the lowest characteristic numberwithout calculating all the rest. If all the characteristic numbers arepositive and if p is chosen equal to some upper bound for the numbers,the magnitudes are reversed and the least characteristic number of Abecomes dominant in A - pI so that iteration with A - pI yields thischaracteristic number.

If the dominant characteristic number is multiple and has associatedwith it less independent characteristic vectors than its multiplicity, the

Page 115: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Deflation 103

problem becomes more difficult. Fortunately, this is not often encounteredin practice. A discussion of this case has been given by Aitken (1, pp.279-284].

4.14 DEFLATION

When one characteristic number and its associated characteristic vectorhave been found for a matrix A, in order to find further characteristicnumbers and vectors we need to use some method of deflation to reducethe original problem to one in which the characteristic number and vectorthat have just been found are no longer present. Generally this willrequire a knowledge of the characteristic vector for the transposed matrixAT as well as that for the matrix A.

Suppose that Al, the characteristic number of largest magnitude, hasbeen found for matrix A and suppose that Al is real. Then, of course, Alis also the characteristic number of largest magnitude for A T. Supposethat, as usual, the associated characteristic vectors have been foundapproximately from the sequence of iterates Aky and (AT)ky of an arbi-trary vector y by the matrices A and AT. Let xl and y' denote these charac-teristic vectors of A and AT. We saw in section 4.11 that y' is orthogonalto all of the characteristic vectors of A other than x1. Moreover, sincewe can write

yi = a1X1 + a2x2 + ... + anxn,

where x2, x8, - , xn are the other characteristic vectors of A, we have

(y1, yl) = al(xl, yl) + 0.

Since (y1, y') > 0 it follows that (xl, y1) 0 0 and so x1 and yl can benormalized so that (x', y1) - 1.

Now both x1 and y1 are column vectors. Let us denote their componentsby x11, x21, - , and y11, y21, ... , ynl, respectively. The transposeof yl is a row vector (yl)T and if we form the matrix product x1(y1)T weobtain a square n x n matrix which will be

rxllvil x1112'... xllynq

x11Y11 x21121 ... x21

Lxnly1l xniy21 ... xnlyn1J

We remark that the matrix product (yl)Tx1 is a scalar, namely the innerproduct (y', x') which is unity.

Page 116: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

104 Linear Equations and Matrices

We next form the matrix

AI = A - Aixi(yl)T. (4.14.1)

We show that the matrix Al has the same characteristic numbers andvectors as the matrix A except for the first characteristic number, in placeof which there is a characteristic number equal to zero. We have

Alxi = Axi - Ai[xl(yl)TJxl

Alxi - Aixl[(Y')Tx1J = Aix' - Aixl(yl, xl)

= Alxl --- Aixl = 0,

since (yi, xi) = 1. Also, if i 54 1, then

Aix' = Ax' -- Ai[xl(yl)T]x'

= A;x' -- Alxi[(Yl)Tx'J

=A'xx-Aixi(yl,x')=A,x'

since (yi, x') = 0 by the orthogonality property.If we now apply the power method to the matrix Ai we will obtain the

dominant characteristic number among A2, , A" together with theassociated characteristic vector. Clearly, the method can be repeatedafter the second number and vector have been found.

It is possible to avoid the calculation of the matrix Ai and of the sequenceof iterates Aiky because these iterates can be obtained from the sequenceAky by means of the formula

Aiky = Aky - Alkxl(yi)TY. (4.14.2)

To prove this formula, we need to introduce the so-called bilinear resolu-tion of the matrix A.

If xl, x2, , x" are characteristic vectors of A and yl, y2, ... , y"are the characteristic vectors of AT where xi and yi are associated withconjugate complex characteristic numbers, then we saw in Section 4.11that

(y`)Tx'=(y',x') = 0 if i 0j.Moreover, if we proceed as earlier in the present section we easily see thatthese vectors can be normalized in such a way that

(Y')TX' = (Y`, z') = 1.

Using these results it is easy to verify that

I = xl(yl)T + x2(y2)T + ... + xn(yn)T.

Page 117: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Deflation 105

If we multiply this equation on the left by A and remember that Ax' = A=x`,we obtain

A = 21x1(yl)T + 22X2(y2)T + ... + 2nXn(y°)T. (4.14.3)

Using (4.14.1), we find at once that

AI = 22x2(y2)T + ... + 2nxn(yn)T. (4.14.4)

If we multiply equation (4.14.3) repeatedly on the left by A, we obtain

Ak = AlkX1(yl)T + A2kx2(y2)T + + A k7Ln(yn)T.

In a similar manner,AIk = 221'-XS(y2)T + ... + 2Rkxn(y,,)T.

ThusAlk = Ak - 21kx1(yI)T,

and equation (4.14.2) follows at once.It is not even necessary to compute the whole sequence of iterates Alky.

It is sufficient to calculate two consecutive iterates A1'ny'and A11+Iy byformula (4.14.2). Then A2 and x2 are determined in the same manner inwhich Al and xI were found. Usually we will choose a value of m lessthan the number of the iterate which was used in the determination of AIand xI. Devices for improving the convergence, such as Aitken's 82-process, are, of course, still available.

Actually, it is inappropriate to use the same vector y for iterations byAI as was used for the iterations by A. Doing so in order to be able to use(4.14.2) produces results of low accuracy. If the approximation to thecharacteristic vector x2 thus obtained is used as a starting vector foriteration by A1, however, the iteration will converge rapidly.

Example 13. For the matrix of example 10, find the characteristic numbernext in order of magnitude after 21. Also find the corresponding charac-teristic vector.

In example 12 we found Al = 11.8354 and the characteristic vector

XI =

1.0000

1.7502

2.2926

Proceeding exactly as in examples 10 and 12 but using the transposedmatrix AT, we find the characteristic vector of AT associated with AI to be

1.0000

0.8309

2.1706

Page 118: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

106 Linear Equations and Matrices

Normalizing this vector so that (yl, x1) = 1 we have

r0.1346

y1 = 0.1118

0.2921Then we have

x1(y1)T =

1

1.7502

2.2926

(0.1346, 0.1118, 0.2921)

0.1346 0.1118 0.2921

0.2356 0.1957 0.5112

0.3086 0.2563 0.6697)Using (4.14.1), we find that

A1=

0.4070 1.6768 -1.4571

1.2116 0.6838 -1.0503

-0.6254 -1.0334 1.0738

Starting, as usual with the vector y, all of whose components are unity,we obtain the sequence of iterates A1ky:

1 0.6267 2.56 40 7.18 95 22.2742

1 0.8451 1.98 00 6.49 74 19.2469

1 -0.6120 -1.93 94 - 5.80 14 -17.6344

r 67.0339-1 (-203.40741

58.6699 177.3779

L-53.3573 161.6575)Taking the ratio of the first components of successive vectors we obtain, asapproximations to A2, the numbers zs = 3.0982, z4 = 3.0095, z5 = 3.0344.Applying Aitken's 62-process yields the result 3.0289. Proceeding in asimilar manner, using the second and third components of successivevectors, we obtain the approximations 3.0289 and 3.0288, respectively.These values for A2 are very close to the true value 3.0293. If we normalizeeach of the last three vectors A1ky and apply the 82-process to their com-ponents we obtain

x2 =

1.0000

0.8727

-0.7950

Page 119: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Real Symmetric Matrices 107

Considerable labor can be saved by using equation (4.14.2), but someloss of accuracy results. To apply this formula, we first calculate

El i r0.5383X1(y1)Ty = Xl(yl)T

Then from (4.14.2) we easily obtain

Al4y-22.8330

18.7551

-17.6792

1

1

A15Y =

0.9425

1.2346

73.1874

52.0495

-54.7681

which agree only approximately with the values obtained earlier. Takingthe ratios of the components of these vectors, we obtain as approximationsto 22 the values 3.2053, 2.7752, and 3.0979 with an average of 3.0261.These values are not as good as those previously obtained.

The power method, followed by deflation, is a useful method for findingthe characteristic numbers and vectors of matrices, especially if only a fewof these are needed. Blind application of the method is not recommended.Because of the many situations which can arise, it is necessary for thecomputer to observe carefully the behavior of the iterates. For matricesof low order, where the calculations can be carried out by hand or on adesk calculator, it can be used successfully. For matrices of high order,however, where it is desirable to use high-speed electronic computers,methods that will yield all of the characteristic numbers and vectors, nomatter how they are distributed, are needed.

In Section 4.15 we describe briefly such methods for real symmetricmatrices and in Section 4.16 give a very brief discussion of what can bedone in the case of nonsymmetric matrices.

4.15 REAL SYMMETRIC MATRICES

We have seen that the characteristic numbers of a real symmetricmatrix are all real and that such a matrix can always be reduced to diagonalform by a similarity transformation. Moreover, if W is the matrix whosecolumns are the characteristic vectors of the matrix A, then

W-1AW = A (4.15.1)

where A is the diagonal matrix whose principal diagonal elements are thecharacteristic numbers of A. It can be shown that W is an orthogonalmatrix, that is, WT' - W-1.

Page 120: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

108 Linear Equations and Matrices

Hence, to find the characteristic numbers and vectors, it is only necessaryto find an orthogonal matrix W which will reduce A to diagonal formaccording to equation (4.15.1). Unfortunately, for n > 2, there is nomanageable expression for the general orthogonal matrix of order n.

A procedure for obtaining the set of characteristic numbers as thelimiting set of diagonal elements of a sequence of matrices generated fromA by means of a series of plane rotations was introduced by Jacobi [15)in 1846. Each step of the method is reminiscent of the familiar method inanalytic geometry for removing the xy-term from the general second-degreeequation of a conic section; this is accomplished by rotating the co-ordinate axes through a suitable angle.

To explain the form of a plane rotation we denote the rotation angle by99 and consider the rotation associated with the ith row and jth column.Then we define the matrix U,, = (up?) in the following way:

u99=1, P0i,jutc =COs q, utf = -sin q,u!i =sin 9, u1f = cos 9,

all other u9Q = 0.

In other words, the matrix U,f has the following form

1

1

I

cos 99 -sin p1

1

sin 9 cos 9

1

1

Clearly U,, is an orthogonal matrix. As in elementary analytic geometry,it can be shown that the angle p can be chosen in such a manner that the

Page 121: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Real Symmetric Matrices 109

elements a;, = a,1 of A are replaced by zeros in the transformed matrix.We have only to choose p so that

tan 29? = 2a{fall - a55

to annihilate the elements a,5 = a,,. Jacobi annihilated the maximumoff-diagonal element of Aa = A using an angle quo and matrix U101 ,

obtaining a new matrix

A. = U-1 AU1050.

He then annihilated the maximum off-diagonal element of Ai using anangle 9r and matrix U ,,.,, obtaining the matrix

flAlUi,jt.A2 = U.-,.1

By continuing this process, sequences of matrices Ui jk and A,t are obtainedsuch that

Ate, = UikjkAkU;.jk.

Jacobi showed that by repeating this procedure a sufficiently large numberof times, we eventually reach a stage N for which all off-diagonal elementsare less than any fixed preassigned value. At this stage the diagonalelements of A. are close to the characteristic values and the matrix

U U1Ql0U{1flU1sfi ... UiNfX

is approximately the required matrix of characteristic vectors.Scanning the matrix after each rotation for the largest off-diagonal

element is time-consuming, and so a number of variations of the originalJacobi method have been proposed. One method consists in systematicallyannihilating all the off-diagonal elements in the first row, then in thesecond, etc. Of course, if any element is already within the requiredlimits of accuracy, it is passed over. It must be remembered that an ele-ment once annihilated may be increased again under subsequent rotations.Consequently, after passing through the matrix once, there is no guaranteethat all off-diagonal elements are zero. It is necessary to iterate the processuntil all elements are sufficiently small as in the original Jacobi method.

Another variation of the Jacobi method proceeds systematically in thesame serial fashion as the above method, but annihilates onlythose elementswhose values exceed some preassigned threshold value t. The iterationcontinues until all off-diagonal elements are less than t. Then the thresholdis decreased and the process is repeated for the lower value of the threshold.

Page 122: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

110 Linear Equations and Matrices

The procedure is repeated, continually reducing the threshold until thedesired accuracy is obtained.

Another method proposed by Givens [9] is also based on the use ofplane rotations to eliminate off-diagonal elements of the original matrix.The angle in the rotation matrix U,, is chosen in such a way that the ele-ments a,-1j = a,,;_l of the matrix to which the rotation is applied areannihilated. The elements are annihilated in the order a13, a14, - - ,al", a.A, , as", an, - , as,,, etc. Once an element is annihilated it isnever altered in successive rotations; thus in one pass through the matrixall possible elements are annihilated. Instead of a diagonal matrix,however, we obtain a tri-diagonal matrix in which not only the principaldiagonal but also the two symmetric parallel diagonals adjacent to it maycontain nonzero elements. This simplified matrix is then used to find thecharacteristic numbers and vectors by methods which we shall not describehere.

Since the methods described in this section are principally of use whenthe calculations are performed on high-speed electronic computers, nonumerical examples of their use have been included.

4.16 REAL NONSYMMCTRIC MATRICES

If all the characteristic numbers and vectors of a matrix are required,an automatic method that will work in all cases is desirable. The powermethod described in Section 4.13 depends too much on the skill of thecomputer to be useful with high-speed computing machinery. The Jacobimethod and its variations described in Section 4.15 provide suitablemethods for finding all the characteristic numbers and vectors of a realsymmetric matrix. For nonsymmetric matrices, the situation is much lessfavorable. A number of methods have been proposed, but most of themhave not yet been adequately tested.

We describe one such method which has been proposed by Lanczos[17]. This method will reduce any matrix to tri-diagonal form.

First, we must introduce the concept of a bi-orthogonal system ofvectors. Two sets of vectors x', x2, - - - , x" and yl, y2, - - , y" are called abi-orthogonal system if (x', y') = 0 when i 0 j. We start with twoarbitrary vectors xl and yl and construct two sets of n vectors which forma bi-orthogonal system in the following manner. Proceeding by induction,if xl, x2, - , xk and y1, y2, - , yk have already been constructed to forma bi-orthogonal system, the next two vectors are defined by the equations

xk+l = Axk - akxk - bk_lxk'/1`,(4.16.1)(Yk+l)T - (yk)T A - ak( )T - I)1 111 1)T (4.16.2)

Page 123: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Real Nonsymmetric Matrices 111

whereak = (y)TAxk

bk-1 =(y-l)TAe '

bo = 0. (4.16.3)(xk,

yk) (x 1, 7 -1)

It can be shown that the two sets of vectors remain bi-orthogonal.The recursion formula (4.16.1) for the set of vectors x1, x2, , x" can

be written in the form

Ax1 = x2 + atx1

Ax2 = is + a2x2 + btx1

Axk = xk+l + akxk + bk--1x l

Ax" = a"x" + b"_1x"-1

because it can be shown that both x"+' and y"-±l are zero. The alternativematrix form is

AS = ST (4.16.4)

where S is an n x n matrix whose columns are the vectors xl, x$,and T is the tri-diagonal matrix

, x"

ai b2 0 0 0 0 0

1 a2 b2 0 0 0 0

0 1 a3 bs 0 0 0

T=0 0 0 0 - a"_2 b"_2 0

0 0 0 0 1 a"_1 b"_1

0 0 0 0 0 1 a"

From (4.16.4) we see that T = S-1AS so that T is obtained from A by asimilarity transformation. The characteristic numbers of T are thereforethe same as those of A, and the characteristic vectors of A are simplyrelated to those of T.

After the tri-diagonal form is reached, it is not too hard to find itscharacteristic equation and the roots of this equation but we shall omit adiscussion of these matters.

Various modifications of this procedure have been proposed.Givens [10] has proposed a method for finding characteristic values and

vectors of a general complex matrix by transforming the matrix to semi-triangular form.

Page 124: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

chapter 5 Solution ofordinarydifferentialequations

5.1 INTRODUCTION

A large number of problems of applied mathematics and also manyproblems of pure mathematics can be conveniently formulated in terms ofdifferential equations. Indeed the differential equation is the primarymathematical instrument for the precise expression of the laws of nature,for these laws are nearly always statements of relationships between vari-ables and their relative rates of change, namely, their derivatives.

A differential equation is an equation involving variables and theirderivatives. If there is a single independent variable so that the derivativesare total derivatives, the equation is called an ordinary differential equation.Examples of such equations are

y' =2x$+y, (5.1.1)

Y" - 7y,.= 6y, (5.1.2)and

y" + 4y = 6 sin x (5.1.3)

where, as usual, primes denote differentiation with respect to x. If thereare two or more independent variables so that the derivatives are partialderivatives, the equation is called a partial differential equation. Examplesof such equations are

a2u asu8x$+ays° (5.1.4)

112

Page 125: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Introduction 113

and

a2z az+ at

zt. (5.1.5)TX2

In this chapter we study only ordinary differential equations.By the order of a differential equation is meant the order of the highest

derivative which appears. Thus (5.1.1) is of first order, (5.1.2) is of thirdorder, and (5.1.3), (5.1.4) and (5.1.5) are all of second order. The mostgeneral ordinary differential equation of the nth order can be written inthe form

f(x,y,y',y"..... y("))=0 (5.1.6)

if only two variables are involvedWe may also consider simultaneous differential equations in which there

are two or more dependent variables satisfying two or more differentialequations. For example, we may consider a system of m first orderdifferential equations involving m dependent variables yi, y2, - YmSuch a system may be written in the form

x)

ys' = f2(yi, y2, ... , ym, x),. . . . . . . (5.1.7)

Y'n =./mYi'y2,...,y.,x.It should be observed that the nth order differential equation (5.1.6)

can be replaced by an equivalent set of n first-order equations. This isaccomplished by making the substitutions

yi=Y, y2=Y', y3=y", y"=y("-1),

Then, if (5.1.6) is solved for y("), yielding

y(") = F(x) y, y', ... , y(n-i)),

an equivalent system is

yi' = y2Y2' = ys

yri_1 = Y.

yn' = F(x, yl, y2, ... , y")Conversely, from a system of m first-order differential equations such

as (5.1.7), it is theoretically possible to obtain a differential equation oforder not exceeding m and containing only one dependent variable,although it may be impossible to carry out the actual eliminations inpractice.

Page 126: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

114 Solution of Ordinary Differential Equations

By a solution or integral of the differential equation (5.1.6) we mean afunction y = g(x) such that if g(x) and its derivatives are substitutedinto (5.1.6), there results an identity in x. For example, y = ex - 2x2- 4x - 4 is a solution of (5.1.1), for on making the substitution we haveex - 4x - 4 = 2x2 + ex - 2x2 - 4x - 4 which is an identity in x.Similarly, y = e-x is a solution of (5.1.2), as is easily verified.

The solution of a differential equation is, however, not unique as iseasily seen by considering the very simple differential equation

y' =f(x)

wheref(x) is any continuous function. Then clearly

y = fix) dx + C = F(x) + C

where F(x) is any indefinite integral off(x) and C is an arbitrary constantof integration. Thus the solution F(x) + C of the differential equationy' =f(x) represents a one-parameter family of curves. This family in-cludes every continuous solution of the differential equation. A solutionwhich results from giving a particular value to the arbitrary constant iscalled a particular solution. By particularizing this constant we are ableto make the solution satisfy one additional condition. It is frequentlyconvenient to choose this constant to make a specified value yo of y cor-respond to a certain value x0 of x. Geometrically this means that thecurve passes through the point (xo, yo).

The situation just described is typical. The general solution of a first-order differential equation will involve one arbitrary constant and thegeneral solution of an nth order differential equation will involve narbitrary constants. In certain exceptional cases there will be solutions ofthe differential equations which are not included in the general solution,but we do not discuss these here.

As an example, we note that the general solution of the differentialequation (5.1.2) is

y = Cle-x + C2e 2x + C3ea

as is easily verified by direct substitution in the differential equation. Thesolution y = e -x is obtained by choosing Ci = 1, C2 = C3 = 0.

5.2 FIRST-ORDER EQUATIONS. EXISTENCE THEOREM

We begin by considering first-order differential equations which havethe general form F(x, y, y') = 0. We shall suppose that it is possible to

Page 127: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

First-Order Equations. Existence Theorem 115

solve for y' and hence we may write a first-order equation in the form

y' =.f(x, y).

If it is possible to write (5.2.1) in the form

M(x) dx + N(y) dy = 0

(5.2.1)

(5.2.2)

where M(x) is a function of x alone and N(y) is a function of y alone, thenwe say that the variables are separable. Here it is at once clear that thesolution is

)fM(x) dx -} fN(y) dy = C (5.2.3)

where C is an arbitrary constant. The problem is then reduced to theproblem of evaluating the two integrals in (5.2.3).

Example 1. Find the general solution of the differential equation

dy xJi -1- x2dx y

Find also the particular solution for which y = 3 when x = 0.Separating the variables, we have

ydy-xJ1 +x2dx=0.Integrating

or

Jy2 - }(l + VS)% = C

y$-(1 +x$)%t=C', C'=2C.

This is the general solution. To find the particular solution we set x = 0and y = 3, obtaining C' = 8, so that the particular solution is

y$ - (1 + xs)% = 8.

In many of the simpler equations encountered in applied mathematics,we find that the variables can be separated so that this method is oftenuseful. But there are, of course, a great many differential equations in whichthe variables are not separable. There are a number of artifices availablefor solving certain classes of first-order equations. Since these methodsapply to limited classes of equations and since they are adequately de-scribed in most elementary books on differential. equations, we omitthem here. Instead we turn our attention to the problem of getting asmuch information as possible about the solution of an equation (5.2.1)without actually finding an explicit solution of the equation. To achievethis may involve a determination of the general appearance of the solution

Page 128: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

116 Solution of Ordinary Differential Equations

curves by graphical means or it may involve an approximation to thesolution.

We first consider a graphical procedure. The general solution of (5.2.1)is an equation connecting x and y and an arbitrary constant C. For eachvalue of the arbitrary constant we have a particular solution y = g(x).The graph of such a particular solution is called an integral curve of thedifferential equation. Corresponding to the infinitely many values whichthe arbitrary constant may assume, we have infinitely many integralcurves. At each point of an integral curve, equation (5.2.1) enables us tocalculate the slope of the tangent to the curve. If (x, y) is any point in thedomain of definition of f(x, y) then (5.2.1) gives the slope of the tangentto tiie integral curve which passes through this point. Thus associated witheach point in the domain of definition of f(x, y) there is a definite direction,tamely the direction of the tangent line whose slope is calculated from(5,2.1). We say that (5.2.1) defines a direction field. The direction fieldrar be represented graphically by drawing at (x, y) a short line segmentwhose slope is, f(x, y). Such a line segment will be called a lineal element.

A r integral curve will have at any point the same direction as the direc-tion field. Thus if we draw the direction field for a differential equation,we can easily sketch the integral curves, si-' a any curve which is drawnso that it is tangent at each of its points to the lineal element there is anintegral curve.

To draw the direction field of the differential equation (5.2.1) it is con-venient to first draw some of the isoclines which are curves in the directionfield along which f(x, y) is constant. Note that an isocline is not anintegral curve. The family of isoclines is the family of curves ,,'(x, y) = = k.By giving k a series of values we may sketch a series of isoclines. Thenon each isocline we may draw several parallel lineal elements each havingslope k, where k is the constant associated with .he particular isocline.We thus obtain a sketch of the direction field from which we may sketchthe integral curves as indicated previously.

Example 2. Draw several isoclines and sketch the direction field of thedifferential equation

dy x

dx.....

- 2yDraw the integral curve which passes through the point (1,3).

The isoclines are the straight lines -x/2y = k or y = -xl2k. Theyare drawn in Fig. 5.1 with dotted fines for k = --1, --4, -1, 0, 4, 4, 1,oo. Several lines' elements are indicated on each isocline. The heavysolid curve is a; proximately the int ;ral curve passing through (1, 3) andwas drawn to coincide as well as possible with the direction field.

Page 129: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

First-Order Equations. Existence Theorem

-5

117

x

Fig. 5.1. Isgclines and lineal elements for the equation y' 3 -z,2y.

Since the variables are separable in the differential equation of thisexample we may find the general solution and compare it with the graphicalsolution obtained here. We have at once

x dx + 2y dy = 0.

The general solution is found to be x2 + 2y2 = C which is seen to be afamily of ellipses. The appearance of the direction field is clearly con-sistent with this result. The equation of the integral curve which passesthrough (1, 3) is x2 + 2y2 = 19.

It may often be desirable to obtain a numerical approximation to aparticular solution of the differential equation (5.2.1). In such cases thesolution would take the form of a table of values of corresponding valuesof x and y together with the values of y' associated with them.

Suppose, then, that we wish to find a solution of (5.2.1) such thaty = yo when x = xo; in other words, the integral curve is to pass throughthe point (xo, yo). By substituting in (5.2.1), we find the slope of the tangentat (xo, yo) to the integral curve is f(xo, yo) which we shall denote by yo'.To find the value yl of y corresponding to x = x, = xo + h where h is a

Page 130: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

118 Solution of Ordinary Differential Equations

small quantity, we may use the tangent as an approximation to the actualintegral curve and thus obtain as an approximation to y1 the value yo +hyo . Having thus obtained the point (x1i y1) which is very close to the inte-gral curve, we may repeat the process computing the slope yl of the curvethrough (x1, y1) by means of (5.2.1). Then, if x2 = x1 + h, we haveapproximately Y2 = y1 + hyl , and we take (x$, y2) as a point on theintegral curve. This step-by-step procedure may be repeated as oftenas desired to obtain further points on the integral curve. We express thisstep-by-step procedure by means of a general formula. Suppose that thesolution of (5.2.1) has been carried from (x(,, yo) to (xn, y,,) where xn =xo + nh, then for the next point we have xn+1 = x, + h = xo + (n + 1)hand

yn+1 = yn + hyn' = yn + hf(xn, yn) (5.2.4)

This method of step-by-step solution, often called Euler's method, is avery crude method. Its accuracy depends on the size of the step h whichis used, and h must usually be taken very small in order to obtain desiredaccuracy. If we are forced to choose h small, a large number of steps willbe necessary to continue the solution over any desired domain of x values.This method therefore entails a large amount of calculation, and also thelarge number of steps may cause the introduction of serious round-offerrors. It is therefore desirable to introduce more accurate formulas forthe numerical procedure of calculating the solution. This will be done inSections 5.7-5.11.

Example 3. For the differential equation

dy x

dx 2y

obtain a numerical approximation to the solution between x = 1 andx=3ify=3whenx.- 1.

To avoid large amounts of calculation we choose h-0.4 so thatxo= 1,x1=1.4,x$=1.8,x8=2.2,x4= 2.6, and x5 = 3.0. Then fromthe differential equation we find that ya = -0.167. Hence y1 = 3 +(0.4x-0.167) = 2.933. Again from the differential equation y1' = --0.239.The next value of y is y2 = 2.933 + (0.4X-0.239) = 2.837. Continuingin this manner we obtain the following table of values of x, y, and y'(Table 5.1). We have also included the values obtained from the exactsolution x2 + 2y2 =19 which was obtained previously.

We see that the calculated solution exhibits rather large errors. Theerror could be reduced by decreasing the size of h but with a correspondingincrease in the labor. The more accurate formulas of Sections 5.9 and

Page 131: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

First-Order Equations. Existence Theorem 119

5.10 would enable us to obtain greater accuracy with a very modestincrease in the labor of calculation.

The previous discussion has furnished us with geometric evidence thatthe differential equation (5.2.1) has infinitely many solutions and that thesesolutions form a one-parameter family. The particular value of theparameter which determines a particular solution may be determined in avariety of ways, for example, by specifying one pair of correspondingvalues of x and y, We have no right to believe that (5.2.1) always possesses

TABLE 5.1

Numerical Solution of y' = -2y

y=3when x=1x y True y

1.0 3.000 -0.167 3.0001.4 2.933 -0.239 2.9191.8 2.837 -0.317 2.8072.2 2.710 -0.406 2.6612.6 2.548 -0.510 2.4743.0 2.344 -0.640 2.236

such a family of solutions, but we may expect it under certain circum-stances. We now state without proof the fundamental existence theoremfor first-order differential equations which tells us under what circum-stances (5.2.1) will possess solutions.

EXISTENCE TxEoREM. In a closed region R of the xy-plane, let f (x, y) becontinuous and satisfy there a Lipschitz condition; that is, suppose thatthere exists a constant A such that

I.f(x, y) --f(x, z) 1 5 A ly -- z{

for all (x, y) and (x, z) in R. Let (x0, y0) be an interior point of R. Thenthe differential equation

dy-f(x,y)dx

has a unique solution y = Y(x) such that y = ya when x = x0; in otherwords, in a suitable interval xa - hi < x < xp + h2 there exists one andonly one function Y(x) continuous and having a continuous derivative inthe interval, such that Y'(x) =f jx, Y(x)] in the interval and Y(xo) = y0.

Page 132: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

120 Solution of Ot'Iaary Dbfereetial Equatlo.

We remark that the Lipschitz condition is satisfied if, in particular,of/ay is continuous in R.

A similar existence theorem may be stated for systems of first-orderdifferential equations. We have previously remarked that a differentialequation of higher order may be reduced to a system of differential equa-tions of first order, and so we may state existence theorems of similartype for such differential equations as well.

5.3 LINEAR DIFFERENTIAL EQUATIONS WITH CONSTANTCOEFFICIENTS

The general linear differential equation of order n is of the form

d"Y

a C + P,(x) -2ni1 + + P,i._,(x)dx

+ P.(x)y = R(x). (5.3.1)

Clearly no loss of generality results from taking the coefficient of thederivative of highest order to be 1, since this can always be accomplishedby division. We note that the term R(x) is different from the other termsof the equation in that it is free of y and its derivatives. For this reason,if R(x) is not identically zero, the equation (5.3.1) is called nonhomogen-eous whereas, if R(x) is identically zero, (5.3.1) is homogeneous. Instudying the nonhomogeneous equation (5.3.1), we often study the reducedequation which is the corresponding homogeneous equation obtained byreplacing R(x) by zero in (5.3.1). By contrast, the original equation (5.3.1)is called the complete equation.

In this section we shall consider the special case in which all the func-tions P1(x), P2(x), . , are constants. Although such differentialequations are treated in great detail in most elementary textbooks ondifferential equations, we shall study these here because of their greatimportance in nearly every field of physical science and engineering. Theyappear very frequently in the study of electrical circuits and vibratingmechanical systems.

To describe the important ideas as clearly as possible and with a mini-mum of complications, we shall at first consider second-order lineardifferential equations with constant coefficients. The equations which weshall consider are therefore of the form

.y" -} Py' + Qy = R(x). (5.3.2)

If we replace R(x) by zero, we have the reduced equation

y" + Py' + Qy = 0. (5.3.3)

Page 133: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Dear Equations with Constant Coefficients 121

If yl(x) and y2(x) are any two solutions of (5.3.3), then Clyl(x) + C2y2(x),where Cl and C2 are arbitrary constants, is also a solution. This may beverified by direct substitution in the equation. As a direct consequenceof the general existence theorem, it may be shown that if yj(x) and. y2(x)are linearly independent solutions of (5.3.3), the general solution of (5.3.3)is of the form Cly,(x) + C2y2(x), where C, and C2 are arbitrary constants.The definition of linearly independent functions is completely analogousto the definition given in Section 4.1 for linearly independent vectors. Thusthe functions yl(x) and y2(x) are linearly independent if Ayl(x) + By2(x)0 implies that A = B = 0,

Notice that the foregoing properties hold only for homogeneous equa-tions. For the nonhomogeneous equation (5.3.2) it is easily verified bydirect substitution that if yo(x) and yl(x) are any two solutit ; of (5.3.2),then y0(x) - yl(x) is a solution of (5.3.3). Also it* y,(x) is any solution of(5.3.3) and u(x) is any solution of (5.3.2), then u(x) -I- y,(x) is a solution of(5.3.2). From this it follows that the general solution of the completeequation (5.3.2) is obtained by adding to a particular solution of (5.3.2)the general solution of the reduced equation (5.3.3). Thus to find thegeneral solution of the complete equation (5.3.2) we must solve twoproblems: first, the problem of finding the complementary function whichis the general solution of the reduced equation, and second, the problem offinding any particular solution of the complete equation.

We turn now to the problem of finding the solution of the reducedequation (5.3.3). It is natural to try a solution of the form y = e'°', wherem is a constant to be determined, because all derivatives of this functionare alike except for a numerical coefficient. Substituting in equation(5.3.3) and dividing out the common factor e-11 which can never be zero,we obtain

m2+Pm+Q=0 (5.3.4)

which is called the auxiliary equation. Solving this equation for m we have

-P±JP24QM -2

If we denote these roots by ml and m2, we have two solutions e'010 andem2 . If ml 0 m2, these solutions are independent and the general solutionof (5.3.3) is

y = Clemjx + C2emsx.

If ml = m2, we do not have two independent solutions. But direct sub-stitutions shows that here xemtx is also a solution of the equation and hencethe general solution is

y = (Cl + Cgx)emlx

Page 134: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

122 Solution of Ordinary Differential Equatiom

Example 4. Find the general solution of

y" -- 2y' -. By = 0.

The auxiliary equation is m2 - 2m - 8 = 0, so the roots are ml = 4and m2 = -2. Hence the general solution is

y = Cie" + Cae-20.

Example 5. Find the general solution of

v'+6v'+9y=0.The auxiliary equation is mr + 6m + 9 = 0 which has the equal roots

- 3, - 3. Hence the general solution is

y = (Cl + Cax)e"80.

If the roots of the auxiliary equation (5.3.4) are complex, the precedingexpressions still give the general solution, but the form is inconvenientbecause complex quantities are involved. Here the roots are conjugatecomplex and may be written a f ij where a and fi are real. Thus thegeneral solution is

y = Cle("+iP)x + Cze(a_lP)e

= eax(Cre x + C2e c).Using the formulas

cos ¢x ± i sin Ax

and setting A = Cl + Cs and B = i(C1 - C9), the general solution maybe written in the form

y = eax(A cos flx + B sin (x).

Alternative forms, which are often useful, are

y = Cex cos (ox + y) = Ce" sin (ox + 6).These merely involve changes in the definition of the constants. Forexample, C = A -+B2.

Example 6. Find the general solution of

y"+4y'+l3y= 0.The auxiliary equation is m2 + 4m + 13 = 0 which has complex roots

-2 ± 3i, so that the general solution is

y = e--2"(A cos 3x + B sin 3x).

Next we turn our attention to the problem of finding a particular integralof the complete equation (5.3.2). In many practical problems the function

Page 135: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Linear Equations with Constant Coethdents 123

R(x) is some combination of polynomials, exponentials, sines, andcosines. In many such problems the method of undetermined coefficientsis applicable and, when it is, it is probably the most convenient method.

The method consists in assuming a likely expression for the particularintegral and then substituting this guess into (5.3.2). The result of thissubstitution provides us with the necessary equations to determine thevalues of one or more unknown coefficients which were included in thetrial solution. The form of R(x) will indicate what form of trial solutionshould be used. If R(x) contains e1z, the trial solution should containAe''x. If R(x) contains a polynomial of degree n, then the trial solutionshould also contain such a polynomial whose coefficients are to be found.If R(x) contains sin rx or cos rx, the trial solution should contain A cos rx +B sin rx. If R(x) contains products of these basic functions, so should alsothe trial solution. If any term in the trial solution happens to be a solutionof the reduced equation, the portion of the trial solution which containsthis term should be multiplied by x to obtain a revised trial solution.

We give several examples which will clarify the application of themethod

Example 7. Find a particular solution of

y"+2y'-8y=x$-x.Since the right-hand member is a polynomial of degree 2, we seek a trial

solution of the formy9=Ax2+Bx+C.

Substituting this in the differential equation we obtain

2A + 2(2Ax + B) - 8(Ax$ + Bx + C) = xs - x.

This equation will be an identity in x if the coefficients of like powers ofx are equal. Equating corresponding coefficients, we obtain

-8A=I4A-8B=-1

2A+2B-8C=0.Solving these equations for A, B, and C and substituting the values foundinto the trial solution we find the particular solution

-8x2+4x- 19

64

Example 8. Find the general solution of

y"-2y'-8y=3 cos x.

Page 136: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

124 Solution of Ordinary Differential Equations

In example 4 the complementary function was found to be

yo = Cie' + Cse-1.

To find a particular solution of the complete equation we seek a trialsolution of the form

y, = A cos x + B sin x.

Substitution into the differential equation yields

(--9A-2B)cosx+(-9B+2A)sinx=3cosx.Equating coefficients, we have

-9A-2B=32A-9B=0

and we find that A = -ft, B = - 8 . The general solution is

y = Cies- + C2e s. - 27 cos x + 6 sin x85

Example 9. Find the general solution of

y" - 2y' - 8y = 12e-22.

The complementary function is as in example 8. To find a particularsolution we would expect to try Aee211, but we observe that this is a solutionof the reduced equation Hence instead we try

y, = AxeSubstitution into the differential equation yields

4Axe-40 - 4Ae-27, + 4Axe-2z - 2Ae- - 8Axe-2 = 12e-2z.

Equating coefficients we find that -6A = 12 or A = -2. The generalsolution is therefore

y = Cie*z + C2e2` - 2xe-'x.

Example 16. Find the general solution of

y"+4y=4sin2z+8e2.The auxiliary equation is m2 + 4 = 0 and hence the complementary

function isy, = Ci cos 2x + C2 sin 2x.

Since sin 2x, which appears on the right side of the equation is a solutionof the reduced equation but e2O is not, we take for our trial solution

y9 = Ax cos 2x + Bx sin 2x + Cea`.

Page 137: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

General Linear Differential Equations

Substitution into the differential equation yields

-4A sin 2x + 4B cos 2x + 8Ce' = 4 sin 2x + 8e".

Equating coefficients, we have

125

-4A = 44B=08C=8

and we find that A = -1, B = 0, C = 1. The general solution is

y = Cl cos 2x + C2 sin 2x - x cos 2x + e2x.

The methods of this section are applicable to higher-order linear dif-ferential equations with constant coefficients. The auxiliary equation maybe formed in exactly the same way, but will, or course, be a polynomialequation of degree greater than 2. Methods for solution of such an equa-tion are discussed in Chapter 3. The method of undetermined coefficientsused for finding a particular solution of the complete equation is alsoavailable for higher-order differential equations. No changes are necessaryexcept that, of course, the labor is considerably greater. It is still true thatthe general solution of the complete equation is obtained by adding tothe general solution of the reduced equation a particular solution of thecomplete equation. It does not appear to be necessary to include examplesof such differential equations.

5.4 GENERAL LINEAR DIFFERENTIAL EQUATIONS

As in Section 5.3, it will be convenient to confine our discussion tolinear equations of second order, that is, we consider the special case,n t- 2, of the differential equation (5.3.1).

Only in special cases is it possible to obtain solutions of the reducedequation in terms of elementary functions. We, therefore, cannot givespecific methods of solution as we did in Section 5.3.

If we are able to find the general solution of the reduced equation, thereis a very useful method known as the method of variation of parameters,which may be used to find a particular integral of the complete equation.We proceed to describe this method

We consider the linear differential equation

y" + P(x)y' + Q(x)y = R(x). (5.4.1)

Suppose that ul(x) and u=(x) are linearly independent solutions of thereduced equation so that the general solution of the reduced equation is

y = Clul(x) + Csua(x) (5.4.2)

Page 138: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

126 Solution of Ordinary Differential Equations

where C1 and C2 are arbitrary constants. To form a trial solution of thecomplete equation (5.4.1), we replace the constants or parameters C1 andC2 by (variable) functions C1(x) and C2(x). It is from this that the methodderives its name.

We then seek to determine functions C1(x) and Cs(x) such that

y = C1(x)u1(x) + C2(x)u2(x) (5.4.3)

shall be a solution of (5.4.1). Differentiating (5.4.3) we have

y' = Clu1' + C2u2 + C1'u1 + C2'u2. (5.4.4)

Since we seek a solution of (5.4.1) and have two functions C1(x) and C2(x)at our disposal, we may impose one additional restriction on C1(x) andC2(x). We choose to set

CI u1 + C2 'US = 0. (5.4.5)

Note that these are the terms which appear in (5.4.4) because C1(x) andC2(x) are not constant. Differentiating (5.4.4) and remembering that(5.4.5) holds, we have

y" = C1u1" + C2u2" + C1'u1' + C2'u2'. (5.4.6)

Substituting (5.4.6) into (5.4.1), we have

C1u1" + C2u2" + C1 'U1' + C2 'U2'

+ P(C1u1' + C2u2') + Q(Clu1 + C2u2) = R(x)or

C1,(u1" + Put' + Qu1) + C2(u2" + Put + Qu2) + C1'u1' + Ca up' = R(x).

Remembering that u1 and u2 are solutions of the reduced equation, we seethat the coefficients of C1 and C2 are zero. Hence this reduces to

Ci'u1' + C2 u2' = R(x). (5.4.7)

Equations (5.4.5) and (5.4.7) constitute two linear equations which may besolved for Cl' and C2'. We may then obtain C1 and C. by integration.Substitution of these functions C1(x) and C2(x) into (5.4.2) provides asolution of the complete equation (5.4.1).

We emphasize that this method is applicable to general linear equationsand not just to equations with constant coefficients. We illustrate themethod by applying it to an example with constant coefficients, since it isonly here that we can be sure of finding the general solution of the reducedequation.

Example 11. Find the general solution of

y"+y=secx.

Page 139: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Integrating Factors and the Adjoint Equation

The general solution of the reduced equation is

y == C1 cos x + C2 sin x.We try the solution

ThenY,, = C,(x) cos x + C2(x) sin x.

yp' = -C1 sin x + C2 cos x + C,' cos x + C2' sin. x,and we set

Cl' cos x + C2' sin x = 0.

For the second derivative we find

y9' _ -Cl cos x - C2 sin x - Cl' sin x + C2' cos x.

Substitution into the differential equation yields

- Cl' sin x + C2 cos x = sec x.

Solving the equations for Cl' and C2', we obtain

C1' = -tan x,

C2' -1,from which

121

C1 = In cos x,

C2=x.The resulting particular solution is

y9 = cos x In cos x + x sin x

and the general solution is

y = C, cosx+C2sinx+cosxIncosx+xsinx.We remark that example 11 cannot be solved by the method of undeter-

mined coefficients described in Section 5.3. However examples 7, 8, 9,and 10 which we solved by the method of undetermined coefficients canalso be solved by the method of variation of parameters.

The method of variation of parameters may also be applied to linearequations of order higher than two with obvious modifications. Themethod tends to become rather lengthy and tedious.

5.5 INTEGRATING FACTORS AND THE ADJOINT EQUATION

We begin with a linear differential equation of the first order which maybe written in the form

Po(x)/ + Pi(x)y = R1(x). (5.5.1)

Page 140: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

128 Solution of Ordinary Difereadal Egutios

This differential equation is said to be exact if its left member is the deriva-tive of some function F(x, y), where it is to be remembered that y is afunction of x. Here we see that

d F(x, y) = F. + Fy' = Pi(x)y' + Pi(x)y

where F. and F, denote the partial derivatives of F with respect to x and yrespectively. Since this is an identity, we have

F. = Pi(x)y and F, = Po(x).

From this we see that F(x, y) = Pi(x)y and that we must have P0'(x) _P1(x). This condition is necessary for (5.5.1) to be exact; it is also easilyseen that it is sufficient. Thus if Po'(x) = P1(x), the differential equation(5.5.1) is exact and may be written in the form

ax[Po(x)y] = R1(x)

and its solution is

Po(x)y = fRi(x) dx C.

In general, of course (5.5.1) will not be exact. As we now show, however,it is always possible to multiply (5.5.1) by a suitable function of x so thatthe resulting equation is exact. Such a function is called an integratingfactor. It will first be convenient to divide equation (5.5.1) by Po(x),thus obtaining

y' + P(x)y = R(x) (5.5.2)

where P(x) = P1(x)/P0(x), R(x) = R1(x)/P0(z). We may take (5.5.2) as theusual form of the first-order linear differential equation. Suppose thatµ(x) is an integrating factor for (5.5.2). Then

u(x)y' + u(x)P(x)y - IA(x)R(x)

is exact, and as in the previous discussion we must have

µ'(x) = u(x)P(x),from which we find that

µ(x) =JP(X)

am(5.5.3)

Thus we have found an integrating factor and the differential equationbecomes

d

dxlyef

P(m) ate) _ R(x)e!P(s) d:

Page 141: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Integrating Factors and the Adjoint Equation

The general solution is

yeJP(z) do = ('R(x)e1' ' dXdx + C.

Example 12. Find the general solution of

y'+ytanx=coax.The integrating factor is

Jtan z dze = sec x.

The differential equation becomes

y'secx+ysecxtanx= 1or

whose general solution isdx

(y sec x) 1

129

ysecx=x+C.Next we consider a second-order linear differential equation which we

write in the form. Po(x)y" + P1(x)y' + P2(x)y = R(x). (5.5.4)

This differential equation is said to be exact if its left member is the deriva-tive of an expression linear in y and y'. We now show that the necessaryand sufficient condition for (5.5.4) to be exact is that

Po"(x) - P1(x) + P2(x) - 0. (5.5.5)

First suppose that (5.5.4) is exact; there then exist functions A(x) andB(x) for which

Pay" + Ply' + Pay ' dz (Ay' + By)=Ay"+A'y'+By'+B'y.

Equating coefficients, we have

Po=A, P1=A'+B, P2=B'.Substituting these expressions in (5.5.5) we find that (5.5.5) is identicallysatisfied.

Conversely, suppose that (5.5.5) is satisfied. If we use (5.5.5) to sub-stitute for Ps, we find that

Poy"+Ply, +PayPoy"+ply,[Poy' + (P1 - Po')yJ

Page 142: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

130 Solution of Ordinary D fferentiai Equations

Thus the left member of (5.`;.4,) is the derivative of a linear expression andthe differential equation is exact.

In general, of course, (5.5.4) is not exact. The function µ(x) will be anintegrating factor if an exact equation is obtained when (5.5.4) is multipliedby µ(x). By (5.5.5) this will happen if and only if

d z d

axz (µPo) - - (UP1) + µP2 = 0. (5.5.6)

This differential equation for µ may be written in the form

Pou" + (2Po' -- P1)µ' + (Po" - P1' + P2),u = 0. (5.5.7)

Equation. (5.5.6) or (5.5.7) is called the adjoint equation of the reducedequation

P0y + Ply' + P2y = 0. (5.5.8)

Thus a function µ(x) is an integrating factor for a given differentialequation if and only if it is a solution of the adjoint equation.

We note that the adjoint of equation (5.5.7) is found to be (5.5.8).Thus each is the adjoint of the other.

In most cases, the use of the adjoint equation to find an integrating factorfor a given differential equation is impractical because the adjoint equationis likely to be as difficult to solve as the original equation. The adjointequation, however, is of theoretical interest, particularly in connectionwith the study of the properties of the solutions of the equation.

If it is possible to find an integrating factor for (5.5.4), the solution of(5.5.4) can be obtained easily, because the first integral of the exactequation is a first-order linear equation whose general solution can alwaysbe found by one additional integration as shown earlier in this section.

Sometimes it is possible to find an integrating factor by finding a solu-tion of the adjoint equation by inspection or by a few systematic trials.

Example 13. Find the general solution of

x3y"+2a,'-2y=0.The equation is not exact, since tPo"-'-P1'+F2=6x-2.200.

The adjoint equation is

xsµ" + (6x2 - 2x)µ' + (6x -- 4)µ = 0.

We try a solution of the form µ = xk. Substituting in the adjoint equationwe have

k(k - 1)x1+1 + (6x2 - 2x)kxk-1 + (6x - 4)xk = 0.

Page 143: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Linear Differential Equations. Green's Function 131

Equating the coefficients of xk+1 and xk to zero we find that k = --2.Hence x-2 is an integrating factor for the original equation. Thus themultiplied equation

xy" + 2x-'y' - 2---l y = 0

is exact and may be written

d [xy' + (2x-1 - 1)yl = 0.dx

The first integral then isxy'+(2x-'-l)y=C1

ory' + (2x-2 - x-1)y = C1x--'.

This is a first-order linear equation, and its integrating factor is found to bex-'e-210. The general solution is

y - C1x + C2xe*1".

The notion of an integrating factor and the adjoint equation can beextended to linear differential equations of any order. We write thehomogeneous nth order linear differential equation in the form

Po(xhy""} + Pl(x)ytn--1) + P2(x)y""-2> + ... + P.-1(x)y' + P.(x)y = 0.

Then the adjoint equation is

x" (P°lA) dx" 1(P 4u) +dxs-2

(P2µ) _ .d

d+ 0.

5.6 LINEAR DIFFERENTIAL EQUATIONS. GREEN'S FUNCTION

In Sections 5.3 an 5.4 we have given methods for finding the generalsolution of the complete linear differential equation when the generalsolution of the reduced equation was known. In these methods we assumedthat the function R(x) on the right side of the equation was continuous.When the function R(x) is piecewise continuous, however, it is Possible toobtain solutions by other means. A function R(x) is called piecewisecontinuous if it is continuous except at a finite number of points, at eachof which it has a jump discontinuity. At a jump discontinuity x0, R(x)approaches different limits as x approaches x0 from the left and from theright. If we write x - xo+ to indicate that x - xo with x > x0 and x --,.xo

Page 144: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

132 Solution of Ordinary Differential Equations

to indicate that x - x0 with x < x0, then, at a jump discontinuity xo, wehave

lim R(x) - lim R(x) 0 0.z- zo+ ¢_¢o-

In many problems of electrical or mechanical vibrations linear differen-tial equations arise in which the right member represents an impressedforce or voltage which is of an intermittent type. In such cases the functionR(x) is discontinuous.

The simplest function possessing a jump discontinuity is the unit stepfunction defined by

qa(x) _0, x < 0

1, x > 0.(5.6.1)

This function is continuous for x 0 0 and has a jump of 1 at x = 0. Wenote that hp (x - x0) is similar except that it has a jump of h at z = xo.

The general step function S(x) defined on an interval (a, b) has theproperty that (a, b) can be divided up into a finite number of intervals ineach of which S(x) is constant. Any step function can be expressed as alinear combination of unit step functions. Thus if x0 = a, x = b, andxl < x2 < < x,_1 are the discontinuities of S(x) in (a, b), and ifS(x)=S,forx, x <x1+1(i=0, 1), then

S(x) = So& - x0) + (Si - S0)p(x - x)

+ ... + (S,,_1 - Sn-2)T(x - (5.6.2)

It is known that every piecewise continuous function can be approxi-mated by such a step function and indeed as closely as desired. In otherwords, if a function f (x) is to be approximated in a finite interval (a, b),then for any given E > 0, it is possible to find a step function which differsfromf(t) by no more than e in the whole interval (a, b).

Suppose now that we wish to find a solution of

y" + P(x)y' + Q(x)y = (5.6.3)

where R(x) is a piecewise continuous function. In addition, we wish thesolution to satisfy the initial conditions

y(xo) = y'(x0) = 0. (5.6.4)

Since y(x) may be discontinuous at x0, these equations are to be interpretedin the sense that y(x) and y'(x) both approach zero as x - xa from theleft, and also from the right. Thus we seek a particular solution of (5.6.3).

Page 145: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Linear Differential Equations. Green's Function 133

Since R(x) can be approximated by a step function, we first solve theproblem for the special case in which R(x) a= 1. In other words, we wishto solve the differential equation

y" + P(x)#' + Q(x)y = Ox - x0) (5.6.5)

subject to the initial conditions (5.6.4). Here p is the function defined in(5.6.1).

Then for x < x0, we have T(x - x0) = 0 and it is obvious that thesolution for x < x0 is y(x) = 0. But for x x0 we have from (5.6.5),

y"`F' P(x')y' + Q(x)y = 1 (5.6.6)

and so if we can find the general solution of the reduced equation we canfind the desired solution of the complete equation. Although we cknnotgive specific directions for finding this solution, we can be sure that it doesexist on the basis of our remarks in Section 5.2. We denote this solutionof (5.6.6) which satisfies (5.6.4) by yl(x, x0) where x0 is included as aparameter to indicate that the solution depends on the choice of x0.

Thus for all x we have found a solution of (5.6.5) satisfying (5.6.4) whichis

=Y,(X,

0, x S x0y = K(x, x0)

x0), x x0.

We call K(x, x0) the indicial function belonging to the left member of(5.6.5). Clearly, K(x, x0) and K'(x, x0) are continuous for all x. But from(5.6.5) we see that K"(x, x0) is continuous for x 0 x0 and has a jump ofI at x = x0.

It is clear that if the right member of (5.6.5) were hp(x - x0), where his a constant and nothing else were changed, the solution would bey = hK(x, x0).

We are now ready to consider the solution of the differential equation(5.6.3) subject to the initial conditions (5.6.4). We observe that forx < x0, the solution is clearly y(x) = 0 as before. We then consider anarbitrary value ofx such that x > x0, and seek the solution in the interval(x0, x). Now in the interval (x0, x) we can approximate R(x) as closely aswe please by a step function. To write an expression for this step function,we divide up the interval (x0, x) into n parts by points

x0=r0<r. <'rg<... < <r,,=x,and the approximating step function is

S (X)_ R(r,), r,<x<ri+l, i-=0,1,...,n-1

I

- R(,rn), x = x = rl.

Page 146: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

134 Soludon of Ordinary Differential Equations

According to (5.6.2) this may be written

S(x) = R(TO),r(x - -ro) + [R(.r) -- R(ro)]4v(x - Ti) + .. .

+ [R(T,a) - T,). (5.6.7)

We have seen that the solution of (5.6.5) where the right member is

[R(r:) - R(Tt-1)Jq,(x - Tc)

would be[R(TE) - R(r,_j))K(x, rc)

Now since (5.6.5) is a linear equation, it is clear that if the right memberis a sum of such terms, the solution will also be a sum of correspondingsolutions; and so we conclude that if the right member of (5.6.5) isreplaced by the sum (5.6.7), the corresponding solution will be

R(TO)K(x, TO) + [R(Ti) - R(TO)]K(x, r1)

-+.... + R(rn_x)]K(x, T,.).

Now as the number of subdivision points used in the approximation ofR(x) increases without limit, and as the distance between successive pointsapproaches zero, we see that this sum approaches the integral

y(x) = R(xo)K(x, xo) + ! K(x, r)R'((r) dr, (5.6.8)

provided the function R(x) has a piecewise continuous derivative R'(z).Observing that K(x, r) = 0 for r > z, we may replace the upper limit of

integration by x, and hence we find that

y(x) = R(xo)K(x, xg) + f K(x, r)R'(r) dr (5.6.9)

is the solution of (5.6.3) which satisfies (5.6.4). Sincex was arbitrary, it isseen that (5.6.9) is valid for all values of x.

Formula (5.6.9) may be written in another form if we perform anintegration by parts. We obtain

m K(x, r)R'(r) dr = K(x, x)R(x) - K(x, xg)R(xo) - `a aK R(r) dro0 8r

-- - K(z, x0)R(x0) - f 8KR(r) dr

since K(x, x) = 0 by definition of the indicial function. If we substitutethis result in (5.6.9), we obtain

EVy(x) _ --

BK(x, r) R(r) dr. (5.6.10)

Page 147: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Linear Differential Equations. Green's Function 135

if we lot

T) - - aK(x, -r)G(x 6(5 1 1),

aTthen (5.6.10) becomes

y(x) =£ G(x, r)R(T) dr.

..

(5.6.12)

The function G(x, T) that appears in (5.6.12) is called the weightingfunction or Green's function belonging to the left member of (5.6.3). It isreadily verified that G(x, xo) satisfies the same initial conditions (5.6.4)as does K(x, xo). We also note that, by the definition of a derivative,

G(x, xa) = - aK(x, T)

aT Loo

=1imK(x,xo)- K(x,x0+h)

h-.O h

Thus for sufficiently small values of h, the function

K(x, x0) - K(x, xa 4- h)h

(5.6.13)

may be considered as a good approximation to G(x, x0). If we rememberthat K(x, xo) is a solution of (5.6.3) with R(x) = 99(x -- x0), it is clear that(5.6.13) is a solution of the same equation with

R(x) = & -- x0) - 4'(x --- xo - h)h

The graph of this function is shown in Fig. 5.2. If we consider it as amechanical or electromotive force, it is an impulse of intensity I/h andduration h, hence of moment h(I/h) = 1. We may then give the followinginterpretation of Green's function:

If equation (5.6.3) represents the behavior of an electrical or mechanicalsystem, the Green's function G(x, xo) belonging to it represents the effectat time x of an impulse at time xo of "infinitesimal" duration, of "infinite"intensity, and of unit moment.

Indicial and weighting functions are useful in solving problems wherewe require the responses of an oscillating system to a variety of impressedforces. Once the indicial or weighting function has been found, the solu-tion for any impressed force can be found by evaluating the integral in(5.6.9) or (5.6.12). This may often be done by numerical, graphical, ormechanical methods. In many practical problems it is not possible to findthe indicial or Green's function directly. It may be possible to find them

Page 148: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

136 Solution of Ordinary Differential Equatloas

R

-I

0 xo xo + hx

Fig. 5.2. Graph of R(x) = [q (z - x,) - 9(x - x, - h)l/h.

by experiment, however, by applying to the system a unit-step force tofind the indicial function or a unit-impulse force to find the Green'sfunction.

Example 14. Find the indicial and Green's functions belonging to thedifferential expression

y" + kay, (5.6.14)

and also find the solution of the equation

y" + k2y =0, x < xo

(5.6.15)R(z),

which satisfies the initial conditions

x Z xp

y(xo) = y'(xo) = 0. (5.6.16)

First we must solve the problem :

y"+kay=1 xZxo

subject to (5.6.16). We see that a particular solution of this equation is1/k8, and if we add the complementary function we obtain as the generalsolution

y(x) = I + A cos k(x - a)

Page 149: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Numerical Solutions 137

where A, a are arbitrary constants. We must now determine these con-stants so that (5.6.16) are satisfied. Imposing these conditions, we have

y(xo) =1

kg+ A cos k(xo - a) = 0

y'(xo) = -Ak sin k(xo - a) = 0.We find at once that at = xo and A = -1 /k2. Substitution yields thedesired particular solution and we may at once write the indicial function,which is

0, x xoK(x, x°)

k2

[1 -- cos k(x - xo)], x xo.

The Green's function is0, x S xo

G(x, xo) = k sin k(x - xo), x > xo.

Then the solution of (5.6.15) subject to the conditions ($.6.16) is

y(x) = 1 fw R(r) sin k(x - r) dr.k

5.7 NUMERICAL SOLUTIONS

In previous sections we have described a number of methods for findingexplicit solutions of differential equations. In many practical problems,however, it is found that it is not possible to obtain such explicit solutionsof the differential equations describing the problem. It may then bedesirable to find a numerical approximation to the solution of the differen-tial equation. In Section 5.1 we pointed out that a differential equation oforder n can be written as a system of n first-order differential equations.Consequently, in describing numerical methods, it will be convenient torestrict the discussion to first-order equations.

In this and following sections, we shall consider a first-order differentialequation y' = f (z, y) and we shall suppose that the value yo of y cor-responding to x = xo is prescribed. The extension to systems of equationsis simple and will be indicated later.

We seek a table of values of x and y for a sequence of values of x. It willbe convenient to take the values of x as equally spaced with h denotingthe common spacing. We consider the points xl = xo + h, x2 = xo +2h, , xA = xo + nh, , and seek values of y, namely yl = y(xl),ys = y(x2), , y a y(x ), . The numerical solution of the differential

Page 150: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

138 Solution of Ordinary Differential Equations

equation is then just this table of values, x,, yi. In addition, it is oftenconvenient to include the corresponding values of y' in the table.

In Section 5.2 we explained how the simple formula (5.2.4), namely

yn+1 = yn + hy,a' = y:, + hf (xn, y,.) (5.7.1)

could be used to obtain such a numerical solution in a step-by-stepmanner.

This formula is quite crude and it is desirable to obtain formulas thatwill give more accurate results. A very simple but more accurate formulais

yn+1 = yn-1 + 2hyn'. (5.7.2)

To see that this formula is more accurate than (5.7.1), we make use ofthe Taylor's series,

h2 h3yn+1 = yn + hyn' + 2 yn" + 6 yn {higher powers of h.

If we write a similar expansion for yn_i and subtract from the precedingequation, we obtain

3

yn+1 = yn-1 + 2hyn' + 3 higher powers of h. (5.7.3)

If h is sufficiently small, the neglected terms in (5.7.2) are smaller than in(5.7.1).

We observe that to get started with formula (5.7.2) it is necessary toknow not only ya but also y1'. We therefore need a special method ofstarting the solution. One possibility is to use several terms of Taylor'sseries to calculate yi and then obtain yi' from the differential equation.The use of Taylor's series and other methods of starting the solution aredescribed in Section 5.8.

Once the solution has been started, it proceeds step by step by repeateduse of (5.7.2). This procedure contains no check on the accuracy of thenumerical calculations or of the process. Some improvement in accuracy,as well as a partial check on the arithmetical work can be obtained byrecalculating each value of yn+1 by means of the formula

yn+i=yn+h2(y;,+1+ii'). (5.7.4)

This is a closed formula of integration, for it is the trapezoidal rule(2.3.2) applied to the integration of the function y'(x). By contrast,(5.7.2) is an integration formula of open type. The error in (5.7.2) isseen from (5.7.3) to be approximately (h3/3)y'. On the other hand, theerror in (5.7.4) is found from (2.5.3) to be -(hs/12)y', which shows that

Page 151: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Numerical Solutions 139

(5.7.4) is more accurate. We note that to calculate we need to knowyn+1; thus we need a preliminary estimate of yn+1 to use in the calculationof y,+1 from the differential equation. The procedure, then, will be tocalculate a "predicted" value of by means of (5.7.2), to use this valuein the differential equation to calculate and then to obtain a "cor-rected" value of y,, 2 by means of (5.7.4). This "correction" processmay be repeated, if necessary, by applying (5.7.4) repeatedly until nochange occurs in the calculated value of y,,+l.

We note that the error in (5.7.4) is approximately one-fourth of theerror in (5.7.2) and is of the opposite sign. Thus if we take the differencebetween the predicted and corrected values of we should obtain aboutfive times the error in the corrected value. In other words, the error in thecorrected value of is in magnitude approximately one-fifth of theabsolute value of the difference between the predicted and corrected valuesof It is often useful to carry along in the solution a column exhibitingthis difference. If this column gets too large, it signals a loss of accuracyin the calculations. We can then decrease the step-size h in order to improvethe accuracy or make use of more accurate formulas described in sub-sequent sections.

Following is an example demonstrating the use of these formulas. Toget the necessary starting value, we make use of the example used in thenext section to show the calculation of starting values.

Example 15. For the differential equation

y'=X2--y, y(0)= 1

find the values of y corresponding to x = 0.2, 0.3, , 0.6. Use thestarting value y1 = 0.9052 for x = 0.1, obtained by rounding the result ofexample 16.

Choosing h = 0.1, we first calculate from the differential equationyl' = -0.8952. We then predict the value y$ from (5.7.2), obtaining

ys = yo + 241'' = I + 2(0.1)(--0.8952)

= 0.8210.

Next, from the differential equation we find y$ = -0.7810. We then use(5.7.4) to correct the value of y2, obtaining

Y2 = Yi + 0.5h(y2' + yl )= 0.9052 + 0.05(-0.7810 - 0.8952)

= 0.8214.

The corrected value of y2 found from the differential equation is -0.7814.If we apply (5.7.4) again we find that no change occurs. We also note that

Page 152: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

140 Solution of Ordinary Differential Equations

y2 -- gs = 0.0004; the magnitude of the error is less than one-fifth of thisvalue. We continue this step-by-step pattern, applying (5.7.2) to predictyn+i and using (5.7.4) to correct We obtain the values in Table 5.2.

TABLE 5.2Solution of Y' = xa - Y, y(0) = 1

Simple Predictor-Corrector

J' y

0.0 1.0000 -1.00000.1 0.9052 -0.89520.2 0.8210 -0.7810 0.8214 -0.7814 0.00040.3 0.7489 -0.6589 0.7494 -0.6594 0.00050.4 0.6895 -0.5295 0.6899 -0.5299 0.00040.5 0.6434 -0.3934 0.6437 -0.3937 0.00030.6 0.6112 -0.2512 0.6114 -0.2514 0.0002

5.8 STARTING THE SOLUTION

In order to apply formula (5.7.2) to the solution of a differential equa-tion, we saw that it was necessary to obtain by some other means thevalues of yl and yi'. To use most of the formulas to be obtained in sub-sequent sections, it will be necessary to know a certain number of theordinates y1, ys, - , y, in addition to the prescribed ordinate yo.

One method of starting the solution of the problem

Y, = f (z, y), y(x0) = Yo

consists in determining the coefficients of a Taylor's expansion

h ' h' hsy. = y(xo + hs) = yo + 1°s+ 2l s2+

(5.8.1)where yo ) = (dky/dx't)%_, by successively differentiating the basic dif-ferential equation or otherwise. We assume, of course, that such a con-vergent expansion exists if s is sufficiently small.

On differentiating the basic differential equation, we obtain

y' = f (x, y), y" = f (x, y) + yf,(x, y),

y" = f x(x, y) + 2y.f.,(x, y) + y'1f,,,,(x, ii) + YYV(x, y),

and so forth. By substituting in the values of xo and yo we obtain thedesired values of yo, yo", yo ,

Page 153: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Starting the Solution 141

Fortunately, it is not necessary to compute the general expressions forthe higher derivatives which, as can be seen, become quite complicated.In any particular case it is usually possible to compute enough of thederivatives to obtain the desired accuracy without excessive labor. Weillustrate the calculation for a simple example.

Example 16. For the differential equation= x$ - y, y(0) = 1,

find the values of y corresponding to x = 0.1, 0.2, and 0.3.From the given equation, we obtain

y'=x$-y,y"$2x-y',y' =2--y",(5.8.2)

Substituting xo = 0, we find that

ye - 1, yo = -1, yo" = 1, yo = 1, yo°° = -1, yo" = 1, ... .We choose h = 0.1 and substitute these values in (5.8.1) obtaining

s l8 S 4 5

Y' = 1 T 10 + 2110! + b \10) 24 `10) + 12010)s

Settings = 1, 2, and 3, we obtainyl = 0.90516, y2 = 0.82127, ys = 0.74918

to five places.

Additional ordinates could be obtained to this accuracy by retainingenough terms in the expression. An alternative method consists in com-puting the coefficients of a new Taylor's series expansion launched fromone of the points just calculated. For example, starting from the pointxs we have , $ " s ,"

ys+a=ys+hys S+hys sa+1! 2! 3!

Here ys is known and ys', y3", are calculated in terms of y3 from (5.8.2).Thus we must either calculate derivatives of higher order or recalculateall the derivatives to obtain additional ordinates by either of these methods.In the foregoing example, equations (5.8.2) were particularly simple butin more complicated examples, the labor of computing the higher deriv-atives increases fairly rapidly. Thus it is usually desirable to abandonthis procedure in favor of a more convenient one as soon as sufficientstarting values have been obtained. The step-by-step procedure of Section5.7 can be used as soon as yi has been calculated by the starting procedure.The more complicated and more accurate procedures of subsequentsections will need more starting values.

Page 154: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

142 Solution of Ordinary Diffetential Equations

Another procedure for finding starting values may be described as amethod of successive substitutions. Before we can explain this methodwe need to obtain some additional closed numerical integration formulasexpressing the desired starting ordinates in terms of derivatives.

Suppose we wish to calculate four starting ordinates. To calculateordinates at points as near as possible to x0, we shall find it convenientto calculate the ordinates y_2, y_1i y1, y2 corresponding to x_2 = xo -- 2h,x_ 1 = xo - h, x1 . = xo + h, x2 = xo + 2h. It is at once clear that

yk - yo = J y'(x) dx, k = -2, -1, 1., 2. (5.8.3),2bzo

We cannot evaluate this integral because we do not know the functiony'(x) until after the differential equation has been solved. However, wemay obtain useful formulas for yk if we approximate y' by means ofStirling's interpolation formula obtaining

Yk=Yo +hfo[yo +Sµ6yo,+ 26Yo+S(S26 1)µa3yo

+s2(s2- 64yo,+,..]ds, k=-2,-1,1,2.24

Carrying out the integration yields the formulas

y-2 = yo + h(-2yo' + 2j"6Yo' -a

62yo' + +/APyyo - 4& B'Yo + ...).

Y-1 = yo + h(-yo' + Wyo' - e 82yo - 03'yo + T-s6 64yo' + ...),(5.8.4)

yi. = yo + h(yo + JuSyn + e 62yo - s4µa3jo - T18-0 o 64yo + ...),...).Y2 = yo + h(2yo' + 2,udyjo' + J 61yo' + J At 3yo' + s 64yo' +

We may rewrite these formulas in terms of the derivatives themselvesinstead of their differences. If we neglect differences beyond the fourthand recall the definitions of the differences involved, we obtain, after somecalculation, the approximate formulas

y_2 = yo - 9T0 (29y-2' + 124y-,' + 24yo `f' 4y1' - y2'%

Y-1 = yo -h

720(- 19y-2' + 346y_1' + 456y o' - 74y1' + 11 y2'),

h (5.8.5)

yi = yo +720

(11Y-2' - 7411_1' + 456yo + 346y1' - 19Y2%

112 = yo +90

(- y-2' + 411-1' + 24yo' + 124yy. + 29y,,').

Page 155: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Starting the Solution 143

To apply these formulas, we begin with a first approximation by makinga rough estimate of the values of y_2, y_1, yl, y2. This might be done, forexample, by taking one or two terms of the Taylor's series expansion. Thecorresponding values of Y-2" y_i, y1', y2' are then calculated from thedifferential equation. These values are then substituted into (5.8.5),obtaining a second approximation to the values of y_Z, y_1, yl, y2. Thesecond approximations to the values of y are then substituted in thedifferential equation to obtain new values for y' which are in turn sub-stituted in (5.8.5), yielding a third approximation. This cycle of operationsis repeated until no change occurs in the values of y_2, y-11 yl, Y2.

For high-speed automatic computers, formulas (5.8.5) are probablythe most convenient. If the calculations are performed by hand, it maybe more convenient to form the necessary difference table and use formulas(5.8.4).

If it should be undesirable or impossible to calculate values of y forx_8 and x_l, we might instead want to calculate the starting values y1, y2,y3i y4. To obtain such formulas we would again start with (5.8.3) andapproximate y(x) by means of Newton's forward formula (1.3.8). Weobtain the formulas:

yi = yo + h(yo' + j 11 yo' - i a 02yo' + z A3-yo,7z i / 4ya' + .. )>

Ayo +h(2yo'+2Ayo 004yo + --

Y3 = yo + h(3yo + I Dyo + a A2yo' + a 03yo' -F s A4yo' + ...},

Y4 = Yo + h(4yo + 8 Ayo' + 84 A2yo + ^0' + A4yo' + ...).

Neglecting differences beyond the fourth, the corresponding approximateformulas may also be written in the form

yl = yo +h

720(251yo' + 646,1' - 264y2 + 106y3 -- 19y4),

ys = yo +h

90(29yo + 124y1 + 24y2' + 4y3' -- y4'),

h(5.8.7)

ys = yo +8U

(27yo' + 102y1' + 72,2' + 42ys' -- 3y4'),

Y4 = yo + 90 (7yo + 32y1 + 12,4 + 32y3' -+ - 7y4)

It should be pointed out that all the formulas (5.8.4}-(5.8.7) involvea truncation error vebicn has been omitted. These truncation errors maybe found in Milne [201.

Page 156: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

144 Solution of Ordinary Dlfferentlal Equations

Example 17. For the differential equationy'=x2-y, y(0)=1,

find by the method of successive substitutions values of y correspondingto x = -0.2, -0.1, 0.1, and 0.2.

As a first approximation to the solution, we take

y(x)=1+xyo'=1-x,and calculate y' for x = -0.2, -0.1, 0, 0.1, and 0.2. These values appearin the first five lines of Table 5.3. Here, h = 0.1. These values are then

TABLE 5.3Solution of y' = x$ - y, 7(9)

Starting the Solution

x y y'

-0.2 1.2 -1.16-0.1 1.1 -1.09

0.0 1.0 -1.00 1st approximation0.1 0.9 -0.890.2 0.8 -0.76

-0.2 1.217 -1.177-0.1 1.105 -1.095

0.0 1.000 -1.000 2nd approximation0.1 0.905 -0.8950.2 0.823 -0.783

-0.2 1.2186 -1.1786-0.1 1.1048 -1.0948

0.0 1.0000 -1.0000 3rd approximation0.1 0.9052 -0.89520.2 0.8213 -0.7813

substituted into (5.8.5) to obtain a second approximation, recorded inthe second five lines of the table. Then y' is calculated again from thedifferential equation and a third approximation obtained by use of (5.8.5).The cycle is repeated until no further change occurs. The fourth approxi-mation agrees with the third approximation to four decimal places.

It would be possible to continue this solution by use of the formulas(5.8.7). We could use the last line of the foregoing computation as thefirst line of a new computation which would carry us on to x = 0.6, andrepetitions of this procedure would take us as far as we wished to go.

Page 157: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Milne's Method 145

However, this method of continuing the computation is quite inefficientand is not recommended. The step-by-step method of Section 5.7 or moreaccurate step-by-step methods are to be preferred.

5.9 MINE'S METHOD

The method of prediction and correction of the ordinate describedin Section 5.7 can be extended by the use of more elaborate formulas inplace of (5.7.2) and (5.7.4). Milne's method consists in using as a predictora formula obtained from the integration formula (2.4.1) and as a correctora formula derived from Simpson's formula (2.3.3). The formulas to beobtained will be more accurate than those of Section 5.7.

If the solution of the differential equation y' = f(x, y) with y(xo) = yohas been obtained for z1, x$, , x as yl, y2, , y,,, then we predictthe value of by the formula

Jn+i = y,-s +3h

(2yn-2 - Yri-1 + 2y.'). (5.9.1)

From the differential equation we obtain the value y;, +k = f yn+i)and then obtain a corrected value of by means of the formula

yn+1 = yrt-1 +3

h (y'-, + yn+1) (5.9.2)

We may apply the correction formula (5.9.2) repeatedly, each timerecalculating y'+i from the differential equation until no change occurs inthe calculated value of

If we observe that the truncation errors in formulas (5.9.1) and (5.9.2)arc given by (2.5.6) and (2.5.4) respectively, we see that the error in (5.9.1)is approximately 28 times the error in (5.9.2), and of opposite sign. Hencethe magnitude of the error in the corrected value will be approxi-mately the magnitude of

e(Y.+i -- g.+,)

Hence it will be useful to tabulate the quantity yA+i - when carryingout a solution by this method. Its values will serve as a control for thetruncation error and may also reveal arithmetical mistakes. Wheneverits values exhibit abrupt changes, it is wise to check the last line or two ofthe computation.

Example 18. Use Milne's method to continue the solution of

y' = x8 -- y, Y(O) = 1

which was started in example 16.

Page 158: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

146 Solution of Ordinary Differential Equations

As before, we choose h = 0.1. Table 5.4 shows the values of yl, ys, yacalculated in example 16, as well as the corresponding values of y1', y$',ys calculated from the differential equation. These values are used topredict the value of 94 by means of (5.9.1). Then y`4' is calculated from thedifferential equation and (5.9.2) is used to correct the value of y4. Thesame method is used to carry the calculation on to x = 0.5 and x = 0.6.

TABLE 5.4Milne's Method

Solution of Y' = x2 - Y, Y(0) - 1x y" y y' y 9

0.0 1.00000 -1.000000.1 0.90516 -0.895160.2 0.82127 -0.781270.3 0.74918 -0.659180.4 0.68968 -0.52968 0.68966 -0.52966 -0.000020.5 0.64347 -0.39347 0.64347 -0.39347 0.000000.6 0.61118 -0.25118 0.61117 -0.25117 -0.00001

The column exhibiting y - 9 shows that the error in each step is very smallindeed. This calculation was carried to five decimal places because it isconsiderably more accurate than the calculation of example 15 where onlyfour places seemed appropriate.

It has been pointed out by several authors, including Hildebrand [12,pp. 202-2141, that Milne's method is unstable. The basic cause of theinstability is the use of Simpson's rule in (5.9.2). Simpson's rule integratesover two intervals and under certain conditions can produce an errorwhich alternates in sign from step to step and which increases in magnitudeexponentially. Because Simpson's rule integrates over two intervals, we seethat in (5.9.2) the calculation of y,,+l is based on the value of y, ,L and thusthe successive values of y are somewhat "loosely" connected with eachother. Thus, there are, in a sense, two distinct sequences of y values,corresponding respectively to odd and even subscripts, which may tend todepart from each other, and thus an oscillation of the calculated solutionabout the true solutions begins to appear. Milne and Reynolds [21] haveshown that an occasional application of Newton's "three-eighths" rule(2.3.6) will effectively damp, out the unwanted oscillation without harmto the desired solution. Other methods of dealing with the stabilityproblem have been discussed by Mime and Reynolds [22j and Hamming[I1].

Page 159: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Adams' Method 147

By contrast the simple predictor-corrector method of Section 5.7 uses(5.7.4) to calculate y,,+z from the immediately preceding ordinate yn. Thusthe successive values of y are more tightly connected together and insta-bility does not occur.

In the following section we give a method which makes use of moreextended formulas of integration but which bases the calculation of yn,ron y and hence does not exhibit the instability of Milne's method.

5.10 ADAMS' METHOD

In deriving formulas for obtaining starting values of the solution of adifferential equation, we began with (5.8.3), approximating the derivativeby means of Stirling's interpolation formula in one case, and by means ofNewton's forward interpolation formula in another case. The formulasobtained gave the ordinates in terms of derivatives which were ahead of theordinates being calculated and therefore only known approximately. Torectify this situation it seems desirable to approximate the derivative inquestion by means of Newton's backward formula to obtain a formula forthe ordinate in terms of derivatives at previously calculated points.

We begin with the obvious formula analogous to (5.8.3), namely

,4+h

yn+1 = yn + y'(x) dx. (5.10.1)x

We use Newton's backward interpolation formula (1.4.6) launched fromy to approximate y'(x) by a polynomial which assumes the calculatedvalues at x0, x,I, xn_Q, - - . We let s = (x - xn) Jh and substitute theresulting polynomial in (5.10.1), obtaining

s a , (s + 2)(s + 1)s $y ,1 (s + 1)D

2in +

6n

+ (s + 3)(s2

2)(s + I)s04yn,

+ , .. ds. (5.10.2)

Carrying out the integration yields the formula

Y+1=yw+h(yn'+ivyn'+ 'CEO yn +(5.10.3)

If this formula is truncated to a suitable number of terms, it may be usedfor carrying on a step-by-step solution of differential equation after theappropriate number of starting values h:=.s been obtained. This methodis known as Adams' method.

Page 160: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

148 Solution of Ordinary DiUerential Equations

In particular, if we wish to obtain accuracy at each step comparable tothat obtained by use of Milne's predictor formula (5.9.1), whose error isobtained from (2.5.6), it will be necessary to retain third differences in(5.10.3). Here it will be necessary to have the starting values yo, yl, y$, ysfrom which we can obtain the corresponding values of the derivatives fromthe differential equation. We then form a difference table from the valuesof the derivatives and calculate y4 from (5.10.3). The value of y* is addedto the table and another line of differences formed. The procedure isrepeated, advancing the solution a line at a time.

If we do not want to make use of differences, the formula may bewritten in terms of the ordinates themselves. Thus if third differences areretained, we obtain from (5.10.3) the formula

y..+1 = yn + 24 (55y.' - 59yn-1 + 37y;, -a - 9y;.-s) (5.10.4)

Although the step-by-step solution can be carried forward as describedusing either (5.10.3) or (5.10.4), it is desirable as in Milne's method to havea formt<ula to use as a corrector for the values of yn+1

To obtain such a formula we again start with (5.10.1) and again makethe substitution s = (x - but in using Newton's backward formulawe launch it from instead of from y,,'. Substitution in (5.10.1) yields

1f -yn+1 = Y. + hJo 1 yn+1 + (s -' 1) Osiln+l

+ (s + 1)ss(s - 1)qsy+.+1 +

(s + 2)(s

24

1)s(s - 1)v4yn+1 + .. ds.

6 (5!.10.5)

Carrying out the integration yields the formulalv2 ,yn+1 = Y. + h(yn+1 - 1oyn+i - 18 yn+1

-- 4V Y,+1 -This formula suitably truncated may also be written in terms of the

ordinates themselves. Thus if third differences are retained, we obtainfrom (5.10.6) the formula

Y.+1 Y. + 24(9yn+1 + 19yn' - 5y.-1 + y;.-2) (5.10.7)

In the modified Adams' method we may predict a value of yx+i by meansof (5.10.4), use the differential equation to calculate the derivativeand then use (5.10.7) to obtain a corrected value of y,,.1. This in turn maybe used in the differential equation to obtain an improved value of y;,+1

Page 161: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Ra,ge-Kutta Method 149

and (5.10.7) used again. This cycle is repeated until no further changeoccurs.

If we want to use (5.10.3) suitably truncated, then, after predictingy, .1 and calculating y' +1 from the differential equation, we will have toextend the difference table tentatively so that (5.10.6) suitably truncatedcan be used to correct y,,+l. Then y' +l must be recalculated from thedifferential equation and the last line of the difference table suitablyrevised and the cycle repeated until no further change occurs.

In deducing (5.10.4) from (5.10.3), the first neglected term was(; f Since it is not difficult to show that in general V'f (x)Is'f c'(x), the error in (5.10.4) can be shown to be approximately (-)hsy".In a similar manner, the error in (5.10.7) can be shown to be approximately.-(, o)h5y . Thus the error in (5.10.4) is approximately thirteen times theerror in (5.10.7) and of opposite sign. Hence the magnitude of the errorin the corrected value will be approximately the magnitude of

xa(yn+1 '

where Vw+l denotes the predicted value calculated by (5.10.4). Thus, asin Milne's method, tabulation of the quantity y,a+l -- providesa useful indication of the error in each step of the method.

We remark that the error in Milne's corrector formula (5.9.2) is of thesame order as that in the modified Adams' corrector formula (5.10.7),but that in Milne's method the coefficient (9 ) is only about 40 per cent ofthat in the modified Adams' method (,o).

if we repeat example 18, using Adams' method in place of Milne'smethod, the results are practically the same as shown in Table 5.4. Noresult differs by more than two units in the fifth decimal place, and it isfound that the predicted and corrected values in Adams' method are equalso that the column y - y is zero here.

5.11 RUNGE-KUTTA METHOD

In the preceding two sections we have discussed step-by-step methods ofcarrying on the numerical solution of the problem

y' = AX, y), y(x0) = yo (5.11.1)

after a suitable number of starting values have been obtained. Methods forobtaining such 'starting values were described in Section 5.8. One of the$emethods depended on the expansion of the solution in a Taylor's seriesof the form

m 5.11.2y1=y(x0+h)=yo+hyo'+h2l $

i,0 +h$31ye + "

. ( )

Page 162: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

150 Solution of Ordinary Differential Equations

The coefficients of this Taylor's series were expressed in terms of thefunction f (x, y) and its partial derivatives. It was observed that thecalculation of these partial derivatives may become difficult or tedious.The methods associated with the names of Runge, Kutta, and otherseffectively replace the result of truncating the Taylor's series by formulaswhich involve combinations of the values off (x, y) at certain points nearthe starting point (xo, yo). These formulas are designed in such a way thatif they were expanded in powers of h, the coefficients of a certain number ofthe leading terms would agree with the corresponding coefficients of theTaylor's series (5.11.2).

One of the more useful of these methods, due to Kutta, but usuallyreferred to as a Runge-Kutta method, may be described by means of thefollowing formula :

whereyj = yo + Q{ko + 2k, + 2k2 + ka), (5.11.3)

ko = hf (xo, yo)

ki = hf (xo + hh, yo + jko)k2 = hf (xo + jh, yo + 1k,) (5.11.4)

ks = hf (xo + hi, yo + k2).

This formula is of fourth-order accuracy, for it can be shown that itagrees with the Taylor's series expansion up through the h4 term. It is ofinterest to note that this formula would reduce to Simpson's rule if f wereindependent of y. We omit the proof of this formula as it is straightforwardbut tedious. It is only necessary to expand k1, k2, ka in powers of h, sub-stitute in (5.11.3), and compare the coefficients of the powers of h withthe corresponding coefficients in (5.11.2).

One of the advantages of the Runge-Kutta method is that it is self-starting and hence may be used at the beginning of the solution. Thesolution may then be carried on with the Runge-Kutta method, making inthe formulas (5.11.3) and (5.11.4) the obvious substitution of (x,,, y;,) for(xo, yo) and yn+x for y1. Alternatively, after a suitable number of startingvalues have been obtained by this method, the solution may be continuedby means of a predictor-corrector method such as that of Adams or Milne.Since the Runge-Kutta method is self-starting, a change in spacing iseasily effected at any intermediate stage of the calculation. Other methodsrequire special restarting procedures when the spacing is changed atintermediate stages. Another advantage of the Runge-Kutta method isthat the evaluation of derivatives of.f x, y) is not required, and so it maybe used whwa f(.;, y) is not given by an analytical e u-ression. A dis..advantage of the method is that each step in the calculation requires

Page 163: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Systems of Equations 151

several evaluations of f(x, y) and this may be excessively laborious. Also,the estimation of errors is more difficult than in the previously describedmethods.

Example 19. Use the Runge-Kutta method to obtain the solution of

y' = x2 - y, y(0) = lfor x-- 0.1 and x=0.2.

Starting from the point (0, 1), we have from (5.11.4) ko = --0.1, kl =-0.09475, k2 = 0.09501, k3 = -0.08950. Then

yr = I + e[-0.1 + 2(-0.09475 - 0.09501) - 0.08950]= 0.90516.

Next we start from (0.1.0.90516) and obtain ko = - 0.08952, kl =-0.08379, k2 = -0.08408, k3 = -0.07811. Then

ys - 0.90516 + ',,[-0.08952 + 2(-0.08379 -- 0.08408) - 0.078111. = 0.82126.

5.12 SYSTEMS OF EQUATIONS; EQUATIONSOF HIGHER ORDER

In the previous sections we have developed and illustrated numericalmethods for the solution of a single differential equation of first order.The extension to systems of first-order equations and to equations ofhigher order involves relatively little that is new. We shall first indicatethe procedure for a system of two first-order equations. The extension tomore than two such equations will then be obvious.

We consider the systemy' = AX, y, z) (5.12.1)Z' = g(x, y, z)

with y = yd and z = zo when x = xo. The solution can be started by theuse of Taylor's series (or otherwise) as described in Section 5.8. A Taylor'sseries can be obtained for each of the functions y and z. Any of thepredictor-corrector methods previously described can then be used tocontinue the solution. For example, if Milne's method is used, we wouldhave the two predictor formulas

yn+ = yn-,s + 3h (24-2 - Y -1 + 2yn') (5.12.2)

and

zri+i = z+r-s +4

(2z;,-2 - zn-i + (5.12.3)

Page 164: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

152 Solution of Ordinary Differential Equations

From the system of differential equations we obtain the values y;,+1 =f(x+* 1, and'x;,+1 = g(xn+1) yA+v zn+1) We then obtain correctedvalues of and by means of the formulas

h(5.12.4)

and

z,.+l = x---I + 3 4z..' + 2.1+,)- (5.12.5)

Again the application of the correction formulas may be repeated ifdesired.

It was pointed out in Section 5.1 that a single differential equation oforder higher than the first can always be replaced by an equivalent systemof first-order equations. Thus the numerical solution of higher-orderequations is a special case of systems of first-order equations. Since theequivalent system of equations assumes a particularly simple form, there isa slight simplification in the application of the predictor-corrector methods.We illustrate the situation by considering an equation of second order

y" = f (z, y, y) (5. 12.6)

with y(xo) = = yo and y'(xo) = yo'. We make the substitution y' = z so thatthe equivalent system of equations is seen to be

y'=z(5.12.7)

z'=f(x,y, z)

with y = yo and z = yo when x = xo. The solution can again be startedby the use of Taylor's series (or otherwise). To continue the solution, apredictor formula can be used to obtain a value of z from the values ofz' or y", but since y' = z it is obviously unnecessary to use the predictorto find a value for y. For example, with Milne's method we would use thepredictor formula

z,, _3 +4h3

(2x.,-8 - z'__j +

that is,

911+1 =

3y1,1 + 2yn"),

whereas to obtain a value for y we would use

yn+z = y.-1 +h

3(y'-,L + 4y.' + y t+i)

(5.12.8)

(5.12.9)

Page 165: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Systems of Egaatioes 153

We would then balculate E;,+1 = yn+i from the differential equation andthen use the formulas

or

zn+l z,-1 +3

(xnyl + 4z,,' + zri+1),

(5.12.10)

and

yn+1 = yn-1 + 4y.' + yn+1) (5.12.11)

The application of the last pair of formulas may be repeated if desired.

Fsample 20. For the differential equation

y" =y+2J', y(0) = 1, y(0) = 0

find the solution up to x = 0.6 at intervals of 0.1.We choose h = 0.1. We shall apply MiIne's method after we have

obtained the solution at x = 0.1, 0.2, 0.3 by means of Taylor's series.From the given equation we obtain

y" = y + 2xy', y" = 3y' + 2xy", yt° = 5y" + 2xy',

y° = = 7y`7 + 2xy,

yvi = 9yiv + 2'yv .

Hence with xo = 0 we have

yo = 1, yo' = 0, yo" = 1, yo = 0, yoiV = 5, yo = 0, yogi = 45,

Thus, if we remember that h = 0.1, we obtain

y,=1+ (2)(10),+24`1014+ t6I110)6+...

(3

(%5

/' 10+610) +810+..

Setting s = 1, 2, and 3 we obtain

yl = 1.0050, y2 = 1.0203, ys = 1.0467,

yi = 0.1008, y2 = 0.2068, y3' = 0.3234

to four places. From the differential equation we find that

yl" = 1.0252, y2' = 1.1030, yg" = 1.2407.

All of these values are shown in Table 5.5.

Page 166: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

154 Solution of Ordinary Differential Equations

We are now in a position to continue the solution by the use of theMilne predictor and corrector formulas. First a predicted value 94' iscalculated from equation (5.12.8) and then a value of 94 is obtained from

TABLE 5.5Mime's Method

Solution of y" = y + 2xy', y(0) = 1, y'(0) = 0

91 91 Y Y Y Y' - y'

0.0 1.0000 0.0000 1.00000.1 1.0050 0.1008 1.0252

0.2 1.0203 0.2068 1.10300.3 1.0467 0.3234 1.2407

0.4 1.0856 0.4572 1.4514 1.0856 0.4574 1.4515 0.0002

0.5 1.1390 0.6166 1.7556 1.1390 0.6168 1.7558 0.0002

0.6 1.2102 0.8123 2.1850 1.2102 0.8127 2.1854 0.0004

equation (5.12.9). Next y4" is calculated from the differential equationand (5.12.10) and (5.12.11) are used to obtain corrected values y4' and y4respectively. The same method is used to carry the calculation on tox = 0.5 and x = 0.6. The column exhibiting y' --- g' shows that the errorin each step is very small indeed. The solution is tabulated in Table 5.5.

Page 167: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

chapter 6 Fourier series

6.1 INTRODUCTION

In many scientific problems, periodic functions are encountered. Afunction f (x) is said to be periodic with period p if f (x + p) - f (X) for allx. For example, the functions sin x and cos x both have period 27r. Forperiodic functions, it would be inappropriate to use polynomial approxi-mations as in Chapters 1 and 2. It seems preferable to seek to approxi-mate general periodic functions by sums of periodic functions such assines and cosines. In this connection it will be recalled that in Section5.3 we solved nonhomogeneous differential equations whose right mem-bers involved (among other functions) sin mx and cos mx. The methodwas quite easy and we might expect to use the same method for dif-ferential equations in which the right member is a general periodic functionif this general function could be expressed as a sum of terms each of theform sin mx or cos mx.

We therefore consider the possibility of expressing a periodic functionin the form of a series

f (x) = Ja0 + I (a,, cos nx + b sin nx) (6.1.1)n.1

where the factor j in the first term is introduced for convenience, as willbe seen later. We are here assuming that f(x) has a period 27r. Suchseries were used in the nineteenth century by Fourier in the study of heatconduction problems and are usually called Fourier series. They were,however, used even earlier, in the eighteenth century, by Daniel Bernoulliwho used them to solve certain problems connected with vibratingstrings.

155

Page 168: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

156 Fourier Series

6.2 CALCULATION OF THE COEFFICIENTS

To obtain expressions for the coefficients a and b in the expansion(6.1.1), the following definite integrals will be needed. In these formulasm and n are assumed to be integers.

os mx cos nx dx = 0, m # n (6.2.1)Fr. c= 7r, m = n 0 0 (6.2.2)

=27r, m = n = 0 (6.2.3)

J-.

=7r, m=n00 (6.2.5)

sin mx sin nx dx = 0, m 0 n (6.2.4)

sin mx cos nx dx = 0. (6.2.6)

These formulas may be proved by methods of the elementary calculus.Because of the periodicity of the integrands, it is clear that the interval ofintegration which is from -7r to 7r may be replaced by any interval oflength 27r.

If we now assume that the series (6.1.1) can be integrated term by termfrom -7T to IT, we find at once that

dx = }ao(27r) + 0

on making use of (6.2.3), (6.2.1) with m = 0, n 5A 0, and (6.2.6) withm00,n=0. Thus

ao = 1 f(x) dx.ir

_" (6.2.7)

Next we multiply both sides of equation (6.1.1) by cos nx and integratefrom -7r to 7r, again assuming that termwise integration is justified. Weobtain

f (x) cos nx dx = 0 + a, (7r) + 0

on making use of (6.2.1), (6.2.2) and (6.2.6). Thus

a,a = 1 f(x) cos nx dx. (6.2.8)7r -r

In a similar manner, multiplying both sides of equation (6.1.1) by sin nxand integrating we obtain

b = 1 f"f(x) sin nx dx. (6.2.9)7r x

Page 169: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Examples of Fourier Series 157

We note that (6.23) can be obtained by setting n = 0 in (6.2.8) and neednot be listed separately. For this reason, }a0 was introduced in (6.1.1).

If we assume that the function f(x) is integrable over the interval(-?r, ?r), the coefficients a and b can always be calculated by formulas(6.2.8) and (6.2.9). We may then associate the series which appears onthe right side of (6.1.1) with the function f(x). There is no guarantee,however, that this series is convergent, or even if convergent, that its sumis fix). Fortunately for most functions f(z) which arise in practicalproblems, it is true that the Fourier series does represent the function in asuitable sense.

Most functions which- arise in practice are either continuous or haveonly finite discontinuities. As in Section 5.6, we say that a function f (z)has a jump discontinuity or a finite discontinuity at a point xQ if the right-and left-hand limits

lim f (xo + h) and lim f (xo - h)4-01

both exist but are not equal. Thus a finite discontinuity is represented bya finite gap or jump in the graph of the function.

We state without proof the following theorem of Dirichlet which issufficient to cover most situations which arise in practical problems.

THEOREM. If f(x) is a bounded function. of period 27r, and if in any oneperiod it has at most a-finite number of maxima and minima and a finitenumber of discontinuities, the Fourier series of f(x) converges to f(x)at all points where f(x) is continuous and converges to the average of theleft- and right-hand limits off (x) at each point where f (x) is discontinuous.

It should be remarked that because of the hypothesis on f(x) in thistheorem, all of the discontinuities of f (x) must be finite discontinuities.

6.3 EXAMPLES OF FOURIER SERIES

In this section we construct the Fourier series of various functions. andpoint out certain interesting properties of the expansions.

Example 1. Expand the function

f(x)=x, --7r<x<7Tin a Fourier series.

We note that this is an odd function, that is, f (-x) = -f(x). Sincecos n(-x) = cos nx, the function cos nx is an even function. Consequentlyx cos nx is an odd function, and since the integral of an odd function over asymmetric interval is obviously zero, we see at once that aA = 0 for all n.

Page 170: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

158 Fourier Series

I V/ i

-3wr /-21r -ir

f

x

/'2w 3a x

Also x sin nx is similarly seen to be an even function, and if we takeaccount of the symmetry of its graph about the y-axis we see that

2 x sinnxdx1- xsinnxdx= - fo"77 -s Tr

2[-x cos nx + sin nx]° = -2cos nor = 2

7r L n n2 o n nThus

2( = 1 - . .1 n+i sin nx = 2 'sin x - sin 2x + sin 3x- .xf )

) -"-1 n 2 3

By the theorem of Dirichlet, we know that this series converges to x for-7r < x < rr. Since the series is periodic with period 27r it must convergeto the periodic extension of f (x) for values of x outside of this interval.The graph of this periodic extension is shown in Fig. 6.1. Note that theFourier series converges to 0 for x = - - , -37r, --7r, ir, 37r, - , and thusconverges to the average of the left- and right-hand limits of the extendedfunction. Specifically we can say that

0° +1 sin nx2 (-1) x, -7r<x<lr

nmi n=x-27r, it<x<31r=x+27r, -31r<x<-n=0, x=(2m+1)7r, m=0,,±1,±2,

Example 2. Expand the function

f(x)= 0, -?r<x<01, 0<x<7r

in a Fourier series.

Page 171: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Examples of Fourier Series

We have

1PC

an= -I- cosnxdx= 1, n=07r.o

=0, n00.

b = 1 Ji sin nx dx = -1 cos nx7r 7rn

Thus

n odd. 2

irn

n even.= 0,

1 2 (sin x sin 3x sin 5xAX) =

1 2 ' sin (2n + 1)x2+ir,o 2n+1

159

It is instructive to study the extended function in order to see why so manyof the coefficients of the Fourier series are zero. The graph of the extendedfunction is shown in Fig. 6.2.

It is clear from (6.2.7) that the constant term in a Fourier series isalways the average value of the function. Here it is J. The graph is readilyseen to be symmetric with respect to the point (0, }) and consequently thefunctionf(x) - I is an odd function. For this reason all an for the latterfunction must be zero as in example 1. It is also interesting to observethat the graph of the extended function is symmetric about the line z = it/2.Since the graphs of y = sin x, sin 3x, possess the same symmetry butthose of y = sin 2x, sin 4x, do not, it is not surprising that the latterfunctions do not appear in the series expansion.

f

I

-31r -21r -Ir 0 in 2u 3ar

Fig. 6.2.

Page 172: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

160

Example 3. Expand the function

f(x) = lxl, --7r < x < rr

Fourier Series

in a Fourier series.Since this is an even function, that is, f(-x) = f(x), it follows that

f(x) sin nx is an odd function and hence b = 0 for all n. Then

1 IxIcosnxdx=? xcosnxdx= ir, n = 0Or r. it 0

2rx sin nx + cosnxls = -4 n oddar n

na

o zrn

Hence= 0, n even 0 0.

f(x) = Ir cos (2n + 1)z2 it ,,-o (2n + 1)2

Example 4. Expand the function

f(x)=-1, --1r<x<0_+1, 0<x<it

in a Fourier series.Since this is an odd function it follows that f (x) cos nx is an odd function

and hence a = 0 for all n. Then

b - 1 (--1) sin nx dx + 1 5:1 . sin nz dx

= 2

J0sin nx dx =2 cos nx

o=n 1] = 0, n even

= 4, n odd.

IrnHence

f(x) 4 sin (2n + 1)x=zr w-0 2n -4. 1

Again note that this series converges to 0 for x = 0, f?r, ±2ir, , thisbeing the average of the left- and right-hand limits at these points ofdiscontinuity.

Example S. Expand the function

l(x) _ --?r, --9r < x < 0

=x, 0<x<lriii a )Fourier series.

Page 173: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Half Range Series 161

This function possesses no obvious symmetry. We find at once that

1 rro 1an=-J -ircosnxdx+ - xcosnxdx. o

n=0

n odd

= 0, n even 54 0.

1 ° 1 r'bn = - -Tr sin nx dx + -

Jx sin nx dx

IT -r IT o

1 - 2 cos mr 1 - 2(--1)ns =n n

Hence

AX) = -yr - 2 cos (2n + 1)x + : 1 - 2(--1)n

sin nx.4 IT n-o (2n + 1? ,.-i n

6.4 HALF RANGE SERIES

In examples 1 and 4 we encountered an odd function, and we observedthat an = 0 for all n. This will be true whenever f (x) is an odd function.Here,

bn=2 f"f(x) sinnxdxa

W

(6 .4.1)

AX) = T b sin nx. (6.4.2)n-1

Thus for any f(x) defined only in (0, 1r), the equations (6.4.1) and (6.4.2)may be used to find a Fourier sine series of period 21r, which representsf(x) in (0, rr). The use of these formulas means that f(x) has been extendedto form an odd function of period 21r. If f (z) satisfies the conditions ofDirichlet's theorem, the series (6.4.2) with coefficients calculated by (6.4.1)will represent the extended odd periodic function and hence will representf(x)in0<x<nr.

In example 3 we encountered an even function and we observed thatb = 0 for all n. This will be true whenever f(x) is an even function.Here,

a = 2 fixcos nx dx (6.4.3)

Page 174: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

162

and

Fourier Series

f(x) = Lo + i an cos nx. (6.4.4)2 n-l

Thus for any f (x) defined only in (0, 7r), the equations (6.4.3) and (6.4.4)may be used to find a Fourier cosine series of period 2a which representsf(x) in (0, 4r). The use of these formulas means thatf(x) has been extendedto form an even function of period 27r. If f(x) satisfies the conditions ofDirichlet's theorem, the series (6.4.4) with coefficients calculated by(6.4.3) will represent the extended even periodic function and hence willrepresent f (x) in 0 < x < ir.

As an example, suppose it is desired to represent the functionf(x) = xin 0 < x <7r. The Fourier sine series is just the series of example 1 andthe Fourier cosine series is just the series of example 3.

6.5 CHANGE OF INTERVAL

If the function f(x) has period 2L instead of 2ir, a change of variablex' = TTXJL may be used to change an interval of length 2L into one oflength 21r. The formulas (6.1.1), (6.2.8), and (6.2.9) then take the form

= 1 ao -} l a cos b" sinn7rx

00

2 n=1 L Lwith

f'ixi cosx

dx,

1L

bnL ,I -Lf(x)

sin nL dx.

(6.5.1)

(6.5.2)

(6.5.3)

Sincef(x) has period 2L, the interval of integration in these two formulasmay be replaced by any interval of length 2L.

Similar remarks apply to the half-range series; it seems unnecessary towrite down the obvious modifications of formulas (6.4.1)-(6.4.4).

6.6 APPLICATION OF FOURIER SERIES TO SOLUTIONOF ORDINARY DIFFERENTIAL EQUATIONS

In Section 5.3 we discussed the solution of nonhomogeneous differentialequations in which the right member involved sin mx and cos mx. We nowshow how to solve such equations when the right hand member is anarbitrary periodic function.

Page 175: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Application to Ordinary Differential Equations

We consider the second-order differential equation

d 2+Pdx+qy=f(x)

163

(6.6.1)

where p and q are constants and f (x) has period 27r. We assume that f (x)satisfies the conditions of Dirichlet's theorem; therefore, it can be repre-sented by the Fourier series

f (x) = ja0 + I (a,, cos nx + b,; sin nx), (6.6.2)x-l

where an and b,a are given by (6.2.8) and (6.2.9).Using the method of Section 5.3, we find that particular integrals of the

equationsd2y +pdy+qy=a,cosnx

and.

are respectivelyz

yP = q - n a cos nx + np a" sin nx(q - n2)a + napz (q - na)2 + n2p2

and

yg =4np

b cos(q - n2)"2 + naps

Also the particular integral of

2

nx + q - n b sin nx.naps + (q - n2)$

2

dx2+Pdx+4y = 102

is a0/2q. If we apply the principle of superposition we obtain as a particularintegral of (6.6.1) the function

y ao °° ((q - n2)a,, -- npb,, cos nx + npa + (q - n2)bn sin nx,2q ++°F (q n2)2 + n2p2 (q -- n2)2 + n2p2

To obtain the complete solution we must, of course, add the comple-mentary function.

As a further example of the method we discuss the solution of a dif-ferential equation arising in the study of the deflection of a column; (forthe derivation of the differential equation see Hoff [13, pp. 230-232]).The differential equation is

EIyiv + Py" = -Py0" (6.6.3)

Page 176: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

164 Fourier Series

wh=°re E, I, and P are constants and yo is a given function of x. The endconditions are

y = y" = 0 when x = 0, L. (6.6.4)

The complementary function is easily found to be

y, =Acoskx+Bsinkx+Cx+D (6.6.5)where ks = P/EI.

We assume the function yo can be expanded in a Fourier sine series

00 nlrxL

where

Then

2 Lb, =

j y0sinn

dx.L

" = - bn n'rs2

inwx

yon -

nel (L i L

Proceeding as in Section 5.3, we find that a particular integral of thedifferential equation

EIy"v+ Py = Pb nor ,sin n'rx(L1 L

is

where

yV =Pb sin n'rx - b sin (nirx/L)

El (nir - P L n4P$/P - 1

PE irq2is Euler's buckling load. Then by the principle of superposition the par-ticular integral of (6.6.3) is

_ bA sin (mrx/L)Y,+p-.i n2Pv/P - 1

If we add the complementary function (6.6.5) we obtain as the completesolution of (6.6.3)

°O b sin (nvx/L)y=Acoskx+Bsin kx+Cx+D4.I . (6.6.6)A-i nsPz/P - 1

The values of the four constants A, B, C, D must next be determined fromthe boundary conditions (6.6.4).

Page 177: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Heat Equation 16'a

The second derivative of the solution is

y" = -AV cos kx - Bk$ sin kx -. bn(mr/L)2 sin (nnrx/L)

n-i nPF/P - 1(6.6.7)

When x = 0, then y" - 0. Substitution of these values in (6.6.7) yieldsA = 0. Also when x = 0, then y = 0. Substitution of these values in(6.6.6) yields D = 0. Moreover y' = 0 when x = L so that B = 0 unlesssin kL = 0. For certain particular values of k, the function sin kLvanishes. These values of k correspond to certain physical conditions whichwe do not discuss here. (See Hoff [13, p. 228].) For all other values of kwe must have B = 0. Finally y = 0 when x = L so that C = 0. Weconclude that the desired solution of the differential equation (6.6.3 1 is

y _ b,, sin (nirx/L)n-1 n$Pz/P - 1

6.7 SOLUTION OF THE HEAT EQUATION BY MEANSOF FOURIER SERIES

In this section we illustrate the use of Fourier series in the solution ofpartial differential equations, by discussing the solution of the heatequation.

We consider a thin uniform rod of length 7r having its sides thermallyinsulated. There is no loss of generality in taking the length of the rodto be 7r, since any length can be considered to be it if a suitable unit oflength is chosen. We assume that its ends are kept at temperature 0 at alltime t. We assume that the initial temperature is given by a function f (x)where x is the distance from one end of the rod. If we denote the tempera-ture at point x and time t by u(x, t), then u(x, t) satisfies the differentialequation

au = cs aeu

at ax$(6.7.1)

where c2 is a physical constant known as the thermal diffusivity. Moreoveru(x, t) satisfies the initial condition

u(x, 0) = f (x), 0 < x < n (6.7.2)

and the boundary conditions

u(0, t) = 0, u(ir, t) = 0, t Z 0. (6.7.3)

Page 178: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

166 Fourier Series

We begin by seeking a solution of equation (6.7.1) in the form u =X(x)T(t). Substituting this into equation (6.7.1) we obtain

1 dT 1 d2X = -k2.(6.7.4)

c2T dt X dx2

Here k2 is a constant since x and t are independent variables, and we havewritten -k2 because the constant is negative in the case useful for ourproblem. Solving the differential equations which result from (6.7.4) weobtain

u(x, t) = (A cos kx + B sin kx)er-Q'k't

as a particular solution of (6.7.1).We must choose A = 0 to satisfy the first of the conditions (6.7.3). The

second condition (6.7.3) will be satisfied if

BsinklT=O or k=n,where n is any positive integer. Hence

Bne-O2ri9tsinnx, n = 1, 2,3, --

is a set of terms each of which satisfies (6.7.1) and (6.7.3). By superpositionwe see that

u(x, t) = B,ae ` n t sin nx (6.7.5)n-1

also satisfies (6.7.1) and (6.7.3). To satisfy condition (6.7.2) we must have00

u(x, 0) =,I B. sin nx = f(x).n-1

Thus Bn are the coefficients of the Fourier sine series off (x) and may becalculated by means of formula (6.4.1). With these values of B. thesolution of our problem is given by equation (6.7.5).

The series solution (6.7.5) is reasonably convenient for numericalcalculations utilizing high-speed automatic computers. Because of theexponential factors which decrease rapidly, the number of terms requiredfor accurate results is usually not excessive except for t y= 0, but, since theinitial values are given, there is no need to carry out the calculations forthis value of t.

Next we consider a modification of the problem just discussed. Weagain assume that u(x, t) satisfies (6.7.1) and the initial condition (6.7.2),but we change the boundary conditions to

u(0,t)=A, u(ir, t) = B, tZ0 (6.7.6)

where A and B are constants. We show how to reduce this problem to theprevious case. We must make use of the steady-state solution of equation

Page 179: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

The Heat Equation

(6.7.1). Since this is independent oft it will be a solution of

a2u

axe0

167

and consequently will be of the form u = c lx + c2. Thus the steady-statesolution satisfying (6.7.6) is easily seen to be

u+_B-Ax+A.IF

(6.7.7)

If we let UT = u - u it is easily verified that uT satisfies (6.7.1) and(6.7.3) and that (6.7.2) is replaced by

uT(x, 0) = AX) -- B - A x - A. (6.7.8)IT

We have calculated the Fourier sine series of x and i in examples 1 and 4.Using these results we see that if B. and C. denote the coefficients of theFourier sine series off (x) and uT(x, 0) respectively, we have

C"=B"+B-A. 2(-1)n-2A (1-(-1)"). (6.7.9)Tr n rrn

Then the solution of the problem is given by

u(x,t)=B 'Ax+A +ICne sinnxTr n-i

with C,, given by (6.7.9).The methods discussed are rather special and would not solve the more

general problem in which the boundary conditions (6.7.3) are replaced by

u(0, t) = g1(t), u(lr, 1) = g2(t), t Z 0. (6.7.10)

In Chapter 7 we discuss finite difference methods for solving the heatequation, and these methods are applicable to this more general problemwithout appreciable change.

As an example of the use of a Fourier cosine series we consider anothermodification of the heat conduction problem discussed at the beginning ofthis section. We again seek u(x, t) satisfying the equation (6.7.1) and theinitial condition (6.7.2), but for boundary conditions we take

au(0,t)=0, au(ir,=0, tZ0. (6.7.11)ax ax

As before, a particular solution of (6.7.1) is

u(x, t) = (A cos kx + B sin kx)e--°'k't

Page 180: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

168 Fourier Series

Hence8u

= (-Ak sin kx + Bk cos kx)e-°'k't.ax

We must choose B = 0 to satisfy the first of conditions (6.7.11). Thesecond condition will be satisfied if k = n where n is any nonnegativeinteger. Thus

u(x, t) + I °'"ttcos nx (6.7.12)00

2 figs

provides a solution of (6.7.1) which satisfies (6.7.11). To satisfy the initialcondition (6.7.2), we must have

u(x,0).= A°+jA,cosnx=f(x).2 n-i

Thus An are the coefficients of the Fourier cosine series of f(x) and maybe calculated by means of formula (6.4.3). With these values of A. thesolution of our problem is given by equation (6.7.12).

6.8 DOUBLE FOURIER SERIES

We may extend the ideas of Fourier series to obtain an expansion of afunction of two variables in a double Fourier series. We consider afunction f(x, y) having period 2ir in each of its variables x and y. Thenf (x, y) may be expanded in a double Fourier series of the form

M

f(x, y) = +2

a,,, cos mx +2

I a.. cos ny

go

+ I (a,,,,, cos mx cos ny + bma cos mx sin ny (6.8.1)m.n-4

+ cm sin mx cos ny + dm,, sin mx sin ny).

To obtain formulas for the determination of the coefficients in (6.8.1),we proceed as in Section 6.2, making use of the formulas (6.2.1)-(6.2.6).The formulas for the coefficients are easily found to be

amn = -1 f f f'.fx, y) cos mx cos ny dx dy, (6.8.2)irt

bmn =1$ f(x, y) cos mx sin ny dx dy, (6.8.3)

1 fcmn = _-, ,f (x, y) sin mx cos ny dx dy, (6.8.4)ir$

= ' f "dmn _ Jf(x, y) sin mx sin nx dx dy. (6.8.5)f 4

Page 181: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Rectangular Plate Problem 169

We do not attempt a discussion of the conditions under which the series(6.8.1) converges to f (z, y). We remark only that conditions similar tothose encountered in the single series case but somewhat more restrictiveare sufficient to ensure convergence. For most functions which arise inpractical problems, the series does represent the function in a suitablesense.

As in the single series we may consider half-range series which representthe given function f(x, y) in the square bounded by the lines x = 0, x = 7r,y = 0, y = 9r. There are four possibilities to consider but we confineourselves to the case in which the function is to be expanded in a puresine series. This means that we extend the function f(x, y) to be an oddfunction in both x and y and also make it periodic with period 27r in bothvariables. We then have

f(x, y) _ d,y,n sin mx sin ny (6.8.6)m n=1

with4 p

dmn = g fff(x, y) sin mx sin ny dx dy. (6.8.7)'Vf

The remarks in Section 6.5 concerning change of interval are applicableto the double Fourier series case with the obvious modifications.

6.9 APPLICATION OF DOUBLE FOURIER SERIESTO A RECTANGULAR PLATE PROBLEM

We consider a rectangular plate in the xy-plane bounded by the linesx = 0, x = a, y = 0, y = b. A load q = q(x, y) is assumed to be dis-tributed over the surface of the plate. Then the differential equation forthe deflection w = w(x, y) is found to be

a4w 0'14W awax4+2 &00ys+ay4 D

where D is a physical quantity called the flexural ridigity of the plate.If the edges of the plate are simply supported, the boundary conditions are

zw=0,=0 for x=0 and x=aaX2

Q (6.9.2)w=0, QQ =0 for y=0 and y=b.

yBefore considering the case of a general load we examine the special

case in which

q = qo sin'rx sin 'ry (6.9.3)a b

Page 182: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

170 Fourier Series

where qa denotes the intensity of the load at the center of the plate. It isclear that all boundary conditions (6.9.2) are satisfied if we take for thedeflection the expression

w = C sin 7T sin (6.9.4)b

in which C is a constant that must be chosen so that w will satisfy equation(6.9.1) with q given by (6.9.3). If we substitute (6.9.4) into equation (6.9.1)we find that

2

4(a2+b2)C D.

Solving for C we find that the solution of this special problem is given by

W= qo sin 'x sin -y . (6.9.5)

b2

a b

If the sinusoidal load distribution is given by

q = qo sin m7rxsin

n1ry-a b

where m and n are integers then, proceeding as above, the deflection isgiven by

w = qo sin m'rx sinn-ry

. (6.9.6)7r4D

m+n22 a b

(a2 b2

Turning now to the problem with a general load q(x, y), we representthe load function in the form of a double Fourier series

°° mrrx n1ry-q(x, y) _ I d, sin .inm,n=1 a b

with_ 4 minx

sinnary dxdmn

ab ooq(x, y) sin

a bdy.

Thus the given load is represented as a sum of partial sinusoidal loadings.The deflection produced by each partial loading was discussed earlierand the total deflection will be obtained by summation of such terms ofthe form of (6.9.6). Hence we obtain

1 dmn, marx . n7ryw in sin - .

r4D m,n-1(m$ +

ba)2 a b

Page 183: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Two-Dimensional Heat Conduction Problem 171

6.10 THE TWO-DIMENSIONAL HEAT CONDUCTION PROBLEM

In Section 6.7 we discussed the heat conduction problem in one spacedimension. We now consider a similar problem in two space dimensions.

We consider a plate in the xy-plane bounded by the lines x = 0, x = a,y = 0, y = b. We assume that its faces are thermally insulated and thatits edges are kept at temperature 0 at all times t. We assume that the initialtemperature is given by a function f (x, y). Then the temperature u(x, y, t)satisfies the differential equation

at (ax2 + a)) (6.10.1)

where c2 is a physical constant. Moreover u(x, y, t) satisfies the initialcondition

u(x, y, 0) = f(x, y), 0<x<a, 0 < y < b (6.10.2)

and the boundary conditions

u(0, y, t) = 0, u(a, y, t) = 0,t Z 0 (6.10.3)

u(x, 0, t) = 0, u(x, b, t) = 0.

As in Section 6.7 we find that a simple solution of equation (6.10.1) whichsatisfies the boundary conditions (6.10.3) takes the form

narysin m,rxsin ---

where

2Smn

2 n2,r2 jma2 -}- b2

a b

m, n, integers.

By superposition we see that

°° 8

u(x, y, t) _ Dmne ` ° "'"t sinmirx

sinnay

m,n=1 a b(6.10.4)

also satisfies (6.10.1) and (6.10.3). To satisfy the initial condition (6.10.2)we must have

rrx nfyu(x, y, 0) _ D,, sin

msin = f (z, y).

m.n-1 a b

Thus Dmn are the coefficients of the double Fourier sine series of f(x, y)and may be calculated by the formula

4 a a

Dmnb o f f (x, y) sin ma x sin nby dx dy.

a

Page 184: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

172 Fourier Series

As a further example of the use of Fourier series we consider the two-dimensional steady-state heat conduction problem. Since the temperatureu(x, y) is now independent of time the differential equation (6.10.1)reduces to

a2u a2u

ax2 + aye

=0 (6.10.5)

which is thefamiliar Laplace's equation. We again consider the plate to bein the ary-plane bounded by the lines x = 0, x = a, y = 0, y = b. Weassume its faces to be thermally insulated, but to consider a nontrivialproblem we change the boundary conditions since the boundary conditions(6.10.3) would lead to an identically zero steady-state temperature. This isevident on physical grounds and also follows from equation (6.10.4) byletting t become infinite. For our example we impose the boundaryconditions

u(0, y) = 0, u(a, y) = 0,

(6.10.6)

u(x, 0) = 0, u(x, b) = f (x).

There is, of course, no initial condition as the solution is independent pftime.

As in Section 6.7, we assume a solution in the form X(x) Y(y) and findthat a simple solution of equation (6.10.5) which satisfies the first three ofthe boundary conditions (6.10.6) takes the form

B. sin nix sinh "y , n = integer. (6.10.7)a a

By superposition we see thatnirx Mr, yu(x, y) = B,, sin --- sinh

r.=1 a a

also satisfies (6.10.5) and the first three conditions (6.10.6). To satisfythe fourth boundary condition we must have

u(x, b) _ B. sin mr -x sinhnurb-- = f(x).

nsi a a

Thus if b,, are the coefficients of the Fourier sine series of f(x), then

B = bnn

nurbsinh '

aSubstitution of these coefficients into equation (6.10.8) yields the desiredsolution of the problem.

Page 185: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

chapter 7 Numericalsolution of partialdifferentialequations

7.1 INTRODUCTION

In Chapter 6 we made use of Fourier series to obtain the solution ofcertain problems involving partial differential equations, such as, forexample, the problem of heat conduction. It was pointed out that themethod described is rather special and would fail in many problems inwhich the boundary conditions are more general than those u$ed in tteexamples discussed or in which the differential equations are more general.In this chapter we describe numerical methods of solution which will besuitable for problems of the general type as well as for the more specialproblems of Chapter 6.

We begin by describing three typical problems which are representa-tive of the three types of differential equations which may be encountered.

Consider a rigid wire whose orthogonal projection on the zy-planeis a simple closed curve C. This frame contains an ideal elastic membraneof uniform density under uniform tension. Let u(x, y) denote the deflectionof this membrane measured from the xy-plane. Under suitable physicalassumptions it can be shown that u(x, y) satisfies Laplace's differentialequation u,a u,,,, = 0 in the interior R of C. The values of u on theboundary C are the prescribed deflection f of the wire frame. Thus u isa solution of the problem

u.. +ui,,,=0inR, u=f on C. (7.1.1)

This is often called Dirichlet's problem for Laplace's equation.

173

Page 186: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

174 Partial Differential Equations

As a second example we consider the longitudinal vibrations of a long,straight rod of small cross section, which coincides with the x-axis. Letu(x, t) denote the displacement at time t from the rest position of thepoint which, at rest, has the abscissa x. If u(x, t) is small and if the unitsare suitably chosen, then u is a solution of the wave equation utt - u, = 0.We may expect the displacement u to be uniquely determined if the initialdisplacement u(x, 0) and the initial velocity ut(x, 0) are prescribed. Thusfor t > 0, u is a solution of the problem

utt - 0 fort > 0, u(x, 0) - fix), ut(x, 0) = g(x) (7.1.2)

where f(x) and g(x) are prescribed functions. This is an example of aninitial-value problem or "Cauchy's problem" as it is sometimes called.

As a third example we consider a heat conduction problem. We con-sider a straight infinite rod of small cross section which coincides withthe x-axis. Let u(x, t) denote its temperature at the point x and time t.We assume that the rod is thermally insulated and that the initial tempera-ture u(x, 0) is known. Then the differential equation that ideally governsthe flow of heat is ut - u,. - 0, provided the units are defined properly.Thus u is a solution of the problem

ut-u==0fort>0, u(x,0)=f(x). (7.1.3)

Once again we have an initial-value problem.Both of the problems (7.1.2) and (7.1.3) may be modified by restricting

x to lie in a finite interval a S x s b. Here the values of u are prescribedon the boundaries x = a and x = = b. Thus we add to the conditions statedin (7.1.2) or (7.1.3) the boundary conditions

u(a, t) = hl(t), u(b, t) = h$(t) (7.1.4)

where hl(t) and h2(t) are prescribed functions of t.Examination of problems (7.1.1)--(7.1.3) reveals that different subsidiary

conditions are associated with each of the three differential equations.It can be shown that no permutation of the subsidiary conditions leads to awell-posed problem. For this reason partial differential equations canbe classified according to the type of subsidiary conditions that must beimposed to produce a well-posed problem. This classification can bedescribed in a particularly simple manner for second-order linear differen-tial equations in two independent variables. The most general differentialequation of this type is

+G-0with coefficients that are functions of x and y only. This equation is calledelliptic, hyperbolic, or parabolic according as the quantity AC - B$

Page 187: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Hyperbolic Equations 175

is positive, negative, or zero. It is clear that Laplace's equationu, + ui,,, - 0 is elliptic, that the wave equation u. = 0 is hyperbolic,and that the heat conduction equation ut - ux = 0 is parabolic. In moregeneral equations than these three, it may happen that the type is differentin different parts of the xy-plane. For example, the differential equationU. + yuyy = 0 is elliptic for y > 0, hyperbolic for y < 0, and parabolicfor y = 0.

It can be shown that the subsidiary conditions imposed in (7.1.1)-(7.1.3)will generate well-posed problems also when combined with more generaldifferential equations of the respective type, but not when combined withdifferential equations of any other type.

In the sections to follow we describe the numerical solution of each ofthese types of differential equations. For simplicity we describe themethods in terms of the simple representative of each type, but the methodsare applicable to more general equations.

7.2 HYPERBOLIC EQUATIONS

We consider the problem defined by (7.1.2), namely

utt - u, , = 0 for t > 0, u(x, 0) = f (x), u f(x, 0) = g(x). (7.2.1)

If F(x) and G(x) are arbitrary twice differentiable functions, it is obviousthat

u(x, t) = F(x + t) + G(x - t) (7.2.2)

is a solution of the differential equation of (7.2.1). The initial conditionsrequire that

F(x) + G(x) = u(x, 0) - f (x)F'(x) - G'(x) = u,(x, 0) = g(x)-

Differentiating the first of these equations, solving for P(z) and G'(x),and integrating we see that

F(x) (e) d + CI1AX)=

2

+ f0,V9

G(x)2[f(x) -

JXg()C2

where Cl and C. are constants of integration. If we use (7.2.2) anddetermine the constant of integration by setting t = 0, we obtain as thesolution of the problem

d . (7.2.3)u(x, t) =

2

1f (x + t) + f (x - t) + 1-f

Page 188: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

176 Partial Differential Equations

This is almost the only initial-value or boundary-value problem of anyinterest that can be solved in such an explicit and elementary manner.

From (7.2.3) we observe that the value of u(x, t) at a point (xo, to)depends only on the initial data on a segment of the x-axis cut off by thelines x + t = constant and x - t = constant that pass through (xo, t0).This segment is called the interval of dependence of the point (xo, to). Con-versely, the set of points (x, t) at which u(x, t) is influenced by the initialdata at a point (xo, 0) is the sector bounded by the lines x + t = xoand x -- t = xo. This sector is called the region of influence of the point(xo, 0). The lines x ± t = constant are called the characteristics of thedifferential equation utt - u,,,,. = 0. The notions of characteristics anddomains of dependence arise also in more general hyperbolic problems.

Since equation (7.2.3) provides a complete solution of the problem(7.2.1), we do not really need a numerical solution of it. Because themethod is easily described in terms of this problem, however, and becausethe method is applicable to more general problems, we proceed to describehow the problem (7.2.1) can be solved using a finite-difference approxima-tion.

In Section 2.2 we obtained a number of formulas for finding approxima-tions to the first derivative of a function. To find approximations for thesecond derivative we may differentiate (2.2. l) with respect to x and then sets = 0, obtaining

f #(xo) ^, h2 (62fo 12 64fo + ...) .

If we omit all terms involving differences of fourth and higher order weobtain the approximation

f"(xo) 1 82fo = A - 2h o2 + f 1

If we proceed in an analogous fashion to obtain approximations to thesecond partial derivatives, we obtain as an approximation to utt = uAthe equation

U(z, t + k) - 2U(x, t) + U(x, t - k)ks

= U(x + h, t) - 2U(x, t) + U(x - h, t) (7.2.4)ha

Here we have taken increments h and k in the x and t directions respectively.We must also replace the initial conditions of (7.2.1) by appropriatefinite-difference approximations. It will not be convenient to replace thefirst derivative by a central difference approximation as was done in Section

Page 189: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Hyperbolic Equations 177

2.2. A one-sided difference is indicated because we want the derivativesat t = 0 and 'U is to be defined only for t > 0. Such an approximation maybe obtained from the definition of the derivative or alternatively bydifferentiating equation (E3.8) with respect to x, setting s = 0 and omittingterms involving differences of second and higher order. We replace theinitial conditions by

U(x, 0) = AX),U(x,

k)k

U(x, 0) = g(x). (7.2.5)

We now limit the variables x and t to a discrete set (x0 + rh, sk) wherer = 0, ±1, ±2, - , s = 0, 1, 2, , and xo is chosen conveniently. Thenonly values of U at points of this set occur in the difference equation. Toshow how the solution can be carried out in a step-by-step fashion, werewrite our equations in the following form:

U(x, 0) = f (x)

U(z, k) = kg(x) + f(x)(726)U(x, t + k) = 2U(x, t) - U(x, t - k)

+22[U(x+h,t)--2U(x,t)+ U(x-h,t)]where 2 = k/h. Since both f(x) and g(x) are given, we know U on theinitial line and can immediately calculate U at the grid points on the linet = k. The third equation of (7.2.6) is then used to calculate the values ofU on the line t = 2k. This is clearly possible because for t = k, the right-hand member involves values of U only on the lines t = 0 and k. Thissame equation can also be used to calculate successively the values of Uat the grid points of the lines t = 3k, 4k, - . . The situation can beindicated graphically by the stencil of grid points that enter into eachapplication of the recursion formula. In Fig. 7.1 a series of such linesare drawn with spacing h in the x-direction and k in the t-direction. Thegrid points are the intersections of these lines and the stencil is indicated bythe heavy dots.

Having explained how the solution of the difference equation problem(7.2.6) can be calculated, it is important to consider whether the solutionthus found approximates the solution of the differential equation problem

kh

t-k

x-h x x+h

Fig. 1.I. Stencil of grid points for hyperbolic equation.

Page 190: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

178 Partial Differential Equations

(7.2.1). For any function U(x, t) with second derivatives, the differencequotients in (7.2.4) and (7.2.5) will tend to the corresponding derivativeswhich appear in the differential problem (7.2.1) as h and k tend to zero.It does not follow that the solution of the difference problem for U willalways tend to the solution u of the differential problem as h and k tendto zero. It can be shown [7, pp. 24-261 that if A S 1, then indeed U(x, t)tends to u(x, t) as h and k tend to zero. We omit the proof but the followingremarks will indicate why U(x, t) may fail to tend to u(x, t) if A > 1.

If the initial values are given in an interval a S x 5 b (which, forsimplicity, we suppose to be bounded by grid points), the formulas (7.2.6)enable us to calculate the values of U(x, t) at the grid points inside atriangle whose base is this interval and whose other two sides have slopesf A. Then, as for the differential problem, each grid point in the trianglehas an interval of dependence on the x-axis which lies in the intervala :!g x ::g b, and this interval of dependence depends on A. Now thecorresponding differential problem will have a solution inside a trianglewhose base is the interval a S x S b and whose other sides have slopes:0. This triangle lies inside the corresponding triangle for the differenceequation if A > 1. Moreover, in this case, for each grid point inside thetriangle where u is defined, the interval of dependence for the differenceequation lies inside the interval of dependence for the differential equation.This situation is illustrated in Fig. 7.2 where PQ is the interval of depend-ence for the difference equation and RS is the interval of dependence forthe differential equation. Thus, if at some point U(x, t) tends to u(x, t)

VN

(x, t)I / N

k

h

a R P Q S b

Fig. 7.2. Intervals of dependence for difference and differential equations for the caseA=k/h> 1.

Page 191: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Hyperbolic Equations 179

for some choice of the initial functions, we can alter these functions in away that changes u at this point (x, t) but leaves the initial values in theinterval of dependence of the difference equation the same as before, sothat U is unchanged at (x, t). Thus U(x, t) will no longer tend to u(x, t).

If 2 > 1, convergence of U to u is the exception rather than the rule.Hence in using the scheme (7.2.6) it is important to choose 2 S 1.

If we wish to solve a hyperbolic differential equation of more generaltype than the one appearing in (7.2.1), we set up a corresponding differenceequation in exactly the same manner as described previously. The calcula-tions will again proceed in a step-by-step fashion, and it will be foundnecessary to restrict the value of the ratio k/h to guarantee convergence.

We may also consider a problem similar to (7.2.1) but restricting therange of x to be a finite interval, a S x S b. Here we prescribe the valuesof u(x, t) on the lines x = a and x = b. Thus the differential equationproblem analogous to (7.2.1) would be

utt-u.= 0 for t>0, a<x<b,u(x, 0) = f (x), ut(x, 0) = g(x) for a S x 5 b,

u(a, t) = hl(t), u(b, t) = h2(t) for t > 0.By replacing the derivatives by finite-difference approximations, the corre-sponding difference-equation problem is

U(x, 0) = f (X)U(x, k) = kg(x) + f(x)

U(a, t) - hl(t), U(b, t) = h9(t)U(x,t+k)=2U(x,t)- U(x, t - k)

+22[U(x+h,t)-2U(x,t)+ U(x-h,t)1where A = k/h.

Example 1. Find a finite difference approximation to the solution of theproblem

for t>0, 0<x<1,u(x,0)=x(1 -x), ut(x,0)=0 for 05xS 1,

u(0, t) = 0, u(l, t) = sin in fort > 0.We choose h = 0.1, k = 0.05 so that A = 0.5, and carry out the solution

as far as the line t = 1.0. Our difference equations become

U(x, 0) = x(1 - x)U(x, k) = x(1 --- x)

U(0, t) = 0, U(1, t) = sin inU(x, t + k) = 2U(x, t) - U(x, t - k)

+0.25[U(x+h,t)-2U(x,t)+ U(x-h,t)].

Page 192: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

180 Partial Differential Equations

The calculations were carried out on a high-speed automatic digitalcomputer, retaining eight significant figures throughout. A portion ofthe solution, rounded to three decimal places, is shown in Table 7.1.

TABLE 7.1Solution of Hyberbolic Equation

t

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

0 0.000 0.090 0.160 0.210 0.240 0.250 0.240 0.210 0.160 0.090 0.0000.05 0.000 0.090 0.160 0.210 0.240 0.250 0.240 0.210 0.160 0.090 0.1560.10 0.000 0.085 0.155 0.205 0.235 0.245 0.235 0.205 0.155 0.124 0.3050.15 0.000 0.076 0.145 0.195 0.225 0.235 0.225 0.195 0.155 0.212 0.4540.20 0.000 0.066 0.130 0.180 0.210 0.220 0.210 0.182 0.179 0.346 0.5880.25 0.000 0.055 0.112 0.160 0.190 0.200 0.191 0.176 0.246 0.499 0.707

0.80 0.000 -0.040 -0.035 0.090 0.363 0.632 0.756 0.837 0.850 0.751 0.588

0.85 0.000 -0.029 0.016 0.207 0.497 0.691 0.760 0.815 0.766 0.642 0.4540.90 0.000 0.000 0.104 0.349 0.607 0.718 0.761 0.767 0.664 0.517 0.309

0.95 0.000 0.056 0.227 0.494 0.680 0.729 0.752 0.692 0.550 0.377 0.156

1.00 0.000 0.140 0.374 0.619 0.719 0.733 0.723 0.597 0.429 0.225 0.000

Although the labor of calculating this solution by hand would be con-siderable, the reader may easily check the calculation of any entry in thetable. For example, if x = 0.3 and t + k = 0.20 we have

U(0.3, 0.20) = 2U(0.3, 0.15) - U(0.3, 0.10) + 0.25[U(0.4, 0.15)

- 2U(0.3, 0.15) + U(0.2, 0.15)]

=2(0.195)-0.205-+-0.25[0.225--2(0.195)-} 0.145]

= 0.180.

To obtain some indication of the accuracy of this solution, the calcula-tions were repeated with a finer subdivision of the region. It appears thatthe solution at most of the points is fairly accurate, although at a few ofthe points near the line x = 1.0 and for the smaller values of t the error isas large as 2 units in the second decimal place. For the larger values of tthe error is sometimes as large as 7 units in the second decimal place forthe large values of the Solution.

7.3 PARABOLIC EQUATIONS

We consider the problem defined by (7.1.3) namely

u= -- uffi = 0 for t>0, u(x, 0) = f(x). (7.3.1)

Page 193: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Parabolic Equations 181

T

L-

k hi + k

t

x-'h x x+hFig. 7.3. Stencil of grid points for parabolic equation (explicit method).

If we proceed as for the hyperbolic equation, replacing the derivatives byfinite-difference approximations, one possible difference equation is

U(x, t - k) - U(x, t) = U(x + h, t) - 2U(x, t) + U(x - h, t)k h$

(7.3.2)

Of course the initial condition becomes U(x, 0) = f (x). Again we limitthe variables x and t to a discrete set (xo + rh, sk) where r = 0, -± 1,±2, -, s = 0, 1, 2, .. To show how the solution can be carried outin a step-by-step fashion we rewrite our equations in the form

U(x, 0) = f (x)(7.3.3)

U(x,t+k)=2U(x+h,t)+(1 - 2A)U(x, t) + AU(x - h, t)where A = k/he. Starting with the initial values U(x, 0) = f(z), the valuesof U at the grid points on the lines t = k, 2k, - can be successivelycalculated from the second equation of (7.3.3). The situation can beindicated graphically by the stencil of grid points that enter into eachapplication of the recursion formula. In Fig. 7.3 the stencil is indicatedby the heavy dots on the mesh lines. Application of formula (7.3.3) in thismanner may be called an explicit difference method.

It is again important to consider whether the solution thus foundapproximates the solution of the differential equation problem. (73.1).An examination of the second formula of (7.3.3) shows that if A 4,U(x, t + k) is a weighted average of the values of U(z, t) with non-negative weight factors. It follows that if m S f (x) :!!g M, then at all gridpoints we have

mS U(x,t)SM if AS}.From the inequalities it is possible to conclude that the difference equationis stable if A S J. But if A > 4, examples can be constructed to exhibitinstability [7 f pp. 93-94]. Moreover, under suitable conditions on thehigher derivatives of u, it can be shown that U(x, t) tends to u(x, t) as Itand k tend to zero if A S 1 [7, pp. 95-98].

Page 194: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

182 Partial Differential Equations

More realistic in a physical sense than the problem (7.3.1) are parabolicproblems in which the differential equation is to be satisfied in a finiteinterval only-for example, heat flow in a rod of finite length as discussedin Section 6.7. A typical problem of this kind can be written in the form

u,-u==0 for a<x<b, t>0(7.3.4)

u(x, 0) f(x), u(a, t) = hi(t), u(b, t) = h$(t).

The method of this section is still applicable. We should choose h so thatb - a is an integral multiple of h and make a and b be grid points. Wethen add to the equations (7.3.3) the two equations

U(a, t) = hl(t), U(b, t) = h2(r). (7.3.5)

Again we must have A < 4 for stability.The stability restriction A 5 4 is much more irksome than the cor-

responding inequality in hyperbolic problems because it forces us to usevery small steps in the t-direction. This difficulty can be circumventedby the use of so-called implicit difference methods which are stable for allA > 0 but which are more complicated for calculation.

To obtain an implicit method we again replace the derivatives by finitedifference approximations. If in ut -- %. = 0, ur is replaced by a seconddifference quotient, not at the level of t as in (7.3.2), but at t + k, thedifference equation

U(x, t + k) - U(x, t)k

U(x+h,t+k)-2U(x,t+k)+U(x-h,t+k) (7.3.6)h'

is obtained. The situation can be indicated graphically by the stencilof grid points shown in Fig. 7.4.

This equation cannot be solved explicitly for U(x, t + k) in terms ofknown values of U(x, t). It is unsuitable for problems in infinite x-regions.

4t+Si

h

x-h x x+hFig. 7.4. Stencil of grid points for parabolic equation (implicit method).

Page 195: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Parabolic Equations 193

But for problems in a finite x-interval like that in (7.3.4), it can be used aswe shall now explain. If we rewrite (7.3.6) in a slightly different form andadjoin the boundary and initial conditions corresponding to (7.3.4) wesee that the system to be solved can be described by the following equations

U(x, 0) = f(x)

U(a,t+k)=hl(t+k),U(b, t + k) = h2(t + k)

AU(x - h, t + k) - (I +2A)U(x,t+k)

+ AU(x + h, t + k) = -U(x, t)

(7.3.7)

=a+h,a+2h,- ,b-h.

Then the last equation of (7.3.7) provides at the level t + k a system of(b --- a)fh -- I simultaneous linear algebraic equations for the samenumber of unknown values of U at the grid points x = a + h, a + 2h, - ,

b - h. If the values of U at the grid points of level t are already known,the values for the level t + k can be found by solving this algebraic system,since its determinant can be shown to be different from zero. Thus, sincethe values of U on the level t = 0 are given, solution of an algebraicsystem provides the values at level k. Solution of the next algebraic systemgives the values for level 2k and so on for levels 3k, 4k, - .

The solution of the algebraic system can be carried out by Gaussianelimination as explained in Section 4.5. We note that the matrix ofcoefficients is tri-diagonal, that is, it has zeros everywhere except on themain diagonal and on the two diagonals parallel to it on either side.Because of this there is a considerable simplication in the calculations.To explain the method we introduce a new notation in order to rewritethe system (7.3.7) for fixed t + k in a more convenient form. We let

b-an

h

u,=U(a+ih,t+k)

i= 1, 2,---,n-Ici=Adl= -U(a+h,t)- AU(a,t+k)

= -U(a+h,t)-Ah1(t+k)d, = - U(a + ih, t)

d.-I= -U(b-h,t)-AU(h,t±k)= -U(b - h, t) - Aha(t + k).

Page 196: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

184 Partial Differential Equations

Then the system of equations which has to be solved may be written in theform

btul + clue = dia2u1 + b2u2 + c2u3 = d2

a3u2 + bsu3 + csu4 = d3

a,-tun-3 + bn-2un-2 + cn-tun-1 = do-2

an-lun-2 + bn-,un-1 = dn-1.

By successive subtraction of a.suitable multiple of each equation fromthe succeeding one, this system can be changed into a simpler one of theform

u1+C1*U2 =d1*u2 + C2*u3 = d2*

US + c3*u4 = ds*

un-2 + cneun-1 = d,* 2un-1 dn-1

where the coefficients are calculated by the recursion formulas

cl* _ L I, d1* = dib1 b1

b, = b, arc,-1

C'.* c*-- br

*

d*=d,-.ard,*1

' b*

(We set 0, by definition.)

The solution of the tranformed system is now immediate: the desiredvalues of u, are given-successively by

un-1 = d_1u,,=d,*--c,,*u,+l, r=n-2,n-3,.. 2, 1.

The comparison of the computational effort required by the explicitand implicit methods of solving the same problem depends to a- large extenton the.type of computing machine used. On most machines it is believedthat calculation of the values of U for a S x 5 b for fixed t should nottake more than four times as long by the implicit method as by the explicitmethod. Under this hypothesis the implicit method with A > 2 would be

Page 197: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Parabolic Equations 185

preferable to the explicit method with A .;_ . This estimate assumes thatthe errors in the approximations computed by the two methods are notvery different and do not depend too strongly on A.

Example 2. Find a finite-difference approximation. to the solution of theproblem

for 0<x.< l, 1>0u(x,0)=4x(1 --x), u(0,t)=0, u(l,t) =0.

We choose h 0.05, k = 0.01 so that A = 4.0 and use the implicitdifference method to carry out the solution as far as the line I = 0.4.Our difference equations become

U(x, 0) 4x(1 - z), x = 0, h, 2h, - , 20h

U(0,t+k)=0, U(l,t+k)=0,

AU(x + h, t + k) = --U(x,t),

The calculations were carried out on a high-speed automatic digitalcomputer, retaining eight significant figures throughout. A portion of

TABLE 7.2Solution of Parabolic Equation

0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50

0.00 0.000 0.190 0.360 0,510 0.640 0.750 0.840 0.910 0.960 0.990 1.0000.01 0.000 0.159 0.310 0.448 0.571 0.677 0.764 0.833 0.882 0.911 0.9210.02 0.000 0,139 0.274 0.400 0.513 0.612 0.695 0.760 0.807 0.836 0.8450.03 0.000 0.125 0.246 0.359 0.463 0.554 0.631 0.693 0.737 0.764 0.7730.04 0.000 0.112 0.222 0.325 0.420 0.503 0.574 0.631 0.672 0.697 0.7060.05 0.000 0.102 0.201 0.295 0.381 0.457 0.522 0.575 0.613 0.636 0.644

0.36 0.000 0.005 0.011 0.016 0.021 0.025 0.028 0.031 0.033 0.035 0.0350.37 0.000 0.005 0.010 0.014 0.019 0.023 0.026 0.028 0.030 0.032 0.0320.38 0.000 0.005 0.009 0.013 0.017 0.021 0.024 0.026 0.028 0.029 0.0290.39 0.000 0.004 0:008 0.012 0.016 0.019 0.021 0.024 0.025 0.026 0.0260.40 0.000 0.004 0.007 0.011 0.01:4 0.017 0.019 01121 0.023 0.024 0024

the solution, rounded to three decimal places, is shown in Table 7.2.Because of symmetry, it suffices to tabulate the solution for 0 S x < 0.5.0:

The labor of solving the systems of equations required in the implicitmethod is too great for hand calculation;- however, the reader may easily

Page 198: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

186 Partial Differential Equations

check that the values given satisfy the required difference equation. Forexample, if x = 0.20 and t + k = 0.03 we have

4U(0.15, 0.03) -- (I + 2 x 4)U(0.20, 0.03) + 4U(0.25, 0.03)= 4(0.359) -- 9(0.463) + 4(0.554)

= -0.515 = - U(0.20, 0.02)approximately.

To obtain some indication of the accuracy of the solution, the calcula-tions were repeated with a finer subdivision of the region. It appears thatthe maximum error in the solution is about 7 units in the third decimalplace, and these larger errors generally occur where the values of thesolution are largest.

7.4 ELLIPTIC EQUATIONS

We consider the problem defined by (7.1.1) namely

R, u=fonCwhere C is the boundary of the region R in the xy-plane. To set up thefinite-difference approximation to this differential equation we subdividethe xy-plane by two families of parallel lines into a square net. Let thelines of the net be x = ph, y = vh (u, v = 0, f 1, ±2, ). The points(uh, vh) are called the lattice points of the net. The lattice points in Ror on C are called nodes of the net. The smallest squares bounded by fourlines of the net are called meshes or cells of the net. Each mesh is boundedby four line segments called links.

If we approximate the derivatives u,. and u,,,, by centered second dif-ferences as in the case of the hyperbolic and parabolic equations, weobtain as an approximation to the left-hand member of the differentialequation

u, +u,,,,fth-Z[U(x+h,y)+ U(x, y + h)

+ U(x - h, y) + U(x, y - h) -4U(x, y)]. (7.4.2)

For convenience we suppose that the boundary C is composed of horizontaland vertical links of the net so that R is actually a union of meshes of thenet. We then apply (7.4.2) at each node in R (not on C) and require that

U(x + h, y) + U(x, y + h) + U(x - h, y)+ U(x, y -- h) - 4U(x, y) = 0 (7.4.3)

for each (x, y) which is a node in R. The situation can be indicatedgraphically by the stencil of grid points that enter into equation (7.4.3).In Fig. 7.5 the stencil is indicated by the heavy dots on the mesh lines.

Page 199: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Elliptic Equations 187

hh y+h

y

y-h

x-,h x x+hFig. 7.5. Stencil of grid points for elliptic equation.

U will be given its prescribed boundary value at each node or_ C. Thismeans that for some nodes in R, some of the neighboring nodes are on Cand the corresponding values of U are prescribed constants. The valuesof U at the nodes in R are to be determined from the equations (7.4.3).We note that equations (7.4.3) are a system of linear equations, and thatthere are as many equations as there are unknown values of U to be found.Moreover, no equation involves more than five unknown values of U.Thus the matrix of the coefficients of the equations is a rather sparse one,containing many zero elements. In most problems this matrix will be oflarge order, ranging from perhaps fifty to several thousands in currentmachine work. This is so because, to get reasonable accuracy, we willneed to use a fairly small mesh size, and hence will have many nodes atwhich U must be calculated. Although it would be possible to solve theresulting equations by any standard method, such as Gaussian elimination,this is likely to be inefficient because it does not take advantage of thespecial properties of the matrix.

On the other hand, an iterative method of solution is likely to be moreefficient for the solution of such a system of equations. If we solveequation (7.4.3) for U(x, y) we see that U(x, y) is the average of the valuesof U at four neighboring points. We may begin by guessing approximatevalues for the solution U(x, y) at each node in R. Improved values ateach point are obtained by averaging the old values at the four neighboringpoints. This process may be repeated until there is no change in thevalues of the solution. The first approximation to the solution does notmatter, although a good guess will speed up the convergence to the correctsolution.

If we let U('t)(x, y) denote the kth approximation to the solution, theforegoing method is described by the equation

U(x+i)(x, y) = (j)[Ut11'(x + h, y) + U(k)(x, y + h)+ U(k)(x - h, y) + U(k)(x, y - h)]. (7.4.4)

Page 200: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

168 i1aHial Differential Equations

A more instructive way of writing this equation is

y) = U'k,(x, y) + (1)[U(kl(x + h, y) + U(k)(x, y + h)

+ U(k)(x - h, y) + U(k)(x, y - h) - 4U(k)(x, y)]. (7.4.5)

The quantity in brackets is called the residual at (x, y). Clearly the aimof :he method is to reduce all of the residuals to zero.

In the solution of such a problem without the aid of a high-speed auto-matic computer, so-called relaxation methods are often used. We startwith an approximation to the solution and compute the residual at eachpoint. We then reduce the largest residual to zero by the use of equation(7.4.5). In general, this will change the residuals at neighboring points.At each step one of the.residuals is reduced to zero, and the process iscontinued until all of the residuals are sufficiently small. An experiencedcomputer can often guess at a good approximation to the solution. He thenuses his experience and intuition and reduces the residuals until he obtainsa satisfactory solution.

In using a high-speed automatic computer it is impossible to incorporateintuition in the machine program, so that more systematic techniques mustbe used. In one method, called the method of simultaneous displacements,each node is taken in turn and the new value of U(x, y) is computed bymeans of equation (7.4.5). When each of the points of R has been treatedonce in this fashion, we say that we have made one sweep of R. At theend of each sweep we compute the sum of the squares of the residuals atthe nodes and we continue to make sweeps of R until the sum of the squaresof the residuals becomes sufficiently small.

Another method, called the method of successive displacements, is avariant of the method of simultaneous displacements. The variationconsists of using a new value of U(x, y) in (7.4.5) as soon as it has beencomputed. Thus if we sweep out R by proceeding from left to right in eachrow of nodes and taking the rows from bottom to top, we could writeinstead of (7.4.5) the equation

U(k+1)(x, y) = U(k)(x, y) + (*)[U(1:1(x + h, y) + U(k)(x, y + h)+ U(k+1)(x - h, y) + U(k+l)(x, y -- h) -- 4U(k)(x, y)]. (7.4.6)

Instead of attempting a discussion of the conditions under which thesolutions obtained by these methods converge to the solution of thecorresponding differential equation we refer the interested reader toForsythe and Wasow [7].

It has been found that the convergence of the foregoing methods canoften be speeded up by using the method of successive overrelaxation.This means that instead of correcting each value U(x, y) by adding one

Page 201: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Elliptic Equations 189

quarter of the residual, we overcorrect by adding a quantity obtained bymultiplying this by a suitable factor. Thus we use the formula

Utk+11(x, y) = Uck1(x, y) + [Uck1(x + h, y) + U'k1(x, y + h)

+ U(k+1)(x - h, y) + Uck+11(x, y - h) - 4U(k)(x, y)] (7.4.7)

where 0 < co < 2. It has been shown that the most rapid converger}ceoccurs for a value called wopt, with 0 < wopt < 2. For methods of detbr-mining wopt and further details about this method, we again refer toForsythe and Wasow [7].

In the preceding discussion we have assumed that the region R is aunion of meshes of the net and that the boundary C is composed ofhorizontal and vertical links of the net. If the boundary C is curved sothat the preceding conditions are not satisfied, the problem becomes muchmore difficult. We omit a discussion of this case and refer the reader toLance [16] and Forsythe and Wasow [7].

We conclude with a simple example illustrating the solution of Laplace'sequation for a square region.

Example 3. Find a finite-difference approximation U to the solution ofthe problem

u,,+u5,, =0 for 0<x<1, 0<y<1u(x,0)=0, u(1,y)=0, u(x,1)=x(l --x), u(0,y)=0.

We choose h = 0.1 and use the method of successive displacements, asgiven by equation (7.4.6), starting with the initial approximation U = 1at all nodes inside the region. The calculations were carried out on ahigh-speed automatic digital computer, retaining eight significant figuresthroughout. After one sweep, the values of U rounded to three places ofdecimals are as shown in Table 7.3. The sum of the squares of the residualsis 73.8.

As an illustration of the calculation of the values in this table we takethe case of x = 0.5, y = 0.2. We obtain from equation (7.4.6)

U111(0.5, 0.2) = V01(0.5, 0.2) + 0.25[U(0)(0.6, 0.2) + U(0)(0.5, 0.3)

+ U(1)(0.4, 0.2) + U(1)(0.5, 0.1) - 400)(0.5, 0.2)]

= 1.0 + 0.25[l.0 + 1.0 + 0.883 + 0.666 - 4(1.0)]

0.887.

After 81 sweeps, the sum of the squares of the residuals was reduced to0.992 x 10-8 and the values in Table 7.4 were obtained for the solution U.

Page 202: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

190 Partial Differential Equations

TABLE 7.3Values of U After One Sweep

0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

1.0 0.000 0.090 0.160 0.210 0.240 0.250 0.240 0.210 0.160 0.090 0.0000.9 0.000 0.439 0.622 0.699 0.732 0.744 0.746 0.739 0.725 0.370 0.0000.8 0.000 0.667 0.889 0.963 0.988 0.996 0.998 0.999 1.000 0.666 0.0000.7 0.000 0.667 0.889 0.963 0.987 0.996 0.998 0.999 0.999 0.666 0.0000.6 0.000 0.667 0.888 0.962 0.987 0.995 0.997 0.998 0.998 0.665 0.0000.5 0.000 0.666 0.887 0.960 0.984 0.992 0.995 0.996 0.996 0.663 0.000

0.4 0.000 0.664 0.883 0.954 0.977 0.984 0.987 0.987 0.988 0.656 0.0000.3 0.000 0.656 0.867 0.934 0.954 0.960 0.962 0.963 0.963 0.635 0.0000.2 0.000 0.625 0.813 0.867 0.883 0.887 0.888 0.889 0.889 0.576 0.0000.1 0.000 0.500 0.625 0.656 0.664 0.666 0.667 0.667 0.667 0.417 0.0000.0 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000

To obtain some indication of the accuracy of the solution, the problemwas also solved using Fourier series. It appears that the maximum errorin the solution does not exceed one unit in the third decimal place.

The same problem was also solved using the method of successive over-relaxation; that is, using equation (7.4.7). With co = 1.8, the sum of the

TABLE 7.4Values of U After 81 Sweeps

V

0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

1.0 0.000 0.090 0.160 0.210 0.240 0.250 0.240 0.210 0.160 0.090 0.0000.9 0.000 0.062 0.115 0.153 0.177 0.185 0.177 0.153 0.115 0.062 0.0000.8 0.000 0.044 0.083 0.112 0.130 0.136 0.130 0.112 0.083 0.044 0.0000.7 0.000 0.032 0.060 0.082 0.095 0.100 0.095 0.081 0.060 0.032 0.0000.6 0.000 0.023 0.043 0.059 0.069 0.073 0.069 0.059 0.043 0.023 0.0000.5 0.000 0.016 0.031 0.043 0.050 0.052 0.050 0.042 0.031 0.016 0.0000.4 0.000 0.012 0.022 0.030 0.035 0.037 0.035 0.030 0.022 0.011 0.0000.3 0.000 0.008 0.015 0.020 0.024 0.025 0.024 0.020 0.015 0.008 0.0000.2 0.000 0.005 0.009 0.013 0.015 0.016 0.015 0.013 0.009 0.005 0.0000.1 0.000 0.002 0.004 0.006 0.007 0.007 0.007 0.006 0.004 0.002 0.0000.0 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000

squares of the residuals was reduced to 0.713 x 10-6 after 43 sweeps;with w = 1.7 the sum of the squares of the residuals was reduced to0.793 x 1" after 29 sweeps; and with w = 1.6 the sum of the squaresof the residuals was reduced to 0.179 x l0-9 after 30 sweeps. The valuesof U so obtained differ from those in Table 7.4 by no more than one unitin the third decimal place. These results demonstrate the marked effectwhich a suitable choice of co can have on the rapidity of convergence.

Page 203: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

References

1. Aitken, A. C. Studies in practical mathematics II. The evaluation of the latentroots and latent vectors of a matrix. Proc. Roy. Soc. Edinburgh, vol. 57 (1937),pp. 269-304.

2. Bodewig, E. Matrix Calculus. Interscience Publishers, New York, 1956.3. Crout, P. D. A short method for evaluating determinants and solving systems

of linear equations with real or complex coefficients. 7Yans. Amer. Inst. Elec. Firs.,vol. 60 (1941), pp. 1235-1240.

4. Davis, H. T. Tables of the HIgher Mathematical Functions, I. Principia Press,Bloomington, Indiana, 1933.

5, Faddeeva, V. N. Computational Methods of Linear Algebra. Translated from theRussian by C. D. Benster, Dover Publications, New York, 1959.

6. Fletcher, A., Miller, J. C. P., Rosenhead, I., and Cowrie, L. J. Index of MathematicalTables. 2nd edition, Addison-Wesley Publishing Co., Reading, Massachusetts, 1962.

7. Forsythe, G. E., and Wasow, W. R. Finite-D fference Methods for Partial D fferen-tial Equations. John Wiley and Sons, New York, 1960.

8. Frazer, R. A., Duncan W. J., and Collar, A. R. Elementary Matrices and SomeApplications to Dynamics and Differential Equations. Cambridge University Press,New York, 1947.

9. Givens, W. Numerical computation of the characteristic values of a real symmetricmatrix. Oak Ri4ge National Laboratory, Report ORNL 1574, February 1954.

10. Givens, W. Computation of plane unitary rotations transforming a general matrixto triangular form. J. Soc. Indust. Appl. Math., vol. 6 (1958), pp. 26-S0.

11. Hamming, R. W. Stable predictor-corrector methods for ordinary differentialequations. J. Assoc. Comput. Mach., vol. 6 (1959), pp. 37-47.

12. Hildebrand, F. B. Introduction to Numerical Analysis. McGraw-Hill Book Com-pany, New York, 1956.

13. Hoff, N. J. The Analysis of Structures. John Wiley and Sons, New York, 1956.14. Householder, A.S. Principles ofNumerical Analysis. McGraw-hilt Book Company,

New York, 1953.15. Jacobi, C. G. J. Uber ehi leichtes Verfahren, die in der theorie der Slikularstorungen

vorkommenden Gleichungen numerisch aufiulbsen. J. Relne An.gew. Math., vol. 30(1846), pp. 51-95.

16. Lance, G. N. Numerical Methods for High-Speed Computers. l]iff and Sons,London, 1960.

17. Lanczos, C. An iteration method for the solution of the eigenvalue problem oflinear differential and integral operators. J. Res. Nat. Bur. Standards, vol. 45(1950), pp. 255-282.

191

Page 204: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

192 References

18. Lebedev, A. V., and Fedorova, R. M. Reference Book on Mathematical Tables,lzdatelestvo akademii nauk USSR Moscow, 1956. Supplement by N. M. Burunova,1959.

19. Milne, W. E. Numerical Calculus. Princeton University Press, Princeton, NewJersey, 1949.

20. Milne, W. E. Numerical Solution of Differential Equations. John Wiley and Sons,New York, 1953.

21. Milne, W. E., and Reynolds, R. R. Stability of a numerical solution of differentialequations. J. Assoc. Comput. Mach., vol. 6 (1959), pp. 196-203.

22. Milne, W. E., and Reynolds, R. R. Fifth-order methods for the numerical solutionof ordinary differential equations. J. Assoc. Comput. Mach., vol. 9 (1962), pp. 64-70.

23. National Bureau of Standards. Tables of Langraggian Interpolation Coefficients.Columbia Press Series, voI.4, Columbia University Press, New York, 1944.

24. Uspensky, J. V. Theory of Equations. McGraw-Hill Book Company, New York,1948.

25. Wilkinson, J. H. The calculation of the latent roots and vectors of matrices on thepilot model of the A.C.E. Proc. Cambridge Philos. Soc., vol. 50 (1954), pp.536-566.

26. Wilkinson, J. H. The use of iterative methods for finding the latent roots andvectors of matrices. Math. Tables Aids Conput., vol. 9 (1955), pp. 182-191.

Page 205: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Index

Adams' method, 147modified, 148

Adjoint differential equation, 130, 131Ad joint matrix, 62, 63, 84Aitken, A. C., 95, 96, 101. 103Aitken's 32-process, 100, 101, 105, 106Augmented matrix, 66

Backward difference, 8Bairstow method, 44-47Bilinear resolution of matrix, 104Bi-orthogonal system of vectors, 110Birge-Vieta method, 44

Canonical box, 90Cauchy's problem, 174Cayley-Hamilton theorem, 83, 84Cell, 186Central difference, 12Central-difference interpolation formu-

las, 10--I4Characteristic equation of matrix, 81, 84Characteristic function of matrix, 80Characteristic numbers of matrix, 80,

81calculation of, 92-111

Characteristic polynomial of matrix, 80,84

Characteristics of wave equation, 176Characteristic vectors of matrix, 80, 81

calculation of, 92-111Closed formulas, 29Coefficients of double Fourier series,

formulas for, 168

Coefficients of Fourier series, formulasfor, 156

Cofactor, 56Column vector, 53Complementary function, 121, 124, 136,

163, 164Corrected value, 133, 145, 148, 152,

153Corrector formula, 138, 145, 148, 152,

153Cramer's rule, 65Crout method of elmination, 73-79

check column for., 76

Deflation, 92, 103-107A operator, 2, 4Descartes' rule of signs, 48Determinant, evaluation of, 56, 76

principal minor of, 82Diagonal matrix, 62Difference, backward, 8

central, 12forward, 2of factorial polynomial, 5repeated, 2, 3, 8, 12

Difference table, 2, 8, 12Differential equation, 112

order, 113ordinary, see Ordinary differential

equationpartial, see Partial differential equa-

tionDirichlet, theorem of, 157Dirichlet's problem, 173

193

Page 206: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

194

Discriminant of quadratic form, 88Double Fourier series, 168-171

formulas for coefficients of, 168half-range, 169

Eigenvalues of matrix, 81Eigenvector of matrix, 81Elimination, Crout method of, 73-79

Gauss-Jordan method of, 71, 72Gauss's method of, 67-71, 183

Elliptic partial differential equation,174,175,186-190

finite-difference approximation for,186

stencil for, 187E operator, 4Equality, of matrices, 55

of vectors, 53Error, in numerical differentiation for-

mulas, 32, 33in numerical integration formulas, 31,

32in polynomial approximation, 20, 21

Euler's method for ordinary differentialequation, 118

Even function, 157, 160Everett's interpolation formula, 14Exact ordinary differential equation,

128, 129Explicit difference method for parabolic

partial differential equation, 181

Factorial polynomial, 5difference of, 5

False position, method of, 36-39Finite-difference approximation, for el-

liptic partial differential equa-tion, 186

for hyperbolic partial differentialequation, 176

for parabolic partial differentialequation, 181, 182

Finite discontinuity, 157Forward difference, 2Fourier cosine series, 162Fourier series, 155-172

application to solution of ordinarydifferential equations, 162-165

application to solution of partial dif-ferential equations, 165-168

Index

Fourier series, double, 168-171formulas for coefficients of, 156half-range, 161, 162

Fourier sine series, 161

Gauss-Jordan method of elimination,71, 72

Gauss-Seidel iteration, 79, 80Gauss's interpolation formula, back-

ward, 13forward, 11, 12

Gauss's method of elimination, 67-71,183

Givens' method, for general complexmatrix, 111

for real symmetric matrix, 110Green's function, 135

Half-range double Fourier series, 169Half-range Fourier series, 161, 162Hamilton-Cayley theorem, 83, 84Hamming, R. W., 146Heat conduction problem, in one dimen-

sion, 174in two dimensions, 171

steady-state, 172Heat equation, Fourier series solution

of, 165-168Hermitian form, 89Hermitian matrix, 89Higher-order ordinary differential equa-

tion, 151-154Hyperbolic partial differential equation,

174, 175-180fininte-difference approximation for,

176stencil for, 177

Identity matrix, 62Implicit difference method for parabolic

partial differential equation, 182Indicial function, 133Initial-value problem, 174Inner product of vectors, complex com-

ponents, 86real components, 54

Integrating factor for ordinary differ-ential equation, 128, 130

Interpolating function, I

Page 207: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Index

Interpolating polynomial, 1Interpolation, 1-21Interval of dependence, 176Inverse interpolation, 19Inverse matrix, 62

calculation of, 69, 72, 78Iterative procedure for square root, 41Iterative process, order of, 39, 40

Jacobi method, for characteristic num-bers, 108

variations of, 109Jordan canonical form of matrix, 90Jump discontinuity, 131, 157

Kronecker delta, 15, 57

Lagrange's interpolation formula, 15Lagrange three-point interpolation, co-

efficients for, 17Lagrangian 'coefficient function, 15, 17Lanczos' method for reduction of matrix

to tri-diagonal form, 110Laplace's differential equation, 172, 173Latent roots of matrix, 81Latent vector of matrix, 81Lattice points, 186Left-hand limit, 157Length of vector, 54Lineal element, 116Linear differential equation, 120-137

constant coefficients, 120-125first order, 127second order, 129

Linear equations, 52-111Linearly dependent vectors, 55Linearly independent solutions of ordi-

nary differential equations, 121Linearly independent vectors, 55Linear transformation, 57Link of net, 186Lipschitz condition, 119Lower triangular matrix, 68

Matrices, equality of, 55similar, 89sum of, 55

Matrix, 55bilinear resolution of, 104characteristic equation of, 81, 84

195

Matrix, characteristic function of, 80characteristic numbers of, 80, 81

calculation of, 92-111characteristic polynomial of, 80, 84characteristic vectors of, 80, 81

calculation of, 92-111diagonal, 62eigenvalues of, 81eigenvector of, 81Hermitian, 89identity, 62inverse of, 62

calculation of, 69, 72, 78Jordan canonical form, 90latent roots of, 81latent vector of, 81lower triangular, 68minimum polynomial of, 85nonsingular, 62orthogonal, 64power of, 83principal diagonal of, 62proper numbers of, 81proper values of, 81proper vector of, 81rank of, 66reduction to tri-diagonal form, 110secular equation of, 81singular, 62spectrum of, 81square, 55symmetric, 61trace of, 82transpose, 61, 86tri-diagonal, 110, 111, 183unit, 62upper triangular, 68

Matrix multiplication, 57-61Matrix polynomial, 84Mesh of net, 186Milne and Reynolds, 146Milne's method, 145-147

for second-order differential equation,152-154

for systems of differential equations,151, 152

Minimum polynomial of matrix, 85Minor, 56Modified Adams' method, 148

Page 208: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

196

Multiplication of matrix, by matrix,57-61

by scalar, 56

Newton-Raphson method, 39-44Newton's backward-difference formula,

7-10Newton's forward-difference formula,

4-7, 10Newton's three-eighths rule, 28, 32, 146Node of net, 186Nonsingular matrix, 62Numerical differentiation, 22-25, 32, 33Numerical integration, 22, 25-32Numerical solution of ordinary differ-

ential equations, 117, 137--154Numerical solution of partial differen-

tial equations, 173-190

Odd function, 157Open formulas, 29Operator 0, 2, 4Operator E, 4Ordinary differential equation, 112-154

Adams' method, 147modified, 148

adjoint equation, 130, 131application of Fourier series to solu-

tion of, 162-165auxiliary equation, 121complete, 120direction field, 116Euler's method, 118exact, 128, 129existence theorem, 1 19first-order, 137general solution of. 114graphical solution of, 116higher-order, 151-154homogeneous, 120integral curve of, 116integrating factor, 128, 130isocline, 116linear, 120-137

constant coefficients, 120-125first-order, 127second-order, 129

linearly independent solutions of, 121Milne's method, 145-147, 151-154modified Adams' method, 148

Index

Ordinary differential equation, nonho-mogeneous, 120

numerical solution of, 117, 137-154particular solution of, 114reduced, 120Runge-Kutta method, 149-451solution of, 114

by graphical procedure, 116stability problem, 146starting solution of, 140-145variation of parameters, method of,

125-127Ordinary differential equations, system

of, 113, 151, 152Orthogonal matrix, 64Orthogonal vectors, 54Overrelaxation, 188

Parabolic partial differential equation,174,175,180-186

explicit method for. 181finite-difference approximation for,

181, 182implicit method for, 182stability of numerical solution, 181,

182stencil for explicit method, 181stencil for implicit method, 182

Partial differential equation, 112, 165-172, 173-190

application of Fourier series to solu-tion of, 165-172

elliptic, 174, 175, 186-190see also Elliptic partial differential

equationhyperbolic, 174, 175-180

see also Hyperbolic partial differ-ential equation

numerical solution of, 173-190para§oUc, 174, 175, 180-186

see also Parabolic partial differen-tial equation

Partial differential equationy, classifica-tion of, 1 14

Periodic function, 155Piecewise continyous function, 131Polynomial equations, solution of, 42-

51Positive definite quadratic form, 88

Page 209: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

Index

Power method, 92, 93-103acceleration of convergence, 100, 102

Power of matrix, 83Predicted value, 139, 145, 148, 151,

152Predictor formula, 138, 145, 148, 151,

152Predictor-corrector method, 139, 140,

145, 148, 151-154Principal diagonal, 62Principal minor of determinant, 82Proper numbers of matrix, 81Proper values of matrix, 81Proper vector of matrix, 81

Quadratic form, 88discriminant of, 88positive definite, 88

Rank of matrix, 66Rectangular plate problem, 169, 170Region of influence, 176Regula Jalsi, 36-39Relaxation method, 188Residual, 77, 188Reynolds, R. R., 146Right-hand limit, 157Roots of equations, 34-51Routh procedure, 50, 51Row vector, 53Runge-Kutta method, 149-151

Scalar multiplication of vector, 54Scalar product of two vectors, 54Secular equation of matrix, 81Similarity transformation, 89Similar matrices, 89Simpson's rule, 27-29, 32, 145, 150Simultaneous displacements, method of,

188Simultaneous equations, 41, 42Simultaneous linear equations, 52, 64-

80Simultaneous ordinary- differential equa-

tions, 113, 1 152Singular matrix, CIA/Spectrum of mat 81

Square matrix, .i

Square net, 186

197

Stability problem in numerical solutionof ordinary differential equa-tions, 146

Stability problem in numerical solutionof parabolic partial differentialequations, 181, 182

Starting solution of ordinary differentialequation, 140-145

Steady-state heat conduction problem,two dimensions, 172

Stencil of grid points for elliptic partialdifferential equation, 187

Stencil of grid points for hyperbolicpartial differential equation, 177

Stencil of grid points for parabolic par-tial differential equation, explicitmethod, 181

implicit method, 182Step function, 132Stirling's interpolation formula, 13,

14Successive displacements, method of,

188Successive overrelaxation, 188Sum of matrices, 55Sum of vectors, 53Sweep, 188Symmetric matrix, 61Synthetic division, 43

with quadratic factor, 44-46Systems of ordinary differential equa-

tions, 113, 151, 152

Three-eights rule, 28, 32, 146Trace of matrix, 82Transpose matrix, 61, 86Trapezoidal rule, 26-28, 32, 138Tri-diagonal matrix. 110, 111, 183

Undetermined coefficients, method of,29, 30, 123-125

Unit matrix, 62Unit step function, 132Upper triangular matrix, 68

Variation of parameters, method of,125-127

Vector, 52, 53column, 53length of, 54

Page 210: Methods of mathematical analysis and computation of Mathematical .Analysis and Computation by John G. Herriot Professor of Mathematics and Computer Science Stanford University John

198

Vector, row, 53scalar multiplication of, 54zero, 54

Vector addition, 53Vectors, bi-orthogonal system of, 110

equality of, 53inner product ' of, complex compo-

nents, 86real components, 54

linearly dependent, 35linearly independent, 55

Vectors, orthogonal, 54scalar product of, 54sum of, 53

Wave equation, 174characteristics of, 176

Weddle's rule, 28, 32Weighting function, 135Wilkinson, J. H., 102

Zero vector, 54

Index