Beruflich Dokumente
Kultur Dokumente
of
Matrix Modeling and Computing
with
MATLAB
Robert E. White
Department of Mathematics
North Carolina State University
white@math.ncsu.edu
Updated on 07-20-06.
Copyright: CRC/Chapman Press a Division of
Taylor and Francis Group
Contents
List of Figures
vii
List of Tables
xi
Preface
xiii
Introduction
xv
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
1
10
19
27
38
2 Vectors in Space
2.1 Vectors and Dot Product
2.2 Cross and Box Products .
2.3 Lines and Curves in R3 .
2.4 Planes in R3 . . . . . . . .
2.5 Extensions to Rq . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
47
47
56
67
76
86
= d: Unique Solution
Matrix Models . . . . . . . . . . . . . .
Matrix Products . . . . . . . . . . . . .
Special Cases of Ax = d . . . . . . . . .
Row Operations and Gauss Elimination
Inverse Matrices . . . . . . . . . . . . .
OX Factorization . . . . . . . . . . . . .
Determinants and Cramers Rule . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
95
95
105
117
127
138
149
159
3 Ax
3.1
3.2
3.3
3.4
3.5
3.6
3.7
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
CONTENTS
vi
4.3
4.4
5 Ax
5.1
5.2
5.3
= d: Multiple Solutions
209
Subspaces and Solutions in R3 . . . . . . . . . . . . . . . . . . . 209
Row Echelon Form . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Nullspaces and Equilibrium Equations . . . . . . . . . . . . . . . 230
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
243
243
250
257
263
272
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
343
343
351
361
370
381
Bibliography
397
Index
399
List of Figures
1.1.1
1.1.2
1.2.1
1.2.2
1.3.1
1.3.2
1.3.3
1.3.4
1.4.1
1.4.2
1.4.3
1.4.4
1.4.5
1.4.6
1.5.1
1.5.2
1.5.3
1.5.4
1.5.5
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
7
13
17
20
21
22
23
31
33
34
35
35
36
39
41
43
44
45
2.1.1
2.1.2
2.1.3
2.2.1
2.2.2
2.2.3
2.2.4
2.3.1
2.3.2
2.3.3
2.3.4
2.4.1
2.4.2
Point in Space . . . . . . . . .
Vector in Space . . . . . . . .
Vector Addition in Space . . .
Unit Vector Cross Products . .
Projected Area . . . . . . . .
Box Product and Volume . . .
Determinant and Volume . . .
Vector Equation and Minimum
Distance between Two Lines .
Helix . . . . . . . . . . . . . .
Projectile in Space . . . . . . .
Normal and Point . . . . . . .
Three Points . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
48
49
50
58
58
64
65
68
71
73
75
77
78
vii
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
Distance
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
LIST OF FIGURES
viii
2.4.3
2.4.4
2.5.1
2.5.2
2.5.3
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
79
81
92
92
92
3.1.1
3.1.2
3.1.3
3.1.4
3.2.1
3.2.2
3.3.1
3.4.1
3.5.1
3.6.1
3.6.2
3.7.1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
101
102
102
103
112
114
125
134
149
155
156
167
4.1.1
4.1.2
4.1.3
4.2.1
4.4.1
4.4.2
Sales Data . . . . . . . . . . . . . . .
Least Squares Function for Sales Data
Radioactive Decay . . . . . . . . . . .
World Population Prediction . . . . .
US Population and Logistic Model . .
Temperature Data and Curve Fit . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
174
176
179
188
204
207
Mass-Spring System . . . . . . . . . .
Variable Damped Mass-Spring . . . .
Forced Mass-Spring . . . . . . . . . .
Series LRC Circuit . . . . . . . . . . .
Tuned Circuit with Modulated Signal
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
251
263
271
273
279
Pollen Image . . . . . . . .
Enhanced Pollen Image . . .
Aerial Photo . . . . . . . . .
Enhanced Aerial Photo . . .
Mars Rover Photo . . . . . .
Enhanced Mars Rover Photo
Moon . . . . . . . . . . . . .
Sharper Moon Image . . . .
Plot of the Matrix C . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
312
312
313
313
314
314
315
315
317
LIST OF FIGURES
ix
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
317
318
318
319
319
320
322
324
325
326
328
328
330
330
334
336
336
337
338
339
340
341
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
354
359
360
364
367
368
368
369
369
370
372
373
373
374
374
376
376
377
378
378
379
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
List of Tables
4.1.1
4.1.2
4.1.3
4.3.1
4.3.2
4.3.3
4.3.4
4.4.1
4.4.2
.
.
.
.
.
.
.
.
.
xi
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
173
174
178
191
193
195
197
202
205
Preface
An important objective of this book is to provide "math-on-time" for second
year students of science and engineering. The student should have had one
semester of calculus. The student most likely would take this matrix course
concurrently with the second semester of calculus or would use this text for independent study of these important topics. This text lls in often missed topics
in the rst year of calculus including complex numbers and functions, matrices, algebraic systems, curve tting, elements of linear dierential equations,
transform methods and some computation tools.
Chapters one and two have introductory material on complex numbers, 2D
and 3D vectors and their products, which are often covered in the beginning of
multivariable calculus. Here a connection is established between the geometric
and algebraic approaches to these topics. This is continued into chapters three,
four and ve where higher order algebraic systems are solved via row operations,
inverse matrices and LU factorizations. Linearly independent vectors and subspaces are used to solve over and under determined systems. Chapters six and
seven describe rst and second order linear dierential equations and introduce
eigenvalues and eigenvectors for the solution of linear systems of initial value
problems. The last two chapters use transform methods to lter distorted images or signals. The discrete Fourier transform is introduced via the continuous
versions of the Laplace and Fourier transforms. The discrete Fourier transform
properties are derived from the Fourier matrix representation and are used to
do image ltering in the frequency domain.
The rst ve chapters can be used as a two-credit course (28 50-minute
classes). Among the nine chapters there is more than enough material for a
three-credit course. This three-credit matrix course when coupled with a nineor ten-credit calculus sequence can serve as a more "diverse" alternative to the
traditional twelve-credit calculus sequence. The twelve-credit calculus sequence
can be adapted to this alternative by reducing the precalculus, moving some of
2D and 3D vectors and dierential equations into the matrix course, and using
computing tools to do the complicated computations and graphing.
Most sections have some applications, which should indicate the utility of the
mathematics being studied. Seven basic applications are developed in various
sections of the text and include circuits, trusses, mixing tanks, heat conduction, data modeling, motion of a mass and image lters. The applications are
xiii
PREFACE
xiv
developed from very simple models to more complex models. The reader can
locate sections pretaining to a particular application by using the index.
R
MATLAB is used to do some of the more complicated computations. Although the primary focus is to develop by-hand calculation skills, most sections at the end have some MATLAB calculations. The MATLAB m-les used
in the text are listed in the index and are included in the books Web site:
http://www4.ncsu.edu/~white. The approach to using computing tools includes: rst, learn the math and by-hand calculations; second, use a computing
tool to conrm the by-hand calculations; third, use the computing tool to do
more complicated calculations and applications.
I hope this book will precipitate discussions concerning the core mathematical course work that scientists and engineers are required to study. Discrete
models and computing have become more common, and this has increased the
need for additional study of matrix computation, and numerical and linear algebra. The precise topics, skills, theory and appropriate times to teach these
are certainly open for discussion. The matrix algebra topics in this book are
a small subset of most upper level linear algebra courses, which should be enhanced and taken by a number of students. This book attempts to make a
bridge from two- and three-variable problems to more realistic problems with
more variables, but it emphasizes skills more than theory.
I thank my colleagues who have contributed to many discussions about the
content of this text. And, many thanks go to my personal friends and Liz White
who have listened to me emote during the last year.
Bob White
MATLAB is a registered trademark of The MathWorks, Inc. For product
information, please contact:
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA 01760-2098 USA
Tel: 508-647-7000
Fax: 508-647-7001
E-mail: info@mathworks.com
Web: www.mathworks.com ?http://www.mathworks.com/A.
Introduction
One can view an pq matrix as a table of objects with p rows and q columns.
The objects are usually real or complex numbers, but they could be characters
or records of information. A simple example is data for the last 12 months of
car sales where there are p = 12 rows and q = 2 columns. The rst column
will have the months number and the second column will have the number of
cars sold in the corresponding month. By examining the data one would like
to make a prediction about futures sales. This is where the modeling enters.
If the graph of the sales versus months "looks" like a straight line, then the
data may be modeled by a linear function of time | = pw
b + f. The slope p
b
and intercept f must be chosen so that the computed sales are "close" to the
car sales data. This is done by appropriate manipulations of the two column
vectors and computing a solution of the resulting system of algebraic equations.
Once p
b and f have been found, the predicted sales for w larger than 12 can
easily be calculated by evaluating the linear function. The modeling process is
complicated by incorrect sales data, changing prices and other models such as
a parabolic function of time.
This text examines a variety of applications, which have matrix models and
often have algebraic systems that must be solved either by-hand calculations
or using a computing tool. Applications to projectiles, circuits, mixing tanks,
trusses, heat conduction, motion of a mass, curve tting and image enhancement
will be initially modeled in very simple ways and then revisited so as to make
the model more accurate. This is typical of the modeling process where there is
an application, a model, mathematical method, computations and assessment
of the results. Then this cycle is repeated so as to enhance the applications
model.
The rst two chapters deal with problems in two- and three-dimensional
space where the matrices have no more than three rows or columns. Here
geometric insight can be used to understand the models. In Section 2.5 the
extension to higher dimensions is indicated for vectors and matrices, solution
to larger algebraic systems, more complicated curve tting, time dependent
problems with systems of dierential equations and image modeling. Chapters
three, four and ve have the basic matrix methods that are required to solve
systems in higher dimensions. Chapters six and seven contain time dependent
models and introduce linear systems of dierential equations. The last two
xv
INTRODUCTION
xvi
6
5
6
0 0 0
1 0 0
]=7 0 0 0 8
L=7 0 1 0 8
0 0 0
0 0 1
5
6
5
6
1 0 0
1 7 10
4 8
H32 (3) = 7 0 1 0 8
X =7 0 2
0 3 1
0 0
3
5
6
5
2 1 0 200
1 1
0
b = 7 0 3@2 1
[D g] = 7 1 2 1 0 8
[X g]
0 1 2
70
0 0 4@3
6
5
5
2 1 0
0
8 6 4
9 1 2 1 0 :
9 6 12 8
1
:
D = (1@10) 9
D=9
7 0 1 2 1 8
7 4 8 12
0
0 1 2
2 4 6
6
5
5
6
1 1
1 2 3 4 5
9 2 1 :
:
UHI = 7 0 0 1 2 1 8
OV = 9
7 3 1 8
0 0 0 0 0
4 1
5
6
1 1 1 1
9 1 } }2 }3 :
:
F4 = 9
7 1 }2 1 }2 8
1 }3 }2 }
6
200
100 8
410@3
6
2
4 :
:
6 8
8
Chapter 1
1.1
In this section we rst discuss the integers and rational numbers. The oating
point numbers, which are used in computers, are a nite subset of the rational
numbers. The real and complex numbers are natural extensions of these. The
complex numbers also can be represented by directed line segments or vectors in
the plane. Although initially complex numbers may appear to be of questionable
value, they will be used extensively in the chapters on dierential equations and
image processing.
1.1.1
Rational Numbers
The integers are the set of whole numbers and include both positive, negative
and zero
Z { 2> 1> 0> 1> 2> }=
The addition and product of two integers are also integers. Any integer can
be uniquely factored into a product of prime numbers (an integer that is only
divisible by itself and one). For example, 90 = 51 32 21 =
The rational numbers are fractions of integers p@q where q is not zero and
p and q are integers
Q {p@q : p> q 5 Z> q 6= 0}=
1
The set of rational numbers has a countable but innite number of elements.
Also, the addition and product of two rational numbers are rational numbers.
1.1.2
Real Numbers
Any real number is approximated by a sequence of rational numbers. Traditionally, one uses a base ten decimal expansion with {l > h 5 Z and 0 {l ? 10
{ = (={1 {g )10h
({1 @10 + + {g @10g + )10h =
This expansion is either a bounded increasing or decreasing sequence of rational
numbers and, therefore, by the completeness axiom for the real numbers it must
converge.
R {({1 @10 + + {g @10g + )10h : {l > h 5 Z> 0 {l ? 10}=
Real numbers contain the rational numbers, but not all real numbers are
rational. For example, consider { = 31@2 where 3 is a prime number. If { were
a rational number, then { = p@q giving 3 = p2 @q2 and 31 q2 = p2 . The
left side has an odd number of prime factors 3, and the right side has an even
number of prime factors 3. This contradicts the unique factorization property
and, hence, { cannot be a rational number.
1.1.3
Computers use a nite subset of the rational numbers to approximate any real
number. This set of numbers may depend on the computer being used. However, they do have the same general form and are called oating point numbers. Any real number { can be represented by an innite decimal expansion
{ = (={1 {g )10h , and by truncating this we can dene the chopped
oating point numbers.
Let { be any real number and denote a oating point number by
i o({) = ={1 {g 10h
({1 @10 + + {g @10g )10h =
This is a oating point number with base equal to 10 where {1 is not equal
to zero, {l are integers between 0 and 9, the exponent h is an integer between
given integers i and j and g is a positive integer called the precision of the
oating point system
F {({1 @10 + + {g @10g )10h : {1 6= 0> 0 {l ? 10> 0 ? g}=
Associated with each real number, {, and its oating point approximate
number, i o({), is the oating point error, i o({) {. This error decreases as
the precision, g, increases. Each computer calculation has some oating point
error. Moreover, as additional oating point calculations are done, there may
be an accumulation of these oating point errors.
Example 1.1.1. Let { = 1=5378 and i o({) = 0=154 101 where g = 3. The
oating point error is
i o({) { = =0022=
The error will accumulate with any further operations containing i o({), for
example, i o({)2 = =237 101 and
i o({)2 {2 = 2=37 2=36482884 = =00517116=
Repeated calculations using oating point numbers can accumulate to signicant errors.
1.1.4
Complex Numbers
Any real number times itself must be positive unless it is zero. The square root
of any negative number cannot be positive and, therefore, not a real number!
The set of complex numbers is dened to be real numbers plus another real
number times l (1)1@2
C {d + el : d> e 5 R and l = (1)1@2 }=
If } 5 C> then real(}) = d is called the real part and imag(}) = e is called the
imaginary part. Two complex numbers are equal if and only if both the real
and imaginary parts are equal.
Complex numbers are often represented graphically where the real part is
located on the horizontal axis and the imaginary part is located on the vertical
axis. The complex number is then either viewed as point in the complex plane
or as directed line segment or arrow from the origin 0 + l0 to the complex point
} = d + el= Figure 1.1.1 illustrates this for } = 2 + 1l= One point of confusion
concerns the starting point of the arrow, which is the origin, but often the arrow
is moved parallel to its original position, as is illustrated by the top dashed arrow
in Figure 1.1.1 that is parallel to }= This is done to depict addition of two arrows
by placing the beginning of the arrow at the end of another arrow.
There are several important operations: conjugate of }, modulus of }, addition, subtraction, product and division. The conjugate of } is another complex
number formed by the reection of } about the real axis. The modulus of } is
the length of the vector. The algebraic operations are dened in the natural
way by using l2 = 1=
Denitions 1.1.1. Attributes of complex numbers } = d + el and z = f + gl=
}
}
|}|
arg(})
equations are
{ + 7 = 3 and
| + 2 = 4=
Thus, the complex solution of } + 7 + 2l = 3 + l4 is } = 4 + 2l=
Denitions 1.1.3. Operations with complex numbers } = d+el and z = f+gl=
}z
}z
}@z
(d f) + (e g)l
(d + el)(f + gl) = (df eg) + (ef + dg)l and
d + el
d + el f gl
df + eg ef dg
+ 2
l=
=
= 2
f + gl
f + gl f gl
f + g2
f + g2
=
=
=
1 + l 3 2l
3 + 2l 3 2l
(3 + 2) + (3 2)l
32 + 22
5
1
+ l=
14 14
The zero complex number has a zero real and imaginary parts, and we
simply write 0 = 0 + l0= The unit complex number has real part equal to one,
imaginary part equal to zero, and we write 1 = 1+l0= The multiplicative inverse
of a non-zero complex number } = d + el is another complex number
} 1
=
=
1 d el
d + el d el
d
e
+ 2
l=
2
2
d +e
d + e2
The following eleven algebraic properties are easily established. The rst ve
properties are the additive group properties, the next ve are the multiplicative
group properties for non-zero complex numbers and the last is the distributive
property.
Theorem 1.1.1 (Field Properties of Complex Numbers) Let }> z> z1 > z2 5 C=
Then
} + z 5 C, } + 0 = }, } + (}) = 0, } + z = z + },
} + (z1 + z2 ) = (} + z1 ) + z2 ;
}z 5 C, }1 = }, }(} 1 ) = 1 when } 6= 0, }z = z},
}(z1 z2 ) = (}z1 )z2 ;
}(z1 + z2 ) = }z1 + }z2 =
Example 1.1.6. This example illustrates how one can solve complex algebraic
equations where we must solve for both the real and imaginary parts of an
unknown complex number } = { + l|= Here we use the above eld properties
1 + 4l
= 2+l
}+1
1 + 4l = (2 + l)(} + 1)
= (2 + l)} + (2 + l)=
Now solve for }
}
=
=
=
(1 + 4l) (2 + l)
(2 + l)
1 + 3l 2 l
2+l 2l
1
7
+l =
5
5
5 + 20l
6 + 7l
5 + 20l 6 7l
=
6 + 7l 6 7l
170 + 85l
=
85
= 2 + l=
The complex numbers are extensions of the real numbers, and many of
the algebraic and absolute value properties extend to the complex numbers.
For example, if d and f are real numbers and |d| is the absolute value, then
|df| = |d| |f|. When d and f are extended to complex numbers and absolute
value is extended to the modulus of a complex number, then one can show
|}z| = |}| |z| = In order to see this is true, let } = d + el and z = f + gl and
show |}z|2 = |}|2 |z|2 :
}z
2
|}z|
= d2 + e2 (f2 + g2 )
2
= |}| |z| =
2
If } = z, then we could write this as } 2 = |}|
Another property of the product }z is arg(}z) = arg(}) + arg(z), and
this with } = z is illustrated in Figure 1.1.2= Figure 1.1.2 was generated by
the MATLAB code complex_prod.m and command quiver.m to generate the
vectors. The proof follows from the trigonometric identities
cos( + *) = cos() cos(*) sin() sin(*) and
sin( + *) = sin() cos(*) + cos() sin(*)=
1.1.5
MATLAB also uses i to represent the square root of minus one. The following
are some complex numbers and operations:
AA z = 1 + i*2
z=
1.0000 + 2.0000i
AA w = 2*z +1
w=
3.0000 + 4.0000i
AA z^2
ans =
-3.0000 + 4.0000i
AA w*z
ans =
-5.0000 +10.0000i
AA z/w
ans =
0.4400 + 0.0800i.
The MATLAB command quiver(x,y,dx,dy,s) produces a plot of a vector that
begins at the point (x,y) and ends at the point (x+dx,y+dy), see Figure 1.1.2.
The following graphs a vector representation of a complex number:
z=
1.0000 + 2.0000i
AA plot(z,*)
AA hold on
AA quiver(0,0,real(z),imag(z),1)
This produces a graph with the complex number marked by a *, and then
inserts an arrow from the origin to the complex number. The MATLAB code
complex_prod.m also illustrates this.
1.1.6
Exercises
1.
10.
2+l
=
3 7l
Find the real and imaginary parts of
11.
2+l
+ 5=
10 + 7l
Solve for the complex number } = { + |l
12.
2 + 4l
= 7 + l=
}+l
Solve for the complex number } = { + |l
2 + 4l
= 1 + l=
2} l
13.
Prove the remaining properties in Theorem 1.1.2.
14.
Does the quadratic formula hold when the coe!cients d> e and f are
complex numbers? You may wish to consider some special cases such as d =
1> e = 0 and f = l= One needs to be able to dene the square root of a complex
number!
15.
Use MATLAB and enter } = 2 + 3l and z = 2 3l=
(a).
Graph } and z=
(b).
Compute }z and }@z=
(c).
Use quiver() to plot the vectors for } and z=
16.
Consider the calculations
in Figure 1.1.2 given by the MATLAB code
s
complex_prod.m. Let } = 3 + 1l=
(a).
Use by-hand calculations to nd } 2 , } 3 , their norms and arguments.
(b).
Modify complex_prod.m to conrm your by-hand calculations.
10
1.2
Mappings from the complex numbers into the complex numbers can be viewed
as functions from the plane into the plane. Several examples such as d} + e or
} 2 were introduced in the previous section and here additional functions will
be described. An important objective is to develop the Euler formula for the
exponential function of an imaginary number
hl| = cos(|) + l sin(|)=
This formula is extremely useful and has applications to trigonometric identities, the solution of algebraic and dierential equations, circuits and signal
processing.
1.2.1
(1.2.1)
ge
7l (3 l)
3 + 8l
3 + 8l 1 l
5 + 11l
=
=
=
=
=
d
1+l
1+l
1+l 1l
2
11
d} + e
f} + g
}+l
=
}l
This function can be represented by two real valued functions x({> |) and y({> |)
i (}) =
=
=
=
=
}+l
}l
({ + l|) + l
({ + l|) l
{ + l(| + 1) { l(| 1)
{ + l(| 1) { l(| 1)
{2 + | 2 1
2{
+l 2
2
2
{ + (| 1)
{ + (| 1)2
x({> |) + ly({> |)=
The solution of i (}) = 2 + l can be found by equating the real and imaginary
parts x({> |) = 2, y({> |) = 1 and solving for { and |= Or, one can use the
properties in Theorem 1.1.1 to nd } as follows:
}+l
}l
}+l
}(1 (2 + l))
}(1 l)
}
= 2+l
= (2 + l)(} l) = (2 + l)} (2 + l)l
= (2 + l)l l
= 3l + 1
1 + 3l 1 l
2 + 4l
=
=
= 1 + 2l=
1+l 1l
2
12
In Section 1.1 we used the polar representation } = |}| (cos() + l sin()) and
Theorem 1.1.2 with } = z to obtain
} 2 = |}|2 (cos(2) + l sin(2))=
This suggests that the square root of complex number should be
} 1@2 |}|1@2 (cos(@2) + l sin(@2))=
A complex square root function i (}) =
values so that its square is }
s
( })2
{ + l|
(1.2.2)
s
} = x + ly must have complex
= (x + ly)2
= (x2 y 2 ) + l2xy=
Thus, one must choose x and y such that { = x2 y 2 and | = 2xy= The use of
trigonometric identities conrms
1@2
x = |}|
1@2
sin(@2)
are the solution of these two equations and, hence, equation (1.2.2) is correct
for the denition of square root of }=
s
Example 1.2.3. Use equation (1.2.2) to nd the square root of } = 1 + 3l.
The modulus of } is 2 and the angle is @3 or 60 degrees so that } = 2(cos(@3)+
l sin(@3))= Equation (1.2.2) gives
(1 +
s 1@2
3l)
s
3l is plus or
Figure 1.2.1 illustrates the linear, square and square root functions of a
complex variable; this was generated by the MATLAB code complex_power.m.
The complex numbers in the domain correspond to the domain semicircle with
radius equal to three. The linear function has values in the complex plane where
the domain semicircle has been doubled in radius and shifted to the right. The
square function has values in the complex plane where the domain semicircle
has been expanded in both the radial direction and in an angular direction to
one complete circle of radius equal to three squared. The smallest curve depicts
the square root function. Now, the domain semicircle has been contracted in
both the radial and angular components to one half of the semicircle and with
radius equal to the square root of three.
13
1.2.2
Exponential Function e}
= 1 and
(1.2.3)
= lhl| =
(1.2.4)
By equating the real and imaginary parts in equations (1.2.3) and (1.2.4) we
have
x(0) = 1 and y(0) = 0 and
gx
gy
= y and
= x=
g|
g|
(1.2.5)
(1.2.6)
Note the x(|) = cos(|) and y(|) = sin(|) satisfy these equations.
In order to justify using the exponential function to represent this complex
valued function, use the power series expansions, which are studied in the second
14
semester of calculus,
h{
{2
{3 {4 {5
+
+
+
+ >
2!
3!
4!
5!
4
{
+
and
4!
{5
+
=
5!
= 1+{+
{2
2!
{3
sin({) = {
3!
cos({) = 1
Extend the exponential functions domain from the real numbers to the complex
numbers by replacing { by l|
hl|
1.2.3
= { + l|
= |}| (cos() + l sin ())
= |}| hl =
Four consequences of Eulers formula are presented. First, since the cosine is
an even function and the sine function is an odd function,
hl{
= cos({) + l sin({)
= cos({) l sin({)
= hl{ =
15
Second, this leads to the representation of the cosine and sine functions
cos({) = (hl{ + hl{ )@2 and
sin({) = (hl{ hl{ )@(2l).
(1.2.7)
(1.2.8)
Third, consider the product of hl{ and hl| and use the trigonometric identities
for the sum of angles
hl{ hl|
Fourth, another identity, which follows from the repeated use of hl{ hl| = hl({+|)
with | = {> is de Moivres formula
(cos({) + l sin({))q
= (hl{ )q
= hl{q
= cos(q{) + l sin(q{)=
(1.2.9)
This formula for dierent choice of q leads to a variety of trigonometric identities. Equation (1.2.9) can be used to reduce computations with large exponents.
Example 1.2.4. Use de Moivres formula to evaluate (3 + 4l)10 . First, write
3 + 4l in exponential form 3 + 4l = 5hl where = tan1 (4@3)= Second, use
equation (1.2.9) with q = 10 on the second factor
(3 + 4l)10
1.2.4
=
=
=
=
=
(5hl )10
510 (hl )10
510 hl10
510 (cos(10) + l sin(10))
510 (0=9885 + 0=1512l)=
Application to Solution of } q = g
Consider the case q = 2 where the solution of } 2 = g is plus or minus the square
root of g= Let g = |g| hl and
1@2 l@2
16
This leads to all q solutions } = (hl2@q )m = hl(2@q)m where m = 0> 1> ===> q 1=
They are solutions because
}q
=
=
=
=
(hl(2@q)m )q
hl(2)m
cos((2)m) + l sin((2)m)
1=
Denition 1.2.2. Let m = 0> 1> > q1= Then hl(2@q)m are solutions to } q = 1
and are called the qwk roots of unity.
Example 1.2.5. Let q = 3 and nd the three solutions of } 3 = 1= Here
2@q = 2@3 or 120 degrees. The three solutions are
hl(2@3)0
hl(2@3)1
hl(2@3)2
= cos((2@3)0) + l sin((2@3)0) = 1
= cos((2@3)1) + l sin((2@3)1) = 0=5000 + 0=8660l
= cos((2@3)2) + l sin((2@3)2) = 0=5000 0=8660l=
1@q
= g1@q = |g|
(1.2.10)
m q
Dene z h
and use the fact (z ) = 1 to obtain all q solutions } =
g1@q zm where m = 0> 1> ===> q1= A summary of the above is given in the following
theorem.
Theorem 1.2.1 (Solutions of } q = g)= Let z hl2@q and g = |g| hl = Then
z satises z = z1 > zq = 1 and 1+z+ +zq1 = 0= Moreover, the solutions
1@q l@q m
h
z = g1@q zm where m = 0> 1> > q 1=
of } q = g are given by } = |g|
Example 1.2.6. Let q = 3 and nd the three solutions of } 3 = 1 + l= Here
2@q = 2@3 and g = 1 + l = 21@2 hl@4 = The three solutions are
21@6 hl@12 hl(2@3)0
21@6 hl@12 hl(2@3)1
21@6 hl@12 hl(2@3)2
=
=
=
=
=
=
17
1.2.5
Complex functions are evaluated using MATLAB as are real functions. The
computations in Example 1.2.6 are easy to do. The second solution is
AA a = exp(i*2*pi/3)
a=
-0.5000 + 0.8660i
AA b = 2^(1/6)*exp(i*pi/12)
b=
1.0842 + 0.2905i
AA a*b
ans =
-0.7937 + 0.7937i
AA z = a*b
z=
-0.7937 + 0.7937i
AA z^3
ans =
1.0000 + 1.0000i.
The MATLAB code complex_power.m, see Figure 1.2.1, uses an implied loop
to generate a row vector of values for the parameter w= Then a row vector of
complex values is computed to form the semicircle, which is to be the domain
of three functions. Array operations given by }=s are used to compute the
18
square and square root functions. An array operation on a row vector produces
another row vector whose components are given by the operation. For example,
if d = [2 3]> then d=2 = [22 32 ]=
The MATLAB code euler_form.m, see Figure 1.2.2, uses a for-loop to generate a sequence of vectors associated with the complex exponential function
raised to a variety of powers. The vectors are created by the MATLAB command quiver(x,y,dx,dy,1), which graphs a vector beginning at the point ({> |)
and ending at ({ + g{> | + g|).
1.2.6
Exercises
1.3. VECTORS IN R2
1.3
19
Vectors in R2
1.3.1
$
$
There are a number of notations of vectors. One is the l > m unit vectors often
used in physics textbooks. Other notations list the components in either a row
or a column. There is also some confusion about the dierence between a point
in a plane and a vector in a plane; often the notation is the same! Part of the
problem is the need to have vectors with more than two or three components,
which will be considered after the rst two chapters.
$
Denition 1.3.1. A vector in R2 is an ordered list of two real numbers
d =
[d1 d2 ]. One can visualize this by forming the directed line segment from the
origin point (0> 0) to the point (d1 > d2 )=
Notation. Points in the plane R2 will be denoted by (d1 > d2 )> and vectors will
be considered as either row or column vectors:
$
d = [d1 d2 ] denotes a row vector >
d1
a =
denotes a column vector =
d2
$
d=
aW = [d1 d2 ] is called the transpose of the column vector a so that aW =
Example 1.3.1. The standard unit basis vectors are
$
1
and
l = [1 0] or e1 =
0
$
0
m = [0 1] or e2 =
=
1
Any vector can be represented as a linear combination of unit vectors. For
$
example, if
d = [2 3], then either by row vectors
$
$
$
d = 2 l + 3 m or by column vectors
a = 2e1 + 3e2 =
These vectors are illustrated in Figure 1.3.1.
20
1.3. VECTORS IN R2
21
Figure 1.3.2: f2 = d2 + e2
The vector notation for Newtons law of motion is
$
i = [i1 i2 ]
gy1
gy2
= [p
p
]
gw
gw
$
= p d where
gy1 gy2
$
d = [
] = acceleration vector.
gw gw
As in complex vectors there are operations with vectors such as addition,
length and angles. Two very useful theorems are related to the length of a
side of a triangle, which is opposite one of the angles. When the angle is 90
degrees, the Pythagorean theorem gives a very useful relationship between the
three sides. There are number of proofs for the Pythagorean theorem, but the
following is a very nifty proof that is based on geometry. Consider Figure 1.3.2
where the right triangle has sides of length d> e and f with f being opposite the
90 degree angle. The gure is drawn with d larger than e. The area of the big
square is f squared, and it is the union of four identical triangles and a small
square
f2
= 4(de@2) + (d e)2
= 2de + d2 2de + e2
= d2 + e2 =
22
=
=
=
=
(e sin())2 + (d e cos())2
e2 sin2 () + d2 2de cos() + e2 cos2 ()
e2 (sin2 () + cos2 ()) + d2 2de cos()
e2 + d2 2de cos()=
1.3.2
Vector Operations
Vectors can be scaled, added and subtracted by either viewing the vectors
geometrically or as symbolic objects. Figure 1.3.4 illustrates vector scaling by
$
$
$
either elongating or shrinking the vector e . Two vectors
d and e can be
$
added by moving vector e parallel to its original position so that its beginning
$
point is the end point of vector
d . The addition corresponds to the diagonal
$
$
$
$
of the parallelogram formed by vectors
d and e . If
d is added to e , then
$
$
the subtraction is the other diagonal from the end of
d to the end of e =
1.3. VECTORS IN R2
23
$ $
$
$
Figure 1.3.4: $
d + e >
d e and v e
$
$
$
Denitions 1.3.2. Let
d = [d1 d2 ], e = [e1 e2 ] and 0 = [0 0] be the zero
$
$
vector.
d equals e means both d1 = e1 and d2 = e2 = The addition of two
vectors is another vector whose components are the sum of the components of
the two vectors
$
$
d + e [ d1 + e1 d2 + e2 ]=
Let v be a real number. The scalar product of a vector is another vector whose
components are the scalar times the components of the vector
$
v
d [ vd1
vd2 ]=
$
$
$ $
$
$
$
e +$
d > (
d + e )+
f =
d +( e +
f )>
$
$
$
$
= d and d + ( d ) = 0 ;
$
$
$
$
$
$
= v
d + w
d , v(w
d ) = (vw)
d > 1
d =
d and
$
$
= vd +ve =
=
24
$
$
$
$
The proofs are straightforward. The proof of
d + e = e +
d uses the
commutative property for addition of real numbers
$
$
d + e = [ d1 + e1
= [ e1 + d1
$ $
= e +
d=
d2 + e2 ]
e2 + d2 ]
$
$
$
Example 1.3.2. Let
d = [2 4], e = [1 2] and v = 3= Then $
d + e = [1
$
$
$
6]>
d e = [3 2] and v e = [3 6]=
Example 1.3.3. One can use the above basic properties to solve vector equa$
$
$
d and e are given
tions for an unknown vector
{ = [{1 {2 ]= Suppose vectors
$
$
$
$
and
{ must satisfy the vector equation
d +
{ = e . Solve this by adding the
$
vector d to both sides and use the algebraic rules
$ $
$
$
$
(
d +
{)
d = e
d
$
$
$
$
$
({ + d) d = e d
$ $
$
$
$
{ + (
d
d) = e
d
$
$
$
{ = e d=
Denitions 1.3.3. Let $
d = [d1 d2 ]. The length or Euclidean norm of the
$
vector d is given by the Pythagorean theorem
q
$
k
d k d21 + d22 =
The angle of the vector is
= arctan(d2 @d1 )=
The unit vector in the direction of $
d is
$
d
1
$
d=
= $
$
kdk
kdk
The cosine law may be rewritten in terms of the norms of the vectors
$
$
$
$
$
$
d > e >$
f =
d e and the angle between the vectors
d and e
$
2
$2
$
2
$
$
d e = k
d k + e 2 k
d k e cos()=
$
This allows one to compute the angle between two given vectors. In fact, this
can be simplied to easily compute cos()> sin() and the area of the parallelogram formed by two vectors. In Section 1.4 this will be applied to the
computation of work and torque.
1.3. VECTORS IN R2
25
$
$
$
Example 1.3.4. If
d = [2 4] and e = [1 2]> then $
d e = [3 2]>
$2
$2
2
$
d e = 13> k
d k = 20> e = 5 so that
$
s s
13 = 20 + 5 2 20 5 cos()
= 20 + 5 20 cos()
cos() = 12@20 = 3@5
= cos1 (3@5) 53=13 degrees.
$
The unit vector associated with
d is
$
s
s
[2 4]
d
= s = [1@ 5 2@ 5]=
$
kdk
2 5
1.3.3
A pilot wishes to y northeast with a speed of 400 miles per hour. The means
the desired velocity vector has length equal to 400 and the speed in the east
$
and north directions are equal. Let this desired velocity be the vector
y = [y1
$
y2 ] where k y k = 400 and y1 = y2 A 0
y12 + y12 = 4002 =
s
Thus, y1 = y2 = 400@ 2= An added di!culty is the wind velocity, which is
coming from the northwest and has a speed equal to 100 miles per hour. Let
$
$
z = [z1 z2 ] where k
z k = 100 and z1 = z2 A 0
z12 + z12 = 1002 =
s
$
Thus, z1 = z2 = 100@ 2= What should the heading velocity k = [k1 k2 ]
be so that the desired velocity is attained? The aircraft must be pointed north
$
of northeast and have a speed larger than 400. The desired velocity
y is the
$
$
resultant of the wind velocity z and the heading velocity k > which means
$
$
$
y =
z + k=
By the basic rules for vector operations
$
$
$
k =
y
z
s
s
s
s
[k1 k2 ] = [400@ 2 400@ 2] [100@ 2 100@ 2]
s
s
= [300@ 2 500@ 2]=
The speed of the aircraft should be
q
s
s
s
$
k = (300@ 2)2 + (500@ 2)2 = 100 18 424=26>
and the angle from the east direction should be
s
s
arctan((500@ 2)@(300@ 2)) = arctan(5@3) 59=04 degrees=
26
1.3.4
The vector notation in MATLAB is very similar to what has been used in this
text and uses square brackets to enclose both row and column vectors. The
overhead arrow and bold notations are not used to distinguish row and column
vectors. A row vector such as d = [2 5] is converted to a column vector by
using a prime, [2 5].
AA a = [2 5]
a=
25
AA e1 =[1 0]
e1 =
1
0
AA e2 = [0 1]
e2 =
0
1
AA aa = a(1)*e1 + a(2)*e2
aa =
2
5
AA b = [-1 5]
b=
-1 5
AA c = 2*a + 3*b
c=
1 25
The MATLAB command quiver(x,y,dx,dy,s) can be used to graph vectors
starting at the point ({> |) and ending at the point ({ + g{> | + g|) and using
$
v = 1= The following generates a graph of the two vectors
d = [2 5] and
$
e = [1 3].
AA quiver(0,0,2,5,1)
AA hold on
AA quiver(0,0,-1,3,1)
1.3.5
Exercises
$
$
$
1.
Consider the vector
d = [2 5]= Write it in l m and column forms.
$
$
$
2.
Consider the vector
d = [1 3]= Write it in l m and column forms.
$
$
$ $
$
$
$
$
$
3.
Let
d = [2 5] and e = [1 3]. Graph
d > e > e >
d + e and
d e=
$
$
$
$
$
$
$
4.
Let
d = [2 3] and e = [1 5]. Graph 2
d > e > e >
d + e and
$
$
d 2e =
27
$
$
$
$
$
5.
Let
d = [2 5] and e = [1 3]. Solve
d +
{ = e=
$
$ $
$
$
6.
Let
d = [1 7] and e = [1 3]. Solve 2
d = e +
{=
$
$ $
$
$
$
7.
Consider Theorem 1.3.3. Prove (
d + e )+
f =
d +( e +
f )=
$
$
$
$
8.
Consider Theorem 1.3.3. Prove v( d + e ) = v d + v e =
$
$
$
d = [1 7]. Compute k
d k, the angle and unit vector of
d=
9.
Let
$
$
$
10.
Let d = [1 3]. Compute k d k, the angle and unit vector of
d=
$
$
11.
Let d = [2 5] and e = [1 3]. Graph these vectors and use the cosine
law to nd the angle between them.
$
$
12.
Let
d = [1 2] and e = [1 3]. Graph these vectors and use the
cosine law to nd the angle between them.
13.
Consider the aircraft heading problem. If the desired velocity is to the
northeast with speed 500 and the wind velocity has speed 120 and from the
north, nd the heading velocity.
14.
Consider the aircraft heading problem. If the desired velocity is to the
northwest with speed 500 and the wind velocity has speed 120 and from the
east, nd the heading velocity.
$
$ $
$
$
$
$
$
d > e > e >
d + e and
d 2 e where
d = [2
15.
Use MATLAB to compute 2
$
3] and e = [1 5]=
$
$
$
$
d and e where
d = [2 3] and e = [1 5]=
16.
Use MATLAB to graph
1.4
1.4.1
$
$
Let
d = [d1 d2 ] and e = [e1 e2 ] have the angle between the vectors. The
vector version of the cosine law is
$
2
$2
$
2
$
$
d e = k
d k + e 2 k
d k e cos()=
(1.4.1)
$
By denition of vector subtraction and the norm
$
2
d e
$
= (d1 e1 )2 + (d2 e2 )2
= d21 2d1 e1 + e21 + d22 2d2 e2 + e22
$2
2
$
= k
d k + e 2(d1 e1 + d2 e2 )=
28
Place this into the left side of equation (1.4.1) and cancel the norms
$2
$2
$
2
2
$
$
$
k
d k + e 2(d1 e1 + d2 e2 ) = k
d k + e 2 k
d k e cos()
$
$
2(d1 e1 + d2 e2 ) = 2 k
d k e cos()
$
$
d1 e1 + d2 e2 = k
d k e cos()=
(1.4.2)
Equation (1.4.2) is of fundamental importance. The left side is an easy calculation, and the right side makes a connection with the geometry. At the end of
this section an application will be given to work being done in a constant force
eld, which is independent of three possible paths.
$
$
Theorem 1.4.1 (Cosine Identity) Let
d = [d1 d2 ] and e = [e1 e2 ] be nonzero vectors and let be the angle between the two vectors. Then the cos() can
be computed by
d1 e1 + d2 e2
cos() =
$ =
$
k
d k e
$
$
Denition 1.4.1. The dot product of two vectors
d = [d1 d2 ] and e = [e1 e2 ]
is given by the real number on either side of equation (1.4.2). The following are
common notations for the dot product of row or column vectors, respectively,
$
$
$
$
d k e cos() or
d e d1 e1 + d2 e2 = k
aW b d1 e1 + d2 e2 = kak kbk cos()=
The cosine identity can be restated as either
cos() =
$
$
d e
$ or
$
k
d k e
cos() =
aW b
.
kak kbk
kak2
$
= $
d
d or
= aW a=
$
$
$
d e k
d k e or
$
W
a b kak kbk =
29
$
$
Denitions 1.4.2. Let
d and e be non-zero vectors. Two vectors are parallel
if and only if they are multiples of each other, that is, there is a real number
$
$
v such that
d = v e = Two vectors are perpendicular (also called orthogonal) if
$
$
and only if the cos() is zero, that is,
d e = aW b = 0=
$
2
$
$
Example 1.4.1. Let
d = [2 3] and e = [1 2]. Then k
d k = 22 + 32 = 13>
$
$2
$
d e = 2(1) + 3(2) = 4=
e = (1)2 + 22 = 5> and
$
$
d e
4
4
s s
s
cos() =
$ = 13 5 = 65 and
$
k d k e
4
1
s
60=26 degrees.
= cos
65
Example 1.4.2. Consider the following three vectors written as column vectors
2
22
6
a=
>b =
and c =
=
3
33
4
Vectors a and b are parallel because a =(1@11)b= Vector a is perpendicular to
c because the dot product aW c = 2(6) + 3(4) = 0= Also, b and c must be
perpendicular. Consider a vector d whose rst component is 2, but the second
component is unknown. Choose the second component so that the vector d
is perpendicular to vector a= Let the vector d be represented by its transpose
dW = [2 {]= The vector d being perpendicular to a requires their dot product
to be zero
2
2 3
aW d =
{
= 2(2) + 3{ = 0=
Thus, { = 4@3 and dW = [2 4@3].
$
Denition 1.4.3. The projection
of
e onto $
d is a vector with direction the
$
$
same as d and length equal to e cos()
$
$
$
$
d
d
$
e cos() = $
$
2 d e=
kdk
kdk
The dot product has a number of interesting algebraic properties. One is
the order of the vectors does not change the value of the dot product.
$
$
d e = d1 e1 + d2 e2
= e1 d1 + e2 d2
$ $
= e
d=
Additional dot product properties listed in the following theorem are also easy
to prove.
30
$ $
$
Theorem 1.4.2 (Properties of Dot Product) Let
d > e >
f be given vectors
and let v be a real number. The dot product properties are
$
$ $
$
$
$
$
$
d e = e
d > v(
d e ) = (v
d) e >
$ $
$ $
$
d ( e +
f) = $
d e +
d $
f and
$
$
$
$
d e k d k e (Cauchy-Schwarz inequality).
Since the norm of a vector can be written in terms of the dot product
2
$
$
$
d
d>
k
dk =
several important properties of a norm can be derived from the above dot
product properties. The following norm properties are similar to the absolute
value of a real number.
$
$
Theorem 1.4.3 (Properties of Norm) Let
d and e be given vectors and let
v be a real number. The norm properties are
$
$
$
$
k
d k 0; k
d k 0 if and only if
d = 0>
$
$
kv
d k = |v| k
d k and
$
$
$
$
d + e k d k + e (triangle inequality).
The triangle inequality follows from the dot product properties
$
$
$
2
$
$
d + e ) (
d + e)
d + e = (
$
$
$ $
$
$
$
=
d (
d + e ) + e (
d + e)
$
$ $
$
$
$
$
$
=
d
d +
d e + e
d + e e
$
$
2
2
$
$
= k
d k + 2
d e +e
$
$
2
$
2
$
k
d k + 2
d e + e =
Next apply the Cauchy-Schwarz inequality to get
$2
$
2
$
2
$
d k + 2 k$
d k e + e
d + e k
$
$
$
= (k
d k + e )2 =
1.4.2
The dot product version of the cosine identity can be used to derive the formula
for the cosine of the sum of two angles
cos( + !) = cos() cos(!) sin() sin(!)=
31
Choose
length.
angles.
and let
that
two vectors as illustrated in Figure 1.4.1 where both vectors have unit
Then the rst and second components are the cosine and sine of their
$
$
Let the vectors
d and e have angles equal to and !> respectively,
$
$
the vector
f be the reection vector
d about the horizontal axis so
$
d = [cos() sin()]
$
e = [cos(!) sin(!)] and
$
f = [cos(!) sin(!)]=
$
$
The angle between vectors
d and
f is (!) = + ! and, therefore, by
$
$
application of the cosine identity to the vectors
d and
f
cos( + !) =
=
$
$
d
f
$
$
k d k k
fk
cos() cos(!) + sin()( sin(!))
=
1(1)
32
$
of the parallelogram is e sin() and, thus,
(duhd)2
$
$
= (k
d k e sin())2
$
$
= (k
d k e )2 (1 cos2 ())=
$
$
d e 2
$ 2
$
= (k d k e ) (1 (
$
) )
$
k
d k e
$2
$
2
$
$
d e )2
= k
d k e (
= (d21 + d22 )(e21 + e22 ) (d1 e1 + d2 e2 )2
= (d1 e2 e1 d2 )2 =
(1.4.3)
d1 e1
det([a b]) = det(
) d1 e2 e1 d2 =
d2 e2
Then equation (1.4.3) is
(duhd)2 = (det([a b]))2 =
d1 u + e1 v
0
=
d2 u + e2 v
0
d1
e1
0
u
+v
=
0
d2
e2
ua + vb = 0=
Thus, the above are also equivalent to ua + vb = 0 implies both u and v must
be zero. Such vectors are called linearly independent, which will be studied in
33
e1 v
e2 v
= d1 u(e2 v) e1 v(d2 u)
= uv det([a b])=
1.4.3
This application is concerned with moving a mass from one point in a plane
to an other point in the plane. One can do this by using a ramp or using a
wheel. In the case of ramp the displacement vector is along the top of the ramp
and the force vector may not be parallel to the ramp, see Figure 1.4.4. For the
wheel one must be able to apply a non-zero force tangent to the perimeter of
the wheel, see Figure 1.4.5.
The movement of an object up a ramp requires a force with both non-zero
horizontal and vertical components. In order to reduce the computation of work
to the scalar formula, work equals distance times the force, we must nd the
component of the force
displacement
vector. In
vector in the direction of the
$
$
$
Figure 1.4.4 this is i cos() so that the work is g i cos()= If the given
$
$
vectors are g and i , then the work is computed by the cosine identity and
34
$
$
zrun = g i =
For example, if the bottom edge of the ramp is 10 and the vertical part is 5,
$
then g = [10 5]= Suppose the force vector is 100 in the horizontal direction and
$
$
$
10 in the vertical direction so that i = [100 10]= Then the work is g i =
10(100) + 5(10) = 1050=
For the rotation of a wheel the force vector may not be tangent to the
wheel and so one must compute the component of the force acting in this
direction. This computation, in contrast to the above work problem, uses the
sine of the angle and not the cosine. Figure 1.4.5 reveals why this is the case.
The scalar value
for torque is the radius times the tangent component of the
$
$
force k u k i sin()= This value is related to plus or minus the area of the
parallelogram formed by the radius vector and the force vector.
1.4.4
g1 i1 + g2 i2 = g i cos()=
35
36
The work along the direct path is g i cos()= The work along the second
path is g1 i1 + g2 i2 , and the work along the third path is g2 i2 + g1 i1 > which is
the same as path two because the addition of real numbers commutes. Thus,
the work done is independent of the three paths taken for constant displacement
and force vectors.
1.4.5
The dot product of two vectors can be computed in two ways. The MATLAB
command dot(a,b) will do this if the vectors are both row or column vectors.
If the vectors are both column vectors, then one can use the transpose version
aW b> and in MATLAB this would appear as d0 e provided d and e were column
vectors.
AA a
a=
2 1
AA b
b=
1 -1
AA dot(a,b)
ans =
1
AA a*b
ans =
2 -2
1 -1
In the above d and e were initially row vectors so that d0 e will be a column
vector times a row vector, which results in a 2 2 matrix. By transposing them
37
to column vectors one can compute the dot product as a row vector times a
column vector.
AA cola = a
cola =
2
1
AA colb = b
colb =
1
-1
AA colb*cola
ans =
1
1.4.6
1.
Exercises
2.
Verify the cosine identity in equation (1.4.2) for the vectors in column
form
s
1
3
and b =
=
a=
1
1
3.
Use the cosine identity in equation (1.4.2) to nd the angle between the
vectors in column form
1
3
a=
and b =
=
2
1
4.
Use the cosine identity in equation (1.4.2) to nd the angle between the
$
$
vectors
d = [2 1] and e = [1 1]=
$
$
5.
Find { such that
d = [3 1] and e = [{ 1] are perpendicular.
6.
Find { such that the following column vectors are perpendicular
1
3
a=
and b =
=
2
{
7.
38
9.
Use the formula in equation (1.4.3) to compute the area of the parallelogram given by the column vectors
1
3
a=
and b =
=
2
1
10.
Use the formula in equation (1.4.3) to compute the area of the parallel$
$
ogram given by the vectors
d = [2 1] and e = [1 1]=
$
$
11.
Let
d = [2 1] and e = [1 1]= Verify the area of the parallelogram
$
$
given by the vectors 6
d and 3 e is 18 times the area of the parallelogram given
$
$
by the vectors
d and e =
12.
Consider the work in moving an object up a ramp whose horizontal edge
$
is 25 and vertical edge is 5. If the force vector is i = [10 1]> nd the work.
13.
Consider the work in moving an object up a ramp that requires a force
vector with force of 3 in the horizontal direction and 1 in the vertical direction.
$
If the displacement vector is g = [30 6]> nd the work.
$
$
14.
Use MATLAB to compute the dot product of
d = [2 1] and e = [3 4]=
$
d =
15.
Use MATLAB to compute the area of the parallelogram between
$
[1 2] and e = [3 1]=
1.5
1.5.1
The three most common algebraic representations of a line are the slope-intercept,
the single equation and the parametric equations, respectively:
| |0
= p>
(1.5.1)
{ {0
d{ + e| + b
f = 0 or d({ {0 ) + e(| |0 ) = 0>
(1.5.2)
{ {0
| |0
=
= w= (1.5.3)
{ = g1 w + {0 , | = g2 w + |0 or
g1
g2
|
= p{ + f or
Example 1.5.1. Suppose a line contains the point (1> 2) and satises the
equation 3{ + 4| 11 = 0= Since { = 1 and | = 2 satises this equation, the
39
3
11
|2
3
{+
or
=
= p=
4
4
{1
4
In order to nd the parametric equation (1.5.3), use the second form for the
slope
3
|2
{1
|2
=
or
=
= w=
{1
4
3
4
This means | = 3w + 2 and { = 4w + 1= Note there are other possible choices
for the parameter such as w = 2b
w=
$
Three vector representations are one point and a direction vector g , two
$
distinct points, and one point and a normal vector q = The rst representation
is given by the vector version of the parametric equations
[{ |] = w[g1 g2 ] + [{0 |0 ]
$ $
$
u = wg +
u 0=
(1.5.4)
This is illustrated in Figure 1.5.1 where the direction vector and the point are
$
given; the given point is ({0 > |0 ) and the vector
u 0 starts at the origin and
$
ends this given point. The vector w g in the gure depicts an extension of the
given direction vector. Then any point on the line, represented by the vector
$
u beginning at the origin and ending at the point on the line, is a vector sum
$
$
of w g and
u 0=
If two points are given on the line by ({0 > |0 ) and ({1 > |1 ), then consider the
$
two vectors starting at the origin and ending at these points,
u 0 = [{0 |0 ] and
$
$
$
u 1 = [{1 |1 ]. Then u 1 u 0 is a vector that is parallel to the line and can
40
be used as the direction vector
$ $
$
u = wg +
u0
$
$
$
= w( u 1
u 0) +
u 0=
(1.5.5)
If a point and a normal vector are given, then the normal vector must be
$
$
perpendicular to any vector parallel to the line. If
u and
u 0 are two vectors
$
$
$
that are associated with two points on the line, then u u 0 and
q must be
perpendicular so that
$
$
$
(1.5.6)
q (
u
u 0 ) = 0=
This vector equation is related to the second version of the single equation
(1.5.2) representation
d({ {0 ) + e(| |0 ) = 0
[d e] [{ {0 | |0 ] = 0
$
$
$
q (
u
u 0 ) = 0=
Example 1.5.2. Find the vector equation (1.5.4) for the line with point (2> 1)
and parallel to the vector [1 4]=
$ $
$
u = wg +
u0
[{ |] = w[1 4] + [2 1] or
{ = 1w + 2 and | = 4w + 1=
One choice for a normal vector is $
q = [4 1] because $
q [1 4] = 0=
$ $
$
q (u
u 0)
[4 1] [{ 2 | 1]
4({ 2) + (1)(| 1)
4{ | 7
=
=
=
=
0
0
0
0=
Although the equations look dierent, it is easy to verify that the parametric
equations do satisfy this last single equation representation.
1.5.2
$
Let a line be represented by a direction vector g and point ({0 > |0 )= Let a point
$
$
(s1 > s2 ) not be on this line. Let
u 0 = [{0 |0 ] and
s = [s1 s2 ] be the vectors
associated with these two points. Any point on the line will then be a function
of the parameter w
$ $
$
u (w) = w g +
u 0=
The distance squared from the point not on the line and any point on the line
is a function of w
$
$
$
$
i (w) (
u (w)
s ) (
u (w)
s )=
(1.5.7)
41
42
Since the second derivative is positive, the minimum distance is the square root
of i (w) evaluated at w0 =
Example 1.5.3. Consider the line given by { + 2| = 4= The line contains the
$
points (0> 2) and (4> 0) and is parallel to g = [4 2]= If the point not on this
$
line is (2> 5), then the vector associated with the point is
s = [2 5]=
w0
=
=
=
$ $
$
s)
g (
u0
$
$
g g
[4 2] ([0 2] [2 5])
[4 2] [4 2]
2
1
=
=
20
10
1
The desired point on the line is $
u ( 10
)=
18
4
[0 2] = [ 10 10 ]=
$
1
10 g
$
+
u0 =
1
10 [4
2] + [0 2] =
For the geometric approach to this problem observe in Figure 1.5.2 that
$
$
vector from
s to
u (w0 ) must be perpendicular to the given line. This means
$
$
$
s = Now
the direction vector of the line g must be perpendicular to
u (w0 )
use the dot product to obtain
$
$
$
g (
u (w0 )
s) = 0
$
$
$
$
g (w0 g + u 0 s ) = 0
$
$
$ $
$
u 0
s) = 0
w0 g g + g (
and, hence, we get the same w0 =
Theorem 1.5.1 (Minimum Distance to a Line) Let a given point, given by
$ $
$
$
position vector
s , not be on a line
u (w) = w g +
u 0 = The distance squared i (w)
is dened by equation (1.5.7).
i (w0 ) = min i (w) has solution w0 =
w
$ $
$
g (
u 0
s)
=
$
$
g g
43
1.5.3
The parametric representation of a line has components that are linear polynomials of the parameter, dw + e. If one or both of the component functions are
not linear polynomials, then the set of points will not be a line. For example,
if { = w and | = dw2 > then we have a parabola. In this case the position vectors
$
for points on the parabola are
u = [w dw2 ]= Another example is a circle with
radius d where one representation is { = d cos(w) and | = d sin(w)= The position
$
vector is
u = [d cos(w) d sin(w)]= Complex variables and Eulers formula can
also describe this circle by } = dhlw = d cos(w) + ld sin(w)=
A more complicated curve is the cycloid, which is the curve given by a point
on a wheel of radius d as the wheel rolls in a straight line. As is illustrated in
Figure 1.5.3, the position vector is given by
$
$
f +
$
u = $
d + e
= [wd 0] + [0 d] + [d sin(w) d cos(w)]
= [d(w sin(w)) d(1 cos(w)]=
The angle w is the parameter, and it is given in radians so that the arclength
opposite the angle is dw= Figure 1.5.4 depicts this curve with d = 1 and was
generated by the MATLAB code cycloid.m.
Eulers formula can be used to generate sine and cosine curves with dierent
amplitudes, d, frequencies, i> and phases, . By adding the associated complex
numbers one can easily generate very complicated signals such as a persons
voice. Consider just one tone and one sine function of time w
d sin(2i w + )=
44
1.5.4
45
46
AA plot(x,y)
The MATLAB code cycloid.m, see Figure 1.5.4, uses vector operations, and the
code phasor.m, see Figure 1.5.5, uses for-loops with a MATLAB command pause
so that one can step through the loop.
1.5.5
Exercises
Let { 3| = 9=
(a).
Find the slope-intercept equation.
(b).
Find the parametric equations.
2.
Let { = 2w + 1 and | = 3w 2=
(a).
Find the slope-intercept equation.
(b).
Find the single algebraic equation.
3.
Let the line contain the point (2> 7) and be parallel to [1 1]=
(a).
Find the vector equation using a direction vector.
(b).
Find the parametric equations.
4.
Let the line contain the point (2> 7) and be perpendicular to [1 1]=
(a).
Find the vector equation using a normal vector.
(b).
Find the single algebraic equation.
$
5.
Find the point on the line
u = w[1 2] + [0 1] that is closest to the
point (5> 5)=
6.
Find the point on the line given by { = 2w + 2 and | = w + 1 that is
closest to the point (5> 5)=
7.
Use MATLAB to create a graph of the line given by { = w + 2 and | = 2w
with 0 w 5=
8.
Use MATLAB to create a graph of the curve given by { = w + 2 and
| = 2w2 with 0 w 3=
9.
Use the MATLAB code cycloid.m to experiment with dierent wheels,
d = 0=5> 1 and 2=
10.
Use the MATLAB code phasor.m to experiment with a variety of the
inputs:
(a).
Vary the frequencies.
(b).
Vary the amplitudes.
(c).
Vary the phase angles.
1.
Chapter 2
Vectors in Space
Vectors in space are introduced, and the dot, cross and box products are studied. Lines and planes are carefully described as well as extensions to higher
dimensional space. Applications to work, torque, inventories and visualizations
are included.
2.1
A point in space can be located in a number of ways, but here the Cartesian
coordinate system will be used. You may wish to visualize this from the interior
of a room looking down into the corner. The corner is the origin; the x-axis is
the intersection of the left wall and oor; the y-axis is the intersection of the
right wall and the oor; the intersection of the left and right walls is the z-axis.
This is illustrated in Figure 2.1.1. The point (d> e> f) is located by moving d
units in the x-axis, then moving e units parallel to the y-axis, and moving f
units parallel to the z-axis. The distance from the origin to the point is given
by two applications of the Pythagorean theorem to the right triangles in Figure
2.1.1. Associated with the point (d> e> f) is the position vector from the origin
to this point.
$
Denition 2.1.1. A vector in R3 is an ordered list of three real numbers
d =
[d1 d2 d3 ]. One can visualize this by forming the directed line segment from
the origin point (0> 0> 0) to the point (d1 > d2 > d3 )=
Notation. Points in R3 will be denoted by (d1 > d2 > d3 ) and vectors will be
represented by either row or column vectors:
$
d = [d1 d2 d3 ] indicates a row vector>
5
6
d1
a = 7 d2 8 indicates a column vector =
d3
$
d=
aW = [d d d ] is called the transpose of the column vector a so that aW =
1
47
48
49
2.1.1
Vector Operations
Vectors can be scaled, added and subtracted by either viewing the vectors
geometrically or as symbolic objects. Two non-parallel vectors in space form
a plane in space so that the geometric approach to these operations is similar
to vectors with two components. Figure 2.1.3 illustrates vector addition and
$
$
scaling by either elongating or shrinking the vector. Two vectors
d and e
$
can be added by moving vector e parallel to its original position so that its
50
$
$
$
beginning point is the end point of vector
d . The addition
d + e corresponds
$
$
$
to the diagonal of the parallelogram formed by vectors
d and e . If e is
$
$
$
added to
d , then the subtraction
d e is the other diagonal from the end of
$
$
e to the end of d =
$
$
$
Denitions 2.1.2. Let
d = [d1 d2 d3 ], e = [e1 e2 e3 ] and 0 = [0 0 0]
$
$
be the zero vector.
d equals e means d1 = e1 , d2 = e2 and d3 = e3 = The
addition of two vectors is another vector whose components are the sum of the
components of the two vectors
$
$
d + e [ d1 + e1
d2 + e2
d3 + e3 ]=
Let v be a real number. The scalar product of a vector is another vector whose
components are the scalar times the components of the vector
$
v
d [ vd1
vd2
vd3 ]=
The following theorem lists some basic algebraic properties of the above operations for vectors in space R3 > which are analogous to those in the plane R2 .
51
$
$
$
Theorem 2.1.1 (Vector Space Properties) Let
d > e and
f be vectors in
3
R and let v and w be real numbers. Then the following rules hold
$
$ $
$
$ $
$
$
$
d + e = e +
d > ($
d + e )+
f =
d +( e +
f )>
$
$
$
$
$
$
d + 0 = d and d + ( d ) = 0 ;
$
$
$
$
$
$
$
d =
d and
(v + w)
d = v
d + w
d , v(w
d ) = (vw)
d > 1
$
$
$
$
v( d + e ) = v d + v e =
$
$
$
$
The proofs are straightforward. The proof of v(
d + e ) = v
d + v e uses
the distributive property of addition
$
$
v(
d + e ) = [ v(d1 + e1 ) v(d2 + e2 ) v(d3 + e3 ) ]
= [ vd1 + ve1 vd2 + ve2 vd3 + ve3 ]
= [ vd1 vd2 vd3 ] + [ ve1 ve2 ve3 ]
$
$
= v
d +ve =
$
Example 2.1.2. Let $
d = [2 4 1], e = [1 2 4] and v = 3= Then
$
$
d + e = [1 6 5]>
$
$
d e = [3 2 3] and
$
v e = [3 6 12]=
$
Denition 2.1.3. Let
d = [d1 d2 d3 ]. The length or Euclidean norm of the
$
vector d is given by the Pythagorean theorem
q
$
k
d k d21 + d22 + d23 =
As illustrated in Figure 2.1.3 two vectors in space form a plane and so the
$ $
$
cosine law may be rewritten in terms of the norms of the vectors
d > e >
f =
$
$
$
$
d e and the angle between the vectors d and e
$
2
$2
$
2
$
$
d k + e 2 k
d k e cos()=
(2.1.1)
d e = k
$
This allows one to compute the angle between two given vectors.
$
Example 2.1.3. Consider the vectors in Figure 2.1.3
d = [3 2 1] and
$
e = [1 4 2]= The vector starting
at
the
point
(1
4
2)
and
ending at (3 2 1) is
$
$
$
$
represented by d e > and d e is the distance between the end points of
$
$
$
$
2
2
$
$
$
the vectors
d and e . Then
d e = [2 2 1]>
d e = 9> k
d k = 14>
$2
e = 21, and equation (2.1.1) becomes
s s
9 = 14 + 21 2 14 21 cos()
s
= 14 + 21 14 6 cos()=
52
Thus,
s
cos() = 13@(7 6) and
s
= cos1 (13@(7 6)) 40=70 degrees.
2.1.2
$
$
Let
d = [d1 d2 d3 ] and e = [e1 e2 e3 ] form a plane in space and have the
angle between the vectors. The vector version of the cosine law is equation
(2.1.1). By denition of vector subtraction and the norm
$
2
d e = (d1 e1 )2 + (d2 e2 )2 + (d3 e3 )2
$
= d21 2d1 e1 + e21 + d22 2d2 e2 + e22
+d23 2d3 e3 + e23
2
$2
$
= k
d k + e 2(d1 e1 + d2 e2 + d3 e3 )=
Place this into the left side of equation (2.1.1) and cancel the norms to get
$
$
d k e cos()=
(2.1.2)
d1 e1 + d2 e2 + d3 e3 = k
As in the case for vectors with two components, equation (2.1.2) is of fundamental importance because the left side is an easy calculation, and the right
side makes a connection with the geometry.
$
$
Theorem 2.1.2 (Cosine Identity) Let
d = [d1 d2 d3 ] and e = [e1 e2 e3 ]
be non-zero vectors and let be the angle between the two vectors. Then cos()
can be computed by
d1 e1 + d2 e2 + d3 e3
cos() =
=
$
$
k
d k e
$
$
Denition 2.1.4. The dot product of two vectors
d = [d1 d2 d3 ] and e = [e1
e2 e3 ] is given by the real number on either side of equation (2.1.2). The
following are common notations for the dot product of row or column vectors,
respectively,
$
$
$
$
d e d1 e1 + d2 e2 + d3 e3 = k
d k e cos() or
aW b d1 e1 + d2 e2 + d3 e3 = kak kbk cos()=
The cosine identity can be restated as either
$
$
d e
cos() =
$
or
$
k
d k e
cos() =
aW b
.
kak kbk
53
kak2
$
= $
d
d or
= aW a=
$
$
Denitions 2.1.5. Let
d and e be non-zero vectors. Two vectors are parallel
if and only if they are multiples of each other, that is, there is a real number v
$
$
such that
d = v e = Two vectors are perpendicular or orthogonal if and only if
$
$
the cos() is zero, that is,
d e = aW b = 0=
$
$
Example 2.1.4. Consider the vectors in Figure 2.1.3
d = [3 2 1] and e = [1
$
2
$2
$
$
4 2]= Then k
d k = 14> e = 21 and
d e = 3(1) + 2(4) + 1(2) = 13 so
that
$
$
13
d e
13
= s s = s and
cos() =
$
$
14 21
7 6
k
d k e
13
s
40=70 degrees.
= cos1
7 6
The dot product has a number of interesting algebraic properties. One is it
is associative with respect to a scalar multiple
$
$
v(
d e ) = v(d1 e1 + d2 e2 + d3 e3 )
= (vd1 )e1 + (vd2 )e2 + (vd3 )e3
$
$
= (v
d) e =
Additional properties are listed in the following theorems, which are analogous
to Theorems 1.4.2 and 1.4.3, and are also easy to prove. The Cauchy-Schwarz
inequality in (2.1.3) follows directly from the cosine identity in (2.1.2). Real
valued functions that satisfy equations (2.1.4)-(2.1.6) are called norms, and they
are analogous to the absolute value of a single real number. An interpretation of
the triangle inequality is the minimum distance between two points is a straight
line. These concepts generalize to higher dimensional vectors, see Sections 2.5
and 3.1.
$ $
$
Theorem 2.1.3 (Properties of Dot Product) Let
d > e >
f be given vectors in
space R3 and let v be a real number. Then the following hold
$
$ $
$
$
$
$
$
d e = e
d > v(
d e ) = (v
d) e>
$ $
$ $
$
d ( e +
f) = $
d e +
d $
f and
$
$
$
$
d e k d k e (Cauchy-Schwarz inequality);
(2.1.3)
54
$
$
Theorem 2.1.4 (Properties of Norm) Let
d > e be given vectors in space R3
and let v be a real number. Then the following hold
$
$
$
$
k
d k 0;
d = 0 if and only if k
d k = 0>
$
$
kv d k = |v| k d k and
$
$
$
$
d k + e (triangle inequality).
d + e k
2.1.3
(2.1.4)
(2.1.5)
(2.1.6)
Applications to Work
Consider moving a mass from one point in space to an other point where the
$
component changes are recorded in a displacement vector g = [g1 g2 g3 ].
A force in each direction is required, which can be recorded in a force vector
$
i = [i1 i2 i3 ]= For constant displacement and force vectors, the work is the
product of displacement distance
vector
projected
and the length of the force
$
$
$
2.1.4
The MATLAB command dot(a,b) computes the dot product if the vectors are
both row or column vectors. If the vectors are both column vectors, then one
can use the transpose version aW b= In MATLAB this would appear as d0 e
provided d and e were column vectors.
AA a = [1 -1 3]
a=
1 -1 3
AA b = [4 1 7]
b=
417
AA dot(a,b)
ans =
24
AA a_col = a
AA b_col = b
AA a_col*b_col
ans = 24
55
$
The MATLAB command norm(a) computes k
d k > which is the same as
$
$
1@2
( d d ) = This is called the Euclidean norm and is one of many important
norms (see the MATLAB command help norm).
AA norm(a)
ans =
3.3166
AA (dot(a,a))^.5
ans =
3.3166
The next calculations illustrate the MATLAB command quiver3(x, y, z, dx,
dy, dz, 1), which will generate a vector in space starting at the point ({> |> })
and ending at the point ({ + g{> | + g|> } + g}).
AA quiver3(0,0,0,2,3,-1,1)
AA hold on
AA quiver3(0,0,0,3,1,2,1)
The input parameters may be arrays with the same size. Use arrays as
inputs (see MATLAB command help quiver3 for an interesting example).
AA
AA
AA
AA
2.1.5
Exercises
1.
Plot the points (3> 1> 2) and (1> 3> 1)= Indicate the corresponding vectors
starting at the origin.
2.
Plot the points (3> 1> 1) and (1> 1> 3)= Indicate the corresponding vectors
starting at the origin.
3.
Find the unit basis vector and column vector representations of
$
$
d = [3 1 2] and e = [1 3 1]=
4.
5.
Let
(a).
(b).
6.
Let
(a).
$
$
d = [3 1 2] and e = [1 3 1]=
$
$
$
Compute 2 e and 2
d + e=
$
$
$
$
Find the vector
{ = [{1 {2 {3 ] so that 2
d +
{ = e=
$
$
$
$
$
$
$
$
d = 2 l + 4 m n and e = l + 2 m + 3 n
$
$
$
Compute 2 e and 2
d +3e =
56
$
$
$
$
$
$
d +
{ = e=
Find the vector
{ = {1 l + {2 m + {3 n so that 3$
$
$
$
$
$
$
$
$
d = l +4m 2n
and e = l + m + 3 n
$
$
Compute k
d k and e =
$
$
(b).
Find
d e=
$
$
8.
Let
d = [0 1 2] and e = [1 4 1]=
$
$
(a).
Compute k
d k and e =
$
$
(b).
Find
d e=
9.
Use the cosine identity in equation (2.1.2) to nd the angle between the
vectors in column form
5
6
5
6
1
1
a = 7 2 8 and b = 7 3 8 =
1
1
(b).
7.
Let
(a).
10.
Use the cosine identity in equation (2.1.2) to nd the angle between the
$
$
vectors
d = [3 1 1] and e = [1 1 1]=
11.
Consider Theorem 2.1.3.
$
$ $
$
$
$
(a).
Prove v(
d e ) = (v
d) e =
d (v e )=
$
$
$
$
$
$
$
$
d
f for the vectors
d = [2 1
(b).
Verify
d (e +
f)=
d e +
$
$
3], e = [3 4 1] and f = [1 1 4]=
(c).
What is the dierence between "prove" and "verify"?
12.
Consider Theorem 2.1.4. Prove the results of lines (2.1.4) and (2.1.5).
13.
Consider the work in moving an object along an incline in space whose
x-direction is 25, y-direction is 20 and z-direction is 5. If the force vector is
$
i = [10 1 2]> nd the work.
14.
Consider the work in moving an object along an incline in space whose
$
$
$
$
$
displacement vector is g = 20 l + 15 m + 3 n . If the force vector is i =
$
$
$
10 l + 2 m + 1 n > nd the work.
$
d = [2 1 1] and
15.
Use MATLAB to compute the dot product of
$
e = [3 4 2] and their norms.
16.
Use MATLAB command quiver3(x,y,z,dx,dy,dz,1) to plot the vectors
$
$
d = [2 1 1] and e = [3 4 2]=
2.2
In Section 1.4 the cosine identity was used to nd the area of a parallelogram
formed by two vectors in a plane. Then this was used to compute the torque
for the rotation about a point in the plane. The cross product will allow us
to generalize these to vectors in space and not just the xy-plane. The box
product is a combination of the dot and cross product that will enable us to
easily compute the volume of a parallelepiped formed by three vectors in space.
These concepts will be related to determinants of 3 3 matrices.
2.2.1
57
$
Any vector in the plane
d = [d1 d2 ] can be viewed as space vector whose
$
third component is zero, d = [d1 d2 0]= We use some of the results in Section
1.4 for vectors in space that are restricted to one of the coordinate planes. Let
$
$
d = [d1 d2 0] and e = [e1 e2 0] not be parallel. Then the duhd is the area
$
$
of the parallelogram formed by
d and e is
$
$
d k e sin())2
(duhd)2 = (k
= (d1 e2 e1 d2 )2
d1 e1
))2 =
= (det(
d2 e2
An application to torque, which involves rotation about the z-axis, is when
$
$
$
$
d
=
u gives the point to be rotated and e = i is the force vector. Here
$
i sin() is the component of the force acting tangent to the rotation, and
it can be directed in either a clockwise or counterclockwise motion. The convention is to use the clockwise motion as given by a right hand threaded screw
where a clockwise rotation of a screw driver sinks the screw into a mass. If one
views the screw as being below the xy-plane, and rotates the x-axis towards the
y-axis, then the screw should move in a positive z-direction. Dene the cross
product of the unit vectors according to this convention:
$
$
$
l m n
$
$
$
m n l and
$
$
$
n l m=
$
$
The cross product of
d = [d1 d2 0] and e = [e1 e2 0] is dened to be a
vector in the z-direction with magnitude equal to d1 e2 e1 d2
[d1 d2 0] [e1 e2 0] [0 0 d1 e2 e1 d2 ]=
$
$
$
$
$
$
Note, if
d = [1 0 0] = l and e = [0 1 0] = m > then l m = [0 0
$
1(1) 0(0)] = n = This is illustrated in Figure 2.2.1 where the three possible
$
$
planes are viewed from the back (negative) sides. In the case
d =
u and
$
$
$
$
e = i the third component of u i is the torque for rotation about the
z-axis.
2.2.2
In order to understand the cross product denition for any vectors in space,
consider the area of the parallelogram formed by two vectors in space as illustrated in Figure 2.2.2. The area will be non-zero provided the two vectors are
not parallel. The area that is projected into the xy-plane is the absolute value of
58
the third component in the cross product of the two vectors projected into the
xy-plane. One can also project into the yz-plane and the xz-plane with similar
area formulae. The above analysis can be applied to the other two coordinate
planes to yield
[d1 0 d3 ] [e1 0 e3 ] [0 (d1 e3 e1 d3 ) 0] and
[0 d2 d3 ] [0 e2 e3 ] [d2 e3 e2 d3 0 0]=
The cosine identity eventually leads to a formula for the DUHD of the
$
$
parallelogram formed by two vectors in space
d = [d1 d2 d3 ] and e = [e1 e2
59
e3 ]
(DUHD)2
$
$
= (k
d k e sin())2
$
$
= (k
d k e )2 (1 cos2 ())
$
$
d e 2
$ 2
$
= (k d k e ) (1 (
$ ) )
$
k
d k e
$2
$
2
$
$
d e )2 =
= k
d k e (
Next substitute the vector components into the above and endure a messy
algebraic computation to obtain
(DUHD)2
The formula in equation (2.2.1) means the area in space squared is the sum of
the three "projected areas squared."
$
$
Denition 2.2.1. The cross product of
d = [d1 d2 d3 ] and e = [e1 e2 e3 ]
$
$
is another vector
d e whose components are given by the projected areas
$
$
(2.2.2)
d e [d2 e3 e2 d3 d1 e3 + e1 d3 d1 e2 e1 d2 ]
$
$
$
(d2 e3 e2 d2 ) l (d1 e3 e1 d3 ) m + (d1 e2 e1 d2 ) n =
$
$
$
$
As we show below
d e is perpendicular to both
d and e and, thus, it
$
$
is perpendicular to the plane formed by
d and e = Equation (2.2.1) implies the
norm of the cross product is equal to the area of the parallelogram formed by
the two vectors. Determinants are often used as an easy way to remember the
denition of a cross product of two vectors.
f >
$
Denition 2.2.2. Let a 3 3 matrix be given by three row vectors $
d and
$
e
5
6
f1 f2 f3
D = 7 d1 d2 d3 8 =
e1 e2 e3
The determinant of this matrix is a real number dened by expanding across
60
the top row of the matrix
d2 d3
det(D) f1 det(
)
e2 e3
d1 d3
f2 det(
)
e1 e3
d1 d2
+f3 det(
)
e1 e2
= f1 (d2 e3 e2 d3 )
f2 (d1 e3 e1 d3 )
+f3 (d1 e2 e1 d2 )=
(2.2.3)
The components of the row vectors are usually real or complex numbers.
An abuse of notation is to let the top row be replaced by a row of unit basis
vectors so that
5
$ 6
$
$
l
m
n
$
$
d e det(7 d1 d2 d3 8)=
e1 e2 e3
$
Example 2.2.1. Let $
d = [1 3 2] and e = [4 1 5]=
5 $
$ 6
$
l
m
n
$
$
d e = det(7 1 3 2 8)
4 1
5
$
$
$
= (3(5) 1(2)) l (1(5) 4(2)) m + (1(1) 4(3)) n
$
$
$
= 17 l 13 m 11 n
= [17 13 11]=
$
$
The cross product is perpendicular to both the vectors
d and e . In order
to prove this, it su!ces to show the dot product of one of the vectors with the
cross product is zero
$ $
$
(
d e)
d =
=
=
=
[d2 e3 e2 d3 d1 e3 + e1 d3 d1 e2 e1 d2 ] [d1 d2 d3 ]
(d2 e3 e2 d3 )d1 + (d1 e3 + e1 d3 )d2 + (d1 e2 e1 d2 ) d3
d2 e3 d1 e2 d3 d1 d1 e3 d2 + e1 d3 d2 + d1 e2 d3 e1 d2 d3
0=
61
$
2
d e
$
$
2
d e
$
= 0>
= 0,
$
$
= (k
d k e sin())2 and
$2
$
2
$
$
= k
d k e (
d e )2
(Lagrange identity)=
$
$
Example 2.2.2. Let
d = [1 3 2] and e = [4 1 5] be as in the rst
$
$
example so that
d e = [17 13 11]= The area of the parallelogram formed
by these vectors is
s
$
p
d e = 172 + (13)2 + (11)2 = 579 24=06=
$
The cross product has a number of interesting properties. The distributive
property is valid
$ $
$
d ( e +
f ) = [d2 (e3 + f3 ) (e2 + f2 )d3
d1 (e3 + f3 ) + (e1 + f1 )d3
d1 (e2 + f2 ) (e1 + f1 )d2 ]
= [d2 e3 e2 d3 d1 e3 + e1 d3 d1 e2 e1 d2 ] +
[d2 f3 f2 d3 d1 f3 + f1 d3 d1 f2 f1 d2 ]
$ $
$
= d e +
d $
f=
However, the cross product is not commutative and is not associative!
Theorem 2.2.2 (Algebraic Properties of Cross Product) Consider the cross
product of vectors in space. The following hold
$
$
d e
$ $
$
d ( e +
f)
$
$
$
d ( e
f)
$
$
$
d (e f)
$ $
$
$
$
$
= e
d > (v
d ) e = v(
d e )>
$ $
$
=
d e +
d $
f>
$
$$
$
$
$
d
f ) e (
d e )
f and
= (
$
$
$
= (d e ) f=
62
$
handle end at the end of the position vector
u = Apply a force at the handle end
$
given by the vector i . Find the components of torque governing the rotation
about x,y and z axes.
5 $
$ 6
$
l
m
n
$
$
u i = det(7 1 3 1 8)
4 1 2
$
$
$
= (3(2) 1(1)) l (1(2) 4(1)) m + (1(1) 4(3)) n
$
$
$
= 5 l + 2 m 11 n =
2.2.3
Let three vectors in space not be in the same plane. They form a parallelepiped
as is illustrated in Figure 2.2.3. The volume is equal to the area in the base
$
$
formed by the two vectors
d and e times the height. The direction of the
height is perpendicular to the base, that is, it is parallel to the cross product
$
$
$
d e = The height is then equal to the projection of the third vector
f onto
$
$
$
$
$
d e = Let ! be the angle between the vectors f and d e so that the
$
height is k
f k cos(!)= Thus, the volume is plus or minus
$
$ $
$
$
d e (k
f k cos(!)) = (
d e )
f=
$
$
f is the real number
Denition 2.2.3. The box product of $
d > e and $
$ $
$
(
d e )
f=
Example 2.2.4. Compute the volume of the parallelepiped formed by the
$
$
$
vectors
d = [1 2 1]> e = [2 0 1] and
f = [0 1 4]=
5 $
$ 6
$
l
m
n
$
$
d e = det(7 1 2 1 8)
2 0 1
$
$
$
= (2(1) 1(0)) l (1(1) 1(2)) m + (1(0) 2(2)) n
$
$
$
= 2 l + 1 m 4 n = [2 1 4]=
The box product is
$ $
$
f = [2 1 4] [0 1 4]
(
d e)
= 2(0) + 1(1) + (4)4) = 15=
The volume of the parallelepiped is 15=
63
f1
det(D) = det(7 d1
e1
5
d1
= det(7 e1
f1
5
d1
= det(7 d2
d3
f2
d2
e2
d2
e2
f2
e1
e2
e3
6
f3
d3 8)
e3
6
d3
e3 8)
f3
6
f1
f2 8)=
f3
(2.2.4)
(2.2.5)
$ $
$
An interpretation of equation (2.2.4) is that
d ( e
f ) gives plus or minus the
$
volume when the base of the parallelepiped is generated by the vectors e and
$
f . Equation (2.2.5) is formed by interchanging the rows and columns of the
previous matrix; the new matrix (2.2.5) is called the transpose of the matrix in
(2.2.4). If the column vectors in (2.2.5) are represented by a> b and c> then the
matrix in (2.2.5) may be written as [a b c] and det([a b c]) is plus or minus
the volume.
Theorem 2.2.3 (Volume Equivalence) Let three non-zero vectors be represented as column vectors a> b and c= The volume of the parallelepiped formed
by these vectors being non-zero is equivalent to no vector of the three being in
the plane formed by the other two vectors. In symbolic terms, this means det([a
b c]) 6= 0 is equivalent to a 6= gb+hc or b 6= gc+ha or c 6= ga+hb for all
non-zero real numbers g and h. Moreover, volume is equal to the absolute value
of det([a b c]).
Another point of view generalizes to higher dimensional vectors. The matrix
product may be written as a linear combination of the column vectors a b and
64
65 6
5 6
u
0
f1
f2 8 7 v 8 = 7 0 8
w
0
f3
6
5 6
d1 u + e1 v + f1 w
0
7 d2 u + e2 v + f2 w 8 = 7 0 8 =
0
d3 u + e3 v + f3 w
d1
7 d2
d3
5
e1
e2
e3
Thus, the above are also equivalent to ua + vb + wc = 0 implies all u> v and w
must be zero. Such vectors are called linearly independent and will be further
studied in Section 5.1. The vector equation ua+vb+wc = 0 means the diagonal
of the parallelepiped formed by the vectors ua> vb and wc is the zero vector. See
Figure 2.2.4 where the volume of the larger parallelepiped, given by the scaled
vectors ua> vb and wc> is uvw times the volume of the smaller parallelepiped. This
65
d1 u
det([ua sb wc]) = det(7 d2 u
d3 u
6
e1 v f1 w
e2 v f2 w 8)
e3 v f3 w
2.2.4
66
014
AA A = [a b c]
% convert rows to columns
A=
120
201
114
AA det(A)
ans =
-15
AA det(A)
% det(A) = det(A)
ans =
-15
AA newA = [c ; a; b]
% volume with base via a and b
newA =
014
121
201
AA det(newA)
ans =
-15
AA axb = cross(a,b)
axb =
2 1 -4
AA dot(c,axb)
% box product
ans =
-15
2.2.5
Exercises
$
$
$
$
$
Let $
d = [2 3 1] and e = [3 0 1]= Compute
d e and
d e =
$
$
$
$
$
$
$
$
$
$
2.
Let
d = 2 l + 4 m + n and e = l + 3 m n = Compute
d e and
$
d e =
$
$
$
$
$
$
$
$
$
3.
Let
d = l + 3 m + n and e = 0 l + 3 m n = Find the area of the
parallelogram formed by these vectors.
$
$
4.
Let
d = [2 0 1] and e = [3 1 1]= Find the area of the parallelogram
formed by these vectors.
$
$ $
$
5.
Show
d e =e
d=
$
$
$
$
$
$
6.
Show d ( e f ) may not be equal to (
d e)
f . Do both
$
$
$
computations for
d = [2 3 1]> e = [3 0 1] and
f = [1 2 3].
7.
Consider the wrench torque in Example 2.2.3. If the ends of the wrench
$
are given by
u = [1 3 1] and the force vector has components in the x,y and
$
$
z-directions equal to 2> 3 and 1> respectively, nd the torque vector
u i.
1.
67
8.
Consider the wrench torque in Example 2.2.3. If the ends of the wrench
$
$
$
$
$
are given by
u = l + 2 m + n and the force vector is i = [2 1 4]> compute
$
$
the torque vector
u i.
$
$
$
$
$
9.
A parallelepiped is given by three vectors
d = 4l +1m + n> e =
$
$
$
$
$
$
$
l + 5 m + n and
f =2 l + m +5n=
(a).
Use the box product to compute the volume.
(b).
Use a determinant to nd the volume.
$
$
10.
A parallelepiped is given by three vectors
d = [1 3 1]> e = [0 3 1]
$
and f = [1 2 4]=
(a).
Use the box product to compute the volume.
(b).
Use a determinant to nd the volume.
11.
Prove the determinant identities in equations (2.2.4) and (2.2.5).
12.
Use the MATLAB command det(A) and cross(a,b) to do the computations in exercise nine.
13.
Use the MATLAB command det(A) and cross(a,b) to do the computations in exercise ten.
2.3
This section extends the study of lines in the plane to lines in space. Vector
and parametric representations of a line will be developed. Minimum distances
from a point to a line and from line to a line will be analyzed. The cross product
will be used to describe the minimum distance. More general curves including
the helix and path of a projectile will be presented.
2.3.1
Lines in Space
$
Let a given point in space be represented by the position vector
u 0 = [{0 |0
$
}0 ] and let a given direction vector be g = [g1 g2 g3 ]= As for a line in a plane
one can scale the direction vector and add it to the position vector whose end
point is on the line to obtain the position vector for any point on the line
$
$
$
u (w) =
u 0+wg=
This is called a vector equation for the line and is illustrated in Figure 2.3.1.
The direction vector may be found from two distinct points on the line by
$ $
$
u 0 = The parametric
subtracting the corresponding position vectors g =
u 1
equations can be derived from the three scalar equations that correspond to the
$
vector equation with
u (w) = [{(w) |(w) }(w)]
{(w) = {0 + wg1 > |(w) = |0 + wg2 and }(w) = }0 + wg3 =
Example 2.3.1. Find the vector and parametric representations of the line
$
$
u 1 = [2
containing the two points (1> 2> 4) and (2> 5> 3)= Let
u 0 = [1 2 4] and
68
2.3.2
$
$
$
Consider a line given by
u (w) =
u 0 + w g > and let a point (s1 > s2 > s3 ) not be
$
on this line and have position vector s = [s1 s2 s3 ]= The problem is to nd
the point on the line, given by some w = w0 > so that the distance from the point
$
to the line is a minimum. The distance from the given end point of
s to the
$
$
$
$
$
$
end points of u (w) is the length of the vector u (w) s = ( u 0 s ) + w g =
$
$
$
$
Let i (w) (
u (w)
s ) (
u (w)
s ) so that one must solve the minimization
problem
i (w0 ) = min i (w)=
w
69
$
$
(see Figure 2.3.1). This means the dot product of
u (w)
s with the direction
$
vector g must be zero
$
$
g ($
u (w)
s) = 0
$
$
$
$
g (( u 0 s ) + w g ) = 0
$
$
$
$
s ) + g g w = 0=
g ($
u 0
$ $
$
$
u 0 $
s )@( g g ). The minimum distance is the square root
Thus, w0 = g (
of i (w0 )=
The distance squared at w = w0 simplies to
$
$
$
$
i (w0 ) = (
u (w0 )
s ) (
u (w0 )
s)
$
$
$
$
$
s)
= (( u 0 s ) + w0 g ) ( u (w0 )
$
$
$
$
= ( u 0 s ) ( u (w0 ) s ) + 0
$
$
$
$
$
s ) ((
u 0
s ) + w0 g )=
= (
u 0
The computation of the minimum distance can be done by using the cross
product and the Lagrange identity in Theorem 2.2.1
$2
$
$
2
2
$
$
d k e (
d e )2 =
(2.3.1)
d e = k
$
$ $
$
$
u 0 $
s )@( g g ) into i (w0 ) and use the cross product
Next, insert w0 = g (
$
$
$
$
$
s and e = g
identity with
d =
u 0
$
$
$
$
$
$
$
i (w0 ) = (
u 0
s ) (
u 0
s ) + (
u0
s ) (w0 g )
$
$
$
$
$
$
$
$
$
(
u0
s ) (
u 0
s ) g g ((
u 0
s ) g )2
=
$
$
g g
2
$
$
u0
s) g
($
=
=
$2
g
$
$
$
Theorem 2.3.1 (Minimum Distance from Point to Line) Let
u (w) =
u 0 +w g
represent a line, and let a point (s1 > s2 > s3 ) not be on this line and have position
$
$ $
$
$
$
$
$
$
u (w0 ) =
u 0 + w0 g where w0 = g (
u 0
s )@ g g
vector
s = [s1 s2 s3 ]=
gives the point on the line that is closest to the point (s1 > s2 > s3 )= Moreover, the
minimum distance is
$
$
u 0
s) g
($
=
$
g
$
$
Example 2.3.2. Let a line be given by
u 0 = [1 1 1] and g = [1 2 2], and
nd the minimum distance from the point (4> 4> 1) to this line. According to
70
$
$
$
the above theorem the point on the line that is closest is
u (1) =
u 0 + 1 g = [1
1 1] + 1[1 2 2] = [2 3 3] where
w0
$
One can compute the minimum distance directly by evaluating
u (1) and computing the distance, or by using the above cross product formula, which only
requires the two points and the direction vector. The direct calculation is
$
$
u (1)
s = [2 3 3] [4 4 1] = [2 1 2]
$
$
k u (1) s k = 3=
The cross product computation is
5 $
$ 6
$
l
m
n
$
$
$
(
u 0
s ) g = det(7 3 3 0 8)
1
2
2
$
$
$
= 6 l + 6 m 3 n
= [6 6 3]=
This distance is the same as the direct approach
$
$
u0
s) g
($
9
= = 3=
$
3
g
Another minimum distance problem is depicted in Figure 2.3.2, which involves two lines in space that are not parallel and do not intersect. We seek
to nd a point on one line and a point on the second line so that the distance
between them is the smallest. Use the following vector representations for the
two curves, where the parameter w locates a point on the rst line and the
parameter locates a point on the second line
$
$
$
u (w) =
u 0 + w g and
$
$
( ) = $
0+ =
$
$
An important observation is the vector
u (w)
( ) must be perpendicular to
both lines at the points where the minimum distance is attained. This means
$
$
this vector must be perpendicular to both the direction vectors g and
$
$
$
(
u (w)
( )) g = 0 and
$
$
$
(
u (w)
( )) = 0=
71
= 0 and
= 0=
(2.3.2)
By Cramers rule as discussed in Section 2.4 and in Theorem 2.4.1, the solution
of this system will exist if the determinant of the 2 2 coe!cient matrix is not
zero
"
$
$
$
$ #
$2
$
$
g g g
$2
det(
)
=
g
+ ( g )2 =
$
$
$
$
g
If the direction vectors are not parallel, then the cross product will not be zero.
$
$
$
$
But, by the Lagrange identity in equation (2.3.1) with
d = g and e =
$2
$
this determinant is g 6= 0= Once equation (2.3.2) is solved for w = w0
$
and = 0 , the points on the two lines given by the position vectors
u (w0 ) and
$
$
$
( ) can be computed as well as the minimum distance k u (w ) ( )k =
0
The cross product can be used to compute the minimum distance without
$
$
having to solve the algebraic system in (2.3.2). Observe the cross product g
$
$
must be perpendicular to both g and and, hence, it must also be parallel
72
$
$
$
$
$
$
( 0 )= This means the angle between g and
u (w0 )
( 0 )
to
u (w0 )
must be either zero or 180 degrees so that by the cosine identity
$
$
$
$
$
$
$
$
(
u (w0 )
( 0 )) ( g ) = k
u (w0 )
( 0 )k g (1)
$
$
$
$
$
$
$
$
$
$
((
u 0
0 ) + g w0 0 ) ( g ) = k
u (w0 )
( 0 )k g (1)
$
$
$
$
$
$
$
$
0 ) ( g ) + 0 + 0 = k
u (w0 )
( 0 )k g (1)=
(
u 0
The minimum distance squared is
$
$
$
$
((
u 0
0 ) ( g ))2
2
$
$
k
u (w0 )
( 0 )k =
=
$2
$
g
(2.3.3)
Theorem 2.3.2 (Minimum Distance Between Lines) Let two lines be given
$
$
$
$
$
$
( ) =
0 + = If the two
by the vector equations
u (w) =
u 0 + w g and
$
$
lines are not parallel and do not intersect, then g is not the zero vector
and the solution of equation (2.3.2) gives the points on the lines with minimum
distance. Moreover, the minimum distance may be computed by (2.3.3).
$
Example 2.3.3. Let the two lines be given by
u (w) = [1 2 1] + w[2 0 1] and
$
( ) = [0 2 1] + [1 1 1]=
5
$ 6
$
$
l
m
n
$
$
g = det(7 2
0
1 8)
1 1 1
$
$
$
= 1 l 1m 2n
= [1 1 2]=
Equation (2.3.3) is used to compute the minimum distance squared
$
$
$
$
0 ) ( g ))2
((
u 0
([1 0 2] [1 1 2])2
3
=
= =
2
$
6
2
$
g
Thus, the minimum distance is
2.3.3
p
3@2=
Lines in space are given by three linear polynomials of the parameter w: {(w) =
{0 + g1 w> |(w) = |0 + g2 w and }(w) = }0 + g3 w= If the linear polynomials are
replaced by more complicated functions, then the curve will not be a straight
line. An example is the helix. Two illustrations are the outer edges of a spiral
staircase or a circular car ramp in a parking deck. The { and | components
must be projected onto a circle and the } component should be proportional to
73
= fz1 f{0
= fz2 f| 0 and
= fz3 f} 0 pj=
Let the initial position be at the origin so that {(0) = 0> |(0) = 0 and }(0) =
74
0 and for ease of notation consider a unit mass p = 1= The initial velocity
components are given {0 (0)> | 0 (0) and } 0 (0)=
Each of these equations has the form
y0 = g fy and y(0) = jlyhq=
If g and f are constants, then this can be solved by making the change of
variables z g fy and, thus, z0 = 0 fy 0 and
z0 = fz and z(0) = g fy(0)=
By the basic properties of exponential functions
z(w) = z(0)hfw
g fy(w) = (g fy(0))hfw
y(w) = g@f (g@f y(0))hfw =
(2.3.4)
The dierential equation for y = {0 uses p = 1> g = fz1 , {0 (0) given and
{(0) = 0= Then equation (2.3.4) gives
{0 (w) = z1 (z1 {0 (0))hfw and
{(w) = z1 w + ((z1 {0 (0))@f)hfw (z1 {0 (0))@f=
The solution for y = | 0 is similar
| 0 (w) = z2 (z2 | 0 (0))hfw and
|(w) = z2 w + ((z1 | 0 (0))@f)hfw (z2 | 0 (0))@f=
For y = } 0 use p = 1> g = fz3 pj = f0 32 = 32, } 0 (0) given and }(0) = 0
} 0 (w) = 32@f (32@f } 0 (0))hfw and
}(w) = (32@f)w + (((32@f) } 0 (0))@f)hfw + ((32@f) + } 0 (0))@f=
The MATLAB code proj3d.m was used to create the graph for this curve in
Figure 2.3.4.
2.3.4
75
The command plot3() can be used to create more than one curve on the graph
by simply listing a second triple of coordinate points. A simple illustration is
the MATLAB code lines3d.m, which generates the lines in Example 2.3.3. Try
the above codes, experiment with the input data and be sure to "rotate" the
gures, that is, change perspectives or points of view.
2.3.5
Exercises
1.
Let a line be given by the two points (1> 0> 3) and (4> 1> 4)= Find the vector
equation for this line.
$
2.
Let a line be given by the point (1> 2> 1) and the direction vector g = [1
1 2]= Find the parametric equations for this line.
$
3.
Suppose a line has vector equation
u (w) = [1 1 2] + w[1 1 1]=
(a).
Find the point on the line that is closest to the point (2> 4> 7)=
(b).
Compute this distance.
(c).
Use the cross product as in Theorem 2.3.1 to compute the distance.
$
4.
Suppose a line has vector equation
u (w) = [1 2 2] + w[1 2 1]=
(a).
Find the point on the line that is closest to the point whose position
$
vector is
s = [1 5 3]=
(b).
Compute this distance.
(c).
Use the cross product as in Theorem 2.3.1 to compute the distance.
76
$
$
5.
Consider two lines given by
u (w) = [1 1 2] + w[1 1 1] and
(w) = [1
2 2] + [1 2 1]= Use the cross product as in Theorem 2.3.2 to compute the
minimum distance between the two lines.
$
$
6.
Consider two lines given by
u (w) = [1 0 1] + w[1 1 3] and
(w) = [1
-2 2] + [1 2 1]= Use the cross product as in Theorem 2.3.2 to compute the
minimum distance between the two lines.
7.
Consider the two lines given in Example 2.3.3.
(a).
Compute the components in the matrix equation (2.3.2).
(b).
Solve this system for w = w0 and = 0 =
$
$
(c).
Compute the minimum distance directly by k
u (w0 )
( 0 )k =
8.
Use the MATLAB lines3d.m.
(a).
Execute this code to view the two lines in Example 2.3.3. Use
"rotate" to obtain dierent perspectives.
(b).
Modify this code to graph the two lines in either exercise 5 or 6.
9.
Use the MATLAB helix.m.
(a).
Execute this code to view the "spiral staircase" with radius 6 and
height of 10 per revolution.
(b).
Modify the code to consider a "spiral ramp" with radius 60 and
height of 30 per revolution.
10.
Use the MATLAB proj3d.m.
$
$
(a).
Execute this code with the wind speeds
z = [5 10 0] and
z = [5
10 0]=
(b).
Execute this code with dierent air resistance coe!cients f = 0=01
and f = 0=005 (drier air!).
2.4
Planes in R3
This section will give four descriptions of a plane in space. The minimum
distance from a point to a plane with an application to curve tting to data will
be presented. Determinants will be used to solve resulting algebraic systems.
2.4.1
The rst description uses a single equation with three variables {> | and }
d{ + e| + f} = g=
For example, if the four constants were positive, then the intercepts with the
coordinate axes will be positive and the graph would look similar to that given
in Figure 2.4.1. A point ({0 > |0 > }0 ) is in the plane if and only if it satises the
equation
d{0 + e|0 + f}0 = g=
Therefore, any point ({> |> }) in the plane must satisfy
d{ + e| + f} = d{0 + e|0 + f}0 or
d({ {0 ) + e(| |0 ) + f(} }0 ) = 0=
2.4. PLANES IN R3
77
78
The fourth description requires a point and two non-parallel vectors in the
plane. The two non-parallel vectors could be calculated from three points as
above. Any point in the plane can be found by adding the position vector of
the given point, a scaled rst vector and a scaled second vector
$
$
$
$
u =
u + u
d +ve =
0
The scaling factors are real numbers u and v such that the linear combination
$
$
u
d + v e is a vector beginning at the point ({0 > |0 > }0 ) and ending at a desired
point in the plane ({> |> })= See Figure 2.4.3 for an illustration of the linear
combination.
Example 2.4.2. Find the plane that contains the points (1> 1> 3)> (2> 2> 1) and
$
$
$
(0> 3> 2)= Choose the position vectors
u 0 = [1 1 3]>
u 1 = [2 2 1] and
u 2 = [0
3 2] and compute
$
d = [2 2 1] [1 1 3] = [1 1 2] and
$
e = [0 3 2] [1 1 3] = [1 2 1]=
2.4. PLANES IN R3
79
(2.4.1)
80
2.4.2
In Example 2.4.2 suppose a particular point on the plane is given and we want
to nd the parameters u and v so that the linear combination gives the point.
This will require solving for two unknowns. This type of problem also appeared
in the previous section where we were trying to nd the points on two lines
that were closest. A similar problem will be nding a point in a plane that is
closest to a given point not on the plane. For linear systems with small number
of unknowns, determinants give a compact formula for the solutions.
Let a 2 2 matrix D be given by two column vectors a and b> and let the
unknowns be u and v= With a given column vector f for the right side of the
vector equation we have
d1 e1
u
i1
=
or
(2.4.2)
v
d2 e2
i2
d1
e1
i1
u
+v
=
=
d2
e2
i2
The two equivalent scalar equations are
d1 u + e1 v = i1 and d2 u + e2 v = i2 =
Multiply the second equation by d1 > multiply the rst equation by d2 and subtract the two to get
(d1 e2 d2 e1 )v = d1 i2 d2 i1 =
A similar calculation eliminates u and gives
(d1 e2 d2 e1 )u = i1 e2 i2 e1 =
The coe!cient on the left side is the denition of the determinant of the 2 2
matrix D= By moving the column vector f into the rst or second column of D>
one can express the right sides using determinants. This is Cramers rule for
two unknowns.
Theorem 2.4.1 (Cramers Rule) Let D be the 22 matrix in equation (2.4.2).
If ghw(D) 6= 0> then the solution is
i1 e1
d1 i1
u = det(
)@ det(D) and v = det(
)@ det(D)=
i2 e2
d2 i2
Example 2.4.3. Consider Example 2.4.2 where the plane has representation
in equation (2.4.1) or { + | + } = 5= The point ({> |> }) = (4> 3> 2) is in this
plane. The problem is to nd u and v so that equation (2.4.1) holds. Since
(4> 3> 2) is in this plane, we only need to consider the rst two of the scalar
equations { = 4 = 1 + 1u 1v> | = 3 = 1 + 1u + 2v
uv = 3
u + 2v = 2=
2.4. PLANES IN R3
81
1 1
1 2
u
v
=
3
2
3 1
1 3
u = det(
)@3 = 8@3 and v = det(
)@3 = 1@3=
2 2
1 2
It is easy to see that all three scalar equations hold.
2.4.3
This section extends the study of minimum distance from a given point to a
line in a plane to a given point in space to a plane in space. As in Section 1.4,
one can approach the problem either using calculus or geometry. The calculus
approach requires minimizing a function of two variables, and we will defer this
to the multivariable calculus course. The geometric approach gives the same
result and relies on the visualization of the problem as depicted in Figure 2.4.4.
Let the plane be given by a point and two non-parallel vectors in the plane
$
$
$
$
u =
u 0 + u
d +ve =
$
If the given point not in the plane is represented by the position vector
s > then
we must nd the real numbers u = u0 and v = v0 so that
$
$
$
$
d + v0 e
u min
u 0 + u0
82
$
$
$
$
$
is closest to the
s . In this case, the vectors
s
u min and
u
u min are
perpendicular for all points in the plane represented by the position vector.
$
$
$
$
$
Since
d and e are in the plane, we may choose either
u =
u min +
d or
$
$
$
$
$
$
u = u min + e = In these cases, s u min must be perpendicular to both
d
$
and e
$
$
$
d = 0 and
(
s
u min )
$
$
$
( s u min ) e = 0=
$
$
$
$
d + v0 e and using the properties of the dot product,
u 0 + u0
Since
u min
we obtain the following scalar equations
$ $
$
$
$
$
$
(
s
u 0)
d
d
d u0 e
d v0 = 0 and
$
$
$
$
$
$
$
( s u ) e d e u e e v = 0=
0
is
#
$
u0
e $
d
=
$
$
v0
e e
$
$
$
(
s
u 0)
d
=
$
$
$
(
s
u 0) e
(2.4.3)
$2
$ $2
2
$
= k
dk e ( e
d)
2
$
$
=
d e =
$
$
Since the vectors
d and e are required not to be parallel, this determinant is
not zero and equation (2.4.3) must have a solution. Once the solution is found,
$
$
$
s
u min k can be computed.
u min and the desired distance k
$
$
$
An alternative way to compute k s
u min k is to use a normal vector
q to
$
$
$
$
the plane. Then the cosine of the angle between s u min and u 0 s is
$
$
$
s)
q (
u 0
=
cos() =
$
$
$
kqkk u s k
0
$
The angle is indicated in Figure 2.4.4 with
u set equal to $
u 0 so that
$
$
$
u 0
s k |cos()|
k
s
u min k = k$
$
$
$
q (u0
s )
=
(2.4.4)
$
=
k
qk
$
Theorem 2.4.2 (Minimum Distance to a Plane) Let a plane be given by
u =
$
$
$
$
u 0 + u d + v e where u 0 is a position vector of a given point in the plane and
$
$
$
d and e are not parallel vectors in the plane. If
s is a position vector of
a point not in the plane, then the solution of equation (2.4.3) gives the point
$
in the plane closest to the point associated with
s = Moreover, the minimum
distance may also be calculated by equation (2.4.4).
2.4. PLANES IN R3
83
Example 2.4.4. Return to the Example 2.4.2 where the plane is given by
$
$
$
$
u =
u 0 + u
d +ve
[{ | }] = [1 1 3] + u[1 1 2] + v[1 2 1]=
$
Let the point not on this plane be given by the position vector
s = [10 11
$
$
12] and compute s u 0 = [10 11 12] [1 1 3] = [9 10 9]= Then equation
(2.4.3) is
6 3
u0
1
=
=
3 6
2
v0
$
$
u min
u0+
Apply Cramers rule to obtain u0 = 0@27 and v0 = 9@27= Then
s
$
$
$
$
k = 28@ 3= This is consistent
u d + v e = [2@3 5@3 8@3] and k s u
0
min
2.4.4
$
$
$
q (
u0
s)
$
kqk
s
[1 1 1] [9 10 9]
s
= 28@ 3=
3
A consumer would like to predict the price of a high denition television based
upon prices from the previous three months of $2000> $1950 and $1910 for the
rst, second and third months of the year. One way to view this problem is
to plot the prices on the vertical axis versus the times 1> 2 and 3. Then try to
draw a line "closest" to the data, estimate the slope p and the y-intercept f>
and use these in the formula | = p{ + f where { is the time in months and |
is the possible price of the television. Here we are trying to "t" a line to the
three points of price data.
A more precise way of doing this is to view p and f as unknowns in the
following three scalar equations
p1 + f = 2000
p2 + f = 1950 and
p3 + f = 1910=
This is an over determined system with three equations and two unknowns, and
in general does not have a solution to all three equations. In terms of matrices
this is
5
6
5
6
1 1
2000
7 2 1 8 p
= 7 1950 8
(2.4.5)
f
3 1
1910
5 6
5 6
5
6
1
1
2000
p 7 2 8 + f 7 1 8 = 7 1950 8 =
3
1
1910
84
14 6
p
11630
=
=
6 3
f
5860
Apply Cramers rule to solve for p = 270@6 = 45=00 and f = 12260@6
2043=33= Use these to predict the price in the fourth month
|
2.4.5
= p{ + f
(45=00)4 + 2043=33 = 1863=33=
The MATLAB command A\d can be used to solve D{ = g where the matrix D
has q rows and q columns. In the above curve tting problem q = 2 and the
following simple MATLAB computations produce the same results as Cramers
rule.
AA A =[14 6;6 3]
A=
14 6
6 3
AA d =[11630 5860]
d=
11630
5860
AA A\d
ans =
1.0e+003 *
-0.0450
2.0433
The MATLAB command A\d can also be used to solve certain over determined systems such as in equation (2.4.5).
AA A_big = [1 1;2 1;3 1]
A_big =
1 1
2 1
3 1
AA d_big = [2000; 1950; 1910]
d_big =
2.4. PLANES IN R3
85
2000
1950
1910
AA A_big\d_big
ans =
1.0e+003 *
-0.0450
2.0433
A more careful study of what is done to generate possible solutions will be given
in the next two chapters.
2.4.6
1.
2.
3.
4.
5.
Exercises
(a).
Find the algebraic system in equation (2.4.2) such that [{ | }] =
[2 3 1]=
(b).
Use Cramers rule to nd u and v.
6.
Consider a plane given by
[{ | }] = [1 0 1] + u[4 0 1] + v[1 0 1]=
(a).
Find the algebraic system in equation (2.4.2) such that [{ | }] =
[1 0 2]=
(b).
Use Cramers rule to nd u and v.
7.
Consider a plane given by
[{ | }] = [1 1 1] + u[2 3 1] + v[1 0 1]=
Find the point in the plane that is closest to the point (5> 4> 6)=
86
8.
Find the point in the plane that is closest to the point (5> 4> 6)=
9.
A consumer would like to predict the price of a laptop computer based
upon prices from the previous three months of $1000> $960 and $910 for the
rst, second and third months of the year. Model this by assuming the price
decreases as a linear function of time similar to equation (2.4.5).
(a).
Find the slope and the y-intercept of a straight line "closest" to this
data.
(b).
Use these to predict the price after four months.
10.
A consumer would like to predict the price of a laptop computer based
upon prices from the previous months one, two and four equal to $1000> $960
and $870, respectively. Model this by assuming the price decreases as a linear
function of time similar to equation (2.4.5).
(a).
Find the slope and the y-intercept of a straight line "closest" to this
data.
(b).
Use these to predict the price after ve months.
2.5
Extensions to Rq
This section is an introduction to vectors with more than three components and
to the remaining chapters in this book. There are sections with applications
to inventory and price vectors, larger algebraic systems of equations, curve
tting with more than three data points, higher dimensional spaces of vectors,
systems of ordinary dierential equations and matrices used in the context of
visualization. Even though we have mostly considered vectors with two or three
components, which may represent points in space or physical quantities such as
force and velocity vectors, we have used vectors with a number of components to
store information. Examples are the spiral and projectile curves in Subsection
2.3.3 and the lines as given by the MATLAB commands in Subsection 2.3.4.
In the line example, four vectors with 61 components were created to store
the values for the parameter and the {, | and } values of the points on the
line. Many of the operations on vectors have natural generalization to higher
dimensions, but some of the geometric aspects are lost as we move beyond
dimension two and three.
2.5.1
A store carries six dierent styles of television sets. There are a number of each
style in the inventory, and there is a price per set for each style. So, there are
a total of 12 numbers to be recorded. These can be stored in two vectors each
with six components. The inventory or stock numbers will be denoted by a
column vector s, and the price numbers will be stored in a column vector p=
2.5. EXTENSIONS TO RQ
Example 2.5.1.
5
9
9
9
s =9
9
9
7
87
2
4
5
3
7
1
:
9
:
9
:
9
: and p = 9
:
9
:
9
8
7
400
250
280
900
700
100
6
:
:
:
:=
:
:
8
The total value of the original stock and price is given by a "dot product" of
the stock and price vectors
sW p = 2(400) + 4(250) + 5(280)
+3(900) + 7(700) + 1(100)
= 10900=
If there is a second store with a known stock vector b
s, then the total stock can
be computed by "adding" the vectors. For example, if the second store stock
vector is
5 6
1
9 2 :
9 :
9 2 :
:
b
s=9
9 5 :,
9 :
7 3 8
4
then the total stock is
5
9
9
9
b
s+s = 9
9
9
7
1+2
2+4
2+5
5+3
3+7
4+1
: 9
: 9
: 9
:=9
: 9
: 9
8 7
3
6
7
8
10
5
6
:
:
:
:=
:
:
8
The total value of the two stores can be computed in two ways
sW p + b
sW p = 10900 + 8460 or
W
(b
s + s) p = 19260=
88
Large department stores have thousands of products on their shelves, and their
inventory numbers and prices can be stored in vectors with large numbers of
components.
2.5.2
Algebraic Systems
In the previous sections algebraic systems with two unknowns and two equations
were solved using determinants and Cramers rule. In Subsection 2.2.3 the nonzero volume of a parallelepiped is generated by three column vectors a> b and c.
Any point in space can be represented by a linear combination of these vectors
(see Figure 2.2.4)
5
d1
7 d2
d3
e1
e2
e3
ua + vb + wc = r0
65 6
5
6
u
{0
f1
f2 8 7 v 8 = 7 |0 8 =
w
f3
}0
Given the three column vectors and the point, we want to nd u> v and w=
Determinants and a generalization of Cramers rule can be used to compute
these coe!cients. For three unknowns the rule is (see Section 3.7)
w = det( a b r0 )@ det( a b c )=
W
W
Example 2.5.2. Consider the Example
2.2.5 whereW a = [1 2 1]> b = [2 0
W
1]> c = [0 1 4] and det( a b c ) = 15= If r0 = [5 6 4], then solve
65 6 5 6
1 2 0
u
5
7 2 0 1 87 v 8 = 7 6 8=
1 1 4
w
4
The three additional determinants
u = det( r0 b c
v = det( a r0 c
w = det( a b r0
)@(15) = 0@(15) = 0=
For larger algebraic problems determinants are not used and usually row
operations are better suited for the solution. An example of a large system
would be from models of building whose support is from beams connected at a
number of nodes or joints. In order for the building to be in a static state, the
sum of the forces at each node must be zero. Each node has a small number of
equations, but the building usually will have a large number of nodes. Thus,
there are a large number of equations. This will be discussed in chapter three.
2.5. EXTENSIONS TO RQ
2.5.3
89
Curve Fitting
=
=
=
=
6
1
1 :
: p
1 8 f
1
6
5
1
:
9 1
:+ f9
8
7 1
1
2000
1950
1910 and
1890=
6
:
:
8
6
2000
9 1950 :
:
= 9
7 1910 8
1890
5
6
2000
9 1950 :
:
= 9
7 1910 8 =
1890
The solution of this requires a notion of perpendicular vectors in four dimensional space! The solution has the same form and is called the normal equations.
Let aW = [1 2 3 4], bW = [1 1 1 1] and pW = [2000 1950 1910 1890]
W
W
a a aW b
p
a p
=
=
f
bW a bW b
bW p
These concepts will be developed in chapter four.
2.5.4
90
$
the direction vector g to be
$
$
q1
q2
5 $
$ 6
$
l
m
n
= det(7 1 1 1 8)
6 2 3
$
$
$
= l (1) m (3) + n (4)
= [1 3 4]=
Find a point on both planes by setting } = 0 and solve the equations {+|+0 = 1
and 6{ + 2| + 0 = 6 to obtain { = 1 and | = 0= Then the vector equation for
$
the line is
u = [1 0 0] + w[1 3 4]=
If there are p equations and q variables with p ? q, then one would like
to be able to describe the set of points satisfying the p equations. Problems
of this nature arise as parts of models for structures, circuits and uids. These
problems will be discussed in chapter ve.
2.5.5
= dy1 + g1 >
= ey2 + g2 and
= fy3 + g3 =
2.5.6
2.5. EXTENSIONS TO RQ
91
16-bit images they range from 0 to 65535 = 216 1. The black image pixel is
associated with 0, and the white image pixel is associated with 255 (8-bit) or
65535 (16-bit). If these matrices are converted to oating point numbers, then
one can use matrix operations to change the image. For example, if the image
is too bright, then multiply the corresponding matrix by a constant less than
one so that the resulting pixels have smaller values.
In MATLAB one can view the image in several ways. First, just look at the
matrix components. Second, use the MATLAB command mesh() to generate a
surface of the image where the indices of the matrix are on the xy-plane and
the intensity of the image is on the z-axis. Third, one can map the matrix into
a standard image le such as a *.jpg le. This can be done by the MATLAB
command imwrite(). The inverse of the imwrite() is imread(), which generates
a matrix from a *.jpg le.
The following MATLAB function le creates a 5040 matrix that represents
the letter N. The input parameter g in the function lettern(g) should be between
0 and 255 and will indicate how bright the letter will be. Other letter generating
functions are similar.
MATLAB function lettern()
function letn = lettern(g)
letn = zeros(50,40);
letn(10:40,4:8) = g;
letn(10:40,32:36) = g;
for j = 8:32
letn(48-j,j) = g;
letn(47-j,j) = g;
letn(46-j,j) = g;
letn(45-j,j) = g;
letn(44-j,j) = g;
letn(43-j,j) = g;
letn(42-j,j) = g;
end
The MATLAB code le imagncsu.m creates the letters NCSU and displays
them via mesh(), imwrite() as a *.jpg le and imwrite() for the negative image,
see Figures 2.5.1, 2.5.2 and 2.5.3.
MATLAB code le imagncsu.m
ncsu = [lettern(5) letterc(7) letters(9) letteru(11)];
mesh(ncsu);
newncsu = 20*ncsu;
newncsu = newncsu(50:-1:1,:);
negncsu = 255*ones(size(newncsu))-newncsu;
newncsu1 = uint8(newncsu);
imwrite(newncsu1, ncsu.jpg);
negncsu1 = uint8(negncsu);
imwrite(negncsu1, negncsu.jpg);
92
Images and signals often have unwanted noise associated with the transmission and reception. Matrix manipulations can "lter" some of the unwanted
attributes. Chapters eight and nine will investigate space and frequency lters.
The frequency lters use the "fast Fourier transform." This is associated with
matrix products where the Fourier matrix has complex numbers as components.
2.5. EXTENSIONS TO RQ
2.5.7
93
Exercises
1.
A computer store stocks ve dierent laptops and has 5> 6> 2> 1 and 5 units
of the respective models. Suppose the prices per unit are 1000> 850> 1700> 2220
and 1150, respectively.
(a).
Find the stock and price vectors.
(b).
Compute this stores total value of the laptop stock by using the
dot product of these vectors.
2.
Consider the computer store in exercise one. The same owner wishes to
open a second store with the same ve laptop models and 4> 5> 3> 3 and 2 units
of the respective models.
(a).
Find the stock and price vectors for the second store.
(b).
Compute the total value of the stock in both stores by using the
dot product.
3.
Let ua + vb + wc = r0 where aW = [1 0 1]> bW = [2 1 1]> cW = [4 1 4]
and rW0 = [10 1 4]=
(a).
Write this as a matrix equation.
(b).
Use determinants and Cramers rule to solve the matrix equation.
4.
Let ua + vb + wc = r0 where aW = [1 0 1]> bW = [3 1 2]> cW = [2 1
4] and rW0 = [10 1 4]=
(a).
Write this as a matrix equation.
(b).
Use determinants and Cramers rule to solve the matrix equation.
5.
Two planes are given by 2{ + | + 3} = 12 and { + 3| + } = 6=
(a).
Find the normal vectors to each plane.
(b).
Find the vector equation for the line given by the intersection of the
two planes.
6.
Two planes are given by { + | + } = 3 and { + 3| + } = 12=
(a).
Find the normal vectors to each plane.
(b).
Find the vector equation for the line given by the intersection of the
two planes.
7.
Use the MATLAB command A\d to solve the matrix equation in exercise
three.
8.
Use the MATLAB command A\d to solve the matrix equation in exercise
four.
9.
Use the MATLAB function le lettern(g) to experiment with dierent
brightness levels. Use mesh(letn) to view the letter n, for example,
AA lettern(50)
AA mesh(letn)
10.
Use the MATLAB function le lettern(g) as a template to create letter
matrices for your rst name.
11.
Use the MATLAB code le imagncsu.m as a template to create a *.jpg
le for your rst name.
Chapter 3
Ax = d: Unique Solution
This and the next two chapters contain the basic methods for solving matrix
equations of the form Dx = d where D is a matrix and x and d are column vectors. A much more complete description of solution methods and linear algebra
can be found in [5]. The possibilities of a unique solution, no solution, multiple solutions and least square solutions are discussed. In this chapter most
of the algebraic systems are assumed to be square so that the number rows
(equations) and columns (variables) are equal. Row operations and elementary
matrices are used to do by-hand computations of the Gauss elimination, LU factorization and inverse matrix methods. These methods are also implemented in
MATLAB. Applications to steady state circuits, mixing tanks, heat conduction
and support trusses are given.
3.1
Matrix Models
The extension from vectors with two or three components and from 2 2 or
3 3 matrices to higher dimensions will be motivated by graphics and a variety
of applications. In this section the simplest model of cost, circuits and trusses
will be presented. We will return to these models in the remainder of the text
so as to increase their complexity, time dependence and accuracy.
3.1.1
In Section 2.5 price, inventory and graphing vectors were introduced. Vectors
may either be row or column vectors and usually are an ordered list of real or
complex numbers. However, they could have more general components such as
a phone book where the components are triples having a name, address and
phone number. In the remainder of the text we will assume the vector is a
column and will use a bold lower case font to denote vectors.
95
96
eq
97
One can combine scalar multiplication and vector addition to form a linear
combination of these vectors
5 6
5
6 5
6
1
3
0
9 6 :
9
: 9
:
: + 39 2 : 9 1 :
2a+3b c = 2 9
7 3 8
7 1 8 7 4 8
5
3
2
6
6 5
5
11
2(1) + 3(3) 0
9 2(6) + 3(2) 1 : 9 17 :
:
: 9
= 9
7 2(3) + 3(1) 4 8 = 7 1 8 =
21
2(5) + 3(3) (2)
This is in contrast to the augmentation of the three column vectors, which is a
4 3 matrix or array
5
6
1 3
0
9 6 2
1 :
:
D=9
7 3 1 4 8 =
5 3 2
The set of q 1 column vectors Rq is called a vector space because it has
the properties listed in the next theorem.
Theorem 3.1.1 (Vector Space Properties of Rq ) Let a, b and c be in Rq and
let v and w be real numbers. Let a + b and va denote vector addition and scalar
product. Then the following hold:
a + b 5 Rq , a + 0 = a where 0 5 Rq has zeros as components, a + (a) = 0,
a + b = b + a, a + (b + c) = (a + b) + c;
va 5 Rq , 1a = a, v(a + b) = va + vb, (v + w)a = va + wa and v(wa) = (vw)a=
The denitions of dot product and norms for vectors in R2 and R3 , see Sections 1.4 and 2.1, have the following generalizations and analogous properties.
Denitions 3.1.3. Let a and b be given vectors in Rq = The dot product of a
and b is a real number dened by
a b aW b = d1 e1 + d2 e2 + + dq eq =
The vectors a and b are called orthogonal if and only if their dot product in
zero
a b = aW b = 0=
The Euclidean norm of a is a real number dened by
kak (a a)1@2 = (aW a)1@2 = (d21 + d22 + + d2q )1@2 =
In order to illustrate the dot product and norm, consider Example 3.1.1
where q = 4
a b = 1(3) + 6(2) + 3(1) + 5(3) = 27 and
s
kak = (12 + 62 + 32 + 52 )1@2 = 71=
98
Many properties of the dot product and norm, that hold for vectors in the plane
and space, also hold for vectors in Rq = The proofs of these are similar except
for the Cauchy-Schwarz inequality.
Theorem 3.1.2 (Properties of Dot Product) Let a> b and c be given vectors
in Rq and let v be a real number. Then the following hold
a b = b a> v(a b) = (va) b>
a (b + c) = a b + a c and
|a b| kak kbk (Cauchy-Schwarz inequality);
(3.1.1)
= 0 + 2a b + 2wb b and
= 0 + 2b b=
= aa
(a b)
0=
bb
3.1.2
99
Matrices
In Section 2.5 matrices were used to store the intensity at each point or pixel
in an image. Matrices can be used to store a variety of information, which
often requires visualizing or modications. There are four element-wise or array
operations that will be very useful.
Denitions 3.1.4. An augmentation of q p1 column vectors with 1 m q
of the form
5
6
d1m
9 .. :
7 . 8
dpm
is an p q matrix D where the rst index 1 l p is the row number, the
second index 1 m q is the column number and
6
5
d11 d12 d1q
9
..
.. : = [d ] =
D = 7 ...
lm
.
. 8
dp1
dq2
dpq
[i (dlm )] >
[dlm elm ] >
[dlm @elm ] and
[dlm n] =
Example 3.1.2. Consider the 4 3 matrix in Example 3.1.1 formed by augmenting the three column vectors. The component in the third row and rst
column is d31 = 3> and d23 = 1 is the component in the second row and third
column. Array operations with exponents are not the same as matrix products
5 2
6 5
6
1
32
02
1 9 0
9 62
9
:
22
12 :
: = 9 36 4 1 : =
D=2 = 9
2
7 32 (1)2
8
7
9 1 16 8
4
2
2
2
25 9 4
5
3
(2)
Example 3.1.3. This example illustrates how array operations and matrices
can be used to create a graph in MATLAB of a surface given by } = i ({> |) =
100 {2 4| 2 = In order to graph the surface, a collection of points in the
xy-plane must be selected and then the values of i ({> |) at these points must
be computed and stored. Suppose three points in the x-direction are { = 0> 4
and 8, and four points in the y-direction are | = 0> 2> 4 and 6. There are
a total of 12 points in the xy-plane; the 12 values of { can be stored in a
4 3 matrix [, and the 12 values of | can be stored in a 4 3 matrix \= The
corresponding 12 values of i ({> |) can be computed and stored in a 43 matrix
100
I= The following MATLAB commands do this. Note, the row 4 and column 3
component of I is 100 82 4(62 ) = 108= By using smaller increments in
the MATLAB command meshgrid(), one can generate much larger matrices and
a more accurate depiction of the surface, which is graphed by the MATLAB
command mesh(X,Y,F).
AA [X Y] = meshgrid(0:4:8,0:2:6)
X=
048
048
048
048
Y=
000
222
444
666
AA F = 100 - X.^2 - 4*Y.^2
F=
100 84 36
084 68 20
036 20 -28
-44 -60 -108
AA mesh(X,Y,F)
3.1.3
The objective is to nd the dimensions of a 3D box with xed volume and with
minimum cost. In order to approximate the solution, the cost function will
be graphed, and we will inspect the graph for a minimum cost. Suppose the
volume must be 1000 ft3 , the bottom cost 3 $/ft2 , the four sides cost 1 $/ft2 and
there is no top. Let the bottom have edges equal to { and |, and let the height
of the box be }. This is illustrated by Figure 3.1.1. The cost of the bottom is
3{|> and the cost of the sides is 1(|} + |} + {} + {})= Since the volume must
be 1000, 1000 = {|} or } = 1000@({|)= Because the total cost equals the sum
of the cost of the bottom and the four sides,
F({> |) = 3{| + 2(|} + {})
= 3{| + 2(|1000@({|) + {1000@({|))
= 3{| + 2(1000@{ + 1000@|)=
The following MATLAB commands create the surface and contour plots of
this cost function as given in Figure 3.1.2. The three matrices [, \ and F are
20 20 and note how array operations are used to compute the possible costs
in the matrix F. An estimate of the minimum cost is given by { = 9 and | = 9
101
3.1.4
[X Y ] = meshgrid(1:1:20,1:1:20);
C = 3*X.*Y + 2000./Y + 2000./X;
subplot(1,2,1)
mesh(X,Y,C)
subplot(1,2,2)
contour(X,Y,C, 650:25:900)
Consider the two-bar truss in Figure 3.1.3. This truss is attached to a wall on
the left and can be used to support a mass on the node joining the two bars. In
the truss the bar ends are always pin connected. Consequently, the force in the
bars are always along the axis. Assume there is no deformation and the bars
are in a static state. The horizontal bar will have compression force i2 ? 0> and
the diagonal bar will have a tension force i1 A 0. At the joining node there are
three force vectors whose sum must be the zero vector to satisfy the equilibrium
equations
[i1 cos() i1 sin()] + [i2 0] + [0 z] = [0 0] or
[i1 cos() i2 i1 sin() z] = [0 0]=
By equating the rst and second components of the vector equation, we obtain
two scalar equations
i1 cos() i2 = 0 and
i1 sin() = z=
The matrix version of this is
0
cos() 1
i1
=
=
z
i2
sin()
0
102
The solution is easy to compute. For example, if z = 100 and = @6> then
i1
i2
=
200s
100 3
If decreases, then the tension and compressive force magnitudes will increase.
If there are more than two bars, then the number of joints will increase as well
as the number of force vectors and force vector equations. This eventually leads
to much larger algebraic systems as demonstrated in Subsections 3.4.4.
103
3.1.5
Consider the two-loop circuit in Figure 3.1.4 with three resistors and two batteries. The current going through resistors U1 > U2 and U3 will be denoted by l1 > l2
and l3 and will have directions indicated by the arrows in the gure. Kirchhos
current law requires the sum of the currents at any node be zero
l1 l2 + l3 = 0=
Ohms law states that the voltage drop across each resistor is the resistance
times the current. Kirchhos voltage law requires the sum of the voltage drops
in each loop be equal to zero
H1 U1 l1 + U3 l3
H2 U2 l2 U3 l3
The matrix version for the three unknown
equations is
5
65
1
1
1
7 U1
0
U3 8 7
0 U2 U3
= 0
= 0=
6
5
6
1 1 1
0
D = 7 1 0 3 8 and d = 7 10 8 and note
0 2 3
20
det(D) = 1(0 (3)(2)) (1)(1(3) 0) + 1(1(2) 0) = 11=
104
The solutions are
5
l1
l2
l3
6
0 1 1
= det(7 10 0 3 8)@ det(D) = 10@(11)>
20 2 3
5
6
1 0
1
= det(7 1 10 3 8)@ det(D) = 50@(11) and
0 20 3
5
6
1 1 0
= det(7 1 0 10 8)@ det(D) = 40@(11)=
0 2 20
Most circuits have many more loops so that the resulting algebraic systems are
very large. In these cases it is not practical to solve them using Cramers rule.
In the following sections viable alternative methods will be developed.
3.1.6
Exercises
6.
(b).
Use MATLAB and mesh(X,Y,F) to compute F and graph.
Consider the surface } = i ({> |) = 200 {2 3| 2 =
105
(b).
Use MATLAB and mesh(X,Y,F) to compute F and graph.
7.
Consider the minimum cost of the box with no top, volume equals 200,
bottom costs 4 $/ft2 and sides cost 1 $/ft2 =
(a).
Find the cost function.
(b).
Use MATLAB and mesh(X,Y,C) to approximate the minimum cost.
8.
Consider the minimum cost of the box with a top costing 2 $/ft2 , volume
equals 200, bottom costs 4 $/ft2 and sides cost 1 $/ft2 =
(a).
Find the cost function.
(b).
Use MATLAB and mesh(X,Y,C) to approximate the minimum cost.
9.
Consider the two-bar truss with z = 100 and variable = @12> 2@12>
3@12 and 4@12= Find the forces on the two bars.
10.
Consider the two-bar truss with = @6 and variable z = 100> 200> 300
and 400= Find the forces on the two bars.
11.
Consider the two-loop circuit with H1 = 10> H2 = 20> U1 = 1> U2 = 2
and U3 = 2= Find the three currents.
12.
Consider the two-loop circuit with arbitrary batteries and resistors.
Find the three currents and show the center current must be negative.
3.2
Matrix Products
= g1 >
= g2 and
= g3 =
the form
65
6
5
6
d13
{1
g1
d23 8 7 {2 8 = 7 g2 8 or
d33
{3
g3
Dx = d where D is 3 3=
106
= g1 and
= g2 .
3.2.1
d11
d21
d12
d22
d13
d23
d14
d24
6
5
6
g1
{1
9 g2 :
9 {2 :
:
9
:
9
7 {3 8 = 7 g3 8 or
{4
g4
Dx = d where D is 2 4=
5
Matrix-vector Products
107
6
11
3 :
:=
37 8
18
The matrix vector product could also have been computed by a linear combination of the two column vectors of D
6
6 5
6 5
6
5 6 5
5
11
8
3
2
1
9 0 : 9 3 : 9 0 : 9 3 :
9 1 :
:
: 9
: 9
:
9 : 9
Dx = 3 9
7 7 8 + 4 7 4 8 = 7 21 8 + 7 16 8 = 7 37 8 =
18
12
6
3
2
If
F=
2 4
1 2
>
then D + F is not dened because their row and column numbers are not equal.
If v = 7, then vD is dened to be the 4 2 matrix
5
6 5
6
7 14
7(1) 7(2)
9 7(1) 7(0) : 9 7 0 :
: 9
:
vD = 9
7 7(7) 7(4) 8 = 7 49 28 8 and
14 21
7(2) 7(3)
6
6 5
5
0 5
11 2+3
9 1 + 2 0 + 1 : 9 1 1 :
:
: 9
D+E = 9
7 7 + 0 4 + 5 8 = 7 7 9 8=
0 7
22 3+4
Theorem 3.2.1 (Matrix-vector Products Properties) Let D> E and F be pq
matrices. Let ] be a p q matrix with all components equal to zero, called the
zero matrix. Let x and y be q 1 column vectors. Then the following are true:
108
1.
D + (E + F) = (D + E) + F, D + E = E + F and D + ] = D=
2.
3.
The proofs of the above six properties are routine. The last property is the
column version of a matrix-vector product whose proof is
5
6
d11 {1 + + d1p {p
9
:
..
Dx = 7
8
.
dq1 {1 + + dqp {p
5
6
5
6
d11 {1
d1p {q
9
:
9
:
..
..
= 7
8 + + 7
8
.
.
dq1 {1
dqp {p
5
6
5
6
d11
d1q
9
:
9
:
= {1 7 ... 8 + + {q 7 ... 8 =
dp1
dpq
Example 3.2.2. Verify the matrix addition properties in the above theorem
for
5
6
5
6
5
6
1 2
1 3
1 5
D = 7 2 0 8 > E = 7 2 1 8 and F = 7 2 3 8 =
4 6
2 5
4 3
6
5
6 5
6
1 2
1 3
1 5
D + (E + F) = 7 2 0 8 + (7 2 1 8 + 7 2 3 8)
4 6
2 5
4 3
5
6
1 + (1 + 1) 2 + (3 5)
= 7 2 + (2 + 2) 0 + (1 + 3) 8
4 + (2 + 4) 6 + (5 + 3)
5
6
(1 1) + 1 (2 + 3) 5
= 7 (2 + 2) + 2 (0 + 1) + 3 8 = (D + E) + F=
(4 + 2) + 4 (6 + 5) + 3
109
6 5
6
1 2
1 3
= 7 2 0 8+7 2 1 8
4 6
2 5
5
6
11 2+3
= 7 2+2 0+1 8
4+2 6+5
5
6
11 3+2
= 7 2 + 2 1 + 0 8 = E + D=
2+4 5+6
D+E
D+]
3.2.2
6 5
6
1 2
0 0
= 7 2 0 8+7 0 0 8
4 6
0 0
5
6
1+0 2+0
= 7 2 + 0 0 + 0 8 = D=
4+0 6+0
Matrix-matrix Products
2 3
4 5
6 7
8 9
110
Example 3.2.3. First, let
1
D =
3
2
DE =
4
2
4
1
3
0 1
1 0
and E =
and note
3 4
6=
= ED=
1 2
2 1 0
2 4 7
D=
and E = 7 1 2 3 8 =
8 9 10
0 1 1
DE
8 17 19
=
=
25 36 37
This product also can be written as columns of the product given by D times
the column of E
2 4 7 7 8
8
1 =
Db1 =
8 9 10
25
0
5 6
1
2 4 7 7 8
17
2 =
Db2 =
8 9 10
36
1
5 6
0
2 4 7 7 8
19
3 =
Db3 =
=
8 9 10
37
1
b be p q, E
Theorem 3.2.2 (Matrix-matrix Products Properties) Let D> D
be q s, F be s t and v be a real number. Then the following are true:
1.
DE = D b1 bs = Db1 Dbs =
b = DE + DE=
b
(D + D)E
b = DE + DE
b follows from the distributive property
The proof of (D + D)E
of real numbers. Let 1 l p and 1 m s
2.
b
(D + D)E
1 0
D(EF) = 7 0 1
0 2@3
5
1 0
= 7 0 1
0 2@3
5
(DE)F
3.2.3
111
6 5
0
0 8 (7
1
6 5
0
0 8 (7
1
1 0 0
= (7 0 1 0
0 2@3 1
5
1
0
= (7 1@2 1
1@3 2@3
65
1 0 0
2
1@2 1 0 8 7 1
0 0 1
0
6
5
2 1 0
0 3@2 1 8) = 7
0 1 2
65
6
1 0
2 1 8)
1 2
6
2 1
0
0 3@2 1 8 =
0 0 4@3
6 5
1 0 0
2 1
8 7 1@2 1 0 8) 7 1 2
0 0 1
0 1
6 5
6 5
2 1 0
0
2
0 8) 7 1 2 1 8 = 7 0
1
0 1 2
0
6
0
1 8
2
6
1
0
3@2 1 8 =
0 4@3
The objective is to predict the temperature of a mass given an initial temperature and the temperature on the boundary. A very complicated example is
the temperature inside a spacecraft as it enters the earths atmosphere. Such
models have a long history of previous less sophisticated models. In this section
we restrict the mass to a long thin wire so that one may assume the diusion
of thermal energy is only along the length of the wire. For the present model,
we assume no heat is lost through the lateral surface area. Heat may enter the
wire through the left or right ends of the wire. Thus, the temperature will only
vary continuously with time and position along the wire. More complicated
heat models can be found in later sections of this text and in [12].
The model will be a discrete approximation of both time and space, that is,
the time and space variables will be broken into a nite number of segments
and the temperature will be assumed to be constant within each segment. This
is depicted in Figure 3.2.1 where there are four space segments with length
{ = O@4 and cross sectional area D= The temperatures in the three interior
segments are x1 > x2 and x3 ; the temperatures at the left x0 and right x4 are
given. The heat energy in the lwk segment is
fxl (D{)
where is the density, D{ is the volume and f is the specic heat of the wire.
112
xl xl1
=
{
xl xl1
xl+1 xl
+ w D N
=
{
{
Divide by f(D{) and let (w@{2 )(N@f) to get for l = 1> 2 and 3
= xl (xl1 + 2xl xl+1 ).
xqhz
l
One may write this as three scalar equations
xqhz
1
xqhz
2
xqhz
3
113
= u Du + d
5 6
5
65 6 5
6
0
2 1 0
0
(0=16)200
8
0
= 7 0 8 (0=16) 7 1 2 1 8 7 0 8 + 7
0
0 1 2
0
(0=16)70
5
6
32=0
= 7 0 8=
11=2
The approximate temperature at the second time step equal to 2000 is u2 where
the superscript denotes the second time step
u2
= u1 D u1 + d
5
6
5
65
6 5
6
32=0
2 1 0
32=0
(0=16)200
8
0
= 7 0 8 (0=16) 7 1 2 1 8 7 0 8 + 7
11=2
0 1 2
11=2
(0=16)70
5
6
53=7600
= 7 6=9120 8 =
18=8160
114
= (u Du + d) D (u Du + d) + d
= u 2Du + D2 u+2d Dd=
One can continue solving for the temperature at the next time step. This is illustrated in Figure 3.2.2, which was generated by the MATLAB code wire_time.m.
As the time steps increase, the temperature vector reaches a steady state, which
is a straight line. The means for larger time steps
u u Du + d=
Hence, the steady state solution
5
2 1
(0=16) 7 1 2
0 1
3.2.4
The calculations for the heat conduction application can easily be done by
MATLAB. Here we have computed the rst three time steps and the steady state
solution. The interested reader should examine the MATLAB code wire_time.m
to see how this can be done using for-loops.
115
116
3.2.5
Exercises
1.
Compute Dx (both row and column versions), D + E, D + F and vD
where
1 2 3 4
1 3 3 4
D =
> F=
>
4 1 2 5
2 1 12 5
5 6
2
9 1 :
0 22 2 4
:
E =
> x=9
7 5 8 and v = 9=
1 1 3 7
4
2.
Compute Dx (both row and column versions), D + E, D + F and vD
where
1 5 3
3 7
D =
> F=
> v = 7>
8 1 2
0 2
5
6
2
1 0 10
E =
and x = 7 11 8 =
2 3 1
5
3.
Verify D + (E + F) = (D + E) + F where D> E and F are the same as in
exercise one.
4.
Verify D(2x+3y) = 2Dx+3Dy where D and x are the same as in exercise
two and yW = [1 3 2 2].
5.
Compute DE (use both row and column versions) where
5
6
1 0 2 1
1 5 3
D=
and E = 7 5 4 7 1 8 =
8 1 2
1 2 0 1
6.
7.
8.
where
6
1
1 8=
1
1 2
1 5 3
3 7
D=
> E = 7 3 0 8 and F =
=
8 1 2
0 2
1 3
b = DE + DE
b where
Verify the (D + D)E
D=
1 5 3
8 1 2
b=
> D
1
0
1
3 11 0
6
1 2
and E = 7 3 0 8 =
1 3
117
9.
Consider Example 3.2.5 of heat conduction. Change the thermal conductivity from N = 1@1000 to N = 2@1000 and leave the other parameters the
same. Compute > u1 > u2 and the steady state solution.
10.
Consider Example 3.2.5 of heat conduction. Change the number of
segments from q = 4 to q = 5 and leave the other parameters the same.
Compute > u1 > u2 and the steady state solution. Note there are now four
unknowns, the vectors have four components, the matrix is 4 4> the left
temperature is x0 = 200 and the right temperature is x5 = 70=
11.
Use MATLAB to do the computations in exercise 9.
12.
Use MATLAB to do the computations in exercise 10.
13.
Modify the MATLAB code wire_time.m to do exercise 9 and observe
convergence to the steady state solution.
14.
Modify the MATLAB code wire_time.m to do exercise 10 and observe
convergence to the steady state solution.
3.3
Special Cases of Ax = d
In the previous sections we have solved algebraic systems with two and three
unknowns. These could be written as a vector equation Dx = d where D is an
q q matrix with q = 2 or 3, d is a given q 1 column vector and x is an
unknown q 1 column vector. The overall objective is be able to systematically
solve problems with much larger q. In this section some important special
matrices will be considered and an application to heat conduction in a wire will
continue to be studied.
3.3.1
Algebraic systems may have a solution, no solution or multiple solutions. Moreover, any solution may be very sensitive to the data in D or d= These will be
illustrated by four simple 2 2 systems. One can gain insight to these examples
by viewing them from both an algebraic and geometric perspective. Consider
two equations
d11 {1 + d12 {2
d21 {1 + d22 {2
= g1 and
= g2 =
d11 d12
{1
g1
=
=
d21 d22
{2
g2
Plot {1 on the horizontal axis and {2 on the vertical axis. The rst scalar
equation may be written in slope-intercept form of a line
{2 = (d11 @d12 ){1 + g1 @d12 > if d12 6= 0=
118
Do the same for the second scalar equation. The two lines are either not parallel,
parallel and do not overlap, parallel and overlap, or they are "nearly" parallel.
If they are not parallel, then there is exactly one solution. If they are parallel
and do not overlap, then there is no solution. If they are parallel and overlap,
then there are multiple solutions given by the points on the single line. If the
two lines are "nearly" parallel, then small changes in the data can cause large
changes in the intersection, that is, the solution. In the last case the small
changes in the data can be caused by measurement, roundo or human errors.
Case One. If the lines are not parallel, then
d11 d12
det(D) = det(
) 6= 0=
d21 d22
Cramers rule can be used to nd the unique solution
g1 d12
d11
)@ det(D) and {2 = det(
{1 = det(
g2 d22
d21
g1
g2
)@ det(D)=
Case Two. The lines are parallel and do not overlap. For example,
{1 + {2
2{1 + 2{2
= 1 and
= 4=
= 1 and
= 2=
= 1 + and
= 1=
119
Problems whose solutions are very sensitive to small changes in the data are
called ill-conditioned.
The challenge is to detect these possibilities for large systems. This chapter
is restricted to the unique solution case, and chapter ve studies the multiple
solution case. Another possibility is having more equations than unknowns,
which will be investigated in the fourth chapter.
3.3.2
Triangular Matrices
The simplest system to solve is the diagonal system where the equations are for
l = 1> > q
dll {l = gl .
The matrix version of this uses the diagonal matrix D = G
65
5
6
5
d11 0
0
{1
g1
:
9
..
9 {2 :
9 g2
:
9 0 d22 . . .
. :9
:
9
9
.. : = 9 ..
:9
9 .
.
.
7
8
7 .
.
.
.
.
7 .
.
.
0 8
{
gq
q
0
0 dqq
Gx = d=
6
:
:
:
8
If each component on the diagonal is not zero (dll 6= 0 for all l), then the
solution is {l = gl @dll =
More general qq matrices are lower triangular D = O and upper triangular
D=X
5
65
6
5
6
d11
0
0
{1
g1
9
:
.
..
9 g2 :
.. : 9
{2 :
9 d21 d22
.
:
9
:
9
:9
=
9
:
9 .. :
.
9 .
:7 . 8
.
.
7 . 8
..
..
.
7 ..
0 8
{
gq
q
dq1 dq>q1 dqq
Ox = d and
5
d11
9
9 0
9
9 .
7 ..
0
d12
d22
..
.
..
.
..
.
0
d1q
..
.
dq1>q
dqq
65
:9
:9
:9
:7
8
{1
{2
..
.
:
9
:
9
: = 9
8
7
{q
g1
g2
..
.
6
:
:
:
8
gq
X x = d=
Both of these are relatively easy to solve provided all the diagonal components
dll are not zero. The lower triangular system is solved by rst nding {1 and
then {2 and so on until {q is found; this is called forward substitution= The
upper triangular system is solved in reverse order by rst nding {q and then
{q1 and so on until {1 is determined; this is called backward substitution.
120
Example 3.3.1. Let q = 3
5
1
7 2
4
= 11>
= 28 and
= 60=
The rst equation gives {1 = 11= Put this into the second equation 2(11)+3{2 =
28 to compute {2 = (28 2(11))@3 = 2= Finally, put {1 = 11 and {2 = 2 into
the third equation and nd {3 = (60 4(11) 5(2))@6 = 1=
Another way to solve this is by using the column version of the matrix-vector
product
5 6
5 6
5 6 5
6
1
0
0
11
{1 7 2 8 + {2 7 3 8 + {3 7 0 8 = 7 28 8 =
4
5
6
60
The rst equation gives {1 = 11= Now, put this into the left column on the left
side and move it to the right side
5 6
5 6 5
6
5 6 5
6
0
0
11
1
0
{2 7 3 8 + {3 7 0 8 = 7 28 8 11 7 2 8 = 7 6 8 =
5
6
60
4
16
The second equation gives {2 = 2= The last step is to
column and move it to the right side
5 6 5
6
5 6 5
0
0
0
{3 7 0 8 = 7 6 8 2 7 3 8 = 7
6
16
5
=
=
=
=
25>
1>
9 and
6=
121
The solution of the last equation is {4 = 6@2 = 3= Put this into the third
equation and solve for {3 = (9 + 1(3))@3 = 4= The second equation becomes
1{2 2(4) + 3(3) = 1 so that {2 = 0= The rst equation gives 2{1 + 3(0) + 0(4) +
1(3) = 25 so that {1 = 11=
This can also be solved by using the column version of the matrix-vector
product
5 6
5 6
5
6
5
6 5
6
2
3
0
1
25
9 0 :
9 1 :
9 2 :
9 3 : 9 1 :
:
9 :
9
:
9
: 9
:
{1 9
7 0 8 + {2 7 0 8 + {3 7 3 8 + {4 7 1 8 = 7 9 8 =
0
0
0
2
6
The last equation gives {4 = 3= Put this into the right column on the left side
and move it to the right side
6
6 5
6
5
6 5
5 6
5 6
5
22
1
25
2
3
0
9 3 : 9 8 :
9 0 :
9 1 :
9 2 : 9 1 :
:
: 9
:
9
:
: 9
9 :
9
{1 9
7 0 8 + {2 7 0 8 + {3 7 3 8 = 7 9 8 3 7 1 8 = 7 12 8 =
0
2
6
0
0
0
The third equation gives {3 = 4= Put {3 = 4 into
side and move it to the right side
5 6
5 6 5
6
5
2
3
22
9 0 :
9 1 : 9 8 :
9
:
9 : 9
:
9
{1 9
7 0 8 + {2 7 0 8 = 7 12 8 4 7
0
0
0
6
:
:=
8
3.3.3
A Has LU Factorization
If the given matrix can be written as a product of a lower and upper triangular
matrices, then one may be able to solve Dx = d= Suppose D = OX and both O
and X have non-zero diagonal components. By the associative property
Dx = d
(OX )x = d
O(X x) = d=
122
state heat
6 5
{1
{2 8 = 7
{3
123
3.3.4
=
=
=
=
Consider heat conduction in a long thin wire as in the previous section. Assume
there are ve segments, not four, so that the unknown temperatures are x1 > x2 >
x3 and x4 with x0 = 70 at the left end and x5 = 70 at the right end. Also,
assume there is an electrical current, which generates heat at a rate of i per
unit volume, per unit time. The heat in a small lwk segment is now modeled or
approximated by
xl xl1
f(xqhz
)(D{) = fxl (D{) w D N
+
l
{
xl+1 xl
w D N
+ i w (D{)=
{
Divide by f(D{) and let (w@{2 )(N@f) to get for l = 1> 2> 3 and 4
xqhz
= xl (xl1 + 2xl xl+1 ) + i w@(f)=
l
One may write this as four scalar equations
xqhz
1
xqhz
2
xqhz
3
xqhz
4
=
=
=
=
65
6
x1
: 9 x2 :
:9
:
8 7 x3 8 +
x4
124
The time dependent solution can be generated by the MATLAB code wire _time
_cur.m, and the graphical solution is illustrated in Figure 3.3.1. The steady
state solution is given by u = u Du + d so that one must solve Du = d
65
6
5
6 5
6 5
x1
2 1 0
0
x0
i w@(f)
9 1 2 1 0 : 9 x2 : 9 0 : 9 i w@(f) :
:9
:
: 9
: 9
9
7 0 1 2 1 8 7 x3 8 = 7 0 8 + 7 i w@(f) 8 =
0
0 1 2
i w@(f)
x5
x4
Example 3.3.4. Consider the above with O = 10> q = 5> { = 10@5> = f =
1> N = 1@1000> w = 1000 so that (w@{2 )(N@f) = 25@100 = 0=25= If
the electrical current in the wire generates heat at a rate equal to i = 0=1> then
i w@(f) = 100 and the above steady state model becomes
5
65
6 5
6 5
6
2 1 0
0
x1
70
400
9 1 2 1 0 : 9 x2 : 9 0 : 9 400 :
9
:9
: 9
: 9
:
7 0 1 2 1 8 7 x3 8 = 7 0 8 + 7 400 8 =
0
0 1 2
70
400
x3
The reader should verify D = OX
5
65
1
0
0
0
9 1@2
9
1
0
0 :
9
:9
7 0
8
2@3
1
0 7
0
0
3@4 1
6
470
400 :
:=
400 8
470
3.3.5
The calculations for the heat conduction with electrical current application
can easily be done by MATLAB. The steady state solution has been computed
several ways. The interested reader should examine the MATLAB code wire
_time _cur.m to see how the time dependent solution can be computed using
for-loops.
AA A = [ 2 -1 0 0;
-1 2 -1 0;
0 -1 2 -1;
0 0 -1 2];
AA d = [470 400 400 470];
AA A\d
ans =
% solves Au = d
125
0.0000
0.0000
0.0000
1.0000
0.0000 0.0000
-1.0000 0.0000
1.3333 -1.0000
0.0000 1.2500
% rst step using LU
126
u=
1.0e+003 *
0.8700
1.2700
1.2700
0.8700
AA A3 = [A(:,1) A(:,2) d A(:,4)]
A3 =
2 -1 470 0
-1 2 400 0
0 -1 400 -1
0 0 470 2
AA u3 = det(A3)/det(A)
u3 =
1270
3.3.6
Exercises
1.
2.
3.
4.
5.
6 5
6
65
h
0
{1
0 8 7 {2 8 = 7 2 8 =
10
{3
3
6
10
: 9 23 :
:
:=9
8 7 7 8=
3
7
2
0
0
8
3
1
0
65
{1
6
9 {2
4 :
:9
2 8 7 {3
3
{4
7
0
7
0
65
{1
6
9 {2
1 :
:9
2 8 7 {3
4
{4
6
s
: 9 2 :
:
:=9
8 7 15 8 =
16
5
127
Solve
6 5 6
65
65
1
1 0 0
2 7 8
{1
7 1 2 0 8 7 0 9 10 8 7 {2 8 = 7 2 8 =
3
2 0 3
0 0 1
{3
5
7.
Consider the heat conduction with current in Example 3.3 4. Verify the
solutions of Oy = d and X u = y=
8.
Consider the heat conduction with current in Example 3.3 4. Replace
i = 0=1 by i = 0=05, the left end temperature from 70 to 80 and the right end
temperature from 70 to 75. Find the steady state solution.
9.
Use MATLAB to do the computations in exercise 7.
10.
Use MATLAB to do the computations in exercise 8.
11.
Use the MATLAB code wire_time_cur.m to do the time dependent
computations in exercise 8.
3.4
3.4.1
Introductory Illustration
If one adds equation one (row one) to equation two (row two), then the new
algebraic system is
;
? {1 {2 + {3 = 5
2{3 = 6
=
4{2 + {3 = 1=
128
Next interchange equation two (row two) and equation three (row three)
;
? {1 {2 + {3 = 5
4{2 + {3 = 1
=
2{3 = 6=
The interchange is equivalent to multiplying the matrix equation by an elementary permutation matrix S23
5
65
1 0 0
1
7 0 0 1 87 0
0 1 0
0
5
1
7 0
0
3.4.2
129
There are three row operations, which are used to transform matrices to
upper triangular matrices. They can be used to solve algebraic systems, nd
the OX factors, evaluate determinants, nd multiple solutions and eigenvectors.
The row operations can be represented by elementary matrices Hlm (d), Slm and
Hl (f)=
Add d times (urz_m) to urz_l. This can be represented by an q q
elementary matrix Hlm (d) with the only non-zero components being ones on the
diagonal and d equal to the ij-component. For example, for q = 3> d = 2>
l = 3 and m = 2
5
6
1 0 0
H32 (2) = 7 0 1 0 8 =
0 2 1
Note, Hlm (d) is the inverse operation to Hlm (d),
For example,
5
65
1 0 0
1 0
H32 (2) H32 (2) = 7 0 1 0 8 7 0 1
0 2 1
0 2
130
long as the diagonal components of the upper triangular matrix are not zero.
The following 2 2 example illustrates this may not always be possible
{1 + {2
2{1 + 2{2
= 1 and
= 3=
1 1 1
2 2 3
In order to obtain a zero in the 21-component add (2) times urz_1 to urz_2
1 0
1 1 1
1 1 1
b
=
= [X d]=
H21 (2) [D d] =
2 1
2 2 3
0 0 1
The 22-component of X is zero! Moreover, the second row is a shorthand way
of writing 0{1 + 0{2 = 1> which is impossible. Such algebraic systems are called
inconsistent and have no solution.
3.4.3
131
6
0 5 6 6
[D d] = 7 1 3 1 2 8 =
2 1 1 3
Stage 1. In order to get zeros in column m = 1, the 11-component must not be
zero. So, rst interchange urz_1 and urz_2
5
65
6 5
6
0 1 0
0 5 6 6
1 3 1 2
S12 [D d] = 7 1 0 0 8 7 1 3 1 2 8 = 7 0 5 6 6 8 =
0 0 1
2 1 1 3
2 1 1 3
Add (2) times urz_1 to urz_3
5
65
6 5
6
1 0 0
1 3 1 2
1 3
1
2
6
6 8=
H31 (2) S12 [D d] = 7 0 1 0 8 7 0 5 6 6 8 = 7 0 5
2 0 1
2 1 1 3
0 5 1 1
Move to the second column and add urz_2 to urz_3
5
65
6
1 0 0
1 3
1
2
6
6 8
H32 (1) H31 (2) S12 [D d] = 7 0 1 0 8 7 0 5
0 1 1
0 5 1 1
5
6
1 3 1 2
= 7 0 5 6 6 8=
0 0 5 5
Stage 2. The last row corresponds to the equation 5{3 = 5 and so {3 = 1= Put
this into the equations corresponding to the rows 1 and 2 to get
{1 + 3{2 + 1(1) = 2 and
5{2 + 6(1) = 6=
Then {2 = 0 and {1 = 1=
Example 3.4.2. Consider another 3 3 algebraic system
;
? 2{1 + 6{2 + 8{3 = 16
4{1 + 15{2 + 19{3 = 38
=
2{1 + 3{3 = 8=
The augmented matrix is
5
6
2 6 8 16
[D d] = 7 4 15 19 38 8 =
2 0 3 8
132
Stage 1. Get zeros in the rst column by adding (2) times urz_1 to urz_2,
and then adding (1) times urz_1 to urz_3
5
6
2 6
8
16
3
6 8=
H31 (1) H21 (2) [D d] = 7 0 3
0 6 5 8
By adding (2) times urz_2 to urz_3 we get a zero
5
2
H32 (2) H31 (1) H21 (2) [D d] = 7 0
0
in the 32-component
6
6 8 16
3 3 6 8=
0 1 4
Stage 2. The last row corresponds to the equation 1{3 = 4 and so {3 = 4= Put
this into the equations corresponding to the rows 1 and 2 to get
2{1 + 6{2 + 8(4) = 16 and
3{2 + 3(4) = 6=
Then {2 = 2 and {1 = 2=
Example 3.4.3. Consider the two-loop circuit problem that was discussed in
Subsection 3.1.4
;
l1 l2 + l3 = 0
?
U1 l1 U3 l3 = H1
=
U2 l2 U3 l3 = H2 =
Let U1 = 1> U2 = 2, U3 = 3, H1 =
matrix is
5
1
[D d] = 7 1
0
133
Example 3.4.4. Consider the steady state heat wire in Example 3.3.4 where
there were ve segments and electrical current generating heat within the wire.
The algebraic problem for the temperature in each interior segment is
65
5
6 5
6
2 1 0
0
x1
470
9 1 2 1 0 : 9 x2 : 9 400 :
9
:9
: 9
:
7 0 1 2 1 8 7 x3 8 = 7 400 8
0
0 1 2
470
x3
and the augmented matrix is
5
6
2 1 0
0 470
9 1 2 1 0 400 :
:
[D d] = 9
7 0 1 2 1 400 8 =
0
0 1 2 470
6
:
:=
8
Stage 2. The last row corresponds to the equation (5@4)x4 = 1087=5 and so
x4 = 1087=50@1=25 = 870= Put this into the equations corresponding the rows
1, 2 and 3 to get x3 = x2 = 1270 and x1 = 870= The reader should note the
similarities of these calculations with the LU factorization method as given in
Subsection 3.3.4.
3.4.4
[i1
134
Now equate the rst and second components in each vector equation to obtain
a system with six scalar equations
;
A
A
A
A
A
A
?
A
A
A
A
A
A
=
i1 i2 f = 0
i2 v = 10
i2 f i4 = 0
i2 v i3 = 0
i1 i5 f i6 = 0
i3 + i5 v = 0=
1 f 0
0
0
0
0
v
0
0
0
0
0
f
0 1 0
0
0 v 1 0
0
0
1
0
0
0 f 1
0
0
1
0
v
0
65
:9
:9
:9
:9
:9
:9
87
i1
i2
i3
i4
i5
i6
: 9
: 9
: 9
:=9
: 9
: 9
8 7
0
10
0
0
0
0
6
:
:
:
:
:
:
8
6
1 f 0
0
0
0
0
0
v
0
0
0
0 10 :
:
0
f
0 1 0
0
0 :
:=
0 v 1 0
0
0
0 :
:
1
0
0
0 f 1 0 8
0
0
1
0
v
0
0
In order to do the rst stage of Gauss elimination, one must use row operation to transform the lower portion of the augmented matrix to zero components. Fortunately, this matrix has many zero components. The required row
135
6
:
:
:
:>
:
:
8
H63 (1) S43 H52 (f@v) H42 (1) H32 (f@v) H51 (1) [D d] =
5
9
9
9
9
9
9
7
6
1 f 0
0
0
0
0
:
0
v
0
0
0
0
10
:
:
0
0 1 0
0
0
10
: and
0
0
0 1 0
0 10f@v :
:
0
0
0
0 f 1 10f@v 8
0
0
0
0
v
0
10
H65 (v@f) H63 (1) S43 H52 (f@v) H42 (1) H32 (f@v) H51 (1) [D d] =
6
5
1 f 0
0
0
0
0
:
9 0
v
0
0
0
0
10
:
9
:
9 0
0 1 0
0
0
10
:=
9
9 0
0
0 1 0
0
10f@v :
:
9
7 0
0
0
0 f 1
10f@v 8
0
0
0
0
0 v@f
20
The second stage is a backwards substitution:
i6
i5
i4
i3
i2
i1
=
=
=
=
=
=
The negative signs indicate bars 1, 3 and 6 are under compression, and the other
bars 2, 4 and 5 are under tension. As the angle decreases, the magnitudes of
the forces increase, except for bar 3.
136
3.4.5
Row operations using MATLAB are illustrated in the MATLAB code gauss_el.m.
Both stages of Gauss elimination are combined in the single command MATLAB
command A\d. Consider the six-beam support structure with = @6=
AAc = cos(pi/6)
AA s = sin(pi/6);
AA A = [-1 -c 0 0 0 0 ;
0 s 0 00 0;
0 c 0 -1 0 0 ;
0 -s -1 0 0 0 ;
1 0 0 0 -c -1 ;
0 0 1 0 s 0];
AA d = [0 10 0 0 0 0];
AA A\d
ans =
-17.3205
20.0000
-10.0000
17.3205
20.0000
-34.6410
%
%
%
%
%
%
= i1
= i2
= i3
= i4
= i5
= i6
3.4.6
Exercises
1.
2.
3.
4.
5.
Let q = 4 and nd the elementary matrices H43 (7)> S23 and H4 (10)=
Let q = 3 and nd the elementary matrices H21 (2)> S13 and H3 ()=
Consider the algebraic system
;
? {1 + 7{2 + {3 = 1
2{1 + 0{2 + 7{3 = 2
=
14{2 + {3 = 6=
137
(a).
Find the augmented matrix.
(b).
Use row operations to transform the augmented matrix to an upper
triangular matrix.
(c).
Find the solution by using the upper triangular matrix.
6.
As in exercise 5 use Gauss elimination to solve the system in exercise 1.
7.
Consider the algebraic system
;
{1 {2 + {4 = 6
A
A
?
{1 {3 {4 = 7
2{2 + 7{3 = 4
A
A
=
2{1 {4 = 8=
(a).
Find the augmented matrix.
(b).
Use row operations to transform the augmented matrix to an upper
triangular matrix.
(c).
Find the solution by using the upper triangular matrix.
8.
As in exercise 7 use Gauss elimination to solve the system in exercise 2.
9.
Consider the two-loop circuit in Example 3.4.3 with slightly dierent
U1 = 1> U2 = 2, U3 = 4, H1 = 20 and H2 = 10= Use Gauss elimination to nd
the solution.
10.
Consider the two-loop circuit in Example 3.4.3 with arbitrary symbols
for U1 > U2 , U3 , H1 and H2 = Use Gauss elimination to nd the solution.
11.
Consider the steady state heat conduction within a wire in Example
3.4.4. Verify the row operations to nd the indicated upper triangular matrix.
12.
Consider the steady state heat conduction within a wire in Example
3.4.4. Let the left end temperature be x0 = 80, the right end temperature be
x5 = 75 and the heat generated by the current be i = 0=05 per unit time per
unit volume. Use Gauss elimination to solve the steady state problem
6 5
6
5
65
280
2 1 0
0
x1
9 1 2 1 0 : 9 x2 : 9 200 :
: 9
:
9
:9
7 0 1 2 1 8 7 x3 8 = 7 200 8 =
275
0
0 1 2
x3
13.
138
16.
Use MATLAB to nd the solutions in the six-bar truss problem for =
@6> @4 and 2@6= You may use the MATLAB code support.m.
17.
Use MATLAB to nd the solutions in the six-bar truss with two weights
as specied in exercise 14. You may modify the MATLAB code support.m, and
experiment with dierent weights and angles.
3.5
Inverse Matrices
The three types of elementary row operations can be reversed and be represented by elementary matrices. In terms of matrix operations this means for
each elementary matrix there is another elementary matrix such that the product is the identity matrix:
Hlm (d) Hlm (d) = L
Slm Slm = L and
Hl (1@f) Hl (f) = L=
The objective of this section is to be able to nd an q q matrix E such that
for a given q q matrix D we have DE = L= E is called an inverse matrix of D,
is often written as D1 = E. An important use is to nd the solution Dx = d
given by x = D1 d because
Dx =D(D1 d) = (DD1 )d = Ld = d=
Unfortunately, one can not always nd such matrices! We shall see in Section
3.7 D with a non-zero determinant implies that an inverse matrix exists.
3.5.1
The identity q q matrix L has all zero components except on the diagonal
where the components are equal to one. The identity matrix can be written as
a matrix whose jwk column vector is the jwk unit column vector em
e1 e2 eq
L =
6
5
1 0 0
9 0 1 0 :
:
9
=
= 9 . . .
. . ... :
8
7 .. ..
0 0
139
Basic Examples.
1.
Elementary Matrices.
If D = Hlm (d)> then D1 = Hlm (d)= If D = Slm > then D1 = Slm = If D = Hl (f)>
then D1 = Hl (1@f)=
2.
Diagonal Matrices.
If D is a diagonal matrix with non-zero diagonal components dll 6= 0> then D1
is a diagonal matrix with diagonal components equal to 1@dll = For example, if
q = 3 and
5
6
4 0 0
D = 7 0 2 0 8,
0 0 3
then because DD1 = L
D1
6
1@4 0
0
= 7 0 1@2 0 8 =
0
0 1@3
3.
Block Diagonal Matrices.
If D is a block diagonal matrix with diagonal blocks that have inverses, then
D has an inverse matrix which is also a block diagonal matrix. For example,
consider a 5 5 matrix with two diagonal blocks
6
5
1 0 0 0 0
9 0 1 0 0 0 :
:
9
D11
0 4 1 0 0 :
D =
=9
: where
9
D22
7 0 0 0 2 0 8
0 0 0 0 3
5
6
1 0 0
2 0
D11 = H32 (4) = 7 0 1 0 8 and D22 =
=
0 3
0 4 1
Both D11 and D22 have inverses and, hence, the
5
1 0
9 0 1
1
9
D11
=9
D1 =
1
9 0 4
D22
7 0 0
0 0
inverse of D is
0 0
0
0 0
0
1 0
0
0 1@2 0
0 0 1@3
4.
D is a 2 2 Matrix with ghw(D) 6= 0=
The inverse matrix E must satisfy the matrix equation
D
b1
DE = L
b2
e1
=
e2
6
:
:
:.
:
8
140
One can solve these by either Cramers rule or Gauss elimination. For example,
use Cramers rule to nd the inverse of
d11 d12
D=
=
d21 d22
The rst column b1 of the inverse matrix must satisfy
d11
d21
d12
d22
Db1 = e1
e11
1
=
=
0
e21
Then
e11
e21
1 d12
= det(
)@ det(D) = d22 @ det(D) and
0 d22
d11 1
= det(
)@ det(D) = d21 @ det(D).
d21 0
d11
d21
d12
d22
Db2 = e2
e12
0
=
=
1
e22
Then
e12
= det(
e22
= det(
0
)@ det(D) = d11 @ det(D).
1
0 d12
1 d22
d11
d21
b1
b2
=
d22
d21
d12
d11
@ det(D)=
The alternative is to use row operations and Gauss elimination. The GaussJordan method is a variation of Gauss elimination, which can be adapted to
larger matrices and to computers.
3.5.2
2 1
2@3 1@3
1
D=
and D =
=
1 2
1@3 2@3
141
First, use row operations and the augmented matrix to solve Db1 = e1
2 1 1
[D e1 ] =
1 2 0
1 0
2 1 1
2 1
1
H21 (1@2) [D e1 ] =
=
=
1@2 1
1 2 0
0 3@2 1@2
At this point either use backward substitution or more row operation to obtain
an identity matrix in the left side of the augmented matrix. The row operations
include two row multiples and then adding (1@2) times urz_2 to urz_1 :
1 1@2 1@2
H2 (2@3) H1 (1@2) H21 (1@2) [D e1 ] =
0
1
1@3
1 0 2@3
H12 (1@2) H2 (2@3) H1 (1@2) H21 (1@2) [D e1 ] =
=
0 1 1@3
The right column in the transform augmented matrix is the rst column of the
inverse matrix. Let H be the product of the four elementary matrices and write
the above as
H [D e1 ] = [L b1 ]=
In order to nd the second column of the inverse matrix, the same row operations are needed to transform the augmented matrix from [D e2 ] to [L b2 ]
H [D e2 ] = [L b2 ]=
An e!cient way to do both these solves is to combine the two columns of the
inverse matrix into the right side of a larger augmented matrix. That is, use
the row operations to transform [D e1 e2 ] = [D L] to [L b1 b2 ] = [L E]
H [D e1 e2 ] = [L b2 b2 ]=
In order to nd the inverse of an q q matrix D> one must solve q vector
equations
DE = L
e1 e2 eq
D b1 b2 bq
=
Use row operations and elementary matrices to transform the augmented matrix
[D L] to [L D1 ]=
Denition 3.5.2. Consider the q q matrix D and nd the inverse matrix, if
it exists. The Gauss-Jordan method for solving this system has two stages:
Stage 1. Transform the augmented matrix [D L] to upper triangular form
[X O]=
142
(a). start with the left column, column m = 1, and use row operations
to transform column m = 1 to zeros below row l = 1>
(b). move to the next column, column m = 2, and use row operations
to transform column m = 2 to zeros below row l = 2 and
(c). repeat this until column m = q 1 has been done.
Stage 2. Transform the upper triangular matrix [X O] to [L D1 ]
(a). use elementary matrices so that the diagonal of U is transformed
to have ones on all of the diagonal components,
(b). start with the right column of X , column m = q, and use row operations
to transform column m = q to zeros above row l = q>
(c). move to the next left column, column m = q 1, and use row operations
to transform column m = q 1 to zeros above row l = q 1 and
(d). repeat this until column m = 2 has been done.
Example 3.5.1. Use the Gauss-Jordan method to nd the inverse of
5
6
1 2 1
D = 7 1 3 2 8=
1 0 1
The augmented matrix is
5
6
1 2 1 1 0 0
[D L] = 7 1 3 2 0 1 0 8 =
1 0 1 0 0 1
Stage 1. Subtract urz_1 from urz_2 and urz_3
5
6
1 2 1 1 0 0
H31 (1) H21 (1) [D L] = 7 0 1 1 1 1 0 8 =
0 2 0 1 0 1
Add (2) times urz_2 to urz_3
5
6
1 2 1 1 0 0
H32 (2) H31 (1) H21 (1) [D L] = 7 0 1 1 1 1 0 8 =
0 0 2 3 2 1
Stage 2. Divide urz_3 by 2 and then subtract it from urz_2 and urz_1
H13 (1) H23 (1)
5
1
7 0
0
143
6
1 0 0 3@2 1 1@2
7 0 1 0 1@2
0 1@2 8 =
0 0 1 3@2 1
1@2
One can easily verify the inverse is given by the right side of the transformed
augmented matrix
5
6
3@2 1 1@2
0 1@2 8 =
D1 = 7 1@2
3@2 1
1@2
The solution of Dx = d = [1 2 3]W is easily computed by using the inverse
matrix
5
65 6 5
6
3@2 1 1@2
1
1
0 1@2 8 7 2 8 = 7 1 8 =
x = D1 d = 7 1@2
3@2 1
1@2
3
2
Example 3.5.2. Use the Gauss-Jordan method to nd the inverse of
5
6
0 5 6
D = 7 1 3 1 8=
2 1 1
The augmented matrix is
5
6
0 5 6 1 0 0
[D L] = 7 1 3 1 0 1 0 8 =
2 1 1 0 0 1
Stage 1. Because the 11-component is zero,
must be interchanged
5
1 3 1
S12 [D L] = 7 0 5 6
2 1 1
6
1 3 1 0 1 0
[D L] = 7 0 5 6 1 0 0 8 =
0 0 5 1 2 1
144
5
6
1 3 1
0
1
0
7 0 1 6@5 1@5
0
0 8=
0 0 1 1@5 2@5 1@5
In order to transform the left side to the identity, subtract (6@5) times urz_3
from urz_2> subtract urz_3 from urz_1 and last subtract (3) times urz_2
from urz_1
H12 (3) H13 (1) H23 (6@5) H3 (1@2) H2 (1@2) H32 (1) H31 (2) S12 [D L] =
5
6
1 0 0 2@25 1@25 13@25
7 0 1 0 1@25 12@25 6@25 8 =
0 0 1 5@25 10@25 5@25
The inverse is the right side of the transformed augmented matrix
5
6
2 1 13
D1 = (1@25) 7 1 12 6 8 =
5 10 5
The solution of Dx = d = [6 2 3]W is computed by using the inverse matrix
5
65 6 5 6
2 1 13
6
1
x = D1 d = (1@25) 7 1 12 6 8 7 2 8 = 7 0 8 =
5 10 5
3
1
Example 3.5.3. Consider the steady state heat wire problem in Sections 3.3
and 3.4 where there were ve segments and current generating heat within the
wire. The algebraic problem for the temperature in each interior segment is
65
5
6
6 5
x1
2 1 0
0
470
9 1 2 1 0 : 9 x2 : 9 400 :
:9
9
:
: 9
7 0 1 2 1 8 7 x3 8 = 7 400 8 =
0
0 1 2
470
x3
The augmented matrix for nding the inverse
5
2 1 0
0
9 1 2 1 0
9
[D L] = 7
0 1 2 1
0
0 1 2
matrix is
1
0
0
0
0
1
0
0
6
0
0 :
:=
0 8
1
0
0
1
0
2 1
0
0
1
0
0
9 0 3@2 1
0
1@2
1
0
9
7 0 0 4@3 1 1@3 2@3 1
0 0
0 5@4 1@4 2@4 3@4
6
0
0 :
:=
0 8
1
145
Stage 2. Multiply rows 1-4 by 1@2> 2@3> 3@4 and 4@5, respectively, to get for
G H4 (4@5) H3 (3@4) H2 (2@3) H1 (1@2)
G H43 (3@4) H32 (2@3) H21 (1@2) [D L] =
5
6
1 1@2
0
0
1@2 0
0
0
9 0
1
2@3
0
1@3 2@3 0
0 :
9
:=
7 0
0
1
3@4 1@4 2@4 3@4 0 8
0
0
0
1
1@5 2@5 3@5 4@5
In order to obtain zeros in the upper triangular part of the left side, use elementary matrices
H12 (1@2) H23 (2@3)
5
1 0
9 0 1
9
7 0 0
0 0
D1
6
8 6 4 2
9 6 12 8 4 :
:
= (1@10) 9
7 4 8 12 6 8 >
2 4 6 8
3.5.3
6 5
470
870
9 1270
400 :
:=9
400 8 7 1270
470
870
6
:
:=
8
Not all matrices have inverses! Any 2 2 with zero determinant cannot have
an inverse. For example, if
1 1
D=
>
2 2
then one cannot nd the rst column of the inverse matrix because of the
following contradiction
1 1
2 2
Db1 = e1
e11
1
=
0
e21
e11 + e21 = 1 and 2e11 + 2e21 = 0!
146
1
The proof of (D1 D2 )1 = D1
2 D1 follows from the associative property of
matrix products
1
(D1
2 D1 )(D1 D2 )
1
D2 (D1
1 (D1 D2 ))
1
D2 ((D1
1 D1 )D2 )
1
D2 ((L)D2 ) = L=
D2 is an elementary matrix
6
5
0 0
1
7
1@2 0 8 and D1
2
=
2
0 1
0
6
0
0 8 = D1 D2 =
1
with inverses
6
0 0
1 0 8=
0 1
The inverse of A is
5
1
D1 = D1
2 D1
65
6 5
6
1 0 0
1@4 0 0
1@4 0 0
= 7 2 1 0 8 7 0 1@2 0 8 = 7 2@4 1@2 0 8 =
0 0 1
0
0 1
0
0 1
147
3.5.4
148
0
1
3.5.5
Exercises
3 1
1.
Let D =
=
1 3
(a).
Use Cramers rule to nd the inverse of D=
(b).
Use Gauss-Jordan method to nd the inverse.
(c).
Find the inverse of
6
5
3 1 0 0
9 1 3 0 0 :
:
9
7 0 0 3 0 8=
0 0 0 4
2.
3.
4.
5.
6.
7.
6
1 1 1
Let D = 7 1 0 3 8 =
0 2 3
(a).
Use the Gauss-Jordan method to nd the inverse matrix.
W
(b).
Use5the inverse to solve
6 Dx = d = [0 10 20] =
3 1 0
Let D = 7 1 3 1 8 =
0 1 3
(a).
Use the Gauss-Jordan method to nd the inverse matrix.
(b).
Use5the inverse 6to solve Dx = d = [1 2 3]W =
0 2 1
Let D = 7 1 3 5 8 =
2 2 0
(a).
Use the Gauss-Jordan method to nd the inverse matrix.
(b).
Use the inverse to solve Dx = d = [4 3 5]W .
Verify the5 row operations
6 used in Example 3.5.3.
1 2 0 1
9 2 1 0 0 :
:
Let D = 9
7 0 0 2 0 8=
1 2 0 2
(a).
Use the Gauss-Jordan method to nd the inverse matrix.
W
(b).
Use the
5 inverse to 6solve Dx = d
5 = [2 1 4 61] =
1 0 0
1 2 0
Let D1 = 7 0 1 0 8 and D2 = 7 0 1 0 8 =
4 0 1
0 0 1
3.6. OX FACTORIZATION
149
3.6
OX Factorization
If the given matrix can be written as a product of a lower and upper triangular
matrices, then one may be able to solve Dx = d= Suppose D = OX and both O
and X have non-zero diagonal components. By the associative property
Dx = (OX )x = O(X x) = d=
So, solve by forward substitution Oy = d and then solve by backward substitution X x = y= An example was given in Section 3.3
6 5
6
5
65
200
2 1 0
{1
7 1 2 1 8 7 {2 8 = 7 0 8 =
70
0 1 2
{3
150
nd factors
6
0
1 8
4@3
The objective of this section is to show how one can use row operations and
elementary matrices to possibly nd the OX factors for more general matrices.
Block versions of the OX factors will be described and applied to a three-loop
circuit problem.
3.6.1
Attributes of OX Factorization
0 1
D =
1 1
1 1
1 0
1 1
S12 D =
=
= OX=
0 1
0 1
0 1
Second, one can use row operations and elementary matrices to nd OX factors
2 1
D =
1 2
2 1
H21 (1@2) D =
= X=
0 3@2
Now let O be the inverse of the elementary matrix H21 (1@2) giving
2 1
1
1
H21 (1@2) (H21 (1@2) D) = H21 (1@2)
= OX
0 3@2
1
0
2 1
D =
= OX=
1@2 1
0 3@2
Third, the lower and upper matrices may not have an inverse
1 1
D =
1 1
1 1
H21 (1) D =
=X
0 0
1 0
1 1
D =
= OX=
1 1
0 0
3.6. OX FACTORIZATION
151
152
Example 3.6.2. This example does require the interchange of rows to nd the
factorization of the 3 3 matrix
5
6
0 5 6
D = 7 1 3 1 8=
2 1 1
Stage 1. Interchange rows
5
0 1
S12 D = 7 1 0
0 0
3.6.2
Block OX Factors
D11 D12
D=
=
D21 D22
3.6. OX FACTORIZATION
153
D11
D21
D12
D22
Dx
= d
x1
d1
=
=
x2
d2
An example is for q = 5 = 2 + 3 = q1 + q2
diagonal matrix
5
2 1 1
9 1 2 0
9
9 1
0 2
9
7 0
1 0
1
0 0
(3.6.1)
1
0
0
0
2
6
:
:
:=
:
8
In many applications the blocks are parts of models for physical applications
such as velocity and pressure or voltages and currents. Moreover, one may have
some previous knowledge about the square blocks and their inverse matrices.
Block matrix products can be dened as long as number of columns in the
left submatrix is equal to the number of rows in the right submatrix. Block
elementary matrices can be used to transform the block matrix into a block
upper triangular matrix. Here, we must assume the 11-block has an inverse D1
11 =
1
1
b
b
When L1 is q1 q1 , L2 is q2 q2 , D22 D22 D21 D11 D12 , d2 d2 D21 D11 d1 ,
] is an q1 q2 zero matrix, then
L1
L1
]
]
D11 D12
x1
d1
=
D21 D22
x2
d2
D21 D1
D21 D1
L2
L2
11
11
d1
D11 D12
x1
=
b2 =
b22
x2
]W D
d
b22 also has an
b22 is called the Schur complement of D11 in D. If D
The matrix D
inverse, then one can solve for x2 and then x1
b22 x2
D
D11 x1
b 2 and
= d
= d1 D12 x2 =
(3.6.2)
(3.6.3)
of D. Multiplying D
D12
b22
D
]
]
L1
L1
=
=
D21 D1
D21 D1
L2
L2
11
11
154
D11 D12
L1
]
D11 D12
=
(3.6.4)
b22 =
D21 D22
D21 D1
L2
]W D
11
Both the block lower and block upper triangular matrices will have inverses
provided the diagonal blocks have inverses.
Example 3.6.3. Consider the above 5 5 matrix with q1 = 2, q1 = 3>
2 1
1 0 1
D11 =
, D12 =
1 2
0 1 0
5
6
5
6
1 0
2 0 0
D21 = 7 0 1 8 and D22 = 7 0 2 0 8 =
1 0
0 0 2
b22 D22 D21 D1 D12
D
11
5
2 0
b22 7 0 2
D
0 0
5
b1
D
22
is easy to
6 5
0
0 87
2
1 0
2@3 1@3
1 0 1
8
0 1
1@3 2@3
0 1 0
1 0
6
4 1 2
= 1@3 7 1 4 1 8 and
2 1 4
5
6
5 2 3
= 1@4 7 2 4 2 8 =
3 2 5
1
b
b1 d
b1
= D
22 2 = D22 (d2 D21 D11 d1 )
5
6 5 6 5
6
5 2 3
3
1 0
2@3 1@3
1
7
8
7
8
7
8
= 1@4 2 4 2 ( 4 0 1
)
1@3 2@3
2
3 2 5
5
1 0
5 6
6
= 7 5 8
7
and
x1
= D1
11 (d1 D12 x2 )
5 6
6
2@3 1@3
1
1 0 1 7 8
5 )
=
(
1@3 2@3
2
0 1 0
7
9
=
=
6
3.6. OX FACTORIZATION
155
D11 D12
]
L1
D11 D12
=
and
b22
D21 D22
D21 D1
L2
]W D
11
D11 ]
D11 D12
L1 D1
11 D12
=
b22
b22 =
]W
L2
]W D
]W D
If D and D11 have inverses, then the left side is a product of three matrices with
inverses. Consequently, the product on the left side must have an inverse, and
the 2 2 block diagonal matrix on the right side must have an inverse. This
b22 has an inverse. The following theorem summarizes the
means the 22-block D
above results.
Theorem 3.6.2 (Block OX Factors) Consider the 2 2 block system in equab22 has an inverse. Moreover,
tion (3.6.1). If D and D11 have inverses, then D
the solution of (3.6.1) can be found by solving equations (3.6.2) and (3.6.3).
3.6.3
156
The battery increases the potential from zero to E. Within the battery there is
a small resistance r so that by Ohms law there is a drop in potential of lu from
H to H lu, which is depicted by the segment from points d to e= The segment
from e to f has very small resistance and is neglected. The larger resistance
U between points f and g has a potential drop equal to lU from H lu to
H lu lU = 0=
The derivation of the ve voltage equations and two current equations at
nodes one and two assumes the potentials at nodes one and two are given by {1
and {2 and the potential at the bottoms nodes is set to zero. The voltage drops
across resistors Un for n = 1> > 5 are plus or minus ln Un , which depends on
the direction of the current.
Voltage from node one to ground:
{1 + H1 l1 U1 = 0 and
{1 l3 U3 = 0=
Voltage from node one to node two:
{1 + H2 (l2 )U2 = {2 .
Voltage from node two to ground:
{2 + H3 (l5 )U5 = 0 and
{2 l4 U4 = 0=
At each node the sum of the currents must be zero:
l1 + l2 l3 = 0 and
l2 l4 + l5 = 0=
3.6. OX FACTORIZATION
The matrix version of these seven equations is
5
65
U1 0
0
0
0 1 0
9
9 0 U2 0
0
0
1 1 :
9
:9
9 0
:
0 U3 0
0 1 0 : 9
9
9
9
9 0
0
0 U4 0
0 1 :
9
:9
9 0
:
0
0
0 U5 0
1 :9
9
9
7 1 1 1 0
0
0
0 87
0 1 0 1 1
0
0
157
l1
l2
l3
l4
l5
{1
{2
: 9
: 9
: 9
: 9
:=9
: 9
: 9
: 9
8 7
H1
H2
0
0
H3
0
0
6
:
:
:
:
:=
:
:
:
8
3.6.4
158
3.6.5
1.
0.0000 0.0000
1.0000 0.0000
0.5000 1.0000
1.0000 1.0000
5.0000 6.0000
0.0000 -2.5000
Exercises
6
2 1 0
0
9 1 2 1 0 :
:
D=9
7 0 1 2 1 8 =
0
0 1 2
(a).
Use row operations and elementary matrices to nd the OX factors.
(b).
Use these to solve Dx = d = [470 400 400 470]W =
2.
Let D be the 3 3 matrix
5
6
1 2 1
D = 7 1 3 6 8=
1 0 1
(a).
Use row operations and elementary matrices to nd the OX factors.
(b).
Use these to solve Dx = d = [1 2 3]W =
3.
Let D be the 3 3 matrix in Example 3.6.2. Interchange row one and
three, that is, use S13 and not S12 .
(a).
Use row operations and elementary matrices to nd the OX factors.
(b).
Use these to solve Dx = d = [6 3 2]W =
159
6
1 2 3
D = 7 1 2 6 8=
2 3 9
(a).
Use row operations and elementary matrices to nd the OX factors.
(b).
Use these to solve Dx = d = [6 3 2]W =
5.
Let D be the 4 4 matrix in exercise 1.
(a).
View this as a block 2 2 matrix where q = 4 = 2 + 2 = q1 + q2 =
b22 =
Find the four blocks and the Schur complement matrix D
(b).
Use equations (3.6.2) and (3.6.3) to solve Dx = d = [470 400 400
470]W =
6.
Let D be the 5 5 matrix
6
5
2 0 1
0
1
9 0 3 0
2
0 :
:
9
9 1 0 3 1 0 : =
:
9
7 0 1 1 3 1 8
1 1 0 1 3
(a).
View this as a block 2 2 matrix where q = 5 = 2 + 3 = q1 + q2 =
b22 =
Find the four blocks and the Schur complement matrix D
(b).
Use equations (3.6.2) and (3.6.3) to solve Dx = d = [5 6 7 8 9]W =
7.
Use MATLAB to conrm any calculations in exercises 1-6.
8.
Consider the 7 7 matrix in Example 3.6.4. By-hand calculations and
Gauss elimination solve this problem.
9.
Consider the 7 7 matrix in Example 3.6.4. By-hand calculations and
OX factorization solve this problem.
10.
Consider the 7 7 matrix in Example 3.6.4. By-hand calculations and
block OX factorization solve this problem.
11.
Consider the 7 7 matrix in Example 3.6.4.
(a).
Use the MATLAB code circuit3.m to conrm any calculations in
exercises 8-10.
(b).
Use this code to experiment with dierent resistors and batteries.
(c).
What happens when U2 is near or is zero?
3.7
160
3.7.1
d11 d12
D=
= [a b]=
d21 d22
The area of the parallelogram formed by the vectors, which are not parallel, is
plus or minus the determinant of D
det(D) d11 d22 d12 d21 =
As indicated in Section 2.4 determinants can be used to solve 2 2 algebraic
systems Dx = d by Cramers rule when det(D) 6= 0
g1 d12
d11 g1
)@ det(D) and {2 = det(
)@ det(D)=
{1 = det(
g2 d22
d21 g2
Notice the det(D) does change if the rows and columns are interchanged
d11 d21
) = det(DW ) = det(D)=
det(
d12 d22
And, det(D) changes sign if the rows are interchanged
d21 d22
) = det(D)=
det(
d11 d12
The extension of determinants to 3 3 matrices can be done in an inductive
way. Consider a 3 3 matrix with column vectors a, b and c
6
5
d11 d12 d13
D = 7 d21 d22 d23 8 = [a b c]=
d31 d32 d33
The volume of the parallelepiped formed by the three vectors is plus or minus
the dot product of a with b c, which can be written as the determinant of D
det(D) d11 (d22 d33 d23 d32 )
d12 (d21 d33 d23 d31 )
+d13 (d21 d32 d22 d31 )
= d11 (d22 d33 d23 d32 )
d21 (d12 d33 d13 d32 )
+d31 (d12 d23 d13 d22 )
= a (b c)=
161
Here we have interchanged rows and columns and the determinant does not
change. That is, det(D) = det(DW ) where DW is called the transpose of A and
is dened as
6 5 W 6
5
a
d11 d21 d31
DW 7 d12 d22 d32 8 = 7 bW 8 =
d13 d23 d33
cW
Cramers rule, for det(D) 6= 0> allows one to easily solve the 3 3 algebraic
systems Dx = d
{1
{2
{2
The justication of the formula for the rst unknown follows from the properties
of the cross product and the column version of a matrix-vector product
Dx = d
{1 a + {2 b + {3 c = d
{1 a = d {2 b {3 c=
Recall the cross product b c is perpendicular to both b and c= Use this fact
and take the dot product of both sides with b c
({1 a) (b c) = (d {2 b {3 c) (b c)
(a (b c)){1 = d (b c) b (b c){2 c (b c){3 )
det(D){1 = det([d b c]) 0{2 0{3 =
The derivations of the equations for the other two unknowns are similar. Furthermore, these concepts generalize to algebraic systems with q unknowns.
3.7.2
Determinant of an q q Matrix
162
Example 3.7.1. Consider the matrix in Sections 3.1 and 3.4 (Example 3.4.3)
from the two-loop circuit. First, the determinant is evaluated by expanding
down column one, which has only two non-zero components,
5
6
1 1 1
det(D) = det(7 1 0 3 8)
0 2 3
0 3
1 1
= (1)2 (1) det(
) + (1)2+1 (1) det(
)
2 3
2 3
= 6 5 = 11=
One can also use the following elementary row operations to transform the
matrix to upper triangular form
5
6
1 1
1
4 8 =
H32 (2) H11 (1) D = X = 7 0 1
0 0 11
Apply rule three twice to get det(H32 (2)(H11 (1) D)) = det(H11 (1) D) = det(
D) = det(X )= The determinant of an upper triangular matrix can be expanded
by the left column so that the determinant is the product of the diagonal components. Therefore, det( D) = det(X ) = (1)(1)(11) = 11=
Example 3.7.2. Consider the 4 4 matrix for the heat conduction problem in
Sections 3.3 and 3.4 (Example 3.4.4) and expand it by column one using rule
163
one
5
2 1
9 1 2
det(D) = det(9
7 0 1
0
0
5
2 1
= 2 det(7 1 2
0 1
= 2(4) 3 = 5=
6
0
0
1 0 :
:)
2 1 8
1 2
6
5
6
1 0
0
0
1 8) (1) det(7 1 2 1 8)
2
0 1 2
transformation
6
0
0 :
:=
1 8
5@4
Use the third rule three times and expand the upper triangular matrix by the
left column to get
det(H43 (3@4) H32 (2@3) H21 (1@2) D) = det(D) = det(X ) = 1(3@2)(4@3)(5@4) = 5=
3.7.3
164
165
the inverse of
6
1
2 8=
1
Since det(D) = 2 6= 0, the inverse matrix exists. The rst column in the inverse
matrix D1 = E = [b1 b2 b3 ] is
6
5
3 2
6
6 5
5
6 9 det( 0 1 )@2 : 5
:
9
3@2
(1)1+1 P11 @2
e11
:
9
1
2
: 7 2@2 8 =
b1 = 7 e21 8 = 7 (1)1+2 P12 @2 8 = 9
9 det( 1 1 )@2 : =
1+3
:
9
3@2
(1) P13 @2
e31
8
7
1 3
det(
)@2
1 0
166
The other two columns in the inverse matrix may be computed in a similar
fashion to yield
5
6
3 2 1
0 1 8 =
D1 = (1@2) 7 1
3 2
1
If any column of an qq matrix is a linear combination of the other columns,
then the determinant of the matrix must be zero. Equivalently, if the determinant of the matrix is not zero, then no column of the matrix D is a linear
combination of the other columns (the columns are linearly independent, see
Section 5.1 for a more general discussion)
Dx = {1 a:1 + + {q a:q = 0 implies x = 0=
The bold font 0 represents a column vector of zeros. In the cases q = 2 or
q = 3, this condition requires the vectors not be parallel for q = 2> and not
be in the same plane for q = 3. Each column of such matrices must have at
least one non-zero component so that row operations can be done to transform
the matrix to upper triangular form. This eventually leads to the following
theorem, which gives a characterization of matrices that have inverses.
Theorem 3.7.3 (Inverse Matrix Equivalence) Let D be an q q matrix. The
following are equivalent:
(i). D has an inverse,
(ii). Dx = 0 implies x = 0 and
(iii). det(D) =
6 0=
3.7.4
Mixing chemicals occurs in many industrial and biological systems and include
hot tubs, lead poisoning and brine solutions. Here we consider three wellstirred tanks each with 24 liters (L) with ow rates (L/min) such that the tanks
remain full, see Figure 3.7.1. The amounts of a chemical, say salt, are given
by the unknown functions {(w)> |(w) and }(w) (Kg) so that the concentrations
are {(w)@24> |(w)@24 and }(w)@24 (Kg/L). The ow rates in and out of the tanks
are the numbers (L/min) adjacent to the horizontal arrows in the gure. Also,
the chemical is directly added to the tanks as indicated by the rate numbers
(Kg/min) above the vertical arrows in the gure.
The model is derived by equating the rate of change for the amount to
the rate of change incoming minus the rate of change outgoing. The ow rate
(L/min) times the concentration (Kg/L) is the rate of change in or out of a
tank from an adjacent tank. For the tank on the left, pure water is owing in
at a rate equal to 6 (L/min) and the mixture from the center tank is owing in
at a rate equal to 4 (L/min) with a concentration equal to |@24 (Kg/L). The
rate of change for the amount incoming is 1 + 4(|@24) and the rate of change
of amount outgoing is 10({@24)= This gives the dierential equation for the left
167
10@24
4@24
0
12@24 2@24
det(7 10@24 12@24 2@24 8) = (10@24)
8@24
8@24
0
8@24
8@24
10@24 2@24
(2@24)
0
8@24
= 5@144=
Cramers rule can easily be used to nd the steady state solutions { = 7=2>
| = 12=0 and } = 12=0. In chapter seven we will show that the time dependent
solutions will approach the steady state solutions as time goes to innity.
168
3.7.5
g}
= (3 + 8(|@24)) (2(}@24) + 6(}@24))=
gw
AA
AA
AA
AA
AA
AA
AA
AA
AA
3.7.6
10 -12 2;
0 8 -8];
det(A)
ans =
-480
d = [-24 -48 -72];
A\d
ans =
8.4000
15.0000
24.0000
A1 = [d A(:,2) A(:,3)];
A2 = [A(:,1) d A(:,3)];
A3 = [A(:,1) A(:,2) d];
x = det(A1)/-480
x=
8.4000
y = det(A2)/-480
y=
15
z = det(A3)/-480
z=
24.
169
Exercises
1.
170
5.
6
1 2 1 0
9 0 1 0 0 :
:
D=9
7 8 16 11 0 8 =
1 2 3 7
(a).
Find the determinant by expanding row two.
(b).
Use elementary matrices to transform the matrix to upper triangular form and then compute the determinant.
6.
In Example 3.7.3 use determinants to compute the other two columns of
the inverse matrix.
7.
In Example 3.7.1 use determinants to compute inverse matrix.
8.
Consider the derivation of Cramers rule for q = 3 (see the end of Subsection 3.7.1) and justify the equations for {2 and {3 =
9.
Consider the derivation of Cramers rule for q = 4 (see Subsection 3.7.3)
and justify the equation for {4 =
10.
Use Cramers rule to compute the solution to the three-tank mixing
problem.
11.
Consider the three-tank mixing problem where the chemical is now directly inserted from the top at rates 2, 3 and 4 (Kg/min) for the left, center
and right tanks, respectively. Assume the ow rates between the 24 liter tanks
remain as in Figure 3.7.1.
(a).
Find the three dierential equations.
(b).
Find the matrix equation for the steady state solution.
(c).
Solve the matrix equation.
12.
Use MATLAB to conrm any calculations done in exercises 4-7.
13.
Use MATLAB to conrm any calculations done in exercises 10 or 11.
14.
Use MATLAB and determinants to compute the other two solutions of
Du = d = [470 400 400 470]W where D is from Example 3.7.2.
Chapter 4
Ax = d: Least Squares
Solution
This chapter contains methods for "solving" matrix equations of the form
Dx = d where D is a matrix with more rows (equations) than columns (variables). The normal equations will be developed and used to solve these over
determined algebraic systems. Applications include data tting such as sales
predictions, radioactive decay, world population models, ow rate data and
parameter identication. By-hand calculations will be done as well as implementations in MATLAB for larger and nonlinear problems.
4.1
1 1
2000
7 2 1 8 p
= 7 1950 8
f
3 1
1910
Dx = d=
In this case D in 3 2> x = [p f]W is 2 1 and there are more equations
than unknowns. So, it is a good possibility that there is no single straight line
containing the three data points. This was viewed geometrically where we chose
p and f so that the point in the plane given by the linear combination of the
two column vectors of D would be closest to the point d = [2000 1950 1910]W =
171
172
4.1.1
is the p and f that forces the residual vector r d (pa + fb) = [u1 u2 uq ]
to be as "close" as possible to the zero vector. If the sum of the squares of the
residual vectors components is a minimum, then this is called the least squares
solution. The objective is to nd p and f that minimize
rW r = u12 + u22 + + uq2 =
The least squares function of p and f can be explicitly computed as
I (p> f) rW r = (d (pa + fb))W (d (pa + fb))
= dW d2dW ap 2dW bf +
2aW bpf + aW ap2 + bW bf2 =
(4.1.1)
This problem will be solved three ways: graphically, calculus and normal equations (in Section 4.2).
For the above high denition television data a = [1 2 3]W , b = [1 1 1]W
and d = [2000 1950 1910]W and gives
I (p> f) = 114506002(11630)p 2(5860)f + 2(6)pf + 14p2 + 3f2 =
In Subsection 2.4.4 a geometric argument required the minimum to be the
solution of the following algebraic system
W
a r = aW (d (pa + fb)) = aW d (aT ap + aW bf) = 0
(4.1.2)
bW r = bW (d (pa + fb)) = bW d (bT ap + bW bf) = 0=
This is a special case of the normal equations, and as we shall see they give a
solution to the least squares problem even if the number of data points is larger
than q = 3.
173
Example 4.1.1. Suppose a new computer company has had increased sales
and would like to make a prediction of future sales based on past sales. During
the past six months sales have been 78, 85, 90, 95, 104 and 113 computers, see
Table 4.1.1.
A rst look at this data suggests an increase of about 8 computers each
month. A more precise way to view this is to determine the slope and intercept
so that | = pw + f is "closest" to the data points as is depicted in the left graph
in Figure 4.1.1, which will be discussed in detail in the next section. Each of
the data points can be inserted into the linear equation and gives a system with
six equations
;
p1 + f = 78
A
A
A
A
p2 + f = 85
A
A
?
p3 + f = 90
p4 + f = 96
A
A
A
A
p5 + f = 104
A
A
=
p6 + f = 113=
The matrix form is
5
9
9
9
9
9
9
7
1
2
3
4
5
6
1
1
1
1
1
1
:
9
:
9
: p
9
:
=9
: f
9
:
9
8
7
78
85
90
96
104
113
6
:
:
:
:=
:
:
8
The column vectors now have six components, but the least squares function
I (p> f) is a function of two variables. The least squares solution will be determined at the end of this section and will give the straight line indicated in
Figure 4.1.1.
Example 4.1.2. Estimates of the world population over the past hundred years
are in Table 4.1.2, see [9]. Careful inspection of the populations reveals larger
increases in the populations as time progresses. So, an attempt to model this
data by a straight line may not yield very accurate predictions about the world
population. One possible model, among many, is to use a quadratic function
174
175
of time where the three coe!cients are chosen so that the quadratic function
is increasing and concave up for times near the data. Let | = dw2 + ew + f
where time starts in 1900, w = 0, and ends in 2000, w = 100= There are q = 11
equations giving the algebraic system
;
d02 + e0 + 1f = 1=65
A
A
A
2
A
A
? d102 + e10 + 1f = 1=75
d20 + e20 + 1f = 1=86
A
..
A
A
.
A
A
=
d1002 + e100 + f = 6=06=
The equivalent matrix equation uses an 11 3 matrix D and has the form
5
9
9
9
9
9
7
0
102
202
..
.
1002
6
5
1=65
5
6
:
9 1=75 :
:
: d
9
:
:7
9
: e 8 = 9 1=86 : =
:
9 .. :
8 f
7 . 8
6=06
100 1
0
10
20
..
.
1
1
1
..
.
In this case the least square function I (d> e> f) depends on the data and the
three unknown coe!cients d> e and f. The normal equations as described in
the Section 4.2 will be used to solve this system.
4.1.2
Consider the least squares problem for tting data to a straight line with q data
points so that the matrix is q 2 and D = [a b] with least squares function
F(m,c) as given in equation (4.1.1). Since the least squares function depends
on two variables, we may graph the value } = I (p> f) on the z-axis with the
independent variables { = p and | = f. Then upon doing the graphing for
appropriate choices of p and f, the minimum of the least squares function can
be estimated and the corresponding values of p and f approximated.
The MATLAB code ls_graph.m has been used to generate the 3D graph
on the left in Figure 4.1.2 and the contour graph on the right of the same
gure for the least squares function I (p> f) in Example 4.1.1. Some trial and
error was required to locate the minimum of the least squares function, which
is approximately I (p> f) 10 where (p> f) (6=6> 71)= MATLAB commands
mesh() and contour() were used to generate the left and right graphs in the
Figure 4.1.2, respectively. This method is not very accurate and not applicable
when more than two parameters are to be found. But, it does give geometric
interpretation and can be useful when examining the sensitivity of the least
squares solution to variations in the data. In Figure 4.1.2 notice the solution is
located in a long thin "valley" of the graph. This suggests small changes in the
data might cause signicant changes in the solution!
176
4.1.3
177
Compute the rst derivative with respect to f and set it equal to zero
gj
= 0 = 0 02dW b + 2aW bp0 + bW b2f + 0=
gf
This derivative is also called the partial derivative of F(m,c) with respect to the
c variable and is written as CI
Cf =
These two equations can be written in vector form
W
W
a d
p0
a a aW b
=
=
bW a bW b
bW d
f0
Note they are the same as in equations (4.1.2), but now the length of the vectors
is not restricted to q = 3! The matrix equation can also be written as
DW Dx = DW d where
aW
p0
W
D = [a b]> D =
and x =
=
f0
bW
This is called the normal equations corresponding to the least squares problem
Dx = d=
Return to the sales prediction problem in Example 4.1.1 where
a = [1 2 3 4 5 6]W
b = [1 1 1 1 1 1]W and
d = [78 85 90 96 104 113]W >
giving aW a = 91> aW b = 21 = bW a, bW b = 6, aW d = 2100 and bW d = 566= The
normal equation is
91 21
p0
2100
=
>
21 6
566
f0
and the solution is easily computed to be p0 = 34@5 = 6=8000 and f0 =
1058@15 70=5333 with I (p0 > f0 ) 8=1333= These numbers are consistent
with the estimates given by the graphical approach in Figure 4.1.2. Now use
the equation | = p0 w + f0 to predict any future sales. For example, at the
month w = 15 the predicted sales is
|(15) = p0 15 + f0 = 6=8000(15) + 70=5333 172=
The data, straight line model | = p0 w + f0 and prediction are illustrated in
Figure 4.1.1, which was generated by the MATLAB code market.m.
4.1.4
= ux where
u is the decay rate and x(0) is the initial amount.
178
equation is
6
5
ln(101)
1
9 ln(95)
1 :
p
:
9
=9
..
.. : f
7
.
. 8
ln(78=2)
16 1
6
:
:
:=
8
The normal equations are solved, see the MATLAB code decay.m, to give p =
0=0439 and f = 5=0372= This implies u = p = 0=0439 and x(0) = hln(x(0) =
hf = h5=0372 = 154=0352 giving
x(w) = x(0)huw = 154=0352h0=0439w =
The predicted amount at time w = 60 is 11=5172. The data and exponential
model are illustrated in Figure 4.1.3
4.1.5
AA
AA
AA
AA
t = [1 2 3 4 5 6];
sales = [ 78 85 90 96 104 113 ];
a = t;
b = ones(6,1);
d = sales;
A=[a b];
% 6x2 matrix
a*a
% compute the components
ans =
91
a*b
ans =
21
b*a
ans =
21
b*b
ans =
6
a*d
ans =
2100
179
180
AA b*d
ans =
566
AA A*A
% matrix product for normal equations
ans =
91 21
21 6
AA A*d
ans =
2100
566
AA lssol=(A*A)\A*d
% solution via Gauss elimination
lssol =
6.8000
70.5333
AA lssol2 = A\d
% better method...uses QR factors
lssol2 =
6.8000
70.5333
The reader should examine the MATLAB codes market.m and decay.m for
additional least squares computations.
4.1.6
1.
Exercises
(a).
Find the least squares function in equation (4.1.1).
(b).
Solve the system in equation (4.1.2).
(c).
Compute | = pw + f at time w = 5.
2.
Consider the price of high denition television after four months of price
watching
Months
1
2
3
4
(a).
(b).
(c).
HDTV Prices
2000
1950
1910
1875
181
3.
Consider the computer sales problem in Example 4.1.1 after two additional months of sales: month 7 there were 120 computers sold and month 8
there were 131 computers sold. Consider all 8 data points, see Table 4.1.1.
(a).
Find the least squares function in equation (4.1.1).
(b).
Solve the system in equation (4.1.2).
(c).
Compute | = pw + f at time w = 15 months.
4.
Consider tuition, fees and books (lumped as costs) at University Expensive. These have risen over the past four years and one would like to predict
what they will be four years from now. Suppose
Years
1
2
3
4
Costs
11,300
11,900
12,700
13,400
(a).
Find the least squares function in equation (4.1.1).
(b).
Solve the system in equation (4.1.2).
(c).
Compute | = pw + f at time w = 8 years.
5.
Consider the radioactive decay problem, see Table 4.1.3. Suppose there
was a data entry error at time w = 13 where the measured amount should have
been 85.6 and not 86.5.
(a).
Find the least squares solution.
(b).
Predict the amount at time w = 60.
6.
Consider a population such as sh in a large lake, which for a limited
time interval, can be modeled by S 0 = (e g)S where S (w) is the population
size at time w, e is the birth rate and g is the death rate. The solution of this
dierential equation is
S (w) = S (0)h(eg)w =
These rates and the initial population are usually not known and must be
determined from observations. Use the radioactive decay model as a template
and the following population data
Years
1
2
3
4
Population Estimates
1000
1300
1750
2400
(a).
Solve the system in equation (4.1.2).
(b).
Compute S (w) at time w = 8 years.
7.
Use MATLAB to conrm any calculations done in exercises 1-6.
8.
Use the MATLAB codes market.m and ls_graph.m to examine sensitively
of the least squares solution when there is a 10% error or uncertainty in the
data for Example 4.1.1.
182
9.
Use the MATLAB codes decay.m to examine sensitively of the least squares
solution when there is a 5% error or uncertainty in the data for the radioactive
decay problem.
4.2
Normal Equations
The normal equations will be developed for the general least squares solution of
Dx = d where D is p q and p A q (more rows or equations than columns or
unknowns). In order to achieve this, the transpose of a matrix and its properties
will be studied. The normal equations DW Dx = DW d will be shown to solve the
least squares problem, provided DW D has an inverse. These concepts will be
related to the calculus and geometric approaches that were discussed in previous
sections. An application to population predictions, based on past population
data, will be discussed.
4.2.1
Transpose Matrix
aW1
aW2
..
.
6
:
:
:=
8
aWq
Another way of dening the transpose is DW [dml ] where D = [dlm ], 1 l p
and 1 m q=
Example 4.2.1. Consider the following matrices
3
2 7
1 3 4
x=
> D=
and E =
=
4
8 1
7 8 9
The transpose of these are
xW =
3 4
> DW =
2 8
7 1
6
1 7
and E W = 7 3 8 8 =
4 9
183
2 7
3 W
)
8 1
4
W
34
=
= 34 20
20
2 8
3 4
=
7 1
(Dx)W
= (
= xW DW =
The transpose of a matrix-vector product may also be extended to a matrixmatrix product
2 7
1 3 4
51 62 71
DE =
=
8 1
7 8 9
1 16 23
5
6 5
6
51 1
1 7
2 8
(DE)W = 7 62 16 8 = 7 3 8 8
7 1
71 23
4 9
= E W DW =
Theorem 4.2.1 (Properties of Transpose) Let D and E be p q matrices,
F be an q s matrix, x and y be q 1 column vectors and v be a real number.
1.
2.
3.
The proof of (Dx)W = xW DW follows from the column version of a matrixvector product, see Theorem 3.2.1,
(Dx)W
= ({1 a1 + {2 a2 + + {q aq )W
= ({1 a1 )W + ({2 a2 )W + + ({q aq )W
= {1 aW1 + {2 aW2 + + {q aWq
5 W 6
a1
9
9 aW2 :
:
{1 {2 {q 9 . :
=
.
7 . 8
aWp
= xW DW =
The proofs of the other properties are also direct consequences of the denitions.
4.2.2
184
previous section we shall dene "small" in terms of the least squares function
W
I (x) r(x) r(x), which is a function from n-dimensional space into the real
numbers, that is, I : Rq $ R=
Denition 4.2.2. Consider Dx = d where D is p q and p A q. The
least squares solution is an q 1 column vectors x such that the least squares
function evaluated at this x is less than or equal to all other evaluations of the
least squares function
I (x) I (y) for all q 1 column vectors y=
In the previous section with two variables it was not too complicated to
solve the minimization problem. For larger number of columns q A 2, it is
useful to take advantage of the properties of the transpose matrix to derive the
normal equations. Let y = x + (y x) where x is the least squares solution.
Then
r(y) =
=
=
=
d Dy
dD(x + (y x))
dDxD(y x)
r(x)D(y x)=
Put this into the least squares function and use (D(y x))W (D(y x)) 0
I (y) = r(y)W r(y)
= (r(x)D(y x))W (r(x)D(y x))
= (r(x)W (D(y x))W )(r(x)D(y x))
= r(x)W r(x) 2(D(y x))W r(x) + (D(y x))W (D(y x))
I (x) 2(y x)W DW r(x)+0=
(4.2.1)
If DW r(x) = 0> then for all y I (y) I (x)= The vector equation DW r(x) = 0
can be written as
DW r(x) = 0
D (d Dx) = 0
DW Dx = DW d=
W
If the q q matrix DW D has an inverse, then the solution of this equation will
also be the solution of the least squares problem.
Denition 4.2.3. Consider Dx = d where D is p q and p A q. The normal
equation uses the q q matrix DW D and is
DW Dx = DW d=
In order to ensure the q q matrix DW D has an inverse, see Theorem 3.7.3,
we must show DW Dz = 0 implies z = 0. This leads to important concept of
185
2000
1 1
7 2 1 8 {1 = 7 1950 8 =
{2
1910
3 1
The normal equations are
5
1
1 2 3 7
2
1 1 1
3
14
6
6
1
1 8
1
6
2
{1
{2
1 2 3
1 1 1
{1
11630
=
>
5860
{2
=
6
2000
7 1950 8
1910
and the solution is {1 = 45=00 and {2 1863=33= The column vectors in the
3 2 matrix are linearly independent because Dz = 0 implies z = 0 as follows
from
Dz
6
1 1
7 2 1 8 }1
}2
3 1
}1 + }2
2}1 + }2
3}1 + }2
5
= 5
0
=
=
=
=
6
0
7 0 8 or equivalently
0
0
0 and
0=
The only way the three equations can hold is if }1 = }2 = 0, that is, z = 0=
In order to show DW D has an inverse, suppose DW Dz = 0 and show z = 0=
Use the associative and the transpose properties
zW (DW Dz) = zW 0
(zW DW )Dz = 0
(Dz)W (Dz) = 0=
This means Dz must be the zero vector. Since Dz is a linear combination of
the columns of D, it is su!cient to require that no column of D can be written
as a linear combination of the other columns. This proves the next theorem.
186
4.2.3
The minimization of the least squares function I (x) = r(x) r(x) has q independent variables in the vector x= Because of the special structure of the least
squares function, this can be simplied to a function of a single real variable w=
Replace x by x+wy where x is the least square solution and dene
W
(4.2.2)
187
When p A 3 or q A 2> one can generalize this approach. The plane will
now be replaced by the range of the matrix, which is the linear combination of
q p 1 column vectors and can be written as Dy. The concept of distance
between two vectors d and Dy in m-dimensional space will be
((d Dy)W (d Dy))1@2
and, hence, the distance squared between d and Dy is r(y)W r(y)= The least
squares solution is the point in the range of D that is closest to d. Dene
perpendicular or orthogonal vectors a and r in m-dimensional space to mean
aW r = 0= The normal equations now simply require the columns of D to be
orthogonal to the residual vector.
4.2.4
Consider the world population data in Table 4.1.2, which was initially presented
in Example 4.1 2 of the previous section. There were 11 data points from 1900 to
2000 in decade increments, and examination of the data indicated an increasing
and concave upward population estimates. The objective is to nd a quadratic
curve | = dw2 + ew + f so that the data will be "close" to this curve. For a
limited time interval this function can be used to make predictions about the
world population based on just the past observations. This is perhaps one of
the most primitive population models and ignores changing birth and death
rates and variable population densities.
This model is the least square problem with p = 11, q = 3 and {1 = d,
{2 = e and {3 = f= The 11 3 matrix and 11 equations that correspond to the
data (where time equals zero is 1900) is derived from the equations
dw2l + ewl + f = population estimates at times wl =
The p = 11 equations can be written in vector form
5
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
7
0
102
202
302
402
502
602
702
802
902
1002
0
10
20
30
40
50
60
70
80
90
100
1
1
1
1
1
1
1
1
1
1
1
9
:
9
:
9
:
9
:
9
:
:5
6 9
9
: d
9
:
:7 e 8 = 9
9
:
9
: f
9
:
9
:
9
:
9
:
9
:
7
8
1=65
1=75
1=86
2=07
2=30
2=52
3=02
3=70
4=44
5=27
6=06
6
:
:
:
:
:
:
:
:
:=
:
:
:
:
:
:
:
8
188
4.2.5
= dw2 + ew + f
= (0=0005)1302 + (0=0075) 130 + 1=7393 9=38=
The following is the MATLAB code pop.m used to generate Figure 4.2.1. It
uses the MATLAB command A\d to accurately solve the least squares problem
189
4.2.6
1.
Exercises
3
4
> D=
2 0 1
7 1 2
Find xW , DW and E W =
W
W W
Verify
5 (DE) =6E D =
1 2 1
2.
Let D = 7 1 3 2 8 =
1 0 1
(a).
Find DW and D1 =
(b).
Verify (DW )1 = (D1 )W =
(a).
(b).
6
1 3 4
and E = 7 1 0 5 8 =
3 1 2
190
1
9 2
9
7 3
4
6
5
1
2000
9 1950
{
1 :
1
:
=9
7 1910
1 8 {2
1
1875
6
:
:=
8
(a).
Find the normal equations.
(b).
Show the columns in the 4 2 matrix are linearly independent.
(c).
Solve the normal equations.
(d).
Use the above to predict the HDTV price at time w = 8.
6.
Consider the rst four data points in the world population problem and
the resulting quadratic least squares problem with {1 = d> {2 = e and {3 = f
5
6
5
6
0
0 1 5
1=65
{
1
9 100 10 1 :
9 1=75
9
:7
8 9
7 400 20 1 8 {2 = 7 1=86
{3
900 30 1
2=07
6
:
:=
8
(a).
Find the normal equations.
(b).
Show the columns in the 4 3 matrix are linearly independent.
(c).
Solve the normal equations.
(d).
Use the above to predict the world population at time w = 130, and
compare with the prediction based on 11 data points.
7.
Consider the world population problem with 11 data points.
(a).
Find the normal equations for the linear least squares problem.
(b).
Conrm the normal equations for the quadratic least squares problem.
(c).
Compare the predicted world population at time w = 120 for the
linear and quadratic models.
8.
Use MATLAB to conrm any calculations in exercises 1, 2, 5, 6 or 7.
9.
Use the MATLAB code pop.m.
(a).
Conrm the calculations and predict the population at w = 160.
(b).
Use the Gauss elimination method, via (A*A)\(A*d), to solve the
normal equations for both the linear and quadratic models.
(c).
Suppose the population estimates for the last two data points were
too low and should have been 5% higher. Solve the new normal equations and
make a new prediction of the population at w = 160.
191
4.3
Data may be dependent on more than one variable. In this section the focus will
be on multilinear data approximation such as } = i ({> |) = p1 {+p2 |+f where
the parameters for the slopes in the { and | directions and the } intercept must
be found so that the data }l is "closest" to the surface points i ({l > |l )= Problems
like this are easily formulated as least squares problems whose solution will be
given by the normal equations. Applications will include price data for sales
levels in several markets, real estate appraisal as function of several attributes,
and identication of ow rates in "mixing tank" models.
4.3.1
Consider the following four data points in Table 4.3.1 where the measured data
is }l with l = 1> > 4 and may depend in a linear way on the independent
variables { and |. The objective is to nd p1 > p2 and f so that }l p1 {l +
p2 |l + f= This means the residuals ul = }l (p1 {l + p2 |l + f) should be as
small as possible. From inspection of the data points it appears the two slopes
should be negative and the intercept should be positive.
In order to formulate the problem in terms of the normal equations, one
must list the possible equations in the system
;
p1 1 + p2 1 + f = 100
A
A
?
p1 2 + p2 1 + f = 98
p1 1 + p2 2 + f = 95
A
A
=
p1 2 + p2 2 + f = 94=
The vector version of this,
D is 4 3> is
5
1
9 2
9
7 1
2
6
5
6
1 5
100
p1
9 98
1 :
: 7 p2 8 = 9
7 95
1 8
f
1
94
6
:
:=
8
192
6 1
1 2 1 2 9
7 1 1 2 2 89 2
7 1
1 1 1 1
2
5
6
7 9
6
1
1
2
2
1
1
1
1
9 6
10 6
6 4
DW Dx = DW d
5
5
6
5
6 100
p
1
2
1
2
1
:
9
: 7 p2 8 = 7 1 1 2 2 8 9 98
8
7 95
f
1 1 1 1
94
65
6
5
6
p1
579
8 7 p2 8 = 7 576 8 =
f
387
6
6
:
:
8
4.3.2
Investors are always interested in the price per unit of an item. As the number
of units sold increases, usually the price per unit decreases. The price per unit
in one market will be dierent than the price per unit in another market. In
the data in Table 4.3.1 you might consider the } values to be a price per unit in
either country A or country B. Let { be the units sold in country A and | be the
units sold in country B. The price function for country A i ({> |) = p1 {+p2 |+f
is a function of the units sold in the two markets. The two markets have some
interaction so that the number of units sold in one market does have an impact
on the price in the other market. A similar price function for the other country
could also be modeled.
Consider three adjacent countries A, B and C with {, | and } units sold,
respectively. Table 4.3.2 has 9 data points for the price per unit for country A
given by sl where l = 1> > 9= The objective is to nd p1 > p2 > p3 and f so
that sl p1 {l + p2 |l + p3 }l + f= The corresponding equations give the system
;
p1 2 + p2 3 + p3 1 + f = 20> 000
A
A
A
? p1 3 + p2 4 + p3 2 + f = 19> 900
..
A
.
A
A
=
p1 27 + p2 13 + p3 9 + f = 16> 500=
i
1
2
3
4
5
6
7
8
9
Table
xl
2
3
5
8
12
15
19
23
27
4.3.2:
yl
3
4
4
5
6
8
10
11
13
193
6
6
5
1 1 5 p1 6
20> 000
9 19> 900 :
2 1 :
p2 :
:9
:
9
9
:
=
:
:=
.. .. 7 p 8 9
..
8
8
7
3
. .
.
f
27 13 9 1
16> 500
3
4
..
.
The normal equations reduce to a 4 4 matrix solve, which can easily be done
using MATLAB command A\d.
AA [A d]
2 3 1 1 20000
3 4 2 1 19900
5 4 3 1 19300
8 5 3 1 19100
12 6 4 1 18900
15 8 6 1 18400
19 10 7 1 17800
23 11 7 1 17200
27 13 9 1 16500
AA A*A
2090 1064 722 114
1064 556 374 64
722 374 254 42
114 64 42 9
AA A*d
2031100
1154600
754500
167100
AA A\d
% (A*A)\(A*d) is a less robust solver
194
4.3.3
Consider the appraisal of a home based on its location and ve attributes: age,
number of bathrooms, number of bedrooms, heated square feet and general
condition. Several homes in this location have recently been sold for a known
price and known values of the ve attributes. The home being appraised will
have known values of the ve attributes, but not the price. The objective is to
estimate the price of the home based on the recent sales of comparable homes.
Let the independent variables be {1 (age)> {2 (bathrooms)> {3 (bedrooms)>
{4 (square feet) and {5 (condition)= Suppose there are seven comparable homes
in this location, and they have the following attributes and values y given in
Table 4.3.3. The model will assume the value of the property depends linearly
on the values of the attributes and has the form
y p1 {1 + p2 {2 + p3 {3 + p4 {4 + p5 {5 + f=
The equations for the seven comparable homes yield the system
;
p1 10 + p2 2=5 + p3 3 + p4 2000 + p5 9 + f = 260
A
A
A
? p1 12 + p2 2=0 + p3 5 + p4 2500 + p5 8 + f = 270
..
A
.
A
A
=
p1 10 + p2 2=0 + p3 4 + p4 2400 + p5 9 + f = 280=
The corresponding vector equation has a 7 6 matrix, ve unknown slopes and
an unknown intercept
5
6
6
6 p1
5
5
260
10 2=5 3 2000 9 1 9 p2 :
: 9
:
9 12 2=0 5 2500 8 1 : 9
p3 :
:9
9 270 :
9
9
= 9 . :=
9 ..
..
..
..
.. .. : 9 p :
:
7 .
.
.
.
. . 8 9 4 : 7 .. 8
7 p5 8
280
10 2=0 4 2400 9 1
f
l (home)
1
2
3
4
5
6
7
Table
xl1
10
12
15
8
11
9
10
4.3.3:
xl2
2.5
2
2
3
2.5
2
2
195
As in the price data application, the normal equation is easy to solve using
MATLAB.
AA [A d]
AA
AA
AA
AA
1.0e+003 *
0.0100 0.0025 0.0030 2.0000 0.0090 0.0010 0.2600
0.0120 0.0020 0.0050 2.5000 0.0080 0.0010 0.2700
0.0150 0.0020 0.0040 1.9000 0.0060 0.0010 0.2300
0.0080 0.0030 0.0030 1.6000 0.0090 0.0010 0.2500
0.0110 0.0025 0.0040 2.3000 0.0070 0.0010 0.2600
0.0090 0.0020 0.0030 2.0000 0.0080 0.0010 0.2500
0.0100 0.0020 0.0040 2.4000 0.0090 0.0010 0.2800
lssol = A\d
lssol =
-0.5489
% equals p1
6.7198
% equals p2
0.8193
% equals p3
0.0425
% equals p4
7.7542
% equals p5
93.3308
% equals f
r = d - A*lssol
r*r/(d*d)
5.7814e-005
lssol(1)*9 + lssol(2)*2.5 + lssol(3)*4 +
lssol(4)*1900 + lssol(5)*9 + lssol(6)
259.0114
% equals the appraised value of the home
Assume the home being appraised has the following attributes: 9 years old, 2=5
bathrooms, 4 bedrooms, 1900 heated square feet and general condition equal
to 9. Once the ve slopes and intercept have been computed, the home can be
appraised by evaluating
appraised value
= p1 {1 + p2 {2 + p3 {3 + p4 {4 + p5 {5 + f
= p1 9 + p2 2=5 + p3 4 + p4 1900 + p5 9 + f
259=0=
196
Notice the rst slope, p1 , is a negative number, which indicates the value of
the home decreases as the age increases. The other four attributes add to the
value of the home and so their slopes should be positive.
4.3.4
equation Dx = d
6
5
12 5
6
d
9
13 :
:
9
.. : 7 e 8 = 9
8
7
.
f
15 1 29
where x = [d e f]W is
6
1=5
2=0 :
:
.. : =
. 8
1=5
The least squares solution is easy to nd using the MATLAB command A\d.
197
AA [A d]
3.0000 9.0000 12.0000 1.5000
5.0000 8.0000 13.0000 2.0000
7.0000 7.0000 16.0000 2.0000
9.0000 5.0000 18.0000 2.0000
11.0000 4.0000 21.0000 1.5000
12.0000 3.0000 23.0000 1.5000
14.0000 2.0000 26.0000 1.5000
15.0000 1.0000 29.0000 1.5000
AA lssol = A\d
lssol =
0.2849
% equals d
0.2361
% equals e
-0.1099
% equals f
AA r = d - A*lssol;
AA r*r
0.2313
The coe!cients in the other two dierential equations
g|
gw
g}
gw
= b
d{ + be| + b
f} and
= e
d{ + ee| + e
f}
may be computed in a similar way by replacing gl with gbl and gel > respectively,
g|
(wl )
gw
g}
(wl )
gw
|l+1 |l1
gbl and
wl+1 wl1
}l+1 }l1
gel =
wl+1 wl1
198
4.3.5
Exercises
1.
xl
1
2
1
2
3
1
3
2
3
yl
1
1
2
2
1
3
2
3
3
}l (dependent)
100
98
95
94
=
95
89
91
86
84
(a).
Find 9 3 matrix D.
(b).
Use MATLAB to solve the least squares problem.
(c).
Use the least squares solution to predict the value of p1 { + p2 | + f
when { = 4 and | = 6.
3.
Consider the price data application in three markets as given for country
A in Table 4.3.2. Suppose country B has price data p = [25000 24200 23900
23200 22600 22100 21500 20500 20100]W and the other data in the table
remain the same.
(a).
Find 11 4 matrix D.
(b).
Use MATLAB to solve the least squares problem.
(c).
Use the least squares solution to predict the unit price in country
B from p1 { + p2 | + p3 } + f when { = 40> | = 16 and } = 12.
4.
Consider the real estate appraisal data in Table 4.3.3. Suppose value of
the comparable homes is v = [260 270 230 250 260 250 295]W and the other
data in the table remain the same.
(a).
Find 7 6 matrix D.
(b).
Use MATLAB to solve the least squares problem.
(c).
Use the least squares solution to predict value of the same home.
5.
Consider the three-tank data in Table 4.3.4. Find the coe!cients in
g|
=b
d{ + be| + b
f}=
gw
(a).
(b).
b
Find 8 3 matrix D and the 8 1 column vector d.
Use MATLAB to solve the least squares problem.
4.4
199
Parameter Identication
Models evolving from dierential equations have parameters, which must be approximated. An example is radioactive decay as described in Section 4.1. The
model leads to x(0)huw where the parameters are the initial amount x(0) and
the decay rate u= We were able to convert the exponential function into linear
curve t by using the natural logarithm. However, this does not always simplify
all models! An alternative is to use a search algorithm to locate the minimum
of the more complicated nonlinear least squares function. The MATLAB command fminsearch() is an implementation of the Nelder-Mead search algorithm.
Applications to radioactive decay, logistics population and steady state heat
conduction parameter identications will be given.
4.4.1
Minimization problems that occur in parameter identication are from a nonlinear least squares function
I (s1 > s2 > > sq ) = (g1 x(w1 > s1 > s2 > > sq ))2 +
+(gp x(wp > s1 > s2 > > sq ))2
where x(w> s1 > s2 > > sq ) is a solution of a dierential equation and q is the
number of parameters and p is the number of data points. In the radioactive decay problem there are two parameters s1 = x(0) and s2 = u> and the
dierential equation is
gx
= ux with solution x(w> s1 > s2 ) = s1 hs2 w = x(0)huw =
gw
The Nelder-Mead simplex method searches for the minimum of a real-valued
function I (p) of p variables. In the case of three variables a sketchy outline
of the method is as follows.
Step 1.
Step 2.
Step 3.
Step 4.
In step two (p0 + p1 + p2 )@3 is the center of the face (triangle) in the
tetrahedron with vertices p0 > p1 and p2 and
qhz_p3 = p3 + ((p0 + p1 + p2 )@3 p3 )=
If = 0> then qhz_p3 = p3 = If = 1> then qhz_p3 = (p0 + p1 + p2 )@3. The
tricky part of the algorithm is a "good" choice of > where the objective is to
200
choose so that the new set of four points is "closer" to the minimum of I (p).
We shall rely on the implementation given by MATLAB.
The MATLAB implementation of the Nelder-Mead method has the form
fminsearch(Function, guess_ vector). Function is a function le and guess_
vector is an initial guess for the parameters of the function I (p) such that it is
a minimum. For example, use fminsearch() to nd the minimum of
I (s1 > s2 > s3 ) = 100 + (s1 2)2 + (s2 3)2 + (s3 4)2 =
The function le and execution of fminsearch() are
function Fnm = Fnm(p)
Fnm = 100 + (p(1)-2)^2 + (p(2)-3)^2 + (p(3)-4)^2;
AA [p Fval] = fminsearch(Fnm, [10 10 10])
p=
1.9999 3.0000 4.0000
Fval =
100.0000.
4.4.2
Return to the radioactive decay data in Section 4.1 where at times t = [10
11 12 13 14 15 16] the measured amounts of a radioactive substance were
u = [101 95 90 86=2 82 79 78=2]= The exponential function with unknown
initial amount and decay rate must be t to these seven data points. So, p = 7,
q = 2 and the nonlinear least squares function is
I (x(0)> u) = (x1 x(0)huw1 )2 +
+(x7 x(0)huw7 )2 =
The following MATLAB implementation has two function les and a code le.
The function le rad_sol.m has the exponential function and the le ls_rad.m
has the above least squares function. The code le rad_fmin.m has the call to
the MATLAB command fminsearch(), and it also lists the two function les.
MATLAB Code rad_fmin.m
% function r = rad_sol(x1,x2,t)
% r = x1*exp(-x2*t);
%
%function lsrad = ls_rad(xx)
% t = 10:16;
% a = [101 95 90 86.5 82 79 78.2 ];
% lsrad = 0;
% for i = 1:7
% lsrad = lsrad + (a(i)-rad_sol(xx(1),xx(2),t(i)))^2;
% end
%
201
format long
[xx lsval] = fminsearch(ls_rad,[120 .03])
rad_sol(xx(1),xx(2),60)
for i = 0:100
amount(i+1) = rad_sol(xx(1),xx(2),i);
end
plot(amount)
The two function les must be in your directory as well as the above code le
rad_fmin.m. Execution of this code le gives
AA rad_fmin
xx =
1.0e+002 *
1.55946611533598 0.00044865208356
lsval =
9.73565029005973
rad_sol(xx(1),xx(2),60)
10.56557646847834.
This means the initial amount is 155.95 and the decay rate is 0.04486. The
predicted amount at time equal to 60 is 10.5655. These values are very close
to the output from using the linear t to ln(x(w)) = ln(x(0)) + (u)w> where
the initial amount is 154.0352, decay rate is 0.0439 and amount at time 60 is
11.5172.
4.4.3
Function
pw + f
dw2 + ew + f
x(0)h(eg)w
PF
F+hPfw
Dierential Equation
none
none
=
gx
gw = (e g)x
gx
gw = f(P x)x
The least square problems for the rst three can be solved by the normal equations. The dierential equations for the population x(w) are based on the birth
202
and death rates, e and g. For small time intervals they may be approximated
by constants and in this case we get the exponential function. In the logistic
model the birth and death rates are allowed to vary linearly with the population
so that e g = f(P x)= One can view P as the maximum population, and f
will determine how fast the maximum population will be attained.
The parameters P and f can be determined from a least squares approximation of the data derived by using centered nite dierences to approximate
the derivative
gx
1
(wl )
gw
x(wl )
x(wl+1 ) x(wl1 ) 1
wl+1 wl1
x(wl )
= f(P x(wl ))
= fP fx(wl )=
PF
=
F + hP fw
There are eleven data points and three parameters s1 = P> s2 = F and s3 = f
so that p = 11 and q = 3. The second parameter reects the initial population
because
PF
x(0)
x(0) =
giving F =
=
F +1
P x(0)
203
The following MATLAB implementation has two function les and a code le.
The function le log_sol.m has the logistic function and the le ls_log.m has
the above least squares function. The code le pop_us_fmin.m has the call to
the MATLAB command fminsearch(), and it also lists the two function les.
MATLAB Code pop_us_fmin.m
% function r = log_sol(x1,x2,x3,t)
% r = x1*x2/(x2+exp(-x1*x3*t));
%
%function ls = ls_log(xx)
% t = 0:10:100;
% p = [76.09 92.41 106.46 123.08 132.12 152.27 180.67
205.05 227.22 249.46 275.13];
% ls = 0;
% for i = 1:11
% ls = ls + (p(i)-log_sol(xx(1),xx(2),xx(3),t(i)))^2;
% end
%
format long
[xx lsval] = fminsearch(ls_log,[500 .2 .0001])
log_sol(xx(1),xx(2),xx(3),150)
x2 = 282.12*exp(-xx(1)*xx(3)*100)/(xx(1)-282.12);
log_sol(xx(1),x2,xx(3),150)
t = 0:10:100;
p = [76.09 92.41 106.46 123.08 132.12 152.27 180.67
205.05 227.22 249.46 275.13];
for i = 0:30
newt(i+1) = i*10+1900;
popus(i+1) = log_sol(xx(1),x2,xx(3),i*10);
end
plot(t+1900,p,*,newt, popus)
The two function les must be in your directory as well as the above code le
pop_us_fmin.m and execution of this code le gives
AA pop_us_fmin
xx =
1.0e+002 *
5.90373049898959 0.00150901875126 0.00000029836503
lsval =
204
4.4.4
2000 Data
275.13
282.12
275.13
282.12
additional
P
586
676
590
744
*
F
.1613
.1328
.1509
.1175
*
f
.00002982
.00002489
.00002983
.00002208
*
2050 Pred.
404
422
406
433
419
xl
10
14
18
22
26
30
34
38
205
gx
The unknown parameters are F, gx
g{ (0) = T1 and g{ (O) = T2 =
The solution of the ordinary dierential equation can be shown to have the
form
x({) = F1 sinh(F 1@2 {) + F2 cosh(F 1@2 {) + xvxu =
The constants are determined from the left and right boundary conditions
gx
gx
g{ (0) = T1 and g{ (O) = T2 and are
F1
= T1 @F 1@2 and
F2
T2 T1 cosh(F 1@2 O)
=
F 1@2 sinh(F 1@2 O)
This means the temperature x({> F> T1 > T2 ) is a function of the three parameters as well as {=
The temperature data was taken in rod with length O = 70 and at points
starting at { = 10 in increments of 4 until { = 66 is recorded in Table 4.4.2,
which was taken at the Math Instructional and Research Laboratory [3]. The
surrounding temperature was xvxu = 21=47. The nonlinear least squares function has p = 15 data points and q = 3 parameters and is
I (F> T1 > T2 ) = (x1 x({1 > F> T1 > T2 ))2 +
+(x15 x({15 > F> T1 > T2 ))2 =
206
Figure 4.4.2 was generated by the MATLAB code heat_fmin.m and illustrates
the temperature data and the temperature function with the parameters
s1 = F = 0=0018447> s2 = T1 = 6=257308 and s3 = T2 = 0=00000769=
The value of the least squares function was 7=2725.
MATLAB Code heat_fmin.m
% function r = heat_sol(x1,x2,x3,t)
% r = 2147/100+x2/x1^(1/2)*sinh(x1^(1/2)*t)(x2*cosh(70*x1^(1/2))-x3)/x1^(1/2)/sinh(70*x1^(1/2))
*cosh(x1^(1/2)*t);
%
% function lsr1 = ls_heat(xx)
% x = [10 14 18 22 26 30 34 38 42 46 50 54 58 62 66];
% temp_data = [ 115.95 101.94 90.18 80.01 71.37 63.75 56.94
51.97 48.21 44.48 40.66 38.51 37.81 36.11 35.18];
% lsr1 = 0;
% for i = 1:15
%
lsr1 = lsr1 + (temp(i)-sol1(xx(1),xx(2),xx(3),x(i)))^2;
% end
%
format long
[xx fctval] = fminsearch(ls_heat, [.001 -4.3 .0001])
for i = 1:57
xnew(i) = i+9;
temperature(i) = heat_sol(xx(1),xx(2),xx(3),xnew(i));
end
x = [10 14 18 22 26 30 34 38 42 46 50 54 58 62 66];
temp_data = [ 115.95 101.94 90.18 80.01 71.37 63.75 56.94
51.97 48.21 44.48 40.66 38.51 37.81 36.11 35.18];
plot(x,temp_data,*,xnew,temperature)
4.4.5
1.
Exercises
2.
Use the MATLAB command fminsearch() to nd some of the many minimum points of
I (s1 > s2 > s3 ) = 100 sin(s1 ) sin(=5s2 ) sin(=25s3 )=
3.
Use the MATLAB command fminsearch() to solve the radioactive decay
problem in exercise 5 in Section 4.1.
207
Chapter 5
Ax = d: Multiple Solutions
This chapter contains methods for solving algebraic equations Dx = d where D
is a matrix with more columns than rows, that is, more variables than equations.
Row operations are used to nd the basis of the nullspace solution set and a
particular solution. Applications to circuits, trusses and uid ow are studied
in the context of equilibrium equations where the block Gauss elimination and
nullspace methods are introduced.
5.1
5.1.1
Subspaces in Rq
Let a, b and c be vectors in Rq and let v and w be real numbers. Let a + b and
va denote vector addition and scalar multiplication. Theorem 3.1.1 listed the
following vector space properties for the set of all vectors in Rq :
a + b 5 Rq , a + 0 = a where 0 5 Rq has zeros as components, a + (a) = 0>
a + b = b + a, a + (b + c) = (a + b) + c;
va 5 Rq , 1a = a, v(a + b) = va + vb, (v + w)a = va + wa and v(wa) = (vw)a=
Denition 5.1.1. A subset V of Rq is called a vector subspace of Rq if and
only if for all a, b and c in V
a + b 5 V, a + 0 = a where 0 5 V has zeros as components, a + (a) = 0
209
210
where a 5 S, a + b = b + a, a + (b + c) = (a + b) + c;
va 5 V, 1a = a, v(a + b) = va + vb, (v + w)a = va + wa and v(wa) = (vw)a=
The lines and planes that contain the origin are examples of subspaces in
R3 = The following characterization of a subspace in Rq easily follows from the
vector space properties of Rq =
Theorem 5.1.1 (Vector Subspace) A subset V in Rq is subspace if and only if
(i). the scalar multiple of any vector in V must also be in V and
(ii). the sum of any two vectors in V is also in V.
Example 5.1.1. In Section 2.3 a line in R3 was described by a given point
$
$
$
and direction vector as a row vector
u =
u 0 + w g where the parameter w is a
free real number. For the position of particle moving in a straight line w could
represent time. It will be convenient to change to column vector notation so
that a line in R3 is the set of vectors
x = x0 + wd
where x0 represents the given point in R3 > w is a free real number and d is the
given direction vector in R3 = If the given point is the origin, then the line is
called a one-dimensional subspace of R3 and
V = {x 5R3 : x = wd and w 5 R}=
The set of all points in a line, x = 0 + wd = wd> has the two properties in
Theorem 5.1.1. Any scalar multiple of a point is in the line, which follows from
vx = v(wd) = (vw)d where v is a real number. The sum of any two points in
the line is also in the line, which follows from x = w1 d and y = w2 d giving
x + y = w1 d + w2 d = (w1 + w2 )d. If a line in R3 does not contain the origin, then
it is called an a!ne subset of R3 =
Example 5.1.2. Planes in R3 were described in Section 2.4 by a given point
$
$
$
$
and two vectors that are not parallel as
u =
u 0 + u
d + v e where the two
parameters u and v are free real numbers. The column vector notation for a
plane in R3 is
x = x0 + ua + vb
where the two non-parallel vectors are a and b with a 6= bn for any real number
n. If the given point is the origin, then the plane is called a two-dimensional
subspace of R3 and
V = {x 5R3 : x = ua + vb and u> v 5 R}=
Any point in such a plane is represented by x = 0 + ua + vb = ua + vb and
has the two properties in Theorem 5.1.1. Any scalar multiple of a point in the
plane is also in the plane, which follows from w(ua + vb) = (wu)a + (wv)b where w
211
6
2 1 1 3
D = 7 2 4 2 11 8 =
0 3 1 8
The range space of D is the linear combination of the four column vectors in
D= By subtracting row one from row two and then row two from row three we
have
5
6
2 1 1 3
HD = H32 (1) H21 (1) D = 7 0 3 1 8 8 =
0 0 0 0
212
Because the third and fourth columns can be written as a linear combination
of the rst two columns, the range space of HD may be described by the linear
combination of the rst two column vectors in HD.
Denition 5.1.3. A set of vectors y1 > > yn in Rp is called linearly independent if and only if
f1 y1 + + fn yn = 0 implies f1 = f2 = = fn = 0=
This may be stated as \ c = 0 implies c = 0 where \ is the p n matrix of
column vectors and c and 0 are n 1 column vectors.
Example 5.1.1 (continued). In a line R3 containing the origin with one
non-zero vector y1 = d is an example of linearly independent set.
Example 5.1.2 (continued). In a plane R3 containing the origin can be
described by a linear combination of two vectors y1 = a and y2 = b that are
not parallel. Thus, this is an example of a subspace in R3
Example 5.1.3 (continued). Here a subspace in R4 is dened by a linear
combination of two vectors in R4 where y1 = a = [2@6 1@3 1 0]W and
y2 = b = [1@6 8@3 0 1]W = They are linearly independent because the third
and fourth equations in
5
6
5
6 5 6
2@6
1@6
0
9 1@3 :
9 8@3 : 9 0 :
:
9
: 9 :
f1 9
7 1 8 + f2 7 0 8 = 7 0 8
0
1
0
imply f1 = 0 and f2 = 0=
Example 5.1.4 (continued). The rst two column vectors in the new matrix
HD are linearly independent because
5 6
5 6 5 6
2
1
0
f1 7 0 8 + f2 7 3 8 = 7 0 8
0
0
0
implies f1 2 + f2 1 = 0 and f1 0 + f2 3 = 0 and, hence, f1 = 0 and f2 = 0=
An important application is the case where one has n = p linearly independent vectors in Rp . Let D be the p p matrix formed by the columns of
these vectors
D = [y1 y2 yp ]=
Dc = 0 implies c = 0 is equivalent to linearly independent vectors, and in this
case it is characterized by det(D) 6= 0> see Theorem 3.7.3.
Another signicant case is from the least squares problem as described in
Section 4.2 where the p n coe!cient matrix D has more rows than columns
p A n= If the columns are linearly independent, then the n n matrix DW D in
the normal equation has an inverse, see Theorem 4.2.2.
213
5.1.2
214
The linear independence implies u1 u2 = 0 and v1 v2 = 0= The following example shows there may be more that one basis for a particular two-dimensional
subspace, which in Example 5.1.6 is a nullspace of a 1 3 matrix D = [2 2
2].
Example 5.1.5. Consider the two-dimensional subspace in R3 given by the
linear combinations of two vectors a = [1 2 3]W and b = [1 0 1]W . This is
a plane containing the origin whose vector equation is n (x 0) = 0 where
n = a b = [2 2 2]W = This gives the traditional algebraic equation
2{1 + 2{2 2{3 = 0.
Two other vectors that satisfy this equation and are not parallel are b
a = [1
W
W
b
1 0] and b = [0 1 1] . They also describe the original plane because
their vector equation is equivalent to the above algebraic equation. That is,
b = [1 1 1]W and so n
b (x 0) = 0 where n
b =a
bb
b = (1@2)n and
n
b is a linear combination of a and
{1 {2 + {3 = 0. One can explicitly show a
b
ua + vb = b
a
5 6
5
6
1
1
1
u 7 2 8 + v 7 0 8 = 7 1 8 =
3
1
0
5
{1
d11 d12 d13 7 {2 8 = [g1 ] =
{3
Example 5.1.6. Find a particular solution of the equation {1 +2{2 +3{3 = 10
by letting {2 and {3 equal to zero. Then {1 must be equal to 10 and one
particular solution vector is xs = [10 0 0]W = In order to nd the homogeneous
solutions, let {2 and {3 be "free variables" with {2 = u and {3 = v= Then the
215
6
5
6
5
6
2u 3v
2
3
8 = u7 1 8 + v7 0 8=
u
xk = 7
v
0
1
This suggests y1 = a = [2 1 0]W and y2 = b = [3 0 1]W form a basis for
the nullspace of D = [1 2 3]. Clearly, both vectors satisfy the homogeneous
equation and are not parallel and, so, in R3 they are linearly independent. By
Theorem 5.1.2 the general solution is
5
6
5
6 5
6
2
3
10
x = xk + xs = u 7 1 8 + v 7 0 8 + 7 0 8 =
0
1
0
6
5 6
5
6
u
1
0
xk = 7 v@2 8 = u 7 0 8 + v 7 1@2 8 =
v
0
1
Both column vectors on the right side are homogeneous solutions and are not
parallel and, hence, they form a basis for the nullspace of D = [0 2 1]. By
Theorem 5.1.2 the general solution is
5
6
5
6 5 6
1
0
0
x = xk + xs = u 7 0 8 + v 7 1@2 8 + 7 5 8 =
0
1
0
5.1.3
The set of points in R3 that satisfy two equations is equal to the possible
intersection of two planes in R3 = Either the planes never intersect, intersect in a
line or the two planes are the same. Given a collection of algebraic equations it is
not always evident which one of the three cases one has. If the planes are parallel
and are not the same, then there is no solution and the algebraic equations are
called inconsistent. For example, consider the following two equations
{1 + 2{2 + 3{3 = 1
2{1 + 4{2 + 6{3 = 3=
216
By subtracting two times equation one from equation two we have a contradiction 0 = 3 2! In terms of elementary matrices and the augmented matrix this
is
1 0
1 2 3 1
H21 (2) [D d] =
2 1
2 4 6 3
1 2 3 1
=
=
(5.1.1)
0 0 0 1
The last row is equivalent to 0{1 + 0{2 + 0{3 = 1! This means d = [1 3]W is
not in the range space of the 2 3 matrix D=
In the next example the two planes are not parallel and, so, the solution
set will be a line in R3 = Example 2.5.3 illustrates that the direction vector of
the line given by the intersection of the two planes could be found by taking
the cross product of the two normal vectors. The following example gives an
alternative way, which will be useful for higher dimensional systems.
Example 5.1.8. Find all the solutions of
{1 + 2{2 + 3{3 = 4
4{1 + 5{2 + 6{3 = 7=
1 2 3 4
4 5 6 7
1 0
1 2 3 4
H21 (4) [D g] =
4 1
4 5 6 7
1 2
3
4
=
=
0 3 6 9
(5.1.2)
1 2
{1
4
3
=
w
=
0 3
9
6
{2
Find a particular solution by setting {3 = w = 0 and solving for {2 = 9@(3) =
3 and {1 = 4 2(3) = 2 and, hence, xs = [2 3 0]W = In order to nd the
homogeneous solution, replace the right side of the algebraic system by the zero
vector d = 0 and repeat the row operation to obtain
1 2
{1
0
3
=
w
=
0 3
0
6
{2
217
6 5
6
1
2
x = xk + xs = w 7 2 8 + 7 3 8 =
1
0
Note, the direction vector [1 2 1]W is a multiple of the cross product of the
b = [4 5 6]W , which is n n
b = [3 6
two normal vectors n = [1 2 3]W and n
W
3] =
Example 5.1.9. Find all the solutions of
{1 + 2{2 + 3{3 = 4
{1 + 3{2 = 5=
1 0
1 1
1 2 3 4
H21 (1) [D g] =
1 3 0 5
1 2 3 4
=
=
0 1 3 1
(5.1.3)
In this example let {3 = w be the "free variable" so that H21 (1) [D g] represents
an equivalent system
1 2
0 1
{1
{2
=
4
1
w
3
3
1 2
0 1
{1
{2
=
0
0
w
3
3
Solve for {2 = 3w and {1 = 3w 2(3w) = 9w so that xk = [9w 3w w]W = Since
H = H21 (1) has an inverse matrix and by Theorem 5.1.2, the general solution
is
5
6 5 6
9
2
x = xk + xs = w 7 3 8 + 7 1 8 =
1
0
218
5.1.4
The two-loop circuit in Subsection 3.1.5, see Figure 3.1.4, will be used to illustrate how the representation of the solution for the current equation is used.
Let {1 be the potential at the top node relative to the bottom node. The Kirchho voltage law gives three equations for the voltage drops in the three vertical
portions of the loops
;
{1 + H1 U1 l1 = 0
?
{1 U3 l3 = 0
=
{1 (l2 )U2 + H2 = 0=
The Kirchho current law requires the three currents to satisfy
l1 + l2 l3 = 0=
The vector form of the four equations
5
U1 0
0 1
9 0 U2 0
1
9
7 0
0 U3 1
1 1 1 0
is
65
6 5
l1
H1
: 9 l2 : 9 H2
:9
: 9
8 7 l3 8 = 7 0
0
{1
6
:
:=
8
Systems of this form, called the equilibrium equations, also appear in structure,
uid ow and optimizations models, and they will be discussed in more detail
in Section 5.3.
The representation of the current solution to the fourth equation leads to a
reduction in size of the larger algebraic problem. In order to nd the homogeneous solution, let l2 = u and l3 = v be the "free variables" so that l1 = u v=
The vector form of this is
6 5
6
5 6
5
6
5
uv
1
1
l1
ik = 7 l2 8 = 7 u 8 = u 7 1 8 + v 7 0 8 =
v
0
1
l3
The two column vectors on the right side are homogeneous solutions.
The two column vectors are nullspace basis vectors, which can be recorded
in a 3 2 matrix
5
6
1 1
Q = 7 1 0 8=
0 1
This means [1 1 1]Q = [0 0] or equivalently
W
0 0
( 1 1 1 Q )W =
5
6
1
0
=
QW 7 1 8 =
0
1
219
6
H1
7 H2 8
0
5
6
H1
7 H2 8 =
0
6
H1
Q W 7 H2 8
0
5
6
H1
Q W 7 H2 8
0
H1 H2
H1
H1 H2
=
H1
v =
H1 U3 H2 (U1 + U3 )
and
U1 U2 + U1 U3 + U2 U3
H2 U1 H1 U2
=
U1 U2 + U1 U3 + U2 U3
5.1.5
1.
Exercises
220
2.
Let a plane containing the origin be a linear combination of a = [1 1
1]W and b = [2 0 1]W =
(a).
Find the vector and algebraic equations that describe this plane.
b = [0 2 1]W and
(b).
Show this plane is also a linear combination of a
W
b = [1 1 0] =
b
3.
Find the general solution in R3 of 3{1 + 2{2 + {3 = 6=
4.
Find the general solution in R3 of 4{1 + {3 = 4=
5.
Find the general solution in R3 of 2{1 + {2 = 10=
6.
Find the general solution in R3 of 2{1 + 3{2 + 5{3 = 30=
7.
Use an elementary matrix and an augmented matrix to show the following
equations are inconsistent (have no solution)
3{1 + 2{2 + {3 = 2
9{1 + 6{2 + 3{3 = 5=
8.
3{1 + 2{2 + {3 = 2
9{1 + 6{2 + 3{3 = 6=
9.
{1 + 2{2 + {3 = 2
{1 + 3{3 = 3=
10.
{1 + 2{2 + {3 = 2
{1 + 3{2 = 1=
11.
{1 + 2{2 + {3 = 2
2{1 + 5{2 + 3{3 = 7=
12.
(a).
(b).
5.2
5.2.1
221
Solutions in R4
{1 + 2{2 + 3{3 = 1
2{1 + 4{2 + 6{3 = 3=
(5.2.1)
1
=
1
(5.2.2)
222
5.2.2
223
Example 5.2.1. In the above system in (5.2.1) with two equations and four
variables the augmented matrix is
1 2 3 4 1
[D d] =
.
2 4 6 9 3
The row echelon form matrix is
H21 (2) [D d] =
1 2 3 4 1
0 0 0 1 1
where
the two pivots are e1q1 = 1 with q1 = 1 and e2q2 = 1 with q2 = 4= The xed
variables are {1 and {4 > and the free variables are {2 and {3 = The rank of the
2 4 matrix D is two.
Example 5.2.2. Consider the following system with three equations and four
unknowns
;
? {1 + 2{2 + {3 + 3{4 = 1
2{1 + 4{2 + {3 + 7{4 = 3
=
{3 + {4 = 7=
The augmented matrix is
5
6
1 2 1 3 1
[D d] = 7 2 4 1 7 3 8 =
0 0 1 1 7
Subtract 2 times row 1 from row 2 and then
5
1
H32 (1) H21 (2) [D d] = 7 0
0
The three pivots are e1q1 = 1 with q1 = 1, e2q2 = 1 with q2 = 3 and e3q3 = 2
with q3 = 4= The xed variables are {1 > {3 and {4 > and the free variable is
{2 = u= The rank of the 3 4 matrix D is three.
The row echelon form matrix is a short way of writing the equivalent system
6 5 6
5 6
5
65
1
2
1 2 3
{1
7 0 1 1 8 7 {3 8 = 7 1 8 u 7 0 8 =
8
0
0 0 2
{4
A particular solution is found by setting the free variable u = 0 and solving the
upper triangular system for the xed variables. Since the diagonal components
are the pivots, the upper triangular solve can be done to yield a particular
solution xs = [14 0 3 4]W = In order to nd the homogeneous solution,
replace the right side d by the zero vector and solve
6
5 6
5
65
2
1 2 3
{1
7 0 1 1 8 7 {3 8 = u 7 0 8 =
0
0 0 2
{4
224
By Theorem 5.1.2 with H32 (1) H21 (2) the general solution in R4 is
5
6 5
6
2
14
9 1 : 9 0 :
: 9
:
x = u9
7 0 8 + 7 3 8.
0
4
Example 5.2.3. Consider the following system with three equations and four
unknowns
;
2{1 + {2 + {3 + 3{4 = 4
?
2{1 + 4{2 + 2{3 + 11{4 = 10
=
3{2 + {3 + 8{4 = 6=
The augmented matrix is
5
6
2 1 1 3 4
[D d] = 7 2 4 2 11 10 8 =
0 3 1 8 6
Subtract row 1 from row 2 and then subtract row
5
2 1
H32 (1) H21 (1) [D d] = 7 0 3
0 0
The two pivots are e1q1 = 2 with q1 = 1 and e2q2 = 3 with q2 = 2. The xed
variables are {1 and {2 > and the free variables are {3 = u and {4 = v= The rank
of the 3 4 matrix D is two.
The row echelon form matrix is a short way of writing the equivalent system
4
1
3
2 1
{1
=
u
v
=
6
1
8
0 3
{2
A particular solution is found by setting the free variables u = 0 and v = 0
and solving the upper triangular system for the xed variables. A particular
solution is xs = [1 2 0 0]W = In order to nd the homogeneous solution, replace
the right side d by the zero vector and solve
1
3
2 1
{1
= u
v
=
1
8
0 3
{2
225
5.2.3
General Solution of Dx = d
226
of column vectors obtained from the free variables given by the row echelon
matrix. The multiple solutions are all homogeneous solutions plus a particular
solution.
Outline
1.
2.
3.
4.
5.
6.
7.
for Solving Dx = d=
Find the augmented matrix [D d]=
Use elementary matrices to nd the row echelon matrix H[D d]=
There is no solution if the row echelon form matrix is inconsistent.
Use the pivots to nd the xed and free variables.
Find a particular solution of HDxs = Hd=
Set the free variables equal to zero and
solve for the xed variables.
Find the homogeneous solutions of HDxk = H0 = 0=
Replace Hd by the zero vector and
solve for the xed variables in terms of the free variables.
The general solution is the linear combination of the homogeneous
solution plus a particular solution.
Example 5.2.4. This example is more complicated since it has four equations
and six unknowns
;
{1 + {2 + {3 + {4 + {5 + {6 = 1
A
A
?
{1 + 2{2 + {4 + {6 = 1
{
+
{3 + 2{4 + {5 + {6 = 2
A
2
A
=
2{5 + {6 = 4=
The following elementary row operations and
the row echelon form matrix
5
1 1
9 1 2
[D d] = 9
7 0 1
0 0
5
1 1
9 0 1
H32 (1) H21 (1) [D d] = 9
7 0 0
0 0
The free variables
following system
5
1 1
9 0 1
9
7 0 0
0 0
1
1
2
0
1
0
1
2
1
1
1
1
6
1
1 :
:
2 8
4
6
1 1 1 1
0 1 0 0 :
:=
2 2 1 2 8
0 2 1 4
6
5
1
1
9 0
: 9 0 :
: = 9 :u9
7 2
8 7 2 8
0
4
6
6
1
:
9 :
: v9 0 :=
8
7 1 8
1
6
By setting the two free variables to zero and solving the upper triangular system,
we nd a particular solution xs = [1 1 1 0 2 0]W = Set the vector d equal
227
The nullspace of D has dimension equal to two, and the dimension of the range
space is four.
5.2.4
{1 + 2{2 + 3{3 = 1
4{1 + 5{2 + 6{3 = 3=
The augmented matrix is
[D d] =
One row echelon form matrix is
H21 (4) [D d] =
1 2 3 1
4 5 6 3
1 2
3
1
0 3 6 1
1 2 3 1
=
H2 (1@(3)) H21 (4) [D d] =
0 1 2 1@3
A third one is obtained by using row 2 to get a zero in the 12-component
1 0 1 1@3
=
H12 (2) H2 (1@(3)) H21 (4) [D d] =
0 1 2 1@3
This is an example of a reduced row echelon matrix, which can be shown to be
unique. Moreover, the general solution to the algebraic solution of the original
system is easy to construct from
1 0
{1
1@3
1
=
u
where {3 = u.
0 1
1@3
2
{2
228
-1
1
-1
2
229
0
-.5
0
0
-.5
1
AA A*N
0
0
0
0
5.2.5
0
0
0
0
Exercises
(a).
Find the pivots, xed and free variables, and the ranks of D and [D
d].
3.
(b).
Does the algebraic system Dx = d have a solution?
Consider the solution in R4 of
3{1 + 2{2 + {3 + {4 = 6
9{1 + 6{2 + 3{3 + 4{4 = 19=
(a).
Find a row echelon matrix.
(b).
Find the particular solution in R4 =
(c).
Find the homogeneous solutions in R4 =
(d).
Find the general solution in R4 =
4.
Consider the solution in R4 of
;
? 2{1 + {2 + {3 + 3{4 = 1
2{1 + 3{2 + 2{3 + 3{4 = 4
=
4{2 + {4 = 7=
(a).
(b).
(c).
(d).
230
5.
(a).
Find a row echelon matrix.
(b).
Find the reduced row echelon matrix.
(c).
Find the general solution in R4 =
6.
Consider the solution in R4 of
;
? {1 + {2 + {3 + {4 = 1
2{1 + 3{3 + 4{4 = 2
=
2{2 3{3 + 2{4 = 6=
(a).
Find a row echelon matrix.
(b).
Find the reduced row echelon matrix.
(c).
Find the general solution in R4 =
7.
Consider the solution Example 5.2.4. By-hand calculations nd the reduced row echelon matrix.
8.
Use the MATLAB commands rref() and null() to conrm any calculations
done in exercises 2-7.
5.3
In Subsection 5.1.4 an application was given to a two-loop circuit, and the solution was obtained by using the nullspace associated with the current equation
at the top node in Figure 3.1.4. The resulting equation has the form
5
6 5
6
65
U1 0
i1
0 1
{1
9 0 U2 0
: 9
:
9
1 :
9
: 9 {2 : = 9 i2 :
7 0
8
7
8
7
0 U3 1
{3
i3 8
1 1 1 0
|1
j1
where the rst three unknowns are the currents and the fourth unknown is the
potential at the top node relative to the ground, see Figure 3.1.4. This system
is a special case of the equilibrium equations. In this section the general equilibrium equations will be dened and solved by both block Gauss elimination
and nullspace methods. Applications to more complicated circuits, structures
and uid ows models will be outlined. Additional material on equilibrium
equations can be found in chapter two of [8].
Denition 5.3.1. Let D be an q q matrix and H be an p q matrix with
p ? q= The equilibrium equations can be written as
Dx + H W y = f and
Hx = g
231
D HW
x
f
=
=
H
0
y
g
In the above two-loop circuit algebraic system D is the 33 diagonal matrix
with the three resistor values, and H is the 1 3 row matrix with coe!cients
given by the Kirchho current law. Typically, Hx = g represents some sort of
balance or conservation of quantities in x such as currents, mass or forces. The
top equation Dx + H W y = f may be an implementation of an empirical law
such as voltage drops, momentum or deformation from forces.
5.3.1
Lq
D HW
f
0
0
x
Lq
=
g
HD1 Lp
HD1 Lp
y
H
0
W
D
H
x
f
=
=
y
HD1 f + g
0 HD1 H W
Block Gauss Elimination Method for Equilibrium Equations.
1.
Solve Dz = f and D] = H W so that z = D1 f and ] = D1 H W =
2.
Compute Hz g and H]=
3.
Solve H]y = Hz g so that y = (HD1 H W )1 (HD1 f g)=
4.
Let x = z ]y = D1 f D1 H W y=
232
2 1 0
1 1 0
D = 7 1 2 1 8 and H =
=
0 1 1
0 1 2
The inverse of D is
D1
6
3 2 1
= (1@4) 7 2 4 2 8
1 2 3
233
5=5
=75 =75
|1
=
2=5
=75 2=75
|2
whose solution is |1 = 8=8333 and |2 = 1=500= The nal step requires the
computation of x = z ]y
6 5
6 5
6
5
6
5
2=5
=25
=75
5=8333
{1
7 {2 8 = 7 4=0 8 + 7 =5 1=5 8 8=3333 = 7 1=8333 8 =
1=5000
3=5
=25 1=25
3=1667
{3
5.3.2
The nullspace method is patterned on how we solved the two-loop circuit problem in Section 5.1. Again, assume D is symmetric positive denite and H has
full row rank. The full row rank assumption gives the existence of a particular
solution xs so that Hxs = g= Moreover, there is a basis for the nullspace with
q p vectors. Both these can be constructed as illustrated in the previous
sections from the row echelon form of the augmented matrix [H g].
Let Q be the q(qp) matrix formed by the basis vectors for the nullspace
of H. This implies H times each column in Q is a zero vector and, consequently,
HQ = 0. The homogeneous solutions are linear combinations of the columns in
Q , which may be written as a matrix-vector product Q x0 where the coe!cients
in the linear combination are the components of x0 . The general solution of
Hxs = g is
x = xk + xs = Q x0 + xs =
The next step is to put this representation for x into the rst equation
D (Q x0 + xs ) + H W y = f =
Now multiply both sides by Q W and use HQ = 0 giving (HQ )W = 0W > Q W H W =
0 and
Q W (D (Q x0 + xs ) + H W y) = Q W f
Q W DQ x0 + Q W Dxs + Q W H W y = Q W f
Q W DQ x0 + Q W Dxs + 0 = Q W f =
Thus, one must solve
Q W DQ x0 = Q W f Q W Dxs =
The above two assumptions imply the (q p) (q p) matrix Q W DQ has
an inverse.
Finally one can solve for y by multiplying the rst equation by H
H(D (Q x0 + xs ) + H W y) = Hf =
234
1
= Q W (f Dxs ) = 7 1
0
5
6W
1 1
= QW D = 7 1 0 8
0 1
1
0
1
5
2
7 0
0
6W 5
8
0
3
0
6
9
0
7
8
( 9 D0) =
9
0
6
0
2 3 0
0 8=
=
2 0 4
4
The solution of
Z Q x0 = z
6
1 1 0
2 3 0 7
{1
0
1 0 8
=
2 0 4
9
{02
0 1
0
5 2
{1
0
=
=
2 6
9
{02
1 1
0
27@26
18@26
= 7 1 0 8
+ 7 0 8 = 7 18@26 8 =
45@26
0 1
0
45@26
235
1 1 0 4
[H g] =
=
0 1 1 5
The free variable is {3 = u and this is equivalent to
4
0
1 1
{1
=
u
=
5
1
0 1
{2
Set u = 0 and solve for
homogeneous solution by
1
0
= Q W (f Dxs )
65 6
5
6W 5 6 5
1
2 1 0
9
1
= 7 1 8 (7 2 8 7 1 2 1 8 7 5 8)
3
0 1 2
0
1
= 1(12) 1(1) + 1(8) = 19 and
= QW D
6
5
6W 5
2 1 0
1
= 7 1 8 7 1 2 1 8 = 1 2 3 =
0 1 2
1
Solve Z Q x0 = z
1 2 3
6
1
7 1 8 x0 = 19 so that x0 = 19@6=
1
Then x =Q x0 + xs is as follows
5
6
5 6 5
6
1
9
35@6
x = 7 1 8 (19@6) + 7 5 8 = 7 11@6 8 =
1
0
19@6
236
Find y by solving HH W y = H W (f D (Q x0 + xs ))
5
6
5
6
53@6
1 0
1 1 0 7
1 1 0 7
|1
44@6 8
1 1 8
=
0 1 1
|2
0 1 1
9@6
0 1
2 1
|1
97@6
=
1 2
35@6
|2
whose solution is |1 = 159@18 and |2 = 27@18=
5.3.3
Consider the three-loop circuit in Subsection 3.6.3, see Figure 3.6.1. The matrix
equation for the ve currents x and two potentials at the top nodes y is
5
65
6
6 5
{1
U1 0
H1
0
0
0 1 0
9
9 0 U2 0
:
: 9
0
0
1 1 :
9
: 9 {2 : 9 H2 :
9
9 0
:
:
:
9
0
U
0
0
1
0
{
0
3
9
:9 3 : 9
:
9
9 0
:
:=
:
9
0
0
U
0
0
0
1
{
=
4
9
:9 4 : 9
:
9
9 0
:
:
:
9
H
0
0
0
U
0
1
{
5
3 :
9
:9 5 : 9
7 1 1 1 0
0
0
0 8 7 |1 8 7 0 8
0 1 0 1 1
0
0
0
|2
This is an equilibrium equation with D being a 5 5 diagonal matrix and the
augmented matrix being
1 1 1 0 0 0
[H g] =
=
0 1 0 1 1 0
Here we outline the nullspace method, which can be viewed as a dimension
reduction scheme where the size of the matrix solves gets smaller. The following
row operations transform the augmented matrix to reduced row echelon form
1 0 1 1 1 0
H12 (1) H2 (1) H1 (1) [H g] =
=
0 1 0 1 1 0
There are three free variables {3 = u> {4 = v and {5 = w> and this implies
1 0
{1
0
1
1
1
=
u
v
w
=
0 1
0
0
1
1
{2
Then the homogeneous solutions
5
1
9 0
9
xk = u 9
9 1
7 0
0
are
6
:
9
:
9
: + v9
:
9
8
7
1
1
0
1
0
:
9
:
9
: + w9
:
9
8
7
1
1
0
0
1
6
:
:
:=
:
8
237
6
1 1 1
0 1 1 :
:
1
0 0 :
:=
0
1 0 8
0
0 1
The matrix for the solve in step ve is only 3 3> which is smaller than the
7 7 matrix in the equilibrium equation,
5
6
U1 + U3
U1
U1
U1
U1 + U2 + U4
U1 U2 8 =
Q W DQ = 7
U1
U1 U2
U1 + U2 + U5
5.3.4
The six-bar truss in Subsection 3.4.4, see Figure 3.4.1, assumed there was no
deformation of the bars when an external force is applied to one or more nodes.
If the force is large, then there may be some signicant movement of the nodes
resulting in extension or compression of the connecting bars. The model of this
has the form of the equilibrium equations. The rst equation is an enhanced
version of Hookes law, which we will not go into. The second equation manages
the assembly of the local forces and requires the sum of the forces at each node
to be a zero force vector.
Assume the structure deforms only in one plane so that at each end of
the bar (often called an element) there is a two-dimensional force vector, see
Figure 5.3.1. Let the superscript h denote the bar or element number, list the
force components in the horizontal direction by odd number subscripts and
238
the vertical forces by the even subscripts so that for each bar there is a fourdimensional force vector
W
f h = i1h i2h i3h i4h
=
Using the same labels as in Figure 3.4.1, the sum of the forces at each node
gives
Node 1:
Node 2:
Node 3:
[i11
Now there are still three two-dimensional vector equations, but there are 18
local force components. This can be written as Hx = g where H is an 6 18
matrix and g is a external force vector with six components. In Hx = g the two
equations from the two-dimensional vector equation at node one are in rows one
and two, and the remaining four rows are obtained from the vector equations
at nodes two and three where
6
5
0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
9 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 :
:
9
9 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 :
:>
9
H = 9
:
9 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 :
7 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 8
0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1
g = [0 z 0 0 0 0]W and
x = [i11 i21 i31 i41 i12 i22 i32 i42 i13 i23 i33 i43 i34 i44 i35 i45 i36 i46 ]W =
The corresponding augmented matrix may be transformed to a row echelon
form matrix by simply moving rows ve and six to rows one and two. The
development of the rst equation in the equilibrium equations is beyond the
scope of this course, but this illustration should give the reader an appreciation
for the role of row echelon forms and nullspaces.
5.3.5
Models for uid ow have two basic parts. The rst part describes the momentum in the directions of the ow, and the second part tracks the change in
mass. When a volume is broken into union of small cubes, then these parts form
the rst and second equations in the equilibrium equations. In the case of an
incompressible liquid such as water, any mass moving into a xed volume must
also leave the volume. The incompressibility condition is similar to Kirchhos
current law and to the balance of forces at each node of a truss.
In order to keep the discussion as simple as possible, consider uid ow in
a plane, and the rate of change of mass for four adjacent squares or cells as
indicated in Figure 5.3.2. Each cell has a horizontal and vertical component
239
that are proportional to the velocity components in the uid. Let cell l have
horizontal and vertical components given by xl and yl where l = 1> 2> 3 and 4.
For each cell the mass in minus the mass out yields four equations for the eight
unknown components. For the four cells depicted in Figure 5.3.2 with incoming
mass for cells 1-3, we have the following four equations
Cell
Cell
Cell
Cell
1:
2:
3:
4:
v1 x1 + y2 y1 = 0>
v2 x2 + v2 y2 = 0>
x2 x3 + v3 y3 = 0 and
x1 x4 + y3 y4 = 0=
1
0 0
9 0
1 0
9
7 0 1 1
1 0 0
0
0
0
1
1 1 0
0 1
0
0 0
1
0 0 1
9
69
0 9
9
9
0 :
:9
0 89
9
1 9
9
7
x1
x2
x3
x4
y1
y2
y3
y4
6
:
: 5
:
v1
:
: 9 v2 + v2
:=9
: 7
v3
:
:
0
:
8
6
:
:=
8
240
5.3.6
The MATLAB codes E_eq_bge.m and E_eq_null.m implement the block Gauss
elimination and nullspace methods for the two-loop circuit problem. They can
easily be modied to do more complicated problems. The following solves the
three-loop circuit problem with the same parameters as in Subsection 3.6.3,
Example 3.6.4.
AA A =
1. 0
0 .1
0 0
0 0
0 0
0
0
3.
0
0
0
0
0
2.
0
0
0
0
0
4.
AA E =
-1 1 -1 0 0
0 -1 0 -1 1
AA f =
10
-20
0
0
-30
AA g =
AA
AA
AA
AA
AA
AA
0
0
N = null(E,r)
N=
-1 -1 1
0 -1 1
1 0 0
0 1 0
0 0 1
xp = E\g;
z = (N*A*N)\(N*(f - A*xp));
x = xp + N*z;
y = (E*E)\(E*(f - A*x));
sol_null = [x;y]
sol_null =
-5.2290
-10.3053
-5.0763
1.8702
-8.4351
-15.2290
3.7405
5.3.7
241
Exercises
1.
Find the solution of the following equilibrium equation using the block
Gauss elimination method
65
6
5
6 5
{1
1 0 0
2
1
9
:
9 0 2 0
: 9
1 :
: 9 {2 : 9 6 :
9
7 0 0 3 1 8 7 {3 8 = 7 12 8 =
2 1 1 0
0
|1
2.
Find the solution of the following
Gauss elimination method
5
3 1 0 1 0
9 1 3 1 1 2
9
9 0 1 3 0 1
9
7 1
1
0 0 0
0
2
1 0 0
{1
{2
{3
|1
|2
: 9
: 9
:=9
: 9
8 7
1
2
3
4
5
6
:
:
:=
:
8
3.
Find the solution of the equilibrium equation in exercise 1 using the
nullspace method.
4.
Find the solution of the equilibrium equation in exercise 2 using the
nullspace method.
5.
Use MATLAB to conrm any calculations in exercises 1-4.
6.
Modify the six-bar truss problem to have external forces at both nodes
one and three. Find the new equation [H g] and its reduced row echelon form.
7.
In the uid ow problem consider six cells by attaching two cells to the
right of cells three and four. Find the new equation [H g] and its reduced row
echelon form.
Chapter 6
6.1
A rst order linear initial value problem for an unknown function { = {(w) with
given i (w) is
g{
= {0 = d{ + i (w) and {(0) = {0 =
gw
This can be written in dierential operator form where O({) {0 d{ and
O({) = i (w)= The operator O is called linear because
O({ + |) = ({ + |)0 d({ + |)
= {0 d{ + | 0 d|
= O({) + O(|)
243
244
6.1.1
Motivating Applications
A simple model for the vertical velocity y of a projectile is derived from Newtons
law of motion
py 0 = fy pj
where p is the mass, j is the gravitational constant and fy is the air resistance.
In this case { = y, d = f@p, i (w) = j and {(0) = y(0) is the initial velocity.
The velocity as a function of these parameters is
y(w) = (y(0) + pj@f)h(f@p)w pj@f=
Another application is to circuits. Suppose the circuit has two components
in series and an imposed voltage Y (w) = 110 sin(120w)= Let one component be
a resistor U with voltage drop LU and the other component be a capacitor F
with voltage drop T@F where T is the charge and T0 = L. Kirchhos voltage
law gives
T0 U + (1@F)T = Y (w)
where { = T, d = 1@(UF), i (w) = Y (w)@U and {(0) = T(0) is the initial
charge. Since i (w) is now a function of time, the solution is a little more di!cult
to nd, see Example 6.1.4.
A third application is modeling the amount D(w) of a chemical in a single
mixing tank with xed volume Y with incoming concentration F(w) with ow
rate U and outgoing concentration D(w)@Y and ow rate U. The rate of change
of D(w) is the rate incoming minus the rate outgoing
D0 = UF(w) U(D@Y )=
Here { = D, d = D@Y , i (w) = UF(w) and {(0) = D(0) is the initial amount.
If the incoming concentration F(w) varies with time, then the solution step will
be more challenging.
245
Example 6.1.1. Consider the single mixing tank model with U = 6, F = =1,
Y = 1000 and zero initial amount. The initial value problem is
D0 = =6 =006D and D(0) = 0=
We wish to verify D(w) = 100h=006w + 100 is the solution. The left and right
sides of the dierential equation must be equal and the solution evaluated at
time w = 0 must also be zero:
left side = D0 = (100h=006w +100)0 = 100(h=006w )0 = 100h=006w (=006)>
right side = =6 =006(100h=006w + 100) = =006(100h=006w ) and
D(0) = 100h=006(0) + 100 = 100(1) + 100 = 0=
It is always a good idea to check or verify a proposed solution is truly a solution.
6.1.2
6.1.3
The method of undetermined coe!cients works for some classes of i (w)> and it
is an "educated" guess for the form of the solution. The simplest class is if i (w)
is a polynomial of w, and in this case one speculates that the particular solution
may also be a polynomial. The coe!cients in the polynomial particular solution
must be chosen so that the dierential equation holds for all values of w. Other
classes of i (w) are sine, cosine and exponential functions, and the particular
solution for these are illustrated in the following examples.
Example 6.1.2. Consider the initial value problem
{0 = 3{ + 2w + 1 and {(0) = 10=
246
Fh
{(0) = 10
(2@3)0 5@9 = 10
F 5@9 = 10=
247
Fh
d(0)
{(0) = 10
+ (4@(2 d))h2(0) = 10
F + 4@(2 d) = 10=
6.1.4
248
where the function y(w) (the variation of parameter) will be chosen so that the
dierential equation holds. Use the product rule to compute the derivative
dw
0
h y(w)
= d hdw y(w) + i (w)
dw 0
h
y(w) + hdw (y(w))0 = d hdw y(w) + i (w)
249
6.1.5
MATLAB can do symbolic operations, which is in contrast to numerical computation. The MATLAB command int() does symbolic integration such as in
Example 6.1.5 where integration by parts was required.
AA syms t a
AA sol = int(exp(-a*t)*(2*t+1),t)
AA
sol = -1/a*(-2/a*(-exp(-a*t)*a*t-exp(-a*t))+exp(-a*t))
AA simple(sol)
AA
-exp(-a*t)*(2*a*t + 2 + a)/a^2
The MATLAB command dsolve() nds the symbolic solution of many initial
value problems such as in Example 6.1.5.
AA syms t a
AA solde = dsolve(Dx = a*x + 2*t + 1, x(0) = 10)
AA
solde = -2/a*t - 2/a^2 - 1/a + (2 + a + 10*a^2)/a^2*exp(a*t)
Both the above symbolic calculations agree with the by-hand calculations done
in Example 6.1.5.
6.1.6
Exercises
1.
As in Example 6.1.1 verify { = (95@9)h3w (2@3)w 5@9 is a solution to
Example 6.1.2.
2.
As in Example 6.1.1 verify { = 14h3w + (4)h2w is a solution to Example
6.1.3.
3.
Consider the initial value problem {0 = 5{ + 3w + 2 and {(0) = 5=
(a).
Find the homogeneous solution.
(b).
Use undetermined coe!cients to nd the particular solution.
(c).
Find the solution to the initial value problem.
4.
Consider the initial value problem {0 = 3{ + 3w2 + 2w + 1 and {(0) = 10=
(a).
Find the homogeneous solution.
(b).
Use undetermined coe!cients to nd the particular solution
(see the remark at the end of Example 6.1.2).
(c).
Find the solution to the initial value problem.
5.
Consider the initial value problem {0 = 2{ + 10h3w and {(0) = 5=
(a).
Find the homogeneous solution.
(b).
Use undetermined coe!cients to nd the particular solution.
(c).
Find the solution to the initial value problem.
6.
Consider the initial value problem {0 = 2{ + 4h2w and {(0) = 12=
(a).
Find the homogeneous solution.
250
(b).
6.2
Second order initial value problems require one to nd a function of time {(w)
that satises a dierential equation with two time derivatives and two initial
conditions. We will focus on second order linear initial value problems with
constant coe!cients
d{00 + e{0 + f{ = i (w) with {(0) = {0 and {0 (0) = y0 =
The motion of a projectile as illustrated in Subsection 2.3.3 is an example where
{(w) is the position, {0 (w) is the velocity in one direction, {00 (w) is the acceleration
and the dierential equation is derived from Newtons law of motion. Two
important applications are the motion of mass attached to a spring and the
electrical current in a series LRC circuit. These are precursors to models of
cars and trucks with several springs and shock absorbers and to models of
tuning circuits for a radio or television.
251
6.2.1
p
p
p
p
g
gp
n@pw = cos( n@pw) n@p
sin( n@pw) = cos( n@pw)
gw
gw
p
p
p
p
p
g
cos( n@pw) n@p = sin( n@pw) n@p n@p=
gw
This means p{001 = n{1 = The verication for {2 (w) is similar. Because the
derivative operation is linear, the most general solution of p{00 + n{ = 0 is a
252
f1 sin(2(0)) + f2 cos(2(0)) = 2
f1 0 + f2 1 = 2 and
f1 cos(2(0)) 2 f2 sin(2()) 2 = 1
f1 2 + f2 0 = 1=
Note, {0 (0) means rst compute the derivative and then evaluate the derivative
at time equal to zero. This algebraic system in matrix form is
0 1
f1
2
=
2 0
1
f2
and is easy to solve. So, the solution of the second order initial value problem
is
{(w) = (1@2) sin(2w) + 2 cos(2w)=
6.2.2
= 0
= 0=
253
6.2.3
254
p
s
52 4(1)(6))@2 = (5 49)@2 = 1 or 6=
6.2.4
00
O(wh(e@2d)w ) = d wh(e@2d)w + e(wh(e@2d)w )0 + f(wh(e@2d)w )
= d(wh(e@2d)w (e@2d)2 + 2h(e@2d)w (e@2d))
e(1h(e@2d)w + wh(e@2d)w (e@2d)) + f(wh(e@2d)w )
= h(e@2d)w [(d2(e@2d) + e) + w(d(e@2d)2 + e(e@2d) + f)]
= h(e@2d)w [0 + w(0)] = 0=
255
Example 6.2.3. The second order dierential equation {00 + 4{0 + 4{ = 0 has
the characteristic equation
u2 + 4u + 4 = 0
whose solution is
u = (4
p
s
42 4(1)(4))@2 = (4 0)@2 = 2 and 2=
6.2.5
Let {1 (w) and {2 (w) be homogeneous solutions so that {(w) = f1 {1 (w) + f2 {2 (w)
is also a homogeneous solution. We want to be able to choose the coe!cients
such that the initial conditions {(0) = {0 and {0 (0) = y0 hold. This results in
the following algebraic problem
{(0) = f1 {1 (0) + f2 {2 (0) and
{0 (0) = f1 {01 (0) + f2 {02 (0)=
The matrix form is
{1 (0) {2 (0)
{01 (0) {02 (0)
The 2 2 matrix
Z (0)
f1
f2
=
{1 (0) {2 (0)
{01 (0) {02 (0)
{0
y0
1 1
det(Z (0)) = det(
) = u2 u1 6= 0=
u1 u2
256
1
0
e@2d 1
) = 1 6= 0=
Thus, one can solve the initial value problem for the both the distinct and
repeated real solutions of the characteristic equation. These results are summarized in the following theorem
Theorem 6.2.1 (Homogeneous Linear Initial Value Problem) Let {1 (w) and
{2 (w) be homogeneous solutions of the dierential equation O({) = d{00 + e{0 +
f{ = 0. Consider the initial value problem given by the dierential equation
and the initial conditions {(0) = {0 and {0 (0) = y0 = L is a linear operator
and, so, f1 {1 (w) + f2 {2 (w) is also a homogeneous solution. If det(Z (0)) =
{1 (0){02 (0) {2 (0){01 (0) 6= 0> then one can nd the coe!cients such that the
initial conditions hold, and the solution of the initial value problem is unique.
6.2.6
The MATLAB command dsolve() can also be used to solve linear second order
initial value problems. The following illustrate how Examples 6.2.1-6.2.3 can
be done using dsolve(), and note the results agree with the above by-hand
calculations.
AA syms m k t
% example 1
AA dsolve(m*D2x + k*x = 0,t)
C1*sin((k/m)^1/2*t) + C2*cos((k/m)^1/2*t)
% example 1 with initial conditions
AA dsolve(D2x + 4*x = 0,x(0) = 2,Dx(0) = 1,t)
2*cos(2*t) + 1/2*sin(2*t)
% example 2 with initial conditions
AA dsolve(D2x + 5*Dx - 6*x = 0,x(0) = 1,Dx(0) = 2,t)
8/7*exp(t) - 1/7*exp(-6*t)
% example 3 with initial conditions
AA dsolve(D2x + 4*Dx +4*x = 0,x(0) = 1,Dx(0) = 3,t)
exp(-2*t) + 5*exp(-2*t)*t
6.2.7
1.
Exercises
257
3.
Verify {(w) = h2w + 5wh2w is the solution of the initial value problem in
Example 6.2.3.
4.
Consider the initial value problem {00 3{0 + 2{ = 0 with {(0) = 1 and
0
{ (0) = 2=
(a).
Find the homogeneous solutions.
(b).
Find the solution to the initial value problem.
5.
Consider the initial value problem 2{00 + 2{0 12{ = 0 with {(0) = 1
and {0 (0) = 1=
(a).
Find the homogeneous solutions.
(b).
Find the solution to the initial value problem.
6.
Consider the initial value problem {00 + 2{0 + { = 0 with {(0) = 2 and
{0 (0) = 1=
(a).
Find the homogeneous solutions.
(b).
Find the solution to the initial value problem.
7.
Consider the initial value problem 3{00 24{0 + 48{ = 0 with {(0) = 2
and {0 (0) = 3=
(a).
Find the homogeneous solutions.
(b).
Find the solution to the initial value problem.
8.
Use the MATLAB command dsolve() to conrm any by-hand calculations
in exercises 4-7.
9.
Let {(w) and |(w) be solutions of the initial value problem
d{00 + e{0 + f{ = 0 with {(0) = {0 and {0 (0) = y0
d| 00 + e| 0 + f| = 0 with |(0) = {0 and | 0 (0) = y0 =
(a).
(b).
Let Z (0) be the Wronskian associated with the dierential equation. Assume det(Z (0)) 6= 0 and show }(w) must be zero and, hence, the
solution of the initial value problem is unique.
6.3
258
6.3.1
In this section we use Eulers formula for the complex exponential function, see
Section 1.2,
hl|
h}
The sine and cosine functions can be expressed as complex linear combinations
of hl| and hl|
cos(|) =
sin(|) =
1 l| 1 l|
and
h + h
2
2
1 l|
1
h hl| =
2l
2l
We will use these when { is replaced by the real part uw, and | is replaced by
the imaginary part of uw.
When e2 4df ? 0> the solutions of the characteristic equation can be
expressed as
u
= l where
e@2d and
p
e2 + 4df@2d=
{1 (0) {2 (0)
1 0
det(Z (0)) = det(
)
=
det(
) = 6= 0>
{01 (0) {02 (0)
and, therefore, one can nd f1 and f2 such that f1 {1 (w) + f2 {2 (w) will satisfy
given initial values {(0) and {0 (0).
Example 6.3.1. Again consider the undamped mass-spring system p{00 +n{ =
2
0 where ds= p> e = 0 and
p f = n so that e 4df = 0 4pn ? 0= Then = 0
and = 4pn@2p = n@p and
p
p
{1 (w) = h0w cos( n@pw) = cos( n@pw) and
p
p
{2 (w) = h0w sin( n@pw) = sin( n@pw).
259
Suppose the mass is initially at rest and is one unit to the left of the equilibrium
position, that is, {(0) = 1 and {0 (0) = 0= Find f1 and f2 so that f1 {1 (w) +
f2 {2 (w) satises these initial conditions
p
p
f1 cos( n@p0) + f2 sin( n@p0) = f1 1 + f2 0 = 1 and
p
p
p
p
p
f1 sin( n@p0)( n@p) + f2 cos( p@n0) n@p = f1 0 + f2 n@p = 0=
The matrix version of this algebraic system is
1 p0
1
f1
=
0
f2
0
n@p
whose solution is f1 = 1 and f2 = 0= The solution of the corresponding initial
value problem is
p
p
p
{(w) = (1) cos( n@pw) + (0) sin( n@pw) = cos( n@pw)=
Example 6.3.2. Consider the initial value problem {00 + 6{0 + 25{ = 0 with
{(0) = 2 and {0 (0) = 3= First, the characteristic equation is u2 + 6u + 25 = 0
and the solution is
p
6 62 4(1)25
u=
= 3 4l=
2(1)
Second, note this is the complex root case where = 3 and = 4 and, thus,
the homogeneous solutions are
{1 (w) = h3w cos(4w) and
{2 (w) = h3w sin(4w).
Third, nd f1 and f2 so that {(w) = f1 {1 (w) + f2 {2 (w) satises the given initial
conditions. Here we must compute the derivative of {(w) by using the product
rule
{0
1 0
3 4
f1
f2
=
2
3
260
The algebraic solution is f1 = 2 and f2 = 9@4> and the solution to the initial
value problem is
{(w) = 2h3w cos(4w) + (9@4)h3w sin(4w)=
Note, the mass-spring oscillates, but amplitudes of the oscillations rapidly decrease to zero. This is a result of the friction forces, which remove energy from
the mass-spring system.
6.3.2
Consider the model given by p{00 + e{0 + n{ = 0 where the mass p and spring
constant n are xed and the friction (damping) constant e is positive with small
to large values. As e goes from small to large, the nature of the homogeneous
solution will change due to changing characteristic equation roots from complex,
repeated to distinct real roots. The three types of homogeneous solutions are
e2 4pn
e2 4pn
e2 4pn
? 0 (underdamped) :
p
p
h(e@2p)w cos( 4pn e2 w) and h(e@2p)w sin( 4pn e2 w)
= 0 (critically damped ) :
h(e@2p)w and wh(e@2p)w
A 0 (overdamped) :
s
e2 4pn@2p)w
h(e@2p
s
e2 4pn@2p)w
and h(e@2p+
Because p> e and n are all positive, the coe!cients of time w in the above
exponential function are all negative. This implies the homogeneous solution
will approach zero as time increases, which is not the case if e is zero.
Example 6.3.3. Let p = 1, n = 1 and vary e = 1> 2 and 4= Consider the initial
value problem
{00 + e{0 + { = 0 with {(0) = 2 and {0 (0) = 0=
The characteristic equation is u2 + eu + 1 = 0 whose solutions are
s
e e2 4
u=
=
2
s Let e = 1 so that the characteristic equation has complex roots u = 1@2
l 3@2 and the homogeneous solutions have the form
s
s
{(w) = f1 h(1@2)w cos(( 3@2)w) + f2 h(1@2)w sin(( 3@2)w)=
As in Example 6.3.2 the initial conditions are used to nd the coe!cients
f1 h(1@2)(0) cos(0) + f2 h(1@2)(0) sin(0) = f1 1 + f2 0 = 2 and
s
f1 (1@2 + 0) + f2 (0 + 3@2) = 0=
1
s0
1@2
3@2
f1
f2
2
0
261
s
The algebraic solution is f1 = 2 and f2 = 2@ 3> and the solution to the initial
value problem is
s
s
s
{(w) = 2h(1@2)w cos(( 3@2)w) + (2@ 3)h(1@2)w sin(( 3@2)w)=
Let e = 2 and in this case the characteristic equation has repeated real roots
u = 1 and 1 and the homogeneous solution is
{(w) = f1 hw + f2 whw =
Imposing the initial conditions gives
f1 1 + f2 0 = 2 and
f1 (1) + f2 (1 + 0) = 0
whose matrix form is
1 0
1 1
f1
f2
=
2
0
The algebraic solution is f1 = 2 and f2 = 2> and the solution to the initial value
problem is
{(w) = 2hw + 2whw =
s
Let e = 4> which illustrates the distinct real roots case with u = 2 3>
and the general homogeneous solution is
s
3)w
{(w) = f1 h(2+
s
3)w
+ f2 h(2
1s
1s
2 + 3 2 3
f1
f2
=
2
0
s
s
s
By Cramers rule
is f1 s
= 2(2 3)@(2 3) = 2@ 3 + 1 and
s the solution
s
f2 = 2(2 + 3)@(2 3) = 2@ 3 + 1= The solution to the initial value
problem is
s
s
s
s
{(w) = (2@ 3 + 1)h(2+ 3)w + (2@ 3 + 1)h(2 3)w =
262
6.3.3
The MATLAB command dsolve() is used to nd the symbolic solutions to Example 6.3.3 for e = 0> 1> 2 and 4= Then the MATLAB command ezplot() is used
to generate Figure 6.3.1.
AA % b = 0
AA solb0 = dsolve(D2x + 0*Dx + x = 0,x(0) = 2,Dx(0) = 0, t)
solb0 = 2*cos(t)
AA % b =1
AA solb1 = dsolve(D2x + 1*Dx + x = 0,x(0) = 2,Dx(0) = 0, t)
solb1 = 2*exp(-1/2*t)*cos(1/2*3^(1/2)*t)
+ 2/3*3^(1/2)*exp(-1/2*t)*sin(1/2*3^(1/2)*t)
AA % b = 2
AA solb2 = dsolve(D2x + 2*Dx + x = 0,x(0) = 2,Dx(0) = 0, t)
solb2 = 2*exp(-*t) + 2*exp(-t)*t
AA % b = 4
AA solb4 = dsolve(D2x + 4*Dx + x = 0,x(0) = 2,Dx(0) = 0, t)
solb4 = (2/3*3^(1/2) + 1)*exp((-2 + 3^(1/2))*t)
+ 1/3*(-2 + 3^(1/2))*3^(1/2)*exp(-(2 + 3^(1/2))*t)
AA % use ezplot to create the curves on the same graph
AA ezplot(solb4, [0 8])
AA hold on
AA ezplot(solb2, [0 8])
AA ezplot(solb1, [0 8])
AA ezplot(solb0, [0 8])
6.3.4
Exercises
1.
Consider the homogeneous solutions {1 (w) = hw cos(w) and {2 (w) =
hw sin(w)=
(a).
Compute their derivatives.
(b).
Find the Wronskian matrix Z (0)=
(c).
Show det(Z (0))
p= =
2.
Verify {(w) = cos( n@pw) is the solution for Example 6.3.1.
3.
Consider the initial value problem 3{00 + 27{ = 0 with {(0) = 2 and
0
{ (0) = 1=
(a).
Find the homogeneous solutions of the dierential equation.
(b).
Find the solution to the initial value problem.
4.
Consider the initial value problem {00 + 2{0 + 2{ = 0 with {(0) = 1 and
{0 (0) = 1=
(a).
Find the homogeneous solutions of the dierential equation.
(b).
Find the solution to the initial value problem.
5.
Consider the initial value problem 2{00 + 4{0 + 6{ = 0 with {(0) = 1 and
{0 (0) = 2=
(a).
Find the homogeneous solutions of the dierential equation.
263
(b).
6.
Consider Example 6.3.3. Verify the proposed functions are really solutions for the three choices of e=
7.
Consider the initial value problem {00 + 4{0 + n{ = 0 with {(0) = 3 and
0
{ (0) = 0= Find the solutions for variable n = 1> 4 and 10=
8.
Consider the initial value problem p{00 + 4{0 + 1{ = 0 with {(0) = 3 and
0
{ (0) = 0= Find the solutions for variable p = 1> 4 and 10=
9.
Use MATLABs command dsolve() to conrm any calculations done in
exercises 3 5> 7 and 8=
6.4
264
6.4.1
Any function {(w) = {s (w) that satises the second order dierential equation
O({) = d{00 + e{ + f{ = i (w)
is called a particular solution. Because O is a linear operator, see Denition
6.2.1, any homogeneous solution plus a particular solution will also satisfy
O({) = i (w)
O(f1 {1 + f2 {2 + {s ) = O(f1 {1 ) + O(f2 {2 ) + O({s )
= f1 O({1 ) + f2 O({2 ) + O({s )
= f1 0 + f2 0 + i (w) = i (w)=
The general solution is denoted by f1 {1 + f2 {2 + {s where {1 is not a multiple
of {2 =
Theorem 6.4.1 (Properties of L(x)) Let O({) d{00 + e{ + f{ where d> e and
f are constants. If O({1 ) = 0> O({2 ) = 0 and O({s ) = i (w)> then
1.
2.
3.
4.
265
0 2
2 3
d0
d1
=
3
1
00
0
2
d2 w + d1 w + d0 + 2 d2 w2 + d1 w + d0 + 2 d2 w2 + d1 w + d0 = 2w2 + 3w + 2
266
w
(d(2h
267
6.4.2
(6.4.1)
The solution of the initial value problem (IVP) O({) = i (w) with {(0) = {0 and
{0 (0) = y0 is found by choosing f1 and f2 in the general solution so that the
initial conditions are satised. This reduces to two algebraic equations
{(0) = f1 {1 (0) + f2 {2 (0) + {s (0) and
{0 (0) = f1 {01 (0) + f2 {02 (0) + {0s (0)=
The matrix form of this system is
{0 {s (0)
{1 (0) {2 (0)
f1
=
=
y0 {0s (0)
{01 (0) {02 (0)
f2
(6.4.2)
{1 (0) {2 (0)
>
Z (0)
{01 (0) {02 (0)
and in order to solve for the coe!cients, it must have non-zero determinant.
Using Theorem 3.7.3 and the discussion in Section 5.1, this is equivalent to the
column vectors in Z (0) being linearly independent. These results are summarized in the following theorem.
Theorem 6.4.2 (Second Order Linear Initial Value Problem) Consider the
nonhomogeneous initial value problem O({) = d{00 + e{0 + f{ = i (w) with {(0) =
{0 and {0 (0) = y0 = Let {1 (w) and {2 (w) be homogeneous solutions and {s (w) be
a particular solution. If det(Z (0)) 6= 0> then the nonhomogeneous initial value
problem has a solution given by (6.4.1) and the algebraic solution of (6.4.2).
268
Outline
1.
2.
3.
4.
Example 6.4.2 with initial conditions {(0) = 2 and {0 (0) = 1= Steps 1-3
have been done and yield
{ = f1 hw cos(w) + f2 hw sin(w) + w2 + (1@2)w + (1@2)=
The particular solution is {s (w) = w2 + (1@2)w + (1@2) so that {s (0) = 1@2 and
{0s (0) = 1@2= The algebraic system in (6.4.2) is
1 0
1 1
f1
f2
=
2 1@2
1 (1@2)
whose solution is f1 = 3@2 and f2 = 3= Thus, the solution to the initial value
problem is
{ = (3@2)hw cos(w) + 3hw sin(w) + w2 + (1@2)w + (1@2)=
Example 6.4.4 with initial conditions {(0) = 1 and {0 (0) = 2= Steps 1-3
have been done and yield
{ = f1 hw + f2 h2w + 5whw =
The particular solution is {s (w) = 5whw giving {s (0) = 0 and {0s (0) = 5= The
algebraic system in (6.4.2) is
1
1
f1
10
=
=
1 2
25
f2
The solution is found by using Cramers rule to be f1 = 1@(1) = 1 and
f2 = 2@(1) = 2= Thus, the solution to the initial value problem is
{ = hw + 2h2w + 5whw =
6.4.3
The forced mass-spring model has an external force i (w) 6= 0 as well as forces
from the spring and from friction. The corresponding initial value problem is
p{00 + e{0 + n{ = i (w) with {(0) = {0 and {0 (0) = y0 = In order to keep the
discussion as clear as possible, let p = 1, e = 0, n = 1 and i (w) = sin(zw)
with {(0) = 0 and {0 (0) = p
0= The natural frequency, which
is given by the
p
homogeneous
solutions
cos(
n@pw)
=
cos(w)
and
sin(
n@pw)
= sin(w)> is
p
n@p@(2) = 1@(2)> and the frequency of the external force is z@(2)= The
269
1
sin(zw)=
1 z2
Since the denominator goes to zero as z approaches one, this indicates some
special event!
Next impose the initial conditions on the general solution
{(w) = f1 cos(w) + f2 sin(w) +
1
sin(zw)=
1 z2
z
1
sin(w) +
sin(zw)=
2
1z
1 z2
z sin(w) + sin(zw)
=
1 z2
Write this solution as a function of both w and z> and compute the limit with
respect to z using LHpitals rule
lim {(w> z) =
z$1
=
=
g
gz (z sin(w) + sin(zw))
g
2
z$1
gz (1 z )
lim
sin(w) + cos(zw) w
2z
1
w cos(w)
sin(w) +
=
2
2
lim
z$1
270
Since the amplitude of cos(w) is w@(2)> the spring eventually will be deformed
so much that the model is no longer valid. This is known as pure resonance,
and it can be controlled by inserting a suitable amount of resistive or damping
force, as is illustrated in the next subsection.
The solution of the above limiting case can also be derived directly by letting
z = 1 and nding the solution to {00 + { = sin(w)= Since i (w) = sin(w) is also a
particular solution, we speculate the particular solution has the form
{s (w) = w(d cos(w) + e sin(w))=
By placing this into the dierential equation and collecting like terms we have
(0)w sin(w) + (0)w cos(w)(e + e) 2e sin(w) 2d cos(w) = 1 sin(w) + 0 cos(w)=
This gives the same particular solution as well as the same solution to the initial
value problem.
6.4.4
Consider the forced mass-spring when the resistive or damping force is not zero.
Use the MATLAB command dsolve() to nd the solutions for e = 0> 1> 2 and 4
of the nonhomogeneous initial value problem
{00 + e{0 + { = sin(w) with {(0) = 0 and {0 (0) = 0=
The MATLAB command ezplot is then used to graph the four curves, see Figure
6.4.1. Note, for large values of time and positive e the homogeneous solutions
have essentially decayed to zero so that the curves in this gure reect the
particular solutions (1@2)w cos(w) for e = 0, frv(w) for e = 1, (1@2)frv(w) for
e = 2 and (1@4)frv(w) for e = 4
AA % let b = 0
AA solb0 = dsolve(D2x+0*Dx+x = sin(t), x(0) = 0,
AA simple(solb0)
-1/2*cos(t)*t + 1/2*sin(t)
AA % let b = 1
AA solb1 = dsolve(D2x+1*Dx+x = sin(t), x(0) = 0,
AA simple(solb1)
exp(-1/2*t)*cos(1/2*3^(1/2)*t) - cos(t) +
1/3*exp(-1/2*t)*cos(1/2*3^(1/2)*t)*3^(1/2
AA % let b = 2
AA solb2 = dsolve(D2x+2*Dx+x = sin(t), x(0) = 0,
AA simple(solb2)
-1/2*cos(t) + 1/2*exp(-t) + 1/2*exp(-t)*t
AA % let b = 4
AA solb4 = dsolve(D2x+4*Dx+x = sin(t), x(0) = 0,
AA simple(solb4)
Dx(0) = 0,t)
Dx(0) = 0,t)
Dx(0) = 0,t)
Dx(0) = 0,t)
271
AA
AA
AA
AA
AA
AA
6.4.5
Exercises
1.
Find the homogeneous and particular solutions for {00 + 5{0 + 4{ = 3w + 4=
2.
Find the homogeneous and particular solutions for {00 + 2{0 + 2{ = w2 +
2w + 3=
3.
Find the homogeneous and particular solutions for {00 + 5{0 + 4{ = 3h2w =
4.
Find the homogeneous and particular solutions for {00 + 5{0 + 4{ = 2h4w =
5.
Find the homogeneous and particular solutions for {00 + 4{ = sin(w) +
3 cos(w)=
6.
Find the homogeneous and particular solutions for {00 + 4{ = sin(2w)=
7.
Solve the initial value problem for the dierential equation in Example
6.4.1 using the initial conditions {(0) = 1 and {0 (0) = 2=
8.
Solve the initial value problem for the dierential equation in Example
6.4.3 using the initial conditions {(0) = 0 and {0 (0) = 1=
272
9.
Find the solution to the initial value problem {00 +5{0 +4{ = 6h2w +3w +4
with {(0) = 0 and {0 (0) = 0=
10.
Find the solution to the initial value problem {00 + 4{ = 2h2w + w + 4
with {(0) = 0 and {0 (0) = 1=
11.
Consider the force mass-spring problem {00 + { = cos(zw) with {(0) = 0
0
and { (0) = 0=
(a).
Find the particular solution when z 6= 1=
(b).
Solve the initial value problem when z 6= 1=
(c).
Solve the initial value problem when z = 1=
12.
Conrm any by-hand calculations in exercises 1-11 using MATLABs
command dsolve().
13.
Use MATLABs commands dsolve() and ezplot() to solve and graph the
{00 + e{0 + { = cos(w) with {(0) = 0 and {0 (0) = 0 for e = 0> 1> 2 and 4=
6.5
This section begins with an application to LRC series circuits where a model for
the current is also a second order linear dierential equation. The right side can
be a very complicated function, and the method of undetermined coe!cients
may not yield a particular solution. Possible alternatives are to use the variation of parameters method to nd the particular solution or to use a suitable
numerical method. Both these alternatives require the second order linear differential equation to be written as a rst order system of dierential equations.
The numerical method that is implemented in the MATLAB command ode45()
is a variation of the Runge-Kutta scheme and uses variable time steps.
6.5.1
In the model for the forced mass-spring the damping or friction coe!cient e
of the velocity {0 was used to control the magnitude of the oscillations of the
mass. In a car or truck this is similar to having eective shock absorbers. The
model for the current in a series LRC circuit with an external source is also a
second order dierential equation with sine and cosine functions of time in the
right side. In a tuning circuit one wants to maximize the current by adjusting
the inductors or the capacitors. The series LRC circuit is a primitive tuning
circuit, and for a simple external source one can derive an exact formula for the
maximum current. In more complicated external sources, such as from an AM
(amplitude modulation) radio station, the initial value problem must be solved
numerically.
A series LRC circuit has three components, an inductor O, resistor U and
capacitor F, and an external source H(w). In an AM radio the external source
is from the antenna and is a function with terms equal to products of sine
and cosine functions. Figure 6.5.1 is a depiction of the series circuit and the
corresponding dierential equation model. The voltage drop across the resistor
is YU = UL, the voltage drop across the inductor is YO = OL 0 and the voltage
273
= H(w)
= H(w)=
Compute the derivative of both sides with respect to time to obtain a model
for the current
OL 00 + UL 0 + L@F = H 0 (w)=
The objective is to x the resistance U, and to vary the inductance O or the
capacitance F so that the current L will have a maximum amplitude. In tuning
a radio the amplitudes will vary with the frequency of the various stations. The
desired station will have a large amplitude relative to other stations.
Example 6.5.1. Let H(w) = H0 sin(w) where H0 is a constant (unmodulated
carrier wave) and = iv 2 with iv equals the frequency of the carrier wave.
The model for the current is
OL 00 + UL 0 + L@F = H 0 (w) = H0 cos(w)
where the coe!cients are positive constants. The homogeneous solutions L1 (w)
and L2 (w) are derived as in the previous sections from the characteristic algebraic equation. Because the O, U and F are positive, regardless of which of the
three cases (distinct, repeated or complex roots), the homogeneous solutions
will decay to zero and are called the transient solutions. The signal that remains signicant is the particular solution Ls (w)= The method of undetermined
274
U
d
H0
O 2 + 1@F
=
=
U
O 2 + 1@F
e
0
Cramers rule easily gives the solution
O 2 + 1@F
and
+ 1@F)2 + (U)2
U
e = H0
=
2
(O + 1@F)2 + (U)2
d = H0
(O 2
Let be such that tan() = (O 2 + 1@F)@ (U) and write the particular
solution as
O 2 + 1@F
cos(w) +
(O 2 + 1@F)2 + (U)2
U
sin(w)]
(O 2 + 1@F)2 + (U)2
H0
p
[sin() cos(w) + cos() sin(w)]
2
(O + 1@F)2 + (U)2
H0
p
sin( + w)=
(O 2 + 1@F)2 + (U)2
Ls (w) = H0 [
=
=
The amplitude is the coe!cient of sin( + w) and will be a maximum if the
denominator is a minimum. Since the resistance is xed, the denominator will
be a minimum when O 2 + 1@F = 0= Thus, the current will have a maximum
amplitude when
O 2 + 1@F
= 0 or
1
=
= s
OF
If = iv 2 and iv is the
s desired frequency, then O and F should be adjusted
so that = iv 2 = 1@ OF= As will be illustrated by the MATLAB numerical calculations at the end of this section, these results also approximate the
maximum current for the modulated signal.
6.5.2
275
If the right side of the second order dierential equation is too complicated, the
undetermined coe!cient method may not be able to nd a particular solution.
The variation of parameters method, which was used in Section 6.1 for rst
order dierential equations, can be generalized to nd a particular solution for
second order dierential equations. However, they will need to be reformulated
as a rst order system where there are two rst order dierential equations and
two unknowns for the function and its derivative.
Consider the linear second order dierential equation with constant coe!cients and d 6= 0
d{00 + e{0 + f{ = i (w)=
(6.5.1)
Let | be the derivative of { and, thus,
{0
|0
= | and
= {00 = (i (w) e{0 f{)@d
= i (w)@d e|@d f{@d=
This can be written in vector form as a rst order system of dierential equations
0 0
{
{
0
1
{
0
=
+
=
(6.5.2)
|
f@d e@d
|
i (w)@d
|0
Let {1 (w) and {2 (w) be homogeneous solutions (i (w) = 0) of the second order
problem in (6.5.1). In terms of vector equation in (6.5.2) this means
0
{1
0
1
{1
=
and
f@d e@d
{01
{01
0
0
1
{2
{2
=
=
f@d e@d
{02
{02
Use the vector notation
{1
{2
0
0
1
x1
,
x
,
f
and
D
=
2
i (w)@d
f@d e@d
{01
{02
The two vectors x1 and x2 satisfy
x01 = Dx1 and x02 = Dx2 =
(6.5.3)
{1 {2
Z (w) [x1 x2 ] =
=
{01 {02
The two vector equations in (6.5.3) may be written as a 2 2 matrix equation
Z (w)0 [x01 x02 ] = [Dx1 Dx2 ] = D[x1 x2 ] = DZ (w)=
(6.5.4)
276
{1 {2
f1
xk = x1 f1 + x2 f2 =
= Z (w)c=
{01 {02
f2
Following the rst order dierential equation variation of parameters method,
we speculate that a vector particular solution is also a linear combination of
the column vectors in Z (w), but now the coe!cients depend on time and the
vector particular solution has the form
{1 {2
y1 (w)
xs = x1 y1 (w) + x2 y2 (w) =
= Z (w)v(w)=
y2 (w)
{01 {02
Choose the components of the v(w) so that the nonhomogeneous system (6.5.2)
is satised
x0s
(Z (w)v(w))0
{1
{2
(
y1 (w) +
y2 (w))0
{01
{02
= Dxs + f
= D(Z (w)v(w)) + f
= (DZ (w))v(w) + f =
Now apply the product rule to each component of the two dimensional vectors
x01 y1 (w) + x1 y10 (w) + x02 y2 (w) + x2 y20 (w) = (DZ (w))v(w) + f
Z (w)0 v(w) + Z (w)v0 (w) = (DZ (w))v(w) + f =
Apply the matrix equation in (6.5.4) to get
(DZ (w))v(w) + Z (w)v0 (w) = (DZ (w))v(w) + f =
This means the derivatives of the variable coe!cients must be a solution of
Z (w)v0 (w) = f
0
y1 (w)
{2
0
=
=
y20 (w)
{02
i (w)@d
{1
{01
0
{2
i (w)@d {02
(i (w)@d){2
=
and
det(Z (w))
det(Z (w))
0
{1
det(
{01 i (w)@d
(i (w)@d){1
=
=
det(Z (w))
det(Z (w))
det(
y10 (w) =
y20 (w) =
The vector particular solution is found by integrating both of these to give the
vector version of the variation of parameters particular solution formula
Z
Z
(i (w)@d){2
(i (w)@d){1
+ x2
=
(6.5.5)
xs = x1 y1 (w) + x2 y2 (w) = x1
det(Z (w))
det(Z (w))
277
h
h2w
det(Z (w)) = det( 2w
) = 4=
h 2 h2w (2)
Use integration by part to nd
Z
Z
(i (w)@d){2
((w + 1)@1)h2w
y1 (w) =
=
= h2w (w@8 3@16) and
det(Z (w))
4
Z
Z
(i (w)@d){1
(w + 1)@1h2w
y2 (w) =
=
= h2w (w@8 1@16)=
det(Z (w))
4
The particular solution is
{s
= {1 y1 (w) + {2 y2 (w)
= h2w (h2w (w@8 3@16)) + h2w (h2w (w@8 1@16))
= (w + 1)@(4)=
6.5.3
In this section we will numerically approximate the current in the series LRC
circuit where there is a modulated imposed signal
H(w) = 100 sin(id 2w) sin(iv 2w) where
audio frequency = id ?? iv = station frequency.
In the rst part of this section we were able to nd the exact particular solution
for the unmodulated signal
H(w) = 100 sin(iv 2w)>
and in this case the maximum amplitude of the current was determined to be
100
p
2
(O + 1@F)2 + (U)2
278
where = iv 2= If = 710, U = 400> and L and C are chosen so that O 2 +
1@F 0> then the maximum amplitude is approximately
100
100
p
=
= 0=25=
2
2
400
(0) + (400)
p
s
If O = 2 and F = 106 > then the tuned station is = 1@ 2(106 ) = 103 @ 2
707=1= A signicant variation from O = 2 and F = 106 causes the amplitude
to decrease as long as is at this tuned signal and the signal is unmodulated.
The numerical calculations will illustrate the tuning formula O 2 + 1@F = 0
giving an approximation for tuning even if the signal is modulated.
The MATLAB command ode45() is a variation of the Runge-Kutta numerical
method and uses variable time steps. It requires three input parameters: the
character representation of the function le containing the right side of the
system, the row vector with the initial and nal times and the row vector with
the initial charge and current. The call to ode45() is contained in the MATLAB
code le lrc.m. The MATLAB function le yplrc.m contains the right side of
the vector equation (6.5.2). In the le yplrc.m the charge is depicted by the
four character symbol y(1), and the current is depicted by the four character
symbol y(2). In yplrc.m the rst and second components of the right side of
the vector equation (6.5.2) are denoted by the eight character symbols yplrc(1)
and yplrc(2), respectively.
MATLAB Code lrc.m
% This le has a call to ode45().
% It requires a second le called yplrc.m,
% which models a series LRC tuning circuit.
clear;
t0 = 0;
tf = .3;
% nal scaled time
y0 = [0 0];
% initial charge and current
[t y] = ode45(yplrc, [t0 tf], y0);
plot(t, y(:,2))
title( Series LRC Circuit)
xlabel(time)
ylabel(current)
MATLAB Code yplrc.m
function yplrc = yplrc(t,y)
L = 20; R = 400; C = 10^(-6);
fa = 63/(2*pi);
% scaled audio frequency
fs = 710/(2*pi);
% scaled station frequency
E0 = 100*sin(2*pi*fa.*t);
% modulated signal
% E0 = 100;
% unmodulated signal
yplrc(1) = y(2);
yplrc(2) = (E0*sin(2*pi*fs.*t) - R*y(2) - (1/C)*y(1))/L;
279
6.5.4
Exercises
1.
In Example 6.5.1 derive the algebraic system and solution for the coe!cients d and e=
2.
Use Example 6.5.1 as a template to solve equation (6.5.2) with H(w) =
H0 cos(w)=
3.
Use variation of parameters to nd the particular solution of {00 9{ =
2w + 3=
4.
Use variation of parameters to nd the particular solution of {00 + { =
sin(w)=
5.
Use MATLAB codes lrc.m and yplrc.m to experiment with dierent F =
(0=1)106 , (1=0)106 and (10=0)106 and keep O = 2=
cos(1500w)=
6.
Consider equation (6.5.2) with
s H(w) = H0 sin(63w)
6
(a).
Use the formula = 1@ OF and F = 10 to estimate the O that
will give the maximum amplitude.
(b).
Conrm this by executing the MATLAB code le lrc.m with a modied yplrc.m le.
280
7.
Use a variation of the MATLAB codes lrc.m and yplrc.m to solve and
graph the solutions of {00 + e{0 + { = cos(w) with {(0) = 0 and {0 (0) = 0 for
e = 0> 1> 2 and 4=
Chapter 7
7.1
Solution of x0 = Dx by Elimination
In Section 6.5 a single second order linear dierential equation was expressed
as a system of two rst order dierential equations
0
{
0
1
{
0
{(0)
{0
=
+
with
=
=
|
f@d e@d
|
i @d
|(0)
|0
(7.1.1)
This is a special case of the more general initial value problem
0
{
d e
{
i
{(0)
{0
=
+
with
=
=
(7.1.2)
|
f g
|
j
|(0)
|0
Furthermore, there can be more than two unknowns and two dierential equations. The objective of this section is to present some examples that will indicate
how one can approach these problems so that larger systems can be solved in a
systematic way.
7.1.1
The solution of the homogeneous second order dierential equation d{00 + e{0 +
f{ = 0 has the exponential form huw where u is the solution of the characteristic
281
282
{
f1 hu1 w + f2 hu2 w
=
|
(f1 hu1 w + f2 hu2 w )0
f1 hu1 w + f2 hu2 w
=
f1 hu1 w u1 + f2 hu2 w u2
1
1
= f1
hu1 w + f2
hu2 w =
u1
u2
The two column vectors are examples of eigenvectors associated with the system
matrix in (7.1.1), and u1 and u2 are the corresponding eigenvalues, which will
be studied in more detail in Section 7.2. If initial conditions are required, then
one must choose the coe!cients f1 and f2 so that {(0) = {0 and |(0) = |0 =
Example 7.1.1. Reconsider overdamped mass-spring in Example 6.3.3, where
{00 + 4{0 + { = 0=
The equivalent system is
{
|
=
0
1
1 4
{
|
whose solution is
{
|
= f1
1
u1
hu1 w + f2
1
u2
hu2 w
s
s
where u1 = 2 + 3 and u2 = 2 3= Find f1 and f2 so that {(0) = 1 and
|(0) = 2. This requires the solution of the algebraic system
1
1
{(0)
u1 0
h + f2
hu2 0
= f1
u1
u2
|(0)
1
1 1
f1
=
=
2
u1 u2
f2
Since the roots are distinct, this has unique solution given by Cramers rule
s
s
u2 2
4 3
2 u1
4 3
s
s =
=
=
f1 =
and f2 =
u2 u1
u2 u1
2 3
2 3
7.1.2
283
0
4@50 1@50
{
{
=
=
4@50 4@50
|
|
In subsequent sections we shall derive the solutions by elimination and by eigenvalues giving
{ = f1 h(1@25)w + f2 h(3@25)w and | = f1 2h(1@25)w + f2 (2)h(3@25)w =
The vector form of this is
1
1
{
(1@25)w
+ f2
h
h(3@25)w =
= f1
2
2
|
Example 7.1.2. Suppose the initial amounts in the tanks are {(0) = 2 and
|(0) = 3= Find the coe!cients so that
1
1
{(0)
h(1@25)0 + f2
h(3@25)0
= f1
2
2
|(0)
2
1 1
f1
=
=
3
2 2
f2
The algebraic solution is f1 = (2(2) 1(3))@(4) = 7@4 and f2 = (1(3)
2(2))@(4) = 1@4= The solution to the homogeneous rst order system is
{
1
1
= (7@4)
h(1@25)w + (1@4)
h(3@25)w =
|
2
2
284
7.1.3
For small systems of dierential equations this method is practical, and requires
one to write the rst order system as a single higher order dierential equation.
In the case of two rst order homogeneous equations (7.1.2) with i = j = 0 we
have
{0 = d{ + e| and | 0 = f{ + g|=
If e 6= 0, then the rst dierential equation can be written as
| = ({0 d{)@e=
Put this into the second dierential equation to yield a single second order
dierential equation
(({0 d{)@e)0 = f{ + g(({0 d{)@e)
({00 d{0 )@e = f{ + g(({0 d{)@e)=
As an illustration reconsider Example 7.1.2 and derive the solution using the
elimination method.
Example 7.1.2 (continued). The two dierential equations are
{0 = (4@50){ + (1@50)| and | 0 = (4@50){ + (4@50)|=
In the rst equation solve for |
| = 50{0 + 4{=
Insert this into the second equation
(50{0 + 4{)0
50{00 + 4{0
285
The rst order system requires the solution of both { and |= Find | by using
| = 50{0 + 4{
|
0
2 3
{
{
=
=
1 2
|
|
The rst dierential equation {0 = 2{ 3| can be solved for | in terms of {
| = ({0 2{)@(3)=
Then put this into the second dierential equation | 0 = { 2|
(({0 2{)@(3))0 = { 2(({0 2{)@(3))=
This yields the single second order dierential equation {00 { = 0 whose general
solution is
{ = f1 hw + f2 hw =
Use | = ({0 2{)@(3) to nd the general solution for |
|
1
1
{
hw + f2
hw =
= f1
1@3
1
|
Find the coe!cients so that {(0) = 6 and |(0) = 4> that is,
1
1
{(0)
0
h + f2
h0
= f1
1@3
1
|(0)
6
1 1
f1
=
=
4
1@3 1
f2
The algebraic solution is f1 = 3 and f2 = 3, and so the solution of the initial
value problem is
{
1
1
=3
hw + 3
hw =
|
1@3
1
286
7.1.4
The elimination method still works, but one can clearly see the additional complications. Solve the rst dierential equation for x2 in terms of x1
x2 = x01 + 2x1 =
(7.1.3)
(7.1.4)
Insert x3 and x2 = x01 + 2x1 into the third equation and collect like terms to
obtain a single third order dierential equation
00
0
x000
1 + 6x1 + 10x1 + 4x1 = 0=
(7.1.5)
Assume the solution of (7.1.5) is an exponential huw to get a third order characteristic equation
u3 + 6u2 + 10u + 4 = 0
(u + 2)(u2 + 4u + 2) = 0=
s
s
The algebraic solutions are u = 2, 2 + 2 and 2 2= Therefore, the
general solution to the third order dierential equation is
s
2)w
s
2)w
+ f3 h(2
287
Use equations (7.1.3) and (7.1.4) to nd x2 (w) and x3 (w), and write the general
solution to the homogeneous system in vector form
6
5
6
5
6
5
1
x1
1
s
s
7 x2 8 = f1 7 0 8 h2w + f2 7 2 8 h(2+ 2)w +
1
x3
1
6
5
1
s
s
f3 7 2 8 h(2 2)w =
1
Find the three coe!cients so that the initial temperatures are x1 (0) = 20,
x2 (0) = 30 and x3 (0) = 20= Insert w = 0 into the above general solution to
obtain the algebraic system
65
5
6 5
6
1 s1
1
f1
20
s
7 30 8 = 7 0
2 2 8 7 f2 8 =
20
f3
1 1
1
The algebraic solution is f1 0=0000, f2 20=6066 and f3 0=6066 and so
the solution to the system of dierential equations is
6
6
5
6
5
5
1
x1
s
s
s1
s
7 x2 8 20=6066 7 2 8 h(2+ 2)w 0=6066 7 2 8 h(2 2)w =
x3
1
1
7.1.5
The MATLAB command dsolve() can be used to solve simple linear systems of
dierential equations. The solution of the two-tank mixing in Example 7.1.2 is
found as follows.
AA soltank = dsolve(Dx = (-4/50)*x + (1/50)*y,
Dy = (4/50)*x + (-4/50)*y,
x(0) = 2, y(0) = 3, t)
soltank =
x: [1x1 sym]
y: [1x1 sym]
AA soltank.x
1/4*exp(-3/25*t) + 7/4*exp(-1/25*t)
AA soltank.y
7/2*exp(-1/25*t) - 1/2*exp(-3/25*t)
The solution to the heat conduction in Example 7.1.4 with three equations
can also be easily done. But, one can observe the increased symbolic output. For
more complicated problems numerical calculations such as done by MATLABs
command ode45() are a preferred method.
288
7.1.6
Exercises
1.
{
|
=
4@25 1@25
4@25 4@25
{
|
(b).
Use elimination to nd the vector form of the general solution.
(c).
Find the solution of the initial value problem {(0) = 2 and |(0) = 3=
4.
Use elimination to solve the initial value problem
{
|
=
1 1
2 4
{
|
with
{(0)
|(0)
=
1
4
{
3 1
{
{(0)
2
=
with
=
=
|
1 3
|
|(0)
4
6.
{
4 1
{
{(0)
1
=
with
=
=
|
2 1
|
|(0)
3
289
7.
7.2
7.2.1
= D(uhuw )
= (Du)huw =
290
Because u is not a zero vector, D uL must not have an inverse and, thus, the
determinant of D uL must be zero. This gives a single polynomial equation
that u must satisfy. Once u is found, solve algebraic system (D uL)u = 0 for
the unknown constant vector u that is associated with this u=
Denition 7.2.1. Let D be an q q matrix. An eigenvalue is a number (real
or complex) u such that there is a nonzero vector u and Du = uu= The vector
u is called the eigenvector of D corresponding to the eigenvalue u=
Note, any constant times u is also an eigenvector, because D(fu) = f(Du) =
f(ux) = u(fu)= Examples 7.1.1-7.1.4 in the previous section give the following
examples of eigenvectors and eigenvectors .
0
1
1
Example 7.2.1. Let D =
and consider u =
and u = u1 =
1 4
u1
s
2 + 3=
1s
0
1
Du =
1 4
2 + 3
s
s
1s
= (2 + 3)
=
2 + 3
Example 7.2.2. Let D =
4@50 1@50
4@50 4@50
u = u1 = 1@25=
Du =
4@50 1@50
4@50 4@50
and consider u =
(4@50)1 + (1@50)2
(4@50)1 + (4@50)2
1
= (1@25)
=
2
1
2
1
2
and
Example 7.2.3. Let D =
2 3
1 2
and consider u =
1=
Du =
2 3
1 2
2(1) 3(1)
1(1) 2(1)
1
= (1)
=
1
1
1
1
1
and u = u2 =
291
6
6
5
1
2 1
0
s
Example 7.2.4. Let D = 7 1 2 1 8 and consider u = 7 2 8 and
0
1 2
1
s
u = u3 = 2 2=
6
5
65
1
2 1
0
s
Du = 7 1 2 1 8 7 2 8
0
1 2
1
s
5
6
2(1) +s
1( 2)
8
= 7 1(1) 2(
s 2) + 1(1)
1( 2) 2(1)
6
5
1
s
s
= (2 2) 7 2 8 =
1
5
7.2.2
0
1
D=
=
f@d e@d
In this case the determinant is easy to evaluate and gives the characteristic
algebraic equation
0
1
1 0
det(D uL) = det(
u
)
f@d e@d
0 1
0u
1
= det(
)
f@d e@d u
= u(e@d u) 1(f@d)
= u2 + (e@d)u + f@d = 0=
The solutions may be complex numbers, but we will focus on systems where
the roots of det(D uL) = 0 are real and distinct.
292
0u
1
det(D uL) = det(
)
1 4 u
= u2 + 4u + 1 = 0=
s
s
= 2 + 3 and u2 = 2 3= Find the eigenvector
The two eigenvalues are u1 s
associated with u1 = 2 + 3= Solve the algebraic system
(D u1 L)u = 0
s
x1
0
0 (2 + 3)
1
s
=
=
0
x2
1
4 (2 + 3)
This is equivalent to two algebraic equations, which are multiples of each other,
s
s
(2 + 3)x1 + x2 = 0 and x1 + (2 3)x2 = 0=
This
s gives one degree of freedom to choose, say, x1 = 1 and then x2 = 2 +
3= This agrees with one homogeneous solution obtained using the elimination
s
method. In order to obtain the other homogeneous solution, let u2 = 2 3
and repeat the above calculations.
Example 7.2.2 (continued). Find the eigenvalues using determinants by
solving
4@50 u
1@50
det(D uL) = det(
)
4@50
4@50 u
= (4@50 u)(4@50 u) (1@50)(4@50) = 0=
The two eigenvalues are u1 = 1@25 and u2 = 3@25= Find the eigenvector
associated with u1 = 1@25= Solve the algebraic system
(D u1 L)u = 0
4@50 (1@25)
1@50
x1
0
=
=
4@50
4@50 (1@25)
0
x2
2u
3
det(D uL) = det(
)
1
2 u
= (2 u)(2 u) (3)1 = 0=
293
The two eigenvalues are u1 = 1 and u2 = 1= Find the eigenvector associated
with u2 = 1= Solve the algebraic system
(D u1 L)u = 0
2 (1)
3
x1
0
=
=
1
2 (1)
0
x2
7.2.3
294
The solution of det(D uL) = 0 done by-hand calculations is a little messy and,
so, the MATLAB commands det() and solve() are used.
AA syms r
AA poly = det(A - r*eye(3))
% compute the determinant
-5/144 - 5/12*r - 5/4*r^2 - r^3
AA r = solve(poly)
% solve for the roots of this polynomial
AA r1 = eval(r(1))
% converts the symbolic expression to numbers
-.1264
AA r2 = eval(r(2))
-.7643
AA r3 = eval(r(3)
-.3593
From here one can solve the algebraic system (D uL)u = 0 to nd the eigenvectors, but an easier and more robust approach is to use another MATLAB
command eig(), which computes all the eigenvalues and their associated eigenvectors.
7.2.4
The MATLAB command [U R] = eig(A) computes the eigenvectors and eigenvalues of the matrix A. All three symbols are square matrices. The columns
of X , indicated by X (:> m), are the eigenvectors. The matrix R is a diagonal
matrix whose m wk diagonal components are the eigenvalues associated with the
m wk column of X . One homogeneous solution is X (:> m)hU(m>m)w , and the general
homogeneous solution is a linear combination of X (:> m)hU(m>m)w = The eigenvectors
and eigenvalues for Example 7.2.3 are easily computed by [U R] = eig(A). The
columns of X have been scaled to have length equal to one, and appear dierent
than those done by-hand calculations. However, any eigenvector can be scaled
to obtain another eigenvector associated with the same eigenvalue.
AA A = [2 -3;1 -2]
AA [U R] = eig(A)
U=
.9487
.7071
.3162
.7071
R=
1
0
0
-1
AA newu1 = U(:,1)/U(1,1)
1.0000
0.3333
AA newu2 = U(:,2)/U(1,2)
1.0000
1.0000
295
-.2201
-.0758
.9725
0.0000
-.3593
0.0000
.2898
.5047
.8132
0.0000
0.0000
-.1264
The solution to the three-tank mixing problem (7.2.1) is the general homogeneous solution plus the steady state solution, which was calculated in Subsection
3.7.4. The steady state solution is the algebraic solution of (7.2.1) when the
time derivatives on the left side are all zero. The time dependent solution is
5
6
5
6
5
6
=3546
=2201
{(w)
7 |(w) 8 = f1 7 =7396 8 h=7643w + f2 7 =0758 8 h=3593w +
=5721
=9725
}(w)
5
6
5
6
=2898
7=2
f3 7 =5047 8 h=1264w + 7 12=0 8 =
=8132
12=0
Since the eigenvalues are all negative, the time dependent solution converges to
the steady state solution as time increases.
7.2.5
1.
Exercises
296
4.
4@25 1@25
D=
=
4@25 4@25
6.
3 1
D=
=
1 3
7.
4 1
D=
=
2 1
8.
9.
Use the MATLAB command [U R] = eig(A) to conrm any calculations
in exercises 5-8.
7.3
Solution of x0 = Dx + f (w)
(7.3.1)
In this case, one can show, see Subsection 7.3.3, there are q linearly independent
homogeneous solutions formed by the eigenvectors um and eigenvalues um
u1 hu1 w > u2 hu2 w > > uq huq w =
Any homogeneous solution xk (w) satises x0k = Dxk and is a linear combination
of these
xk (w) = f1 u1 hu1 w + f2 u2 hu2 w + + fq uq huq w =
A particular solution is any xs (w) that satises x0s = Dxs + f (w), and they
can be found for simple cases by the method of undetermined coe!cients, see
297
= x0k + x0s
= Dxk + Dxs + f (w)
= D(xk + Dxs ) + f (w)>
7.3.1
{1
{2
x0
0
= Dx + f
4 1
{1
6
=
+
=
10 1
12
{2
The homogeneous solutions are found by rst nding both eigenvalues and their
corresponding eigenvectors. Solve
det(D uL) = 0
4u
1
det(
) = 0
10
1u
(4 u)(1 u) 10 = 0
298
= 0 and
= 0=
1
1
= f1
h6w + f2
hw =
2
5
The steady state solution is the solution of 0 = Dx + f
xs
= D1 f
1
4 1
6
=
10 1
12
1@(6)
1@(6)
6
1
=
=
=
10@(6) 4@(6)
12
2
1
1
1
6w
w
= f1
=
h + f2
h +
2
2
5
Since the rst eigenvalue u1 = 6 is positive, the general solution may not converge to the steady state solution!
7.3.2
Consider particular solutions when f (w) is a simple vector function of time such
as gw + h or ghfw or g cos(fw) + h sin(fw) where g and h are given constant
vectors. Reasonable speculations are that any particular solution should have
the forms xs (w) = aw + b or ahfw or b cos(fw) + c sin(fw)> respectively. The a
and b constant vectors are to be found so that x0s = Dxs + f (w)= This is the
vector version of undetermined coe!cients that was used in Sections 6.1 and
6.4. Here we will equate vector coe!cients of the like functions of time and
solve the resulting algebraic systems.
299
{1
{2
x0
0
= Dx + gw + h
4 1
{1
2
6
=
+
w+
=
10 1
6
12
{2
1@(6)
1@(6)
2
2@3
=
=
=
10@(6) 4@(6)
6
2@3
Use a in the second equation to solve for b
b = D1 (a h)
1@(6)
1@(6)
2@3
6
7@9
=
(
)=
=
10@(6) 4@(6)
2@3
12
32@9
Thus, a particular solution is
xs (w) = aw + b
2@3
7@9
=
w+
=
2@3
32@9
Use the homogeneous solution from Example 7.3.1 to nd the general solution
x(w) = f1 u1 hu1 w + f2 u2 hu2 w + aw + b
2@3
7@9
1
1
6w
w
= f1
w+
=
h + f2
h +
2@3
32@9
2
5
Example 7.3.3. Find the particular solution of
{1
{2
x0
0
= Dx + gh2w
4 1
{1
4
=
+
h2w =
10 1
2
{2
300
1@(12) 1@(12)
4
1@2
=
=
=
10@(12) 2@(12)
2
3
Hence, a particular solution is
xs (w) = ah2w =
1@2
3
h2w >
1@2
1
1
6w
w
= f1
h2w =
h + f2
h +
3
2
5
Example 7.3.4. Find the particular solution of
{1
{2
x0
0
= Dx + g cos(3w) + h sin(3w)
1
3
4 1
{1
+
cos(3w) +
sin(3w)=
=
2
4
10 1
{2
301
and choose the vector coe!cients so that the dierential equation holds
(a cos(3w) + b sin(3w))0
D 3L
a
g
=
=
3L
D
b
h
This is easily solved using MATLAB
4@10
8@30
a=
and b =
=
2@10
22@30
The general solution is
x(w) = f1 u1 hu1 w + f2 u2 hu2 w + a cos(3w) + b sin(3w)
1
1
= f1
h6w + f2
hw +
2
5
4@10
8@30
cos(3w) +
sin(3w)=
2@10
22@30
The method of undetermined coe!cients does not always work or is too complicated to implement. An alternative is the variation of parameters method,
which can also be generalized to systems of dierential equations. This method
gives a closed formula for the particular solution, but it may involve some
di!cult integrations. A third way to solve systems is to use numerical approximations such as implemented in the MATLAB command ode45().
302
7.3.3
The vector version of variation of parameters is a generalization of those discussed in Sections 6.1 and 6.5. Again, assume there are q distinct real eigenvalues of the matrix D so that the homogeneous solution of (7.3.1) is a linear
combination of
xk (w) = f1 u1 hu1 w + f2 u2 hu2 w + + fq uq huq w =
Let [(w) be an q q matrix with column m equal to xm (w) um hum w
(7.3.2)
Then the homogeneous solution can be written as the matrix [(w) times the
W
coe!cient vector c = f1 f2 fq
xk (w) = [(w)c=
(7.3.3)
W
Here the column vector v(w) = y1 (w) y2 (w) yq (w)
is to be found so
that xs (w) = [(w)v(w) satises x0s = Dxs + f (w)=
In order to nd ym (w), expand the matrix-vector product by columns
xs (w) = [(w)v(w)
= y1 (w)x1 (w) + y2 (w)x2 (w) + + yq (w)xq (w)=
The derivative with respect to time may be computed by columns using the
product rule
x0s (w) = (y1 (w)x1 (w) + y2 (w)x2 (w) + + yq (w)xq (w))0
= (y1 (w)x1 (w))0 + (y2 (w)x2 (w))0 + + (yq (w)xq (w))0
= y1 x01 + y10 x1 + y2 x02 + y20 x2 + + yq x0q + yq0 xq =
Because each xm (w) um hum w is a homogeneous solution, x0m = Dxm , the above
can be rewritten using the column version of matrix-vector products
x0s (w) = y1 Dx1 + y10 x1 + y2 Dx2 + y20 x2 + + yq Dxq + yq0 xq
= (y1 Dx1 + y2 Dx2 + + yq Dxq ) + (y10 x1 + y20 x2 + + yq0 xq )
= (D[)v + [v0 =
Choose v so that xs = [v satises x0s = Dxs + f (w), which means
(D[)v + [v0
= D([v) + f (w)
= (D[)v + f (w)=
303
[ 1 f >
(7.3.5)
which is a valid formula provided [(w) has an inverse and the components of
[ 1 f can be integrated.
A matrix [(w) in (7.3.2) formed by the columns of q linearly independent
homogeneous solutions is called a fundamental matrix of the system (7.3.1).
The fundamental matrix and its properties for dierent classes of eigenvalues
are more completely discussed in Chapter 9 in [7]. Here we will assume the
eigenvalues of D are distinct and real and then, with some theoretical eort,
one can show the eigenvectors are linearly independent. By using Theorem
3.7.3 and the properties of determinants
det([(w)) = det([u1 hu1 w u2 hu2 w uq huq w ])
= hu1 w hu2 w hu2 w det([u1 u2 uq ])
= hu1 w hu2 w hu2 w det([(0)) 6= 0=
Thus, [(w) has an inverse.
Example 7.3.5. Consider Example 7.3.2 and nd a particular solution by the
variation of parameters formula in (7.3.4). The matrix [(w) and its inverse are
6w
h
5hw hw
hw
1
[(w) =
(w)
=
and
[
@(7h5w )=
2h6w 5hw
2h6w
h6w
The matrix-vector product is
6w
(5@7)h6w (1@7)h6w
2w + 6
h (16w@7 + 6)
[ 1 f =
=
=
hw (2w@7 + 0)
6w + 12
(2@7)hw
(1@7)hw
Use integration by parts to compute the integrals in the vector
6w
Z w
h (8w@21 67@63)
1
[ f=
=
hw (2w@7 + 2@7)
304
1
f=
2w@3 7@9
2w@3 32@9
>
which agrees with the particular solution in Example 7.3.2 that was found by
undetermined coe!cients.
The by-hand calculations in this and similar examples using the variation of
parameters formula (7.3.4) can be complicated, and one should consider using
a symbolic computing tool such as Maple or the symbolic toolbox in MATLAB.
The following MATLAB code will execute the formula in (7.3.4) for Example
7.3.5.
MATLAB code varpar.m
% This is a symbolic calculation to nd
% a particular solution using variation
% of parameters for a 2D system of DEs.
syms t
f = [2*t + 6;6*t + 12];
x1 = [exp(6*t); 2*exp(6*t)];
x2 = [exp(-t); -5*exp(-t)];
X = [x1 x2];
invX = inv(X)
vprime = invX*f
v = int(vprime,t)
xp = X*v
newxp = simple(xp)
Everyone should do at least one variation of parameter by-hand calculation,
and then conrm the calculation using a symbolic computation tool.
7.3.4
305
(7.3.6)
When the columns in the fundamental matrix are linearly independent for all
0 w W , which is the case for q distinct real eigenvalues, then [(w) will have
an inverse and one can solve for the coe!cients in c=
Outline for x0 = Dx+f (w) and x(0) = x0 with Distinct Real Eigenvalues.
1.
Find the real eigenvalues um and eigenvectors um =
2.
Find the fundamental matrix
Examples 7.3.1, 7.3.2 and 7.3.5 (continued). Find the solution of the
initial value problem
0
4 1
{1
2
6
{1
=
+
w+
and
10 1
6
12
{2
{2
{1 (0)
2
=
=
{2 (0)
1
Step 1. Both eigenvalues and eigenvectors were found in Example 7.3.1 where
determinants were used. One could also do this by using the MATLAB command
eig().
Step 2. The fundamental matrix [(w) is a 22 matrix formed by the eigenvalues
and eigenvectors
x1 (w) x2 (w)
[(w) =
u1 hu1 w u2 hu2 w
=
6w
1h
1hw
=
=
2h6w 5hw
Step 3. A particular solution was found in Example 7.3.2 using undetermined
coe!cients, and it was also found in Example 7.3.5 using variation of parameters
2w@3 7@9
=
xs (w) =
2w@3 32@9
Step 4. The general solution is the homogeneous solution plus the particular
solution
x(w) = [(w)c + xs (w)
6w
1h
f1
2w@3 7@9
1hw
=
+
2w@3 32@9
2h6w 5hw
f2
6w
w
1h
1h
2w@3 7@9
= f1
+ f2
+
=
2w@3 32@9
2h6w
5hw
306
f1
f2
1 1
2 5
f1
f2
[(0)c + xs (0) = x0
0 7@9
2
+
=
=
0 32@9
1
1
2
0 7@9
(
)
=
1
0 32@9
5@7 1@7
25@9
166@63
=
=
=
2@7 1@7
41@9
9@63
1 1
2 5
6w
{1 (w)
1hw
2w@3 7@9
1h
+ 9@63
+
=
= 166@63
2w@3 32@9
{2 (w)
2h6w
5hw
7.3.5
Heat conduction models have been discussed in Sections 3.2, 3.3 and 7.1 (Example 7.1.4). The last version considered a thin wire with three interior cells
and attempted to nd the approximate temperature in the cells as a function of
time. As a simplication we assumed no internal heat source and zero temperature at the left and right ends of the wire. The model had the form u0 = Du
where D is 3 3 and u is a column vector with three temperatures.
The present model will be for four unknown temperatures and have nonzero
internal heat source such as from electrical resistance. The unknowns xl (w)
are approximations of the temperature in the wire at position {l = l{ where
{ = O@(q+1) and q = 4= By following the time dependent model in Subsection
7.1.4, the system of dierential equation is
5
60
x1
9 x2 :
:
f 9
7 x3 8
x4
65
x1
2 1 0
0
:
9
9
1
2
1
0
x
:9 2
= (N@({)2 ) 9
7 0 1 2 1 8 7 x3
0
0 1 2
x4
6
5
2
i + (N@({) )x0
:
9
i
:=
9
8
7
i
i + (N@({)2 )x5
5
6
:
:+
8
The left and right temperatures are x0 and x5 , and the initial temperatures for
the interior cells will be given.
Let the thermal properties be = 1, f = 1 and N = 0=001 with O = 10 so
that { = 2= Assume the left, right and initial temperature are always zero.
Model the increasing heat source in the wire by i = 0=1 0=1h0=1w = Then the
307
u0
60
x1
9 x2 :
9
:
7 x3 8
x4
6
x1
x2 :
:+
x3 8
x4
308
7.3.6
1.
Exercises
309
2a.
(d).
Use variation of parameters to nd a particular solution in exercise
2b.
4.
Consider the system of dierential equations in exercise 2 with initial
condition
3
x(0) =
=
5
(a).
Solve the initial value problem for f in exercise 2a.
(a).
Solve the initial value problem for f in exercise 2b.
0
5.
Solve
value
the initial
problem
x = Dx + f where
1 1
7
1
1
D=
>f=
+
w and x(0) =
=
2 4
2
3
0
0
6.
Solve
the initial
value problem
x =Dx + f where
3 1
4
1
1
D=
>f=
+
h3w and x(0) =
=
1 3
2
3
1
7.
Solve
value
x0 =
Dx +f where
the initial
problem
4 1
4
1
1
D=
>f=
cos(2w) +
sin(2w) and x(0) =
=
2 1
2
3
1
0
8.
Solve
5 the initial value
6 problem
5 x
6 = Dx + f where
5 6
3 1
0
4
1
7
8
7
8
7
1
3
1
5
D=
>f=
w and x(0) = 2 8 =
0
1 3
4
3
9.
In exercise 3 conrm your by-hand calculations using a symbolic computation tool.
10.
Use MATLABs command dsolve() to conrm any by-hand calculations
in exercises 4-8.
11.
Consider the application to heat conduction in a wire as implemented in
the MATLAB code heat4.m. Modify this code so that there are q = 5 unknown
temperatures. The matrix now will be 5 5, there will be ve dierential
equations and the column vectors must have ve components.
(a).
Compare the graphical output with the q = 4 output in Figure
7.3.1.
(b).
Experiment with the length of the time interval by adjusting the
increment size in the time loop from w = (n 1) 200 to w = (n 1) 500.
Observe the convergence of the approximate temperatures as time increases.
Chapter 8
8.1
Most images have some initial distortion or equipment noise associated with
them. Because one can some times determine the nature of the distortion, it
may be possible to eliminate or reduce the undesirable attributes in the image.
As indicated in Subsection 2.5.6, digital images can be associated with matrices
of integers. The general plan is to convert the image le to a matrix, manipulate
the matrix and then convert the manipulated matrix into an enhanced image.
8.1.1
Enhanced Images
The following pairs of images have been enhanced by simple operations on the
image matrix, which will be discussed in this and the next chapter. Figures
8.1.1 and 8.1.2 are images of pollen where the rst gure lacks contrast and is
dark. The pollen image in Figure 8.1.1 is provided courtesy of Roger Heady,
Australian National University. Figure 8.1.2 was created by using a piecewise
linear transformation and sharpening.
311
312
313
Images in Figures 8.1.3 and 8.1.4 are an aerail photo, which initially is too
bright in some areas. The aerail image in Figure 8.1.3 is provided courtesy of
NASA. The enhanced version was obtained by a power array transformation
and gives a clearer image of the water channel.
314
The Mars Rover image in Figure 8.1.6 has been enhanced to see the darker
regions in Figure 8.1.5. The Mars image in Figure 8.1.5 is provided courtesy of
NASA.
315
The second image of the moon in Figure 8.1.8 has sharper craters than
the original moon image in Figure 8.1.7. The moon image in Figure 8.1.7 is
provided courtesy of NASA.
316
8.1.2
Grayscale Images
C = letterc(200);
newC =uint8(C);
newC(5:20,1:12)
ans =
000000000000
000000000000
000000000000
000000000000
000000000000
0 0 0 200 200 200 200 200
0 0 0 200 200 200 200 200
0 0 0 200 200 200 200 200
0 0 0 200 200 200 200 200
0 0 0 200 200 200 200 200
0 0 0 200 200 200 200 200
200 200
200 200
200 200
200 200
200 200
0000
200
200
200
200
200
200
200
200
200
200
317
Figure 8.1.10:
Image of Letter C
318
Figure 8.1.11:
Negative Image
Example 8.1.2. One can augment the matrices of letters to form words or
other objects. In this example four letters are created by functions similar
to the letter function letterc(g) to form the matrix qfvx and then the image
NCSU. The mesh plot of the matrix is given in Figure 8.1.12, the image NCSU
with black background is in Figure 8.1.13 and the "negative" of the image
NCSU with white background is in Figure 8.1.14. The "negative" is created
by replacing the components in the matrix ncsu by 255 qfvx(l> m), that is,
qhjqfvx(l> m) = 255 qfvx(l> m)= The following MATLAB code imagncsu.m was
used to generate these gures.
Figure 8.1.12:
Matrix NCSU
319
imwrite(newncsu1, ncsu.jpg);
negncsu1 = uint8(negncsu);
imwrite(negncsu1, negncsu.jpg);
Figure 8.1.13:
Figure 8.1.14:
8.1.3
Image of NCSU
Color Images
Color images are decomposed into red, green and blue. Three p q matrices,
or a 3D array whose dimensions are p> q and 3> are used to represent the color
image. In MATLAB this is given by duud|(:> :> 1) for the red matrix, duud|(:> :> 2)
for the green matrix and duud|(:> :> 3) for the blue matrix. The MATLAB command imwrite() maps to the image array into the array.jpg le that is associated
with color image. The following MATLAB code le color_imagncsu.m can be
used to generate color versions of the image NCSU.
MATLAB code color_imagncsu.m
red = 10; % 220
green = 10; % 100
blue = 250; % 10
ncsu = [lettern(1) letterc(1) letters(1) letteru(1)];
newncsu = ncsu(50:-1:1,:);
redncsu = red*newncsu;
greenncsu = green*newncsu;
bluencsu = blue*newncsu;
colorncsu(:,:,1) = redncsu;
colorncsu(:,:,2) = greenncsu;
colorncsu(:,:,3) = bluencsu;
colorncsu1 = uint8(colorncsu);
imwrite(colorncsu1, colorncsu.jpg);
320
Figure 8.1.15:
8.1.4
Cropped Images
In order to cut or crop unwanted parts of an image, one needs to rst nd the
image matrix from the image le. This can be done by using the MATLAB
command imread(). Once the image matrix is found, the appropriate part of
the image matrix can be selected. Then map this back into a smaller image
le. For example, if one wants to examine the pollen grain in the center of the
image in Figure 8.1.1, use the following MATLAB commands.
AA pollenmat = imread(pollen.jpg)
AA size(pollenmat)
ans =
500 500
AA imwrite(pollenmat(200:400,100:400),mac8115.jpg)
Figure 8.1.15 contains this cropped image. In order to distinguish the dark
and white areas, there needs to be more separation between the dark and light
components in the image matrix. This is known as "contrast" in the image
matrix and will be more carefully discussed in the next section.
8.1.5
1.
Exercises
321
4.
Modify color_imagncsu.m to generate a color image of your rst name.
5.
Crop the aerial photo given in aerial.jpg so that the landing strip is the
main part of a smaller image le.
6.
Crop the Mars photo given in mars.jpg so that the rock formation in the
center right is the central part of a smaller image le.
8.2
8.2.1
Histogram of an Image
322
clear;
% Creates an image matrix for pollen.jpg.
pollenmat = imread(pollen.jpg);
u = double(pollenmat);
[nx ny] = size(u)
nshades = 256;
hist = zeros(nshades,1);
for i = 1:nx
% creates the histogram, hist
for j = 1:ny
for k = 0:nshades-1
if u(i,j) == k
hist(k+1) = hist(k+1)+1;
end
end
end
end
plot(hist);
The histogram in Figure 8.2.1 indicates low contrast and a darker image
because the pixels are clumped together and have lower shades. In subsequent
subsections we will transform the image matrix so that the histogram is more
evenly distributed.
8.2.2
323
Shift Transformation
The shift transform either increases or decreases all of the pixels (components
of the image matrix) by the same amount. The histogram in Figure 8.2.1 for
the pollen image indicates that most of the components have shades between
90 and 150, and so a shift to the right equal to 100 would tend to brighten the
image.
Denition 8.2.2. Let x be an 8-bit image matrix and let vkli w be a positive
or negative integer. The shift transformation of the image matrix is a mapping
to another 8-bit image matrix W x whose components are
;
0>
if x(l> m) + vkli w ? 0
?
x(l> m) + vkli w>
if 0 x(l> m) + vkli w 255 =
(W x)(l> m)
=
if x(l> m) + vkli w A 255
255>
The truncation below 0 or above 255 can seriously distort the associated
image. The MATLAB command uint8() does this truncation as illustrated in
the following trivial calculations:
AA u = [-100.3 45.0 257; 23.7 150.0 301.1]
-100.3000 045.0000 257.0000
023.7000 150.0000 301.1000
AA shift_u = u + 100
-00.3000 145.0000 357.0000
123.7000 250.0000 401.1000
AA new_u = uint8(shift_u)
000 145 255
124 250 255
In terms of the MATLAB command uint8(), the shift transformation can be
written as
W x = uint8(x + vkli w) or in component form
(W x)(l> m) = uint8(x(l> m) + vkli w)=
Example 8.2.2. This example illustrates the shift transformation applied to
the image matrix of pollen.jpg. The following MATLAB code pollenlight.m is
a shift to a brighter image than in Figure 8.1.1, generates a new histogram in
Figure 8.2.2 and a new image le in Figure 8.2.3.
MATLAB code pollenlight.m
% This code uses the shift transformation to either
% brighten or darken all of the image.
clear;
pollenmat = imread(pollen.jpg);
u = double(pollenmat);
[nx ny] = size(u)
324
8.2.3
In order to spread the shades (increase the contrast) in the pollen image in
Figure 8.1.1 so that its histogram in Figure 8.2.1 is less clumped in the center,
we can use a linear map applied to the pixels in the center region. If the slope
of the linear map is larger than one, then the shades in the original image
325
326
327
8.2.4
Power Transformation
On the unit interval {2 is concave upwards and also has values on the unit
interval. The square root function {1@2 is concave downwards and has values
on the unit interval when { is in the unit interval. By replacing the { by a
normalized image component x(l> m)@255, one can adjust the relative brightness
and darkness of the image. In order to ensure the image is in the 8-bit integer
range, one must use a scaled power 255(x(l> m)@255)s and the uint8() function.
Denition 8.2.4. The power transformation of an image matrix x is a 8bit image matrix Ws x whose (l> m) components are given by the composition of
the power function {s with positive s and the 8-bit valued MATLAB function
uint8()
(Ws x)(l> m) uint8(255(x(l> m)@255)s )=
A trivial illustration is done using the array operations in MATLAB:
328
329
8.2.5
Exercises
1.
Consider the MATLAB code le pollenhist.m. Alter it to nd the histogram of the Mars Rover image in mars3.jpg.
2.
Consider the MATLAB code le pollenhist.m. Alter it to nd the histogram of the aerial image in aerail.jpg.
3.
Apply the shift transformation with vkli w = 40 and
330
331
4.
Consider the MATLAB code le pollenlight.m. Experiment with dierent values of vkli w = 100> 50> 150 and 200= Note the histograms and the
corresponding images.
5.
Apply the piecewise linear transformation with (u1 > v1 ) = (20> 90), (u2 > v2 )
= (180> 200) and
8.3
8.3.1
332
N w
=
f {2
The reverse of heat diusion is to use negative time steps and to start with the
temperature distribution in the future. This suggests that deblurring an image
may be modeled by starting with a blurred image as a future "temperature"
and apply the explicit nite dierence model with negative time steps. In the
blurring of the image, one must be careful to choose the time step small enough
so that 1 2 is positive. The backward iterations eventually start to oscillate
and give badly distorted images. The rst example illustrates this for a simple
1D image.
Example 8.3.1. The image is given by a simple piecewise constant function,
which could be viewed as proles of two rectangular buildings. Blurring could
be caused by moisture in the air, but here it will be simulated by the forward
heat diusion model of blurring. Once this is done, negative time steps will be
used in an attempt to deblur the distorted image. The MATLAB code blur1d.m
is an implementation of this.
MATLAB code blur1d.m
clear;
clf;
% This code illustrates possible blurring and deblurring in 1D.
% It is motivated by heat diusion in 1D.
% Blurring is modeled by diusion of heat in positive time steps.
% Deblurring is done by diusion of "heat" in negative time steps.
% In order to see the changes, push a key.
u = zeros(101,1);
newu = u;
u(30:50) = 10;
u(70:73) = 15;
dt = .00001;
dx = 1/100;
%
% Forward in "time" or "blurring"
%
subplot(1,3,1)
plot(u)
axis([0 101 0 16]);
title(Image)
gure(1)
pause
subplot(1,3,2)
for k = 1:10
for i = 2:100
333
8.3.2
334
with {
The reverse of heat diusion is to use negative time steps and to start with the
temperature distribution in the future. As in the 1D case deblurring an image
may be modeled by starting with a blurred image as a future "temperature"
and apply the explicit nite dierence model with negative time steps. In the
blurring of the image, one must choose the time step small enough so that 1
2{ 2| is positive. Like the 1D example backward iterations eventually start
to oscillate and give badly distorted images. The second example illustrates the
blurring and deblurring of the image NCSU.
Example 8.3.2. Consider the image NCSU that was created in Subsection
8.1.2. The following MATLAB code, blur2d_ncsu.m, illustrates deblurring in
2D using negative time steps. The reader will nd it informative to experiment
with the time step sizes and the length of the outer time loops. The mesh()
plots are also interesting to observe, but are not printed out in this text. Figures
8.3.2, 8.3.3 and 8.3.4 are original, blurred and deblurred image les, respectively.
The deblurring is still a little fuzzy relative to the original image.
335
336
8.3.3
The original pollen image pollen.jpg in Figure 8.1.1 was enhanced by increasing
the contrast via a piecewise linear transformation to the image in Figure 8.2.6.
The image in Figure 8.2.6 will be deblurred or sharpened by using negative time
337
338
339
8.3.4
340
8.3.5
Exercises
1.
Experiment with blur1d.m and vary the parameters for the time step and
the k-loop.
(a).
Vary gw = 0=00005> 0=00010 and 0=00020=
(b).
Vary n = 1 : 5> 1 : 10 and 1 : 20=
2.
Experiment with blur2d_ncsu.m and vary the parameters for the time
step and the k-loop.
341
Chapter 9
Image Processing in
Frequency Domain
The discrete Fourier transform is introduced to lter unwanted attributes of an
image or signal such as from electronic noise or from atmospheric distortion.
The discrete Fourier transform is represented by the Fourier matrix whose components are complex numbers. By using properties of complex numbers and
matrices a number of important properties of the discrete Fourier and fast
Fourier transform are derived. These are then used to lter in the frequency
domain a number of images.
9.1
9.1.1
Laplace Transform
344
=
=
=
=
hvw hdw gw
lim
Q $4
0
Q
h(vd)w gw
lim
Q $4
lim [
Q $4
1
1
h(vd)Q
]
(v d)
(v d)
1
=
vd
A special case is d = 0 so that O(1) = 1@v= There are a number of other rules
for computing Laplace transforms, but here we list only four important rules.
Basic Rules for Laplace Transform. Assume all functions are such that
the improper integrals in the denition exist.
1.
2.
3.
4.
O(fi ) = fO(i ),
O(i + j) = O(i ) + O(j),
O( gi
gw ) = vO(i ) i (0) and
O(i j) = O(i )O(j) where i j is called the convolution of i and j
Z
(i j)(w)
i ( )j(w )g =
The third rule is important because it converts the derivative operation into
multiplication by the parameter v= The third property is established by using
the integration by parts formula
Z
Z
ygx = xy xgy
with gx =
gi
gw gw
and y = hvw = Assume i (w) and the parameter v are such that
345
gi
) =
gw
=
=
4
0
hvw
Z
lim
Q $4
gi
gw
gw
hvw
gi
gw
gw
vQ
lim [i (Q )h
Q $4
Z
v0
i (0)h
(v)hvw i (w)gw]
= 0 i (0) + vO(i )=
The proof of the convolution formula is more complicated, but it will be used
in the next subsection.
9.1.2
The solution process using Laplace transforms to solve initial value problems
can be outlined in the following three steps: use the Laplace transform to
convert the initial value problem (often associated with the time domain)
into an algebraic problem (often associated with frequency domain), solve
the algebraic problem, and convert back to the time domain for the solution
of the initial value problem.
Consider the initial value problem
gx
= dx + i (w) with x(0) given.
gw
Compute the Laplace transform of both sides of the dierential equation and
use the rst three basic rules
gx
) = O(dx + i (w))
gw
vO(x) x(0) = dO(x) + O(i )=
O(
346
Evidently,
x(w) = (i j)(w) + x(0)hdw
Z w
=
i ( )j(w )g + x(0)hdw
0
Z w
=
i ( )hd(w ) g + x(0)hdw
0
Z w
= hdw
i ( )hd g + x(0)hdw =
0
This agrees with the solution in Section 6.1 where the homogeneous solution is
hdw and the particular solution is from the variation of parameters formula.
9.1.3
Fourier Transform
I (fi ) = fI (i ),
I (i + j) = I (i ) + I (j),
I ( gi
gw ) = lzI (i )>
I (i j) = I (i )I (j) where i j is called the convolution of i and j
Z 4
(i j)(w)
i ( )j(w )g =
4
The solution of a dierential equation can be found using the Fourier transformation. For example, nd a solution of
g2 x
+ fx = i (w)=
gw2
As in the use of the Laplace transform, compute the Fourier transform of both
sides of the dierential equation and use the above rules
I (
g2 x
+ fx) = I (i (w))
gw2
gx
) + fI (x) = I (i (w))
gw
((lz)2 I (x) + fI (x) = I (i (w))=
(lzI (
347
$2
1
=
+f
Let j = j(w) be such that I (j) = $21+f and use the fourth rule with the
convolution to conclude
x(w) = (i j)(w)=
Some functions and their transforms can become complicated, but they can be
computed by using tables or symbolic computation tools.
9.1.4
The symbolic toolbox in MATLAB has commands to compute the Laplace and
Fourier transforms and their inverses. Some simple illustrations are given below.
AA laplace(t)
1/s^2
AA laplace(t^2)
2/s^3
AA ilaplace(1/(s*(s+1)))
1-exp(-t)
AA ilaplace(2/(s-3)^2)
2*t*exp(3*t)
The Fourier transforms of many functions give Dirac delta functionals, which
can be viewed as a limit of impulse functions.
Denitions 9.1.3. The unit step function, K(w w0 ), or Heaviside function is
dened as
0> for w ? w0
=
K(w w0 )
1> for w w0
The impulse function L (w w0 ) can be written as
1
(K(w (w0 )) K(w (w0 + )))
2
1
for w0 w w0 +
2 >
=
=
0>
w ? w0 or w0 + ? w
L (w w0 )
$0
Z
i (w)L (w w0 )gw = lim
$0
w0 +
i (w)
w0
1
gw = i (w0 )=
2
348
9.1.5
The discrete Fourier transform is derived from the Fourier transform of i (w) by
assuming i (w) is periodic on the unit interval. Let $ = 2n where n are integers
from 0 to q 1. In this case the improper integral may be approximated as
follows by letting [0 4) be approximated by [0 q]
Z 4
Z q
Z 1
I (i ) =
hlzw i (w)gw 2
hlzw i (w)gw = 2q
hlzw i (w)gw=
0
4
q1
X
hl2n(m@q) i (m@q)(1@q)
m=0
= 2
q1
X
m=0
Denition 9.1.4. Let the complex number } hl2@q and let im be complex
numbers where m are integers from 0 to q 1. The discrete Fourier transform,
DFT, is a mapping from Cq into Cq whose nwk component is
q1
X
m=0
} nm im =
349
= sf (} n ) =
q1
X
im (} n )m where
m=0
sf ({)
q1
X
im {m =
m=0
l2@3
= cos(2@3) l sin(2@3) =
Example
s 9.1.1. Let q = 3 so that } = h
1@2l 3@2= The Fourier matrix is 33 with complex numbers as components
5 0
6 5
6
} }0 }0
1 1 1
F = 7 }0 }1 }2 8 = 7 1 }1 }2 8 =
}0 }2 }4
1 }2 }1
1
}2
1
}2
65
i0
1
9 i1
}3 :
:9
} 2 8 7 i2
}1
i3
6
:
:=
8
350
1 1
1 }2
1
}2
1
}2
fhyhq
frgg
1
}
}2
}3
65
i0
1
9 i2
}3 :
:9
} 2 8 7 i1
}
i3
6
:
:
8
where
1 1
with }b = hl2@4
1 }b
1 0
i0
i1
=
, fhyhq =
and frgg =
=
0 }
i2
i3
F2
Thus, the 4{4 matrix product reduces to two 2{2 matrix-vector products. A
similar reduction occurs when q = 8 = 23 and in general for q = 2g or g =
orj2 (q)= This generates a very fast implementation of the Fourier transform
called the fast Fourier transform. It requires (q@2)orj2 (q) operations, which is
much less than the 2q2 operations for the general matrix-vector product.
In applications q is typically very large and an e!cient method to do these
computations is required. In MATLAB the command t() is an implementation
of the DFT called the fast Fourier transform. The computation in Example
9.1.1 is easily done
AA t([1 7 2])
%n=3
10.0
-3.5000 - 4.3301i
-3.5000 + 4.3301i.
9.1.6
1.
Exercises
2.
3.
351
9.2
Properties of DFT
The Fourier transform of a function i (w) may be discretized, and many of its
properties have analogues to the discrete case. The discrete Fourier transform,
DFT, will be dened and three important properties will be discussed. These
include the DFT of the discrete sine and cosine functions, inverse DFT and
DFT of convolutions. Like the Fourier transform of functions, the DFT will
be able to identify frequencies of periodic functions. This allows one to "lter"
unwanted parts of signals or images.
9.2.1
Denition of DFT
The discrete Fourier transform is derived from the Fourier transform. The
discrete Fourier transform, DFT, is a mapping from Cq into Cq whose nwk
component is
q1
X
} nm im =
m=0
352
9
9
= 9
9
7
5
9
9
= 9
9
7
1
1
1
1
1
1
}1
}2
}3
}4
sf (} 0 )
sf (} 1 )
sf (} 2 )
sf (} 3 )
sf (} 5 )
1 1
}2 }3
}4 }
} }4
}3 }2
6 5
: 9
: 9
:=9
: 9
8 7
1
}4
}3
}2
}
65
:9
:9
:9
:9
87
1
7
2
2
3
6
:
:
:
:
8
11=0000
4=0902 + 6=1554l
7=0902 1=4531l
7=0902 + 1=4531l
4=0902 6=1554l
6
:
:
:=
:
8
9.2.2
353
Fhl2i t
65 6 5
6 5 6
1
1
1+1+1
3
}2 8 7 1 8 = 7 1 + } + }2 8 = 7 0 8 =
1
}1
1 + }2 + }
0
1 1
= 7 1 }1
1 }2
If i = 1, then
Fhl2i t
65
6 5
6 5 6
1
1
1 + }2 + }
0
} 2 8 7 } 1 8 = 7 1 + 1 + 1 8 = 7 3 8 =
0
1 + } + }2
}1
} 2
65
6 5
6 5 6
1
1
1 + } + }2
0
} 2 8 7 } 2 8 = 7 1 + } 2 + } 8 = 7 0 8 =
1+1+1
3
}1
} 1
1 1
= 7 1 }1
1 }2
If i = 2, then
Fhl2i t
1 1
= 7 1 }1
1 }2
DFT of Sine and Cosine Functions. Let [Ff ]n denote the nwk component
of the vector Ff . Then for f = hl2i t
l2i t
[Fh
]n
[Fhl2i t ]n
0>
q>
for n 6= i
for n = i
0>
q>
for n 6= q i
=
for n = q i
and
[F cos(2i t)]n
=
;
?
[F sin(2i t)]n
0>
q@2>
for n 6= q i or i
for n = q i or i
0>
(q@2)l>
=
(+q@2)l>
and
for n 6= q i or i
for n = i
for n = q i
The MATLAB code ttrig.m illustrates these rules, which are analogous to the
rules for the Fourier transform of the sine and cosine functions giving Dirac
delta functionals.
354
9.2.3
Inverse DFT
Let the complex number } hl2@q and let jm be complex numbers where
m are integers from 0 to q 1. The inverse discrete Fourier transform is a
355
} 2 8
} 1
6
1 + } + }2
1 + }2 + } 8
1+1+1
9.2.4
-3.5000 + 4.3301i
q1
X
m=0
dm (} n )m and [Fb]n = sb (} n )
q1
X
em (} n )m =
m=0
356
b = [e0 e1 e2 ]W
sa ({)sb ({) = (d0 + d1 { + d2 {2 )(e0 + e1 { + e2 {2 )
= (d0 e0 ) + (d0 e1 + d1 e0 ){ + (d0 e2 + d1 e1 + d2 e0 ){2
+(d1 e2 + d2 e1 ){3 + (d2 e2 ){4 =
Dene the convolution of a and b to be the vector of coe!cients in the product
polynomial
d0 e0 d0 e1 + d1 e0 d0 e2 + d1 e1 + d2 e0 d1 e2 + d2 e1 d2 e2 =
Denition 9.2.1. Let a and b have q components and let sa ({) and sb ({)
be polynomials associated with these vectors. The convolution of two vectors,
frqy(a> b)> is a 2q 1 vector such that
sfrqy(a>b) ({) = sa ({)sb ({)=
The analogue of the convolution property for the discrete Fourier transforms
requires the use of padded discrete Fourier transforms. This is a technical
di!culty caused by the fact that the dimension of vectors increases during the
convolution of two vectors. Let a be an q vector. A padded vector of a is a
2q 1 vector, A, with a in the rst q components and zeros in the last q 1
components. For example, let q = 3 and a = [d0 d1 d2 ]W so that
A = [d0 d1 d2 0 0]W =
Let } = hl2@5
5
1 1
9 1 }
9
2
FA = 9
9 1 }3
7 1 }
1 }4
6
:
:
: d2 )=
:
8
6
:
:
: e2 )
:
8
1
}2
}4
}
}3
6
:
:
: d2 =
:
8
1
9 1
9
= 9
9 1
7 1
1
5
9
9
+9
9
7
5
9
9
+9
9
7
357
:
9
:
9
: d0 e0 + 9
:
9
8
7
1
}2
}4
}
}3
1
}3
}
}4
}2
1
}
}2
}3
}4
6
:
:
: (d0 e1 + d1 e0 )
:
8
:
:
: (d0 e2 + d1 e1 + d2 e0 )
:
8
6
:
9
:
9
: (d1 e2 + d2 e1 ) + 9
:
9
8
7
1
}4
}3
}2
}
6
:
:
: d2 e2
:
8
= F frqy(a> b)=
This is true for general vectors and gives the desired analogue of the convolution
of Fourier transform for functions.
Convolution Property of DFT. Let A and B be the padded vectors of
two q vectors a and b. The 2q 1 dimensional DFT of the convolution of a
and b is the component-wise or array product of the DFT of A and B
F frqy(a> b) = FA= FB=
Example 9.2.4. The reader should conrm by-hand calculations the following
MATLAB computations, which verify the convolution property. Let q = 3 and
a = [2 3 6] and b = [8 6 3].
AA a = [2 3 6]
AA b = [8 6 3]
AA conv(a,b)
16
36
72
45
18
AA A = [a 0 0]
AA B = [b 0 0]
AA tA = t(A)
tA =
11.0000
-1.9271 - 6.3799i
1.4271 - 3.9430i
AA tB = t(B)
tB =
17.0000
7.4271 - 7.4697i
4.0729 + 0.6735i
1.4271 + 3.9430i
-1.9271 + 6.3799i
4.0729 - 0.6735i
7.4271 + 7.4697i
358
9.2.5
0.0847 + 0.1510i
-0.6197 + 0.3299i
0.0847 + 0.1510i
-0.6197 + 0.3299i.
359
360
9.2.6
Exercises
9.3. DFT IN RQ RQ
361
6.
Consider the MATLAB code tsine.m. Use a variation of it to lter the
noisy cosine function
20 cos(2t) + 3 cos(2100t) + 4 sin(2120t)=
DFT in Rq Rq
9.3
In the previous section the DFT of a single vector was dened to be another
vector with nwk component
q1
X
m=0
Three important properties were the DFT of sine and cosine functions, the
inverse DFT and the convolution identity. These were used to illustrate a lowpass lter for a noisy 1D image or signal. The objective of this section is to
extend the DFT to 2D images, which are represented by matrices and not a
single vector. This will allow us to lter unwanted attributes of 2D images.
9.3.1
Denition of DFT in 2D
q| 1 q{ 1
(hl2@q| )n| m| (hl2@q{ )n{ m{ im{ >m| = si (}{n{ > }|n| ) where
m| =0 m{ =0
X X
q| 1 q{ 1
si ({> |)
m| =0 m{ =0
n
q| 1 q{ 1
1 X X
}{n| m| }|n{ m{ jn{ >n| =
q{ q|
n| =0 n{ =0
Both the 2D DFT and its inverse can easily be computed by using the
MATLAB commands t2() and it2(). For example, for q{ = 2 and q| = 3 :
362
9.3.2
The following MATLAB code in ttrig2da.m illustrates a more general rule for
2D DFT of sine and cosine functions of two variables
MATLAB code in ttrig2da.m
clear;
nx = 4;
ny = 3;
fy = 2;
fx = 1;
for i = 1:nx
for j=1:ny
u(i,j) = sin(2*pi*(i-1)/nx*fx+2*pi*(j-1)/ny*fy);
end
end
u
tu = t2(u)
AA ttrig2da
u=
0.0000
1.0000
0.0000
-1.0000
tu =
-0.0000
-0.8660
-0.5000
0.8660
0.5000
0.0000 - 0.0000i
0.0000
0.0000 + 0.0000i
0.8660
-0.5000
-0.8660
0.5000
0.0000 + 0.0000i
0.0000 - 0.0000i
0.0000 + 0.0000i
-0.0000 - 6.0000i
0.0000 - 0.0000i
-0.0000 + 0.0000i
-0.0000 + 6.0000i
0.0000 - 0.0000i
9.3. DFT IN RQ RQ
363
As in the 1D DFT of the sine and cosine functions, the 2D DFT transforms
will identify the frequencies as spikes in the matrix of the Fourier transforms.
Let { = 0 : 1@q{ : 1 1@q{ and | = 0 : 1@q| : 1 1@q| .
The n{ > n| -component of DFT(cos(2{i{ + 2|i| )) is
;
?
q{ q|
>
q 2q
{
>
0>
The following MATLAB code ttrig2d.m also illustrates these rules. Figure
9.3.1 is the graph of the 2D DFT of the "padded" image of the indicated sine
and cosine functions of two variables. The frequency domain has been shifted
so that the center frequencies are the smaller frequencies. The "spikes" are
located near a circle of radius 400 from the center. Since the "spikes" are very
large, the vertical axis in the mesh plot is the orj(1 + dev(i i wx)).
MATLAB code ttrig2d.m
% Computes the 2D DFT using t2().
% Notice the locations of the "spikes" in
% the mesh plot, which indicates the frequencies.
nx = 500;
ny = 500;
for i = 1:nx
for j=1:ny
u(i,j) = 1 + ...
2^0*(1+sin(2*pi*((i-1)/nx)*200))+...
2^2.*(1+sin(2*pi*((j-1)/ny)*200))+...
2^4.*(1+cos(2*pi*((i-1)/nx+(j-1)/ny)*141))+...
2^6.*(1+sin(2*pi*((i-1)/nx-(j-1)/ny)*141));
end
end
tu = t2(u,2*nx-1,2*ny-1);
tu = tshift(tu);
mesh(log(1+abs(tu)));
364
9.3.3
q| 1 q{ 1
sd ({> |)
m| =0 m{ =0
7 11]
5
11
2 8]
9
8
29
128
73
43
144
78
45
139
88.
9.3. DFT IN RQ RQ
365
9.3.4
The convolution identity can be restated by taking the inverse DFT of both
sides
frqy2(d> e) = li i w2(i i w2(d> 2 q{ 1> 2 q| 1)= i i w2(e> 2 q{ 1> 2 q| 1))=
If e is an image, then the DFT of e will reect the frequencies of the periodic
parts of the image. By masking or ltering out the unwanted frequencies one
can obtain a new image by applying the inverse DFT. A lter is a matrix with
the same dimension as the DFT of the padded image. The components of the
lter usually vary from 0 to 1. If the component is 1, then the frequency is
allowed to pass; if the component is 0, then the frequency is deleted.
366
9.3. DFT IN RQ RQ
367
9.3.5
Exercises
368
9.3. DFT IN RQ RQ
369
370
9.4
Frequency Filters in Rq Rq
The low-pass, high-pass and band-reject lters will be studied. These have various shapes including ideal (step functions), Butterworth (polynomial functions)
and Gaussian (exponential functions). Applications to the NCSU image, a light
and noisy aerial image and sharpening of micro chip image will be presented.
9.4.1
Classications of Filters
A lter is a matrix with the same dimension as the 2D DFT of the padded
image. The components of the lter usually vary from 0 to 1 and let I lowhu
represent such a matrix. Then the ltered image is given by Q hze
Q hze = li i w2(I lowhu= i i w2(e> 2 q{ 1> 2 q| 1))=
The MATLAB code tsine2d.m in the previous section illustrated an ideal lowpass lter for a low frequency sine wave with higher frequency noise. A high-pass
lter allows higher frequencies in the image to remain, and it can be viewed as a
ones matrix minus a low-pass lter matrix. The band-reject lter allows higher
and lower frequencies to pass and inhibits some middle range frequencies. Ideal
lters have components that are either zeros and ones. The following are three
examples of band-reject lters wherep
the approximate frequencies to be rejected
are near g0 and we use glvw(l> m) (l q} )2 + (m q| )2 =
Ideal Band-reject Filter.
1
=
1 + (glvw(l> m)z@(glvw(l> m)2 g20 )2q
1
2
2
2
2 ((glvw(l>m) g0 )@glvw(l>m)z)
371
The parameters z and g0 control the width and location of the band. In
the Butterworth band-reject lter the exponent q controls the steepest of the
boundaries in the band of frequencies to be rejected. There are similar versions
of high and low-pass lters.
9.4.2
The MATLAB code lter_ncsuid.m generates a noisy NCSU image, see Figure
9.4.1, and lters it via an ideal low-pass lter as indicated in Figure 9.4.2. The
ltered image is in Figure 9.4.3 and has blurred edges on the letters.
MATLAB code lter_ncsuid.m
% This code uses an ideal low-pass lter to
% eliminate unwanted frequencies from a noisy
% NCSU image.
clear;
ncsu = [bign(5) bigc(7) bigs(9) bigu(11)];
newncsu = 20*ncsu;
[nx ny] = size(newncsu);
nx
ny
newncsu = newncsu(nx:-1:1,:);
newncsu1 = uint8(newncsu);
imwrite(newncsu1, ncsu.jpg);
u = newncsu;
for i = 1:nx
% This is NCSU with periodic noise.
for j = 1:ny
u(i,j) = u(i,j) + ...
15.*(1+sin(2*pi*((i-1)/nx)*80))+...
15.*(1+sin(2*pi*((j-1)/ny)*80));
end
end
sinencsu = uint8(u);
imwrite(sinencsu, sinencsu.jpg);
tu = t2(u,2*nx-1,2*ny-1);
tu = tshift(tu);
subplot(2,2,1);
mesh(u);
subplot(2,2,2);
mesh(log(1+(abs(tu))));
lter = ones(2*nx-1,2*ny-1);
% Use ideal low-pass lter.
d0 = 150;
for i = 1:2*nx-1
for j =1:2*ny-1
dist = ((i-nx)^2 + (j-ny)^2)^.5;
372
9.4.3
The ideal low-pass ltered image in Figure 9.4.3 is not entirely satisfactory.
Another approach is to use a band-reject lter where one may need to experiment with the width, z, the "slope", q, and the location, g0 , of the band. The
MATLAB code lter_ncsubu.m uses the Butterworth band-reject lter and may
be applied to either the noisy big sine wave or the noisy NCSU. This code generates a noisy NCSU image, see Figure 9.4.1, and lters it via the Butterworth
band-reject lter as indicated in Figure 9.4.4. The ltered image is in Figure
9.4.5, and one should compare it with the ideal low-pass ltered image in Figure
9.4.3. The code is similar to the above, but the lter denition is dierent as
indicated below:
% Use Butterworth band-reject lter.
d0 = 160;
n = 2;
w = 20;
373
374
for i = 1:2*nx-1
for j =1:2*ny-1
dist = ((i-nx)^2 + (j-ny)^2)^.5;
if dist ~= d0
lter(i,j)= 1/(1 + (dist*w/(dist^2 - d0^2))^(2*n));
else
lter(i,j) = 0;
end
end
end
9.4.4
375
9.4.5
376
377
378
Figure 9.4.10:
Figure 9.4.11:
9.4.6
379
Exercises
1.
Experiment with the parameter g0 in the ideal low-pass lter in lter_ncsuid.m.
2.
Modify the lter in lter_ncsuid.m to become an ideal band-reject lter. Experiment with the location and width of the band of frequencies to be
rejected.
3.
Experiment with the parameters q> z and g0 for the Butterworth bandreject lter in lter_ncsubu.m.
4.
Modify the lter in lter_ncsubu.m to become a Gaussian band-reject
lter and experiment with its parameters.
5.
Experiment with the parameters q> z and g0 for the Butterworth bandreject lter in lter_aerail.m.
6.
Modify the lter in lter_aerial.m to become a Gaussian band-reject
lter and experiment with its parameters.
7.
Experiment with the parameters in the high-pass Gaussian lter used
lter_micro.m. Also, modify the sharpening step to include other linear combinations:
% Update image with high frequencies.
l_micro = a*tu + b*lter.*tu;
8.
Repeat exercise 7 using the high-pass Butterworth lter.
Appendix A
(a). 0.333
(b).
0.111; huuru = 0=000111
(a).
2z + 3} = 25 + 3l
(b).
}z = 17s+ 19l; }@z = (11 23l)@13
} 2 = 1@2 + ( 3@2)l and 1 + } + } 2 = 0
} + 0 = (3 + 4l) (7 + 2l) = (3 7) + (4 2)l = 4 + 2l
1@58 + (17@58)l
9@25 + (12@25)l
Prove |} + z|2 (|}| + |z|)2 : Use the dot product as in Section 1.4.
Chapter One
Section 1.2
1.
3.
(a).
(b).
(a).
x = 2{ | + 7 and y = { + 2| + 1
} = 3@5 + (9@5)l
x=
5.
7.
9.
11.
{2 + | 2 + | 2
3{
and y = 2
{2 + (| 1)2
{ + (| 1)2
(b).
} = 3@2 + l
s
1 + l = 1=0987 + 0=4551l
(a).
} = 1
s (1=0987 + 0=4551l)
(1 + l)10 = ( 2)10 hl(2@8)10 = 32l
3 + 4l = 5hl where = arctan(4@3)
Solutions of } 3 = 3 + 4l are
51@3 hl@3 (hl2@3 )0 = 1=6289 + 0=5202l
51@3 hl@3 (hl2@3 )1 = 1=2650 + 1=1506l and
51@3 hl@3 (hl2@3 )2 = 0=3640 1=6708l
381
382
13.
z1
=
=
=
= hl2@q
= cos(2@q) + l sin(2@q)
= cos(2@q) l sin(2@q)
1
cos(2@q) + l sin(2@q)
cos(2@q) l sin(2@q)
1
cos(2@q) + l sin(2@q) cos(2@q) l sin(2@q)
cos(2@q) l sin(2@q)
1
Chapter One
Section 1.3
1.
3.
5.
7.
9.
11.
13.
$
$
2
$
d = 2 l + 5 m and a =
5
$
$
d e = [3 2]
[{1 {2 ] = [1 3] [2 5] = [3 2]
$
$
$
f = [f1 f2 ] and
Hint:
d = [d1 d2 ]> e = [e1 e2 ] and
compute
both
sides.
s
$
k
d k = 1 + 49> arctan(7@1)
s
s 81=87 degrees and
$
$
d @ k
d k = [1@ s50 s7 50]
s
13 = 29 + 10 2 29 10 cos(). Then cos() = 13@ 290 and
40=24 degrees.
$
k [353=55 473=55]
Chapter One
Section 1.4
1.
3.
5.
7.
9.
11.
13.
s
1 3
2
2
duhd = (det(
)) = 7 so that the duhd is 7=
2 1
2 1
12 3
det(
) = 3 and det(
) = 54=
1 1
6 3
$
$
zrun = i g = 3(30) + 1(6) = 96=
383
Chapter One
Section 1.5
1.
3.
5.
(a).
| = (1@3){ 3
(b).
{ = 3w and | = w 3
(a).
[{ |] = [2 7] + w[1 1]
(b).
{ = 2 + w and | = 7 w
[0 1] + (3@5)[1 2] = [3@5 11@5]
Chapter Two
Section 2.1
3.
5.
7.
9.
11.
13.
5 6
3
$
$
$
$
d = 3 l + m + 2 n or a = 7 1 8
2
$
$
$
(a).
2
d + e = [7 5 5] (b).
{ = [5 1 3]
s
s
$
$
$
$
(b).
d e = 3
(a).
k d k = 21 and e = 11
s s
1(1) + 2(3) 1(1) = 6 11 cos() giving 10=02 degrees
$
$
(a).
Hint:
d = [d1 d2 d3 ] and e = [e1 e2 e3 ] and
compute both sides.
(b).
Both sides are equal to 26.
(c).
Proof requires equality for all possible vectors.
$
$
zrun = i g = 10(25) + 1(20) + 2(5) = 280
Chapter Two
Section 2.2
$
1.
3.
5.
7.
9.
11.
$
$
$
$
$
s
$
d e = 3 l + m 9 n and
d e = 91
s
46
$
$
Hint:
d = [d1 d2 d3 ] and e = [e1 e2 e3 ] and
compute both cross products.
$
$
u i = [0 1 3]
$ $
$
(a).
(
d e)
f = [4 3 19] [2 1 5] = 84
(b).
84
Hint: expand the determinants.
Chapter Two
Section 2.3
1.
3.
5.
7.
[1 2 1] + w[3 1 1]
(a).
[1
p [1 1 1]
s 1 2] + (7@3)
168@3 = 3(56)@3
(b).
p
56@3
(c).
s
2
(a).
5 3
w
4
=
3 3
3
(b).
384
p
3@2
Chapter Two
Section 2.4
1.
3.
(a).
(b).
[1 2 4]
(c).
[1 2 4] [{ 2 | 1 } 2] = 0
(a).
[1 2 3]
(b).
[1 2 3] [{ 1 | 1 } 1] = 0
{ 2| 3| = 6
5.
(a).
2 = 1 + 2u + v
3 = 1 + 3u + 0v
1 = 1 + 0u + 0v
(b).
7.
[1 1 1] + (17@19) [2 3 1] + (60@19) [1 0 1] =
= [113@19 70@19 96@19]
9.
(a).
(b).
p4 + f = 866=67
Chapter Two
Section 2.5
1.
3.
(a).
(b).
sW p = 21470
(a).
5
65 6 5
6
1 2 4
u
10
7 0 1 1 87 v 8 = 7 1 8
1 1 4
w
4
5.
(b).
(a).
[8 5 7]
(b).
Chapter Three
Section 3.1
1.
(a).
(b).
[8 19 17 23 7]
5
9
9
9
9
7
3.
5.
(c).
(d).
(a).
30
s
80
(b).
(c).
(a).
(b).
6
sin(1) sin(3)
sin(0)
9 sin(6) sin(2)
sin(1) :
:
9
7 sin(3) sin(1) sin(4) 8
sin(5) sin(3) sin(2)
5
[X Y] = meshgrid(1:1:3,1:1:3)
F = 400 - 20*X.^2 - Y.^2
F({> |) = 4{| + (2{ + 2|)200@({|)
About F(8=1> 8=1)=
9.
11.
:
:
:
:
8
6
1
27
0
9 216 8
1 :
9
:
7 27 1 64 8
125 27 8
(a).
(b).
I =
7.
2
0
1
5
1
4
7
2
2
1
7
1
1 4 3
@12
2@12
3@12
4@12
i1
386.
200.
141.
115
i2
-373.
-173.
-100.
-57.
l1 = 0> l2 = 5 and l3 = 5
Chapter Three
Section 3.2
1.
3.
2 1 6 8
Dx = [35 37]W and D + F =
6 2 14 10
2 21 2 12
Both sides should equal
=
7 3 17 17
385
386
5.
23 26 37 7
1 0 9 7
33 55
37
135
7.
9.
= 32@100>
u1 = [64=00 00=00 22=40]W >
u2 = [87=04 27=64 30=46]W
u = [167=50 135=00 102=50]W
Chapter Three
Section 3.3
1.
3.
5.
7.
x = [2 4 3]W
x = [50 2 5 1]W
y = [210 115 156=67]W and x = u = [182=5 155=0 117=5]W
Use forward and backward substitution.
Chapter Three
Section
5 3.4
1.
3.
5.
6
2 1 1 7
7 4 1 1 0 8
0
3 1 2
5
1 0 0
9 0 1 0
H43 (3) = 9
7 0 0 1
0 0 7
(a).
(b).
(c).
7.
(a).
(b).
6
5
0
1 0
9 0 0
0 :
:> S = 9
0 8 23 7 0 1
1
0 0
5
1
9 0
H4 (10) = 9
7 0
0
5
6
1 7 1 1
[D d] = 7 2 0 7 2 8
0 14 1 6
5
1
7
H32 (2) H21 (1) [D d] = 7 0 14
0
0
0
1
0
0
0
1
0
0
6
0
0 :
: > and
0 8
1
6
0 0
0 0 :
:=
1 0 8
0 10
6
1 1
b
5 0 8 = [X d]
6 6
b is
The solution of the equivalent system X x = d
W
x = [5@2 5@14 1] =
6
5
1 1 0
1 6
9 1 0 1 1 4 :
:
[D d] = 9
7 0 2
7
0 4 8
2 0
0 1 8
H43 (2@9) H42 (2) H32 (2) H41 (2) H21 (1) [D d] =
6
1 1 0
1
6
:
9 0 1 1 2
1
b
: = [X d]
9
8
7 0 0
9
4
2
0 0
0 1@9 58@9
b is
The solution of the equivalent system X x = d
W
x = [25 89 26 58] =
5
6
1 1 1
0
[D d] = 7 1 0 4 20 8
0 2 4 10
5
6
1 1
1
0
b
5 20 8 = [X d]
H32 (2) H21 (1) [D d] = 7 0 1
0 0 14 50
b is
The solution of the equivalent system X x = d
5
(c).
9.
(a).
(b).
(c).
11.
Chapter Three
Section 3.5
1.
3.
5.
7.
9.
3@10
1@10
1@@10 3@10
(b).
H12 (1@3) H2 (3@10) H1 (1@3) H21 (1@3) [D L] = [L D1 ]
5
61 5
6
3 1 0 0
3@10
1@10 0
0
9 1 3 0 0 :
9
0 :
9
: = 9 1@@10 3@10 0
:
(c).
7 0 0 3 0 8
7
0
0
1@3 0 8
0 0 0 4
0
0
0 1@4
5
61
5
6
3 1 0
8 3 1
7 1 3 1 8 = (1@21) 7 3 9 3 8
(a).
0 1 3
1 3 8
5
65 6 5
6
8 3 1
1
17@21
(b).
(1@121) 7 3 9 3 8 7 2 8 = 7 30@21 8
1 3 8
3
31@21
Hint: Do the row
operations.
5
6
5
6
1 0 0
1 2 0
7 0 1 0 8 and D1
7 0 1 0 8
(a).
D1
1 =
2 =
4 0 1
0 0 1
5
6
1 2 0
1
7 0 1 0 8
(b).
(D1 D2 )1 = D1
2 D1 =
4 0 1
5
6
1 2 0
1
7 0 1 0 8
(D2 D1 )1 = D1
1 D2 =
4 8 1
See text form MATLAB commands.
(a).
387
D1 =
388
11.
node 1:
[i1 0] + [0 i2 ] + [i7 0] + [i3 f i3 v] = [0 0]
node 2:
[i3 f i3 v] + [0 i8 ] + [i4 f i4 v] = [0 0]
node 3:
[0 i5 ] + [i6 0] + [i4 f i4 v] = [0 0]
node 4:
[i6 0] + [0 i8 ] + [i7 0] + [0 z] = [0 0]
Chapter Three
Section 3.65
6
65
2 1
0
0
1
0
0
0
9
9 1@2
0 :
1
0
0 :
:
: 9 0 3@2 1
9
1.
(a).
7 0
2@3
1
0 8 7 0 0 4@3 1 8
0 0
0 5@4
0
0
3@4 1
1
1 W
(b).
y = [470 625 823 3 1087 2 ] and x = [870 1270 1270 870]W
5
65
6
1 0 0
2 1
1
3.
(a).
S13 D = 7 1@2 1 0 8 7 0 5@2 1@2 8 and
0 2 1
0 0
5
S13 d = [3 2 6]W
W
(b).
y = [3 1@2 5]W and
x = [1 9 1]
b22 = 4@3 1
5.
(a).
D
1 2
b 2 = [823 1 470]W
b22 x2 = d
(b).
D
3
x2 = [1270 870]W and x1 = [470 1270]W
7-11.
See circuit3.m
Chapter Three
Section 3.7
1.
3.
5.
7.
11.
(a).
(b).
(a).
(b).
(a).
(b).
389
Chapter Four
Section 4.1
1.
3.
5.
(a).
(b).
(c).
(a).
(b).
(c).
(a).
(b).
Chapter Four
Section 4.2
1.
3.
5.
6
5
6
2 7
5 12
(a). DW = 7 0 1 8 and (b). E W DW = 7 5 19 8
1 2
10 27
Hint: Compute the transpose of DD1 = L.
(a).
30 10
p
19130
=
10 4
f
7735
5 6
5
6
0
1 1
9 0 :
9 2 1 : }1
9 :
:
(b).
Dz = 9
7 3 1 8 }2 = 7 0 8 implies four equations must
0
4 1
hold:
1}1 + 1}2
2}1 + 1}2
3}1 + 1}2
4}1 + 1}2
7.
=
=
=
=
0>
0>
0 and
0=
Chapter Four
Section 4.3
1.
(a).
(b).
(c).
OK
No. The data are not "near" a plane.
p1 = 4=0, p2 = 1=0, f = 92 and rW r = 36 AA 0=25=
390
3.
5.
(b).
(c).
(a).
9
:
9
:
9
:
9
:
9
:
9
:
: and d = 9
9
:
9
:
9
:
9
:
9
:
7
8
25000
24200
23900
23200
22600
22100
21500
20500
20100
6
:
:
:
:
:
:
:
:
:
:
:
:
8
(b).
2 3 3 1
3 4 4 1
5 4 4 1
8 5 5 1
12 6 6 1
15 8 8 1
19 10 10 1
23 11 11 1
27 13 13 1
3
5
7
9
11
12
14
15
9
8
7
5
4
3
2
1
12
13
16
18
21
23
26
24
:
9
:
9
:
9
:
9
:
9
b=9
: and d
:
9
:
9
:
9
:
9
8
7
(8 10)@2
(7 9)@2
(5 8)@2
(4 7)@2
(3 5)@2
(2 4)@2
(1 3)@2
(1 2)@2
6
:
:
:
:
:
:
:
:
:
:
8
Chapter Four
Section 4.4
1.
3.
5.
Chapter Five
Section 5.1
1.
3.
5.
b = [1 1 1]
(a).
n = [2 2 2] and n
(b). 5 u = 1@26 and 5v = 1@26 5 6
2@3
1@3
2
x = u7 1 8 + v7 0 8+ 7 0 8
0
1
0
5
6
5 6 5 6
1@2
0
5
x = u7 1 8 + v7 0 8 + 7 0 8
0
1
0
9.
11.
391
1 0
3 2 1 2
3 2 1 2
=
3 1
9 6 3 5
0 0 0 1
implies 0{1 + 0{2 + 0{3 = 1!
The free 5
variable
{3 = u and
6 is 5
6
3
3
x = u 7 0 8 + 7 1@2 8 =
1
0
The free5variable
u and
6 is5{3 = 6
1
4
x = u 7 1 8 + 7 3 8 =
1
0
Chapter Five
Section 5.2
1.
(a).
(b).
(c).
3.
(a).
(b).
(c).
(d).
5.
(a).
6
4
9 0 :
:
xs = 9
7 0 8
50
6
5
6
5 6
2@3
1@3
0
9 1 :
9 0 :
9 0 :
:
9
:
9 :
xk = u 9
7 0 8 + v7 1 8 + w7 0 8
1
5 6 0 5
6 0 5
6
5
4
2@3
1@3
9 0 :
9 1 :
9 0 :
9
:
9
:
9
:
9
x=9
7 0 8 + u7 0 8 + v7 1 8 + w7
0
0
0
3 2 1 1 6
0 5
0 0 16 1
5@3
9 0 :
:
xs = 9
7 0 8
5 1
6
5
6
2@3
1@3
9 1 :
9 0 :
:
9
:
xk = u 9
7 0 8 + v7 1 8
06
06
5
5
5
6
5@3
2@3
1@3
9 0 :
9 1 :
9 0 :
:
9
:
9
:
x=9
7 0 8 + u7 0 8+ v7 1 8
1
0
5
6 0
2 1 1 3 4
7 0 3 1 8 6 8
0 0 0 0 0
5
6
0
0 :
:
0 8
1
392
(b).
(c).
5
7.
1 0
9 0 1
9
7 0 0
0 0
6
1 0 2@6 1@6 6@6
7 0 1 1@3 8@3 6@3 8
0 0 0
0
0
5 6
5
6
5
6
1
2@6
1@6
9 2 :
9 1@3 :
9 8@3 :
:
9
:
9
:
x=9
7 0 8 + u7 1 8 + v7 0 8
0
0
1
6
0 1 0 0 1
0 1 0 1@2 1 :
:
1 1 0 0 1 8
0 0 1 1@2 2
Chapter Five
Section 5.3
1.
3.
W
HD15H W = [25@6]> y =
6 30@29 and x = [89@29 72@29 106@29]
1@2 1@2
0 8 > z = [2=4828 3=6552]W and
Q =7 1
0
1
x = [3=0690 2=4828 3=6552]W
Chapter Six
Section 6.1
1.
3.
5.
7.
9.
Chapter Six
Section 6.2
1.
3.
5.
7.
9.
(a).
(b).
(a).
(b).
(a).
(b).
{0 (0) = 2 + 5(1 + 0) = 3
{k = f1 h3w + f2 h2w
{ = (3@5)h3w + (2@5)h2w
{k = f1 h4w + f2 wh4w
{ = 2h4w + 11wh4w
Hint: Subtract the two equations.
Hint: Show } must be equal to zero.
Chapter Six
Section 6.3
1.
3.
5.
7.
Chapter Six
Section 6.4
1.
3.
5.
7.
9.
11.
Chapter Six
Section 6.5
3.
Chapter Seven
Section 7.1
1.
(a).
{
|
=
0
1
1 8
{
|
393
394
3.
(c).
(a).
(b).
5.
(c).
{
|
s
1s
h(4+ 15)w +
4 + 15
s
1s
h(4 15)w
f2
4 5
s
s
s
s
f1 = (4 15)@( 15) and f2 = (4 + 15)@( 15)
Replace
100(L) by 50 (L).
{
1
1
= f1
h(2@25)w + f2
h(6@25)w
|
2
2
f1 = 7@4
andf2 = 1@4
1
1
= (1)
h4w + 3
h2w
1
2
(b).
{
|
= f1
Chapter Seven
Section 7.2
1.
3.
5.
7.
s
1s
1s
0
1
(a).
Show
= (2 3)
1 4
2 3
2 3
s
(b).
Let u = 2 3and
0
0u
1
x1
=
implies
0
1 4 u
x2
s
s
(2 + 3)x1 + 1x2 = 0 and x1 + (2 + 3)x
s 2 = 0=
Let x1 = 1 and then
compute
x
=
(2
+
2
3)=
2 3
1
1
(a).
Show
= (1)
1 2
1@3
1@3
2 (1)
3
x1
0
(b).
=
implies
1
2 (1)
0
x2
(1)x1 + (3)x2 = 0 and (1)x1 + (3)x2 = 0=
x2 = 1@3=
Let
x1 = 1 and then compute
4@25 u
1@25
det(
) = (4@25 u)2 4@252 = 0 implies
4@25
4@25 u
u = 6@25 and
2@25=
4u
1
det(
) = (4 u)(1 u) + 2 = 0 implies
2 1 u
u = 2 and 3=
Chapter Seven
Section 7.3
1.
(a).
(b).
(c).
3.
(a).
u1 = 1 and u1 =
w
h
h5w
[(w) =
w
h
h5w
w
h
[(w)y(w) =
hw
(b).
(c).
1
1
; u1 = 5 and u1 =
1
1
w
h @2
hw @2
and [(w)1 =
h5w @2 h5w @2
5w
w
h
h (w@2 + 0)
h5w (w@2 4@10)
h5w
w 2@5
2@5
2w
3w
hw h5w
h @3
h @3
(d).
[(w)y(w) =
=
0
h2w @3
hw h5w
1
185@36
7@6
1
2w
3w
h +
+
w
(37@4)
h + (28@9)
1@6
1
2
109@36
1
1
17@26
(7@2)
h2w + (67@13)
h3w +
cos(2w)+
2
1
11@13
7@26
sin(2w)
10@13
5.
7.
Chapter Eight
Section 8.1
1.
3.
(c).
Chapter Eight
Section 8.2
1.
3.
5.
9.
Chapter Eight
Section 8.3
Have fun comparing the new images.
Chapter Nine
Section 9.1
1.
3.
395
396
9
9
F5 f = 9
9
7
1 1
1 }
1 }2
1 }3
1 }4
1
}2
}4
}
}3
1
}3
}
}4
}2
1
}4
}3
}2
}
65
:9
:9
:9
:9
87
2
8
9
1
3
: 9
: 9
:=9
: 9
8 7
23=0000
2=6910 + 9=4576l
3=8090 4=6695l
3=8090 + 4=6695l
2=6910 9=4576l
6
:
:
:
:
8
Chapter Nine
Section 9.2
1.
(a).
3.
(a).
Chapter Nine
Section 9.3
Enjoy the image lters.
65
6 5
6
sin(21(0))
0=0
8 7 sin(21(1@3)) 8 = 7 1=5l 8
sin(21(2@3))
1=5l
1
}2
}4
}
}3
1
}
}2
}3
}4
6
:
:
:
:
8
Bibliography
[1] Robert L. Borrelli, Courtney S. Coleman, Dierential Equations: a Modeling Perspective, Wiley, 2004.
[2] Gonzales and Woods, Digital Image Processing, 2nd Edition, Prentice Hall,
2002, http://www.imageprocessingplace.com.
[3] Center for Research and Scientic Computing, North Carolina State University, http://www.ncsu.edu/crsc/ilfum.htm.
[4] The MathWorks Inc., http://www.mathworks.com.
[5] Carl D. Meyer, Matrix Analysis and Applied Linear Algebra, SIAM, 2000.
[6] Cleve Moler, Numerical Computing with MATLAB, SIAM, 2002,
http://www.mathworks.com/moler.
[7] R. Kent Nagle, Edward B. Sa and Arthur David Snider, Fundamentals
of Dierential Equations and Boundary Value Problems, Addison Wesley,
2004.
[8] Gilbert Strang, Introduction to Applied Mathematics, Wellesley-Cambridge
Press, 1986.
[9] United Nations, http://www.un.org/esa/population/unpop.htm.
[10] United States Census Bureau, http://www.census.gov/main/www/
cen2000.html.
[11] United States NASA, http://www.nasa.gov/vision/universe/
solarsystem/mer_main.html.
[12] Robert E. White, Computational Mathematics: Models, Methods and
Analysis with MATLAB and MPI, Chapman and Hall/CRC, 2004.
397
Index
Applications
angles and area, 30
circuit, 244
LRC tuning, 272
modulated LRC, 277
three-loop, 155, 236
two-loop, 103, 218
data modeling, 83, 171
ow rate identication, 196
multiple markets, 192
price, 89
radioactive decay, 177, 200
real estate appraisal, 194
sales prediction, 173
United States population, 201
world population, 173, 187
uid ow, 238
heading velocity, 25
heat conduction, 286
in a wire, 111, 123
parameter identication, 204
time dependent, 306
image, 90
contrast, 324
lter in 1D, 358
lter in 2D, 365
lters, 370
sharpen, 336, 339
inventories, 86
mass-spring, 251
damped forced, 270
dampened, 260
forced, 268
mixing
one-tank, 244
three-tank, 166, 293
two-tank, 283
motion of a mass, 49
mass-spring, 251
projectile, 244
projectile in space, 72
phasors, 43
torque, 34, 57, 61
truss
ve-bar, 149
six-bar, 133, 237
two-bar, 101
visualization, 100
work
in space, 54
independent of path, 34
on a ramp, 33
array operations, 99
auxiliary equation, 253
basis vectors, 213
block Gauss elimination, 231
box product, 62
Cauchy-Schwarz inequality, 28, 53,
98
characteristic equation, 253
complex algebraic equation, 6
n-th root, 15
complex function
exponential, 14
linear, 10, 11
quadratic, 11
square root, 12
complex number, 3
exponential form, 14
eld properties, 6
polar form, 4
399
400
convolution
two functions, 344, 346
two matrices, 364
two vectors, 356
cosine identity, 28, 52
cosine law, 22
Cramers rule, 80, 88, 161, 165
cross product, 59
curve tting, 83, 89
de Moivres formula, 15
determinant, 32, 59, 161
dierential equation, 90
general solution, 245
homogeneous second order, 252
homogeneous solution, 245
particular solution, 245
dimension of a subspace, 213
Dirac delta functional, 347
discrete Fourier transform, 351
1D version, 348
2D version, 361
convolution property, 357, 365
fast Fourier, 350
inverse, 354
dot product, 28, 52, 97
INDEX
Heaviside function, 347
helix, 72
histogram of an image, 321
homogeneous solution, 225, 252
ill-conditioned problems, 119
image, 90, 311, 313315
color, 319
lter, 365
lter in 2D, 366
p-w linear transform
contrast, 324
power transform
brighten-darken, 327
sharpen, 336, 339
impulse function, 347
inconsistent algebraic system, 225
initial value problem, 304
rst order linear, 243
second order linear, 250, 267
integer, 1
inverse matrix, 138, 165
Lagrange identity, 61
Laplace transform, 344
least squares, 172
least squares solution, 42, 184
line in a plane
distinct points, 39
parametric equations, 38
point and direction vector, 39
point and normal vector, 39
single equation, 38
slope-intercept, 38
line in space
parametric equation, 67
vector equation, 67
linear operator, 243, 253
linearly independent, 32, 64, 185,
212
logistic function, 202
LU factorization, 151
MATLAB codes
aerialpower.m, 329
bigc(), 371
eigenvalue, 290
eigenvector, 290
equilibrium equations, 230
Eulers formula, 14
INDEX
bign(), 371
bigs(), 371
bigu(), 371
blur1d.m, 332
blur2d-ncsu.m, 334
bridge.m, 149
circuit3.m, 157
color-imagncsu.m, 319
complex-power.m, 12
complex-prod.m, 8
cycloid.m, 43
decay.m, 178
E-eq-bge.m, 240
E-eq-null.m, 240
euler-form.m, 16
tsine.m, 358
tsine2d.m, 366
ttrig.m, 353
ttrig2d.m, 363
ttrig2da.m, 362
lter-aerial.m, 375
lter-micro.m, 375
lter-ncsubu.m, 372
lter-ncsuid.m, 371
gauss-el.m, 136
heat-fmin.m, 206
heat-sol(), 206
heat4.m, 308
helix.m, 73
imagncsu.m, 91, 318
inv-mat.m, 147
letterc(), 91, 316
lettern(), 91
letters(), 91
letteru(), 91
lines3d.m, 75
log-sol(), 203
lrc.m, 278
ls-graph.m, 175
ls-heat(), 206
ls-log.m, 203
ls-rad(), 200
market.m, 177
marspower.m, 329
moonsharpen.m, 339
401
phasor.m, 44
pollenhist.m, 321
pollenlight.m, 323
pollensharpen.m, 337
pollenspread.m, 326
pop-us-fmin.m, 203
pop-us.m, 202
pop-world-fmin.m, 207
pop.m, 188
proj3d.m, 74
rad-fmin.m, 200
rad-sol(), 200
spread.m, 325
support.m, 136
varpar.m, 304
wire-time-cur.m, 124
wire-time.m, 114
yplrc(), 278
matrix
augmented, 99, 128
diagonal, 119
elementary, 129
Fourier, 349, 351
fundamental, 303
identity, 138
image, 90
inconsistent, 130
inverse, 138
lower triangular, 119
reduced row echelon form, 228
row echelon form, 222
transpose, 63, 182
tridiagonal, 122
upper triangular, 119
Wronskian, 255
matrix-matrix products, 109
matrix-vector products, 106
multiple solutions, 89, 226
Nelder-Mead simplex method, 199
Newtons law of motion, 20, 49
norm, 51, 53, 97
normal equation, 89, 184
nullspace method, 234
particular solution, 225, 264
402
phasor, 44
pivot component, 222
precision, 2
prime number, 1
Pythagorean theorem, 21
rank of matrix, 222
rational number, 1
real number, 2
reduced row echelon form matrix,
228
resonance, 270
roots of unity, 16
row echelon form matrix, 222
row operation, 129
Runge-Kutta numerical method, 278
Schur complement, 153
thermal conductivity, 112
undetermined coe!cients, 245, 264,
298
variation of parameters, 247, 276,
302
vector
2D, 19
3D, 47
addition, 23, 50, 96
angle, 24
augmentation, 96
column, 19, 47, 96
dot product, 97
inventory, 86
norm, 24, 51, 97
orthogonal, 97
parallel, 29, 53
perpendicular, 29, 53
position, 47
price, 86
row, 19, 47, 96
scalar product, 23, 50, 96
transpose of a column, 19, 47,
96
unit, 24, 48
INDEX
unit basis, 19
vector space, 23, 51, 97
basis vectors, 213
dimension of a subspace, 213
subspace, 209
nullspace, 211
range space, 211