You are on page 1of 113

CHAPTER 1

Introduction to Mathcad
Mathcad is a product of MathSoft inc. The Mathcad can help us to
calculate, graph, and communicate technical ideas. It lets us work with
mathematical expressions using standard math notation - but with the
added ability to recalculate, view, present, and publish with ease, even
to the Web. We shall explore the following functionalities provided by
Mathcad ,
Numeric operators perform summations, products, derivatives,
integrals and Boolean operations.
Numeric functions apply trigonometric, exponential, hyper-
bolic and other functions and transforms.
Symbolics simplify, dierentiate, integrate, and transform ex-
pressions algebraically.
Vectors and Matrices manipulate arrays and perform vari-
ous linear algebra operations, such as nding eigenvalues and
eigenvectors, and looking up values in arrays.
Dierential Equation Solvers support ordinary dierential equa-
tions, systems of dierential equations, and boundary value
problems both at the command line and in solve blocks that
use natural notation to specify the dierential equations and
constraints.
In this chapter, we give a brief introduction to its user interface and
the basic usage of MathCad in dening, evaluating, and graphing of
variables and functions.
1
2 1. INTRODUCTION TO Mathcad
1. User Interface: Menus and Toolbars
Since MathCad is a window program as shown in the following
screen shot after run the Mathcad program.
Figure 1. Mathcad Window
The blank area is the work area that allow us typing and evaluat-
ing mathematical expression, graphing, symbolic computing, entering
and running Mathcad scripting codes, and entering ordinary text.
It has standard main menu bar at the top of the window as most
window programs do that is shown in the following screen shot.
Figure 2. Main Menu Bar
But some menus deserve a little more attention. They are View,
Insert, and Symbolic menus.
1.1. The View Menu. The View menu, among other features,
allows a user to bring up popup menu bars for using with Mathcad .
1. USER INTERFACE: MENUS AND TOOLBARS 3
Figure 3. Menu Bar
Mathcad has nine popup toolbars that for entering math formulas,
mathematical symbol, graphing, programming, etc. We can choose to
bring up each one at a time or bring up the top level popup menu
toolbar by selecting Math as shown in the following screen shot,
Figure 4. Top Level Popup Menu Toolbar
By click each menu icon at this top level menu bar, we can bring
each individual one as needed.
4 1. INTRODUCTION TO Mathcad
Practice
(1) Start the Mathcad program and explore it top menu system by
click on each menu item.
(2) Bring up the Math popup menu toolbar, move mouse over
each icon to see the caption.
(3) Click each icon of the Math popup toolbar to bring up other
popup toolbars and explore them.
1.1.1. Graph Toolbar. The graphic toolbar contains toolbars for
Figure 5. Graph Toolbar
creating 2D-graph and 3D-graph that are most useful for our purpose.
First click on any blank spot in the work area, which tells Mathcad
where to place the graphic region; then click on the icon
or type [Shift][2]( @ sign) Mathcad creates a 2D graphic region at
the selected location that can be used to graph any equation y = f(x)
or vector pair {Y, X}. We will give examples to illustrate how to graph
functions and vector pair in later section.
1.1.2. Vector and Matrix Toolbar. The Vector and Matrix Tool-
bar contains toolbars for creating and manipulating matrices.
Figure 6. Vector and Matrix Toolbar
1. USER INTERFACE: MENUS AND TOOLBARS 5
The most frequently use menu selection in the matrix popup toolbar
is the create matrix icon,
which upon click will bring up a dialog box that allow us to create
a matrix with specied number of rows and columns. Another way to
bring up the matrix creating dialog box is press [Ctrl][M] (hold [Ctrl]
key and press [M] key)). matrix with one row or column is a
vector. The matrix popup toolbar also contains menu selections that
help us to nd eigenvalues and eigenvectors, to access each individual
row or column, or nd inverse. However once we remember the hot-key
or function-call for each operation, we dont really need these toolbars.
Using hot-key or function-call is a much quick way to invoke the menu
selection.
For example, to nd inverse of an given matrix A, we only need to
type A^{-1} (which will show as A
1
in the workplace) and = (which
tells Mathcad to execute the operation) to nd it.
1.1.3. Evaluation Toolbar. The Evaluation Toolbar contains tool-
Figure 7. Evaluation Toolbar
bar for assignment operator :=, global denition operator , and the
evaluation command =.
Notice in Mathcad , equal sign = is used as evaluation command
that tells Mathcad to carry out the computation. There are two ex-
ecution mode, one is automatic, in this mode, Mathcad carries out
execution when we press [=]; another is manual, in this mode you will
have rst press [=] followed by [F9] key to let Mathcad to carry out the
execution. The manual mode is desirable when we want to delay the
execution and dont want to be bothered by many error message Math-
cad would produce in automatic mode. You turn o/on the automatic
mode from the Math menu on the Main Menu bar.
6 1. INTRODUCTION TO Mathcad
In the automatic execution mode, after we type 3+2= we get
3 + 2 = 5.
If we want to assign 2 to variable x we will have to type x:2 , which
will be displayed as x:=2 in the work area. Therefore, a mathematical
expression
y = x + 3
will be enter dierently according to the meaning of the expression,
(1) Entering it as y:x+3 when x value has been dened before
this expression and you want y to be the value of x plus 3, i.e.
assign the value of x + 3 to y.
(2) Entering it as y(x):x+3 when we want to set y as a function
of x dened as x + 3.
(3) Entering it as y[Ctrl]=x+3 when we like to compare y and
x + 3, i.e. to logically determine if y has the same value as
x+3, here [Ctrl]= mean enter = while hold the [Ctrl] key.
We can get the logic equal sign =from the Boolean Toolbar
as shown below. Notice you also get , , =, and other logic
operation from the Boolean Toolbar.
Figure 8. Boolean Toolbar
The global assignment operator (shortcut ) is to assign an
value (expression) to a variable (a function) so it can be referred in
any place of the work area. The following screen shot illustrates the
dierence between =, :=, =, and ,
1. USER INTERFACE: MENUS AND TOOLBARS 7
The reason behind these dierences and using of Mathcad is that
scans your input from top to bottom and left to right as illustrated in
the following diagram.
Scan Start
Top-Left
to

to
//
Right
Bottom
So a variable or a function must be dened before it is used. The
will give us a leverage to defy this scan order so we can dene and use a
variable (function) without worrying about the proper order demanded
by the Mathcad as illustrated in the following two screen shots. Notice
red font indicate a error.
1.1.4. Calculus Toolbar. The Calculus Toolbar as shown below
allow us to perform computations found in Calculus. We will give
detail description in later section about the symbolic computation using
Mathcad
8 1. INTRODUCTION TO Mathcad
Figure 9. Calculus Toolbar
1.2. The Insert Menu. The Insert menu,among other features,
allows a user insert a text region in the Mathcad work place or math
region inside text region,
Figure 10. Insert Menu
In side the text region, user can enter any text as she/he would
do in a normal text editor with any format setting that can be speci-
ed through the Format->style menu. Another way to insert a text
region is to type double quotation mark . Mathcad also allow a
user to insert a math region inside a text region so users can insert a
mathematical expression in the text region.
1. USER INTERFACE: MENUS AND TOOLBARS 9
A third usage we are interested in the Insert menu is to insert a
graphic region, a matrix, and a special build in function. The following
screen shot shows the case of inserting a matrix.
Figure 11. Insert a Matrix
1.3. The Symbolic Menu. The Symbolic menu, allows us to
Figure 12. Insert Menu
carry out symbolic computation. We can factor polynomial, simplify an
complex expression, nd antiderivative, Laplace transform and inverse
Laplace transform, etc.
10 1. INTRODUCTION TO Mathcad
The following screen shot shows the case of evaluating an expression
symbolically.
Figure 13. Evaluate
Another screen shot to show nding Laplace transform symbolically.
Figure 14. Laplace Transform
Practice
(1) Find dierence between =, := ([Shift][;], :), =([Ctrl][=]) and
([Shit][], sign) with mathematical express y = x + 3.
(2) Dene some matrix in you working area and place with Matrix
toolbar.
(3) Place graph region in the work area, the typing something in
the place hold .
1. USER INTERFACE: MENUS AND TOOLBARS 11
1.4. Shortcut keystrokes. Besides using menus or popup menu
toolbars to insert item into working place, we can (should) use shortcut
keystrokes (or hot keys) to accomplish the same goals.
One important concept in entering expression in Mathcad is the
place holder. It is a little dark rectangle box . For example, when you
type + (addition operator) in any blank area we get + . In the
place holders we enter any valid mathematics expression.
Mathcad uses arithmetic operators +, , etc in the same way as
standard calculator. The following table list the keystrokes for arith-
metic operators, root operators, and subscription (indexing).
Keystroke Usage Type Display Remark
+ add a+ a + type an expression in
- subtract a- a type an expression in
* times a* a type an expression in
/ divide a/
a
type an expression in
power a a type an expression in
\ square root \

type an expression in
[Ctrl]\ n
th
root [Ctrl]\

type index in the rst and
radicand in the second
[ subscript a[ a type subscripts separated by , in
Table 1. Arithmetic And Radical Operators
Since in mathematics x = y has four dierent meanings,
(1) denition: denes functions or notation, for example, in the
expression f(x) = x
2
+ 1, one denes a function f by an ex-
pression x
2
+ 1.
(2) assignment: assigns value of y to x; like in the sentence set x
= y...
(3) logical equal: x is equal to y logically; like in the sentence if
x = y ....
(4) result of computation: like 4 + 5 = 9 here 9 is result of
adding 5 to 4.
Mathcad uses = as execution command, that is to tell Mathcad to
compute the value. It uses (:=) for assignment and denition, and
(boldface =) for logic equal.
12 1. INTRODUCTION TO Mathcad
The following table list keystrokes for assignment plus relational
operators.
Keystroke Usage Type Display Remark
Entering text type any text in
: assignment a:3 a := 3 assign 3 to a
; range
variable
a:1; a := 1 . . . if enter 4 in , a will have values
1, 2, 3, 4
[Shift][]() global
assignment
a 3 a 3 assign 3 to a globally
[Ctrl][=] logic equal a:[Ctrl][=]1; a=1 a is logically equal to 1
< less than a< a < type an expression in
> greater than a> a > type an expression in
[Ctrl][9] less or equal a [Ctrl][9] a type an expression in
[Ctrl][0] greater or
equal
a [Ctrl][0] a type an expression in
[Ctrl][3] not equal a [Ctrl][3] a = type an expression in
Table 2. Assignment And Relational Operators
The following table lists keystrokes to bring up derivative operators,
integration operators and matrix operators.
Keystroke Usage Type Display Remark
[Shift][/](?) derivative [Shift][/]
d
d
variable in at denominator
and function in other
[Shift][Ctrl][/] nth
derivative
[Shift][Ctrl][/]
d
d
index at two exponents vari-
able in at denominator after
d and function in last
[Ctrl][I] indenite
integral
[Ctrl][I]

d integrant in rst and integral


variable in second
[Shift][7](&) denite
integral
[Shift][7]

d integrant in rst and integral


variable in after d
[Ctrl][M] add matrix [Ctrl][M] A dialog box specify rows and columns in
the dialog box
[Ctrl][6] get a row of
a matrix
M[Ctrl][6] M
< >
specify row number in , which
is between 0 and rows(M)-1 in-
clusive.
Table 3. Calculus And Matrix Keystrokes
2. BASIC USAGE OF Mathcad 13
Practice
Start Mathcad and practice all shortcut keys (hot-key) listed in the
four tables.
2. Basic Usage of Mathcad
One can use Mathcad as ordinary graphic calculator in doing arith-
metic computing like 3 + 5 = 8 , dening and graphing functions such
as f(x) = 3x
2
+3. When perform arithmetic computation, you just need
to click any blank area and enter the expression, then press = or = and
[F9] key. The result will be immediately display. For example the fol-
lowing key strokes 3+5= will produce 3 + 5 = 8 in the working area
when aut-computation mode is on, or 3 +5 = if the aut-computation
mode is o. In later case, you will have to press [F9] key to generate
the result.
The dierence between = and [F9] is the following,
= only evaluate expressions when the mode of execution is set
to be automatic. If aut-computation mode is turn o, = will
only create a . after the expression.
F9 causes Mathcad to carry out all computation in a given work-
place. You will have to use [F9] to tell Mathcad to do compu-
tation if you turn o the automatic compute mode, which is
desirable if you dont want to be bothered by Mathcad warning
message.
You can turn on/o the aut-computation mode through Math
menu.
2.1. Some General Editing Methods. As in most window based
text editors, we can use mouse to choose input starting point by moving
mouse cursor to a desired point and click the right button.
Every Mathcad equation, text paragraph, and plot in a worksheet
is a separate object called region. We can also use mouse to select
several regions and drag them around.
To select one region, just move mouse over the region and click. A
light bounding box will appear, which indicates the region is selected,
as in the following screen shot for a selected math region,
14 1. INTRODUCTION TO Mathcad
and another screen shot for selected text region,
Figure 15. Select Text Region
To select one or more regions on the screen, move the mouse to the
starting point and hold down right button and move the mouse. A
selecting box appears, any item inside the selecting box is surrounding
by a dashed box as shown in the following screen shot.
Figure 16. Select Multiple Locations
After releasing the right mouse button, all regions selected items
are bounded by dash box and the mouse cursor changes to a small
hand. Click and hold mouse on any of selected region, you can move
the selected regions to any wanted location. To deselect, simply click
on any blank region outside the selecting box.
We can also select items inside each region. When we click a math
region, we see a blue selecting line under the currently selected item.
The blue selecting line has three dierent shape depends on where we
click at in a math region. If we click at the beginning of the math
region (or before a math operator like +, -, ) etc.), the blue selecting
line is look like ; if we click at the middle of some text, the blue
selecting line is look like ; if we click at the end of the region (or after
a math operator like +, -,) etc.), the blue selecting line is look like .
The following screen shot displays some of the cases,
By push space bar, we can increase number of item selected, arrow
keys are used to change selection and shape of the blue selection line.
To select texts in a text region, we just click at any desired point
inside the region, and either hold the right button down while dragging
2. BASIC USAGE OF Mathcad 15
Figure 17. Click at Dierent Location
or hold the [Shift] down and using the arrow keys to choose the selection
as in most text editors.
Furthermore, we can use [Ctrl]C (copy), [Ctrl]V (paste), and [Ctrl]X
(cut) as in most text editors to copy, paste, and cut selected region(s).
2.2. Dene Variables and Functions. As in all computational
program, when a computation involving a variable of functions, the
variable or function must be dened before its use unless the function is
predened in Mathcad . Mathcad predenes many functions, such as all
trigonometric function, exponential function and logarithm function.
The following table list most frequently used predened functions
Function Type Display Remark
sin(x) sin(x) sin(x) when type sin() = , you will
get 0, since sin() = 0
cos(x) cos(x) cos(x) when type cos() = , you will
get 1, since cos() = 1
tan(x) tan(x) tan(x) when type tan() = , you will
get 0, since tan() = 0
exp(x) exp(x) exp(x) this is exponential function,
you can also type e , you will
get e in you can enter an valid
expression
(x) F[Ctrl]g(x) (x) Heaviside function dened by
(x) =

0 if x < 0
1 if x 0
ln(x) ln(x) ln(x) natural logarithm function
Table 4. Mathcad Some Predened Functions
2.2.1. Dene Variables. There are two type variables in Mathcad ,
a normal variable which holds one value, and a range variable which,
like vectors in math, holds multiple values. The variable name is
any sequence of letters and digits that begin with a letter such as
a, a1, bx12, etc. To dene a normal variable you just click any clear
region and type the name of the variable followed by :, which bring up
16 1. INTRODUCTION TO Mathcad
the assignment operator :=, and followed by the numeral value. For
example the keystrokes x:23 denes a variable named x whose value
is 23, which is displayed as a := 23 in the worksheet.
To dened a range variable, usually an index variable, we use ;,
semicolon. The following table list several type of range variables,
Variable Type Display Remark
a a:1;10 a := 1..10 a takes values 1, 2, . . . , 10
ax ax:1,3;10 ax := 1, 3..10 ax takes values 1, 3, . . . , 10,
incremented by 2. Notice the
user of ,
ab1 ab1:0,.1;10 ab1 := 0, .1..10 ab1 takes values 0, 0.1,0.2, . . .
, 10, incremented by 0.1.
a1e a1e:10,9;1 a1e := 10, 9..1 a1e takes values 10, 9, . . . , 1,
decremented by 1.
ac ac:10,9.8;1 ac := 10, 9.8..1 ac takes values 10, 9.8,9.6, . . .
, 1, decremented by 0.2.
Table 5. Mathcad Example of Range Variables
2.2.2. Dene and graph Functions. To dene a function in Mathcad
is same as to write down a function in a piece of paper. You just
type in the function name, followed by open parenthesis ( and the
argument(s) that are separated by comma(,) and the close parenthesis
), then type the assignment operator colon(:) followed by typing in
the expression(formula) for the given function.
For example to dene a function f(x) = 4x + 3, we would type
f(x):4x+3, notice you dont need to type the multiplication operator
between 4 and x as Mathcad automatically insert it for you. However,
if you want to dene a function such as f(t, y) = 3t + ty, you would
need to specically type in the multiplication operator *, as shown,
f(t,y):3t^2+t*y
,
also notice that we should type no space between terms as Mathcad
will insert it for us when we type in a arithmetic operator. When typing
in an expression involving more than one terms, space character serves
as grouping operator. Hitting space bar will cause Mathcad to group
term together. This is useful when entering expression like
x+3
3x5
, here
we will need to group x + 3 together by press space bar before we
type the division operator(/). Another usage of space is to move out
the superscript or subscript mode. The following table gives several
example to illustrate the usage of space. Notice, in order to move out
2. BASIC USAGE OF Mathcad 17
Type Display Remark
x^2+3x x
2+3x
No space is typed after ^ so
Mathcad continue entering the
expression as exponents.
x^2 +3x x
2
+ 3x A space is typed after ^
so Mathcad exists the power
mode and enter 3x as another
term.
x[2+3x x
2+3x
No space is typed after [, the
subindex operator so Mathcad
continue entering the expres-
sion as subindex.
x[2 +3x x
2
+ 3x A space is typed after [
so Mathcad exists the power
mode and enter 3x as another
term.
x+3/4x+5 x +
3
4x+5
No space is typed before / so
Mathcad interprets as 3 di-
vided by 4x + 5.
x+3 /4x+5
x+3
4x+5
A space is typed before / so
Mathcad groups x + 3 and
treats it as numerator.
Table 6. Mathcad Eect of Space Character
of the denominator, we need to press space too. For example, if we
want enter
x+3
4x+5
+ 7x, we would type in Mathcad as x+3 /4x+5 +7x
that is entering one space after 3 and another space after 5 to move
out the denominator. Play with the space character (space bar) to see
if Mathcad can give us more surprises!
To nd value of a function, such as f(3), or h(4, 2), you rst dene
the function f and g and type f(3)= or h(4,2)=, Mathcad will happily
nd the value for you.
To graph a function of one variable after dening it, just click any
blank space after the denition of the function and type @ or from Insert
menu choose to insert xy-plot. A box will appear with several place
holders. Enter the function name on the left center place holder and
the variable on the bottom center place holder. If the variable name is
not used before, the Mathcad will display a graph over default interval
[-10, 10]. But if we has assign values for the variable, depending on
how we assign value to variable, we might be surprised to nd no curve
18 1. INTRODUCTION TO Mathcad
is displayed. That might be due to our variable only has one value,
so only a dot is plotted. To see if this is the case, double click the
graph box, a popup window will show, by specifying the thickness of
the trace we will see the dot if it is graphed. Another reason we dont
see a curve is that the range for y is not properly specied. We can
change the lower and upper limit for y variable by clicking the lower
and upper left corners, place holders(or number) will appear, change
it to the desired value, the graph will appear. So to graph a function,
we do:
(1) Dene the function.
(2) Dene range value for the variable of your function.
(3) Press @ and enter the function name and variable name in
proper place holder.
(4) Adjust the thickness of the trace.
(5) Adjust the y ranges by changing the numbers on the far left
(see the graph below).
We have two screen shots here, the rst one shows a blanket graph-
ing box with place holder and another graphing box display graph of
f(x) =
1
3
x(3 x) over interval[-4, 4].
Figure 18. Graph of one function and blank graphing box
The second one shows how to graph more than one functions in
the same graph box; it also shows the conguration box and change
of the weight of the curve. To graph two or more functions in one
graphing box, you just type comma(,) after each function name as
f(x),g(x), h(t). If two or more variable name (as in the case of
screen cut) you need specify them in the place holder for variable
comma separated as x,t.
2. BASIC USAGE OF Mathcad 19
Figure 19. Graph of two function in one graphing box
Notice, in this second screen shot t has only one value 2, so the
graph displayed as one point(green). We have changed the weight of
the trace to 5 so the point is big green dot.
Mathcad is capable to display many type of graphs. In the later
chapters we will learn how to plot 3-D graphs, such surface plot, contour
plot, vector eld plot, etc.
Practice
Start Mathcad program,
(1) Type the following expression in the work area
(a) x + 3y
(b) x
2
+ 2x 5
(c) e
2x
(d) x^2 *y^2 -x*y /2x*y-5, notice you need to hit
space bar a few time to before you enter /, so you get expression
x
2
y
2
xy
2xy5
(e) sin(3x)e
x
t
3
e
2t
(2) Dene matrices A =

3 4
1 18

by entering A:[Ctrl][M]
and choose 2 for row and column numbers, entering the num-
bers in proper place holder.
(a) Find inverse of A by type A^{-1}
(a) Find A

2
4

by entering A*[Ctrl][M] and set row=2


and col=1 in the dialog box, entering the number then press =.
Dene b =

2
5

, and nd Ab.
(3) Dene the following functions
20 1. INTRODUCTION TO Mathcad
(a) f(t) = 2t e
t
(4) (b) f(t, x) = t
2
4t sin(x)
(5) (c) f(t, x) =
2xe
x
2txcos(x)
.
(6) Graph function f(t) = t
2
2t 1
(a) without specifying value for t.
(b) dene t = 0, 0.1 5
(c) Graph g(t) = 4 sin(t) in the same chart.
(d) Graph a point (4, 5) in the same plot, now you need
put t, t, 4 in the bottom place holder and f(t), g(t), 5 in the left
middle place holder. You also need to double click the graph
and change the weight so the point is shown as in the following
screen shot.
Project
At beginning you should enter: Project title, your name, ss#, and
due date in the following format
Project One: Dene and Graph Functions
John Doe
SS# 000-00-0000
Due: Mon. Nov. 23rd, 2003
2. BASIC USAGE OF Mathcad 21
You should format the text region so that the color of text is dierent
than math expression. You can choose color for text from Format
>Style select normal and click modify, then change the settings for
font. You can do this for headings etc.
(1) Dene and Graph functions
In the project you will do:
Dene f(x) = (x 3)(x 1)(x + 2)
Dene a range variable x = 5, 4 5 and nd func-
tion value at range variable.
Find zero of its derivative by perform the following task,
[-] dene df(x) with input df(x):[Shift][/] and en-
ter f(x) and x in the place holder so you have df(x) :=
d
dx
f(x).
[-] Type keyword Given , entering df(x)[Ctrl][=] in
next line, and keyword Find following by (x), then press
[Ctrl][.]
[-] Find zeros of its second derivative.
Determine intervals where the function is concave upward
and concave downward. Type your explanation in text
regions.
Graph the function, its rst derivative, and second derivative
in the same plot. Explain the relationship between the
signs of its derivatives and concavities of its graph.
(2) Matrix Calculation
Dene the matrix A =

3 2 4
1 2 1
5 8 22

Find determinant of A by type |A, notice when you type


| you will get | | and in enter A.
Find inverse of A.
Find the solution of the following system of equation
3x
1
2x
2
+ 4x
3
= 1
x
1
+ 2x
2
+ x
3
= 3
5x
1
8x
2
+ 22x
3
= 11
by computing A
-1
b where b =

1
3
20

Solve the same


system of equations by
[-] Enter keyword Given ,
22 1. INTRODUCTION TO Mathcad
[-] entering
3x 2y + 4z = 1
x + 2y + z = 3
5x 8y + 22z = 11,
notice, you use [Ctrl][=] to enter the logic equal sign =.
[-] Enter keyword Find following by (x, y, z), then press
[Ctrl][.]
Compare the solution obtained in above two steps, do see
any dierence? and why? You should enter your obser-
vations in text region (created by enter double quotation
).
Double click the result of A
-1
b and change the display to
fraction.
Dene three functions:
M1(x, y) =
3
4
x +
1
2
y
1
4
M2(x, y) = x 2y 1
M3(x, y) =
5
22
x +
4
11
y
1
2
and graph them in a 3-D plot. You can use [Shift][Ctrl][2]
to create a 3-D plot region and in the place holder, enter
M1,M2,M3.
Rotate the graph by click at the region and hold right
mouse while moving it so the intersection is clearly seen.
CHAPTER 1
Explicitly Solvable First Order Dierential
Equations
In this chapter we will introduce the rst order dierential equations
and several type of it that can be solved explicitly using integration
methods covered in standard Calculus course.
From Calculus, we know that the derivative
df(t)
dt
of a function f(t)
is the rate at which the quantity x = f(t) is changing with respect
to the independent variable t. An equation relating an unknown
function and one or more of its derivatives is called an dierential
equation. Particulary, an equation of the form x

= f(t, x) is called a
rst order ordinary dierential equation(ODE), more precisely a semi
linear rst order ordinary dierential equation. In this chapter will
will demonstrate how to nd explicit solution(s) to a given ODE . In
general one cant nd explicit solution to a given ODE , but for special
types of f(t, x), we will have luck to do that.
Some clearance of notations is needed here.
In x

= f(t, x), t is the independent variable and x(t) is the unknown


function, x

is
dx
dt
, the rst derivative of x(t), and f(t, x) is a given
function of two variables t and x. So to nd an explicit solution is to
nd an formula for x(t) so that when substitute the formula in f(t, x),
we will get an expression in t only that matches x

(t). For example, for


example, suppose we have f(t, x) = x+t, our ODE reads, x

= x+t. If
we set x(t) = 2e
t
t 1 then f(t, x) = x+t = 2e
t
t 1 +t = 2e
T
1
and x

(t) = 2e
t
1 so x

= f(t, x) and x(t) = 2e


t
t 1 is an solution.
On the other hand if we write y

= f(x, y), then in this ODE , x


is the independent variable, y(x) is the unknown function to be found,
and y

is
dy
dx
, the rst derivative of y(x). So for y

= y + x, we would
get an solution y(x) = e
x
x 1.
Sometimes the independent variable does not appear in the equa-
tion such as y

= f(y) or x

= f(x) in those case, one could assume the


independent variable is either x (for y

= f(y)) or t (for x

= f(x)) and
write the solution accordingly. Hence, for y

= y one solution would be


y(x) = e
x
and for x

= x, one would write as solution as x(t) = e


t
.
1
2 1. EXPLICITLY SOLVABLE FIRST ORDER DIFFERENTIAL EQUATIONS
Note 0.1. It is very important for students to know what variable
represents an unknown function and what variable represents the in-
dependent variable that the unknown function is dened with respect
to.
1. Finding antiderivative using Mathcad
You can use Mathcad to nd both denite and indenite integral.
To access those two operators, you can bring up the popup menu, (See
Figure 1. Calculus tool bar
chapter 1 for how to bring up the Calculus popup menu.) Click on the

b
a
symbol to get the operator for denite integral and on the

symbol
to get the operator for the indenite operator. Then just ll in the
place holders accordingly. For denite integral, hit = to get the value
and for indenite integral, you need either
Select the entire expression and from the Symbolics menu
following the menu item evaluate to the symbolically(Or
[Shift][F9]).
or
Hold down the [Ctrl] key and press the [.] (period) key.
You can also access the integration operators by hot keys [Shift][F7]
for denite integral and [Ctrl][I] for indenite integral.
The integration operators appear on the workplace as shown in the
following diagram,
Now lets see some examples. The rst example is for nding denite
integral.
Example 1.1. Find the denite integral

3
0
(x
5
e
3x
sin(3x)) dx.
Solution At any blank space in the workplace of Mathcad , type
[Shift][F7], that is hold the [Shift] key and press [F7] key to place the
denite integration operator

d
1. FINDING ANTIDERIVATIVE USING Mathcad 3
Figure 2. Integration Operators
. Click the upper limit place holder, type 3 and click the lower limit
place holder type 0. Now click the integrant place holder type
x^5 -e^3x -sin(3x)
notice you need it the space bar twice before -sin(3x) . Of
course you need hit space bar once before entering -e^3x to exit the
power mode. Finally in the integration variable place holder type x(see
Figure 2 for the position of each place holder.) Now hit [=] key if in
automatic mode or =[F9] otherwise to nd the value 2.5 10
3
.
The second example is for nd indenite integral.
Example 1.2. Find the denite integral

x + 2e
3x
sin(3x)) dx.
Solution At any blank space in the workplace of Mathcad ,
type [Ctrl][I], that is hold the [Ctrl] key and press [I] key to place the
indenite integration operator

d .
Click the integrant place holder and type
\x+2 -e^3x -sin(3x)
Notice you need to hit the space bar twice before -sin(3x) . Of
course you also need hit space bar twice too before entering -e^3x to
exit the square root operator.
In general, you will need to hit the space bar as many times
an need to escape the power(subscript, division, etc.) mode
before you enter next term.
The backslash \ brings up the square root operator. Finally in
the integration variable place holder type x(see Figure 2 for the position
of each place holder.) Now hold down[Ctrl] to type [.] key and click on
4 1. EXPLICITLY SOLVABLE FIRST ORDER DIFFERENTIAL EQUATIONS
any region outside the bounding box, if not in the auto execution
mode hit [F9] too, to nd the antiderivative


x + 2 e
3x
sin(3x) dx
2
3
(x + 2)
3
2

1
3
exp
3x
+
1
3
cos(3x)
. Here exp represent exponential function. From Calculus, we know
that


x + 2 e
3x
sin(3x) dx =
2
3
(x + 2)
3
2

1
3
exp
3x
+
1
3
cos(3x) + C.
Mathcad omits the C for believing you know it! Remember C is im-
portant when we try to nd a particular solution for a given, so called,
initial condition.
Example 1.3. Find a function x(t) such that x

(t) = 2t and x(0) =


3.
Solution If we take antiderivative on both sides, we have

(t) dt =

2t dt
which leads to
x(t) = t
2
+ C. (1)
Evaluate this x(t) at t = 0 we have
x(0) = 0
2
+ C = C
So the requirement x(0) = 3 implies C = 3. Hence x(t) = t
2
+ 3.
Notice if we drop the C from (1), we would not be able to nd x(t)
that satises x(0) = 3!
The problem of nding a particular solution with initial condition is
called initial value problem, which we will discuss in the later section.
Practice
1. Find the following denite integral using Mathcad .
(a)

2
1
x
3
x cos(x
2
+ 1) dx
(b)

4
1
x
3
+4x5
x+1
dx
(c)

0
5
e
3x

x
x
2
+3
dx
(d)

10
1
x
2
x sec(x
2
+ 1) dx
2. Find the following indenite integral using Mathcad .
(a)

x
5
x

(x
2
+ 1) dx
(b)

x
3
+4x5
x
2
+1
dx
2. SEPARABLE EQUATIONS 5
(c)

x3
(x
2
+3)(x+5)
dx
(d)

x tan(x
2
+ 1) dx
2. Separable equations
If we let x be the independent variable and y be the dependent
variable, a separable ODE is given by,
y

= f(x)g(y)
where both f and g are given one variable functions and y

=
dy
dx
is the
derivative of y(x) with respect to x and y(x) is the unknown function
we want to nd out.
When g(y) 1, that is g(y) is a constant function whose value is
always 1, the separable ODE becomes
y

= f(x)
, which is sometimes called integrable ODE . The general solution to
the integrable ODE is the antiderivative of f(x), i.e.
y(x) =

f(x) dx
So if we can nd the antiderivative of f(x) we can nd the explicit
general solution.
Example 2.1. Find solution y

= x
2
+ 3
Solution The solution is,
y(x) =

x
2
+ 3 dx =
1
3
x
3
+ 3x + C
. Here we used the power rule of antiderivative,

x
n
dx =
x
n+1
n + 1
+ C.
To nd the solution in Mathcad , you just click any blank area in the
workplace and type [Ctrl][I] to get the indenite operator

d
and type x^2 +3 in the place holder for integrant and x in the inte-
grating variable place holder. Then press [Ctrl][.] and click on any
region outside the bounding box to get the result. Sometime you
might need to hit [F9] too if the auto execution mode is turn o.
6 1. EXPLICITLY SOLVABLE FIRST ORDER DIFFERENTIAL EQUATIONS
When g(y) is not a constant function, the general solution to
y

= f(x)g(y)
is given by the equation

dy
g(y)
=

f(x) dx, (2)


which is obtained by dividing both sides of the equation by g(y) and
then taking antiderivative to both sides.
So one has to nd two antiderivatives

dy
g(y)
and

f(x) dx. Some-


times we can solution for y(x) explicit from the (2), sometimes we cant
nd explicit formula for y(x), in that case we say y(x) is an implicitly
dened function.
Notice, in the process of nding the general solution to the separable
ODE , we divide both sides of the equation by g(y), that implicitly
requires that g(y) = 0. On the other hand if g(c) = 0 then y(x) = c is
an solution to the separable equation
y

= f(x)g(y)
This kind solutions are called stationary or steady-state solutions.
Sometimes they are also called singular solution.
Example 2.2. In the study of Epidemics, the spread of disease in
a population can be modelled by I

= (b(t)S(t) r(t))I where S(t) is


number of people that is susceptible to the disease but not infected yet.
I(t) is number of people actually infected. b, r are proportional function.
Now suppose S(t) = e
3t
, b = t
2
, and r = 4, nd all solutions.
Solution First notice that I(t) 0 is the steady-state solution.
Then, to
I

=
dI
dt
= (b(t)S(t) r(t))I,
divide its both sides by I, multiplying its both sides by dt and taking
antiderivative we have

dI
I
=

b(t)S(t) r(t) dt
The left side is easy to nd,

dI
I
= ln |I| + C (3)
Plug in the given functions, we get the right hand side

b(t)S(t) r(t) dt =

t
2
e
3t
4 dt
2. SEPARABLE EQUATIONS 7
Now open Mathcad window, click any blank area, type [Ctrl][I] to get
the antiderivative operator

d
type t^2 *e^{-3t} - 4 in the integrant place holder (again using
space bar to exit the power mode) and t in the other place holder, then
type [Ctrl][.], click any area outside the box. You will get

t
2
e
3t
4 dt =
1
3
t
2
e
3t

2
9
te
3t

2
27
e
3t
4t + C (4)
Put (3) and (4) together, we have
ln |I(t)| =
1
3
t
2
e
3t

2
9
te
3t

2
27
e
3t
4t + C
Solve for I(t), we nally arrive at
I(t) = e

1
3
t
2
e
3t

2
9
te
3t

2
27
e
3t
4t+C
= Ce

1
3
t
2
e
3t

2
9
te
3t

2
27
e
3t
4t

The next example shows that sometimes we can nd explicit for-


mula for the solution of an separable ODE .
Example 2.3. Find general solution of y

=
e
x
+2x
sin(y)+3y
2
+3
Solution Write y

as
dy
dx
, multiply both sides of the equation by
(sin(y) + 3y
2
+ 3)dy and take antiderivative, we have

sin(y) + 3y
2
+ 3 dy =

e
x
+ 2x dx
Now using Mathcad or compute by hand, we nd

sin(y) + 3y
2
+ 3 dy = cos(y) + y
3
+ 3y + C
and

e
x
+ 2xdx = e
x
+ x
2
+ C
So we have an implicitly dened solution y(x) by the equation
cos(y) + y
3
+ 3y = e
x
+ x
2
+ C
Here, we cant nd an explicit formula for y(t).
Practice
8 1. EXPLICITLY SOLVABLE FIRST ORDER DIFFERENTIAL EQUATIONS
Project
3. Linear equations and Bernoulli equations
3.1. Linear Equations. An ODE of form
y

+ a(x)y = b(x)
is called a linear equation. Any equation that can be converted into
this form can also be called a linear equation. Such as x
2
y

+4x
2
e
x
y =
sin(x), which can be written as y

+ e
x
y =
sin(x)
x
2
, is a linear equation.
The general solution of the linear equation is
y(x) = e

a(x) dx

b(x)e

a(x) dx
dx + C

Notice that C is inside the parenthesis. It is common mistake of


students forgetting multiplying C by e

a(x) dx
.
Example 3.1. According to Newtons law of cooling, the time rate
of change of the temperature T(t) of a air conditioned house with ex-
ternal temperature A(t) is proportional to the dierence A T. That
is,
dT
t
= k(A T),
where k is positive constant. Now, suppose A(t) = 80 10 cos(t) nd
the general solution.
Solution Since we want to use Mathcad to nd the antiderivative
for us, the rst thing is to nd how to get the Greek letter . To get
, rst bring the math tool bar from the View menu
Figure 3. Math Toolbar
3. LINEAR EQUATIONS AND BERNOULLI EQUATIONS 9
Click on the
Figure 4. Greek Letter Button
which will bring up
Figure 5. Greek Letter Bar
and select the letter.
Now if we rewrite and put in A(t)
dT
t
= k(A T),
we get
dT
t
= k(80 10 cos(t)) kT,
and is a linear equation with a(t) = k and b(t) = k(80 10 cos(t)), it
easy to see that

a(t) dt =

k dt = kt. Apply the solution formula we


have
T(t) = e
kt

ke
kt

80 10 cos(t)

dt + C

.
After bring up the indenite operator

d
type k*e^k*t (80-10cos(t) as integrant and t as integration vari-
able, press [Ctrl][.], click any place outside the box, we get,

ke
kt

8010 cos(t)

dt = 80e
kt
10k

k
k
2
+
2
e
kt
cos(t)+

k
2
+
2
e
kt
sin(t)

So the solution is
T(t) = e
kt

80e
kt
10k

k
k
2
+
2
e
kt
cos(t)+

k
2
+
2
e
kt
sin(t)

+C

10 1. EXPLICITLY SOLVABLE FIRST ORDER DIFFERENTIAL EQUATIONS

Example 3.2. If in Example 3.1, we set k = 0.2 and =



4
, we
would have general solution
T(t) = e
0.2t

80e
0.2t
5

3.2
0.64 +
2
e
0.2t
cos(t)+
4
0.64 +
2
e
0.2t
sin(t)

+C

The following graph displayed curves of several solutions with dierent


initial values T(0).
Figure 6. Greek Letter Bar
The picture above exhibits the situation when the air condition fails
at t = 0, so after a out 14 hours, the room temperature is the same as
the outside temperature!
Practice
(1) Find general solution to the following problem
(a) y

+ 4xy = x
2
(b) e
x
y

+ e
x
y = sin(x)
(c) xy

= 2y + x
3
cos(x)
(d) y

= 2xy + 3x
2
e
x
2
(e) (x
2
+ 4)y

+ 3xy = x
(f) (x
2
+ 1)y

+ 3x
3
y = 6xe

3
2
x
2
(2) Application: The equation y

= ky models wide range of


natural phenomenaany involving a quantity whose time rate
of change is proportional to its current size.
Continuously Compounded Interest Rate: Let P(t)
denote principle at time t, which will earn interest with rate
r(t) and compounded continuously, we have
dP
dt
= rP. Now
3. LINEAR EQUATIONS AND BERNOULLI EQUATIONS 11
suppose r(t) = cos
2
(t), nd the general solution and graph
the solution for several dierent value for the constant C in
the same coordinate. Explain the long time behavior of the
solutions.
Drug Elimination: Let A(t) be the amount of cer-
tain drug in the bloodstream, measured by the excess over the
natural level of the drug. Then in many situations A(t) will
decline at a rate proportional to the current excess amount.
That is
dA
dt
= A,
where > 0 is called the elimination parameter of the drug.
Suppose for one type of drug, (t) =
1
t
2
+4
nd the general
solution. Discuss its longtime behavior by graphing several
solutions in the same coordinate.
3.2. Bernoulli Equations. A Bernoulli equation is an ODE of
the form
dy
dx
+ a(x)y = b(x)y
n
. (5)
You can see that when n = 1, we get linear equation. So linear equation
is a special case of Bernoulli equation. On the other hand if we let
v = y
1n
, then
dv
dx
= (1 n)y
n
dy
dx
Dividing both side of (5) by y
n
, we have
y
n
dy
dx
+ a(x)y
1n
= b(x)
So
1
1 n
dv
dx
+ a(x)v = b(x). (6)
That is using the transformation v = y
1n
, the Bernoulli equation for
y becomes a linear equation for v.
Therefore to nd the general solution for Bernoulli equation (5) we
rst nd the general solution for the linear equation (6) of v, then using
y = v
1
1n
to nd y.
12 1. EXPLICITLY SOLVABLE FIRST ORDER DIFFERENTIAL EQUATIONS
Example 3.3. In modelling a population with its births(per unit
time) proportional to current population level and the deaths(per unit
time) is proportional to the square of the current population, we have
dx
dt
= ax bx
2
, which is called logistic dierential equation. It is a Bernoulli equation
with n = 2 (Notice it is also a separable equation if a, b are constants.)
Solution Let v = x
12
= x
1
, then xv = 1 apply product rule of
dierentiation, we have x

v + v

x = 0, plug in x

= ax bx
2
, we have
(ax bx
2
)v + v

x = axv bx
2
v + v

x = a bx + v

x = 0 since xv = 1
So
a bx + v

x = 0 (7)
Divide (7) by x and notice
1
x
is v, we have
v

+ av b = 0,
or
v

+ av = b.
Apply the solution formula for linear equation we have
v = e

a dt

be

a dt
dt + C

So
x =
1
v
=
e

a dt

be

a dt
dt + C

Example 3.4. In the logistic model,


dx
dt
= ax bx
2
, suppose a > 0, b > 0 are constants, we will discuss behavior of the
solutions.
3. LINEAR EQUATIONS AND BERNOULLI EQUATIONS 13
Solution From Example 3.3,
x =
e

a dt

be

a dt
dt + C

So
x =
e
at

be
at
dt + C
=
e
at

b
a
e
at
+ C
,
is the general solution.
When C = 0 we have x =
a
b
, a stead-state solution. Also, x = 0 is
another steady-state solution, which cant be represented in the general
solution.
We can rewrite x(t) as
x(t) =
a
b + aCe
at
,
since lim
t
e
at
= 0 So we have lim
t
=
a
b
. That is, as time goes
on the population will gradually settles itself at the level of
a
b
. The
following picture shows that the solution curves approaches the line
y =
a
b
= 10, with a = 0.2 and b = 0.002.
Figure 7. Population a = 0.2 and b = 0.02
14 1. EXPLICITLY SOLVABLE FIRST ORDER DIFFERENTIAL EQUATIONS
Here is how to get the graph in Mathcad :
- we rst dened a function x(t, C):=
0.2
0.02+Ce
0.2t
with two argu-
ments t and C by typing x(t,C):0.2/0.02+C*e^-0.2t,
- then we dened a range variable t:=0,0.1. . .20 by typing
t:0,0.1;20,
- nally, type @ at a blank area to get the xy-plot; in the function
place holder, we put
x(t,0),x(t,-0.01),x(t,-0.008),x(t,0.004),x(t,0.01)
and type t in the variable place holder, and click at outside of the
box to get the graph.

4. Initial value problem and existence theorem


The problem of nding a particular solution x(t) of an ODE x

=
f(t, x) that satisfying condition x(t
0
) = x
0
is called an initial value
problem. The problem can be written

= f(t, x)
x(t
0
) = x
0
Since solving an ODE requires a lots of hard work, it is wise to know if
a given equation has any solution before march on the journey of nd
a solution. For the linear rst order ODE x

+a(t)x = b(t) we following


existence-uniqueness theorem.
Theorem 4.1. If the function a(t) and b(t) are continuous on the
open interval I containing the point t
0
, then the initial value problem
x

+a(t)x = b(t), x(t


0
) = x
0
has a unique solution x(t) on I, given
by
x(t) = e

a(t) dt

b(t)e

a(t) dt
dt + C

(8)
with an appropriate value of C.
So solving an initial value problem for linear rst order ODE is easy.
One just apply the formula (8) and using the equation x(t
0
) = x
0
to
nd C.
Example 4.1. Solve the initial value problem x

+2tx = 4t
3
, x(0) =
1.
Solution First we apply the formula (8)
x(t) = e

a(t) dt

b(t)e

a(t) dt
dt + C

,
4. INITIAL VALUE PROBLEM AND EXISTENCE THEOREM 15
with a(t) = 2t and b(t) = 4t
3
. So

a(t) dt =

2t dt = t
2
, and
x(t) = e
t
2

4t
3
e
t
2
dt + C

.
Using method of substitution or Mathcad , we nd
x(t) = e
t
2

2t
2
e
t
2
2e
t
2
+ C

Let t = 0 we have x(0) = C 2. From initial condition x(0) = 1 we see


that C = 3. So the solution is
x(t) = e
t
2

2t
2
e
t
2
2e
t
2
+ 3

However, for general rst order ODE , the problem is not so nice,
the following theorem is a little bit hard to state and to understand.
Theorem 4.2. Let f(t, x) be dened on interval I. If the partial
derivative of f(t, x) with respect to y (denoted as
f(t,x)
y
, reads par-
tial f(t,x) over partial y) and f(t, x) are continuous at an open disk
centered at (t
0
, x
0
), then the initial value problem

= f(t, x)
x(t
0
) = x
0
has an unique solution on some open interval containing the point t
0
.
Remark 4.1. We will not discuss this existence and uniqueness
theorem for general ODE . But we would like to make some comments.
- To nd
f(t,x)
t
, you just need to treat x variable as a constant,
for example, let f(t, x) = t
2
x
3
+ 3t 4x, we have
f(t,x)
t
=
2tx
3
+3, here 4x is a constant with respect to t, so the derivative
is 0, and x
3
is also a constant, so t
2
x
3
when taking derivative
against t we have 2tx
3
. Therefore nding partial derivative is
as easy as to nd ordinary derivative.
- This theorem only guarantees a solution dened for t in an
open interval, which might be a bounded interval. For example
x

= x
2
, we see that x(t) =
1
t+c
is the general solution, if
c = 2 then the solution is only dened on interval (0, 2) as
x(t) =
1
t2
will become undened at t = 2.
- Some time we could have more than one solution that satises
the same initial condition, for example, for x

= x
2
3
and x(0) =
0 we have two dierent solution, one is x(t) = 0 another one
16 1. EXPLICITLY SOLVABLE FIRST ORDER DIFFERENTIAL EQUATIONS
is x(t) = t
1
3
. The reason is that for f(t, x) = x
2
3
,
f(t,x)
x
=
1
3

x
which is undened at (0, 0). So the conditions of the theorem
are violated.
5. Phase and vector eld diagrams
Sometimes it is more important to know the behavior of solutions
than to know precisely detail of point-by-point of some particular so-
lutions. Here we will discuss two diagrams to get an feel of behavior
of solutions for a ODE without actually nd any solution. The rst,
phase diagram, is used for the autonomous equations and is easy to
draw. The second, vector eld diagram, can be used for any equa-
tion but harder to draw. These two diagrams make use of the facts:
(1) The derivative f

(x) represent the slope of tangent line to the


graph y = f(x) at the point (x, f(x)).
(2) The sign of f

(x) tell whether the graph is going up or down.


If f

(x) > 0 the graph is increasing.


If f

(x) < 0 the graph is going down.


(3) The second derivative f

(x) gives information about concav-


ity:
If f

(x) > 0 the graph is concave upward.


If f

(x) < 0 the graph is concave downward.


The concepts of concavity (up or down) and monotonicity (going up
or down) is illustrated in the following diagram.
Figure 8. Concavity and Monotonicity
5.1. The phase diagram. First-order equations whose right-hand
side does not depend on the independent variable are called autonomous.
That is, autonomous equations are those of the form x

=
dx
dt
= f(x)
(The independent variable is t)or y

=
dy
dx
= f(y) (The independent
variable is x). To draw a phase diagram of x

= f(x), you would


5. PHASE AND VECTOR FIELD DIAGRAMS 17
Step one: Set f(x) = 0 solve the equation. The solution is called the
critical number of the equation x

= f(x).
Step two: Plot the solution one a horizontal (or vertical)number line.
The solutions will divide the line into intervals (segments),
pick any number from each interval (segment) and determine
the sign of the value of f(x) at the picked value.
Step three: Using the sign in Step two to draw arrow on each segment, a
right (up) arrow for positive sign and a left (down) arrow for
negative sign.
Example 5.1. Draw phase diagram for x

= (x1)(x+2)(x3).
Solution
Step one: Here f(x) = (x 1)(x + 2)(x 3) so f(x) = 0 gives
(x 1)(x + 2)(x 3) = 0,
and it has three solutions, x = 2, 1, 3
Step two: Plot the three solution on the number line,
Figure 9. Number Line
we see that we have four intervals: (-, -2), (-2, 1), (1, 3), and (3, ).
The following table organizes our computation,
Interval (-, -2) (-2, 1) (1, 3) (3, )
x-value picked -3 0 2 4
Value of f(x)=
(x-1)(x+2)(x-3)
f(-3)=(-3-1)
(-3+2)(-3-3)
=-24
f(0)=(0-1)(0+2)
(0-3)=6
f(2)=(2-1)(2+2)
(2-3)=-4
f(4)=(4-1)(4+2)
(4-3)=24
Sign of f(x) - + - +
Step three: Draw the arrows on the number line. A right arrow for
positive sign and a left arrow for negative sign.
Figure 10. Phase Diagram
If c is a critical number of x

= f(x), i.e. f(c) = 0,


c is a sink if arrows on both side of it point toward it.
c is a source if arrows on both side of it point away from it.
c is a saddle if one arrow points away from and another points
toward it.
18 1. EXPLICITLY SOLVABLE FIRST ORDER DIFFERENTIAL EQUATIONS
In Example ??, c = 1 is a sink, c = 2, 3 are source.
From phase diagram and the sign of derivative of x

=
df(x)
dt
=
df(x)
dx
dx
dt
= f(x)
df(x)
dx
, we can get an very good picture about the behavior
of the solutions.
Example 5.2. For x

= f(x) = (x 1)(x + 2)(x + 3), we have


f(x)
df(x)
dx
= (x1)(x+2)(x+3)(3x
2
4x5), which has the following
sign distribution,
(a)
d
2
x(t)
dt
2
> 0 on intervals, (2,
2
3

1
3

19), (1,
2
3
+
1
3

19), and
(3, ).
(b)
d
2
x(t)
dt
2
< 0 on intervals, (, 2), (
2
3

1
3

19, 1), and (


2
3
+
1
3

19, 3).
With this information and the phase diagram we have the following
picture of typical solutions for x

= (x 1)(x + 2)(x 3),


Figure 11. Typical solutions for x

= (x 1)(x + 2)(x + 3)
5.2. Vector eld diagram. We know that the derivative x

(t
0
)
of x(t) at t
0
is the slope of the tangent line to the graph of x(t) at
the point (t
0
, x(t
0
)), and the equation of the tangent line is y x(t
0
) =
x

(t
0
)(tt
0
). The idea of vector eld for an ODE x

= f(t, x) is to draw
a segment of tangent line to many chosen points (t
0
, x
0
) with slope
x

(t
0
) = f(t
0
, x
0
). When we draw enough such line segments, patterns
shall emerge and we shall have a clear idea(with some training) of the
behavior of solutions to the equation. The following diagram shows the
vector eld of x

= sin(t). Clearly we see the wave pattern of typical


solution x(t) = cos(t) + C.
Here two diagrams are shown, the right one is provided for novel
eyes, which has solutions curves superimposed on the vector eld. For
complicated vector eld only trained eyes will see the subtle patterns
5. PHASE AND VECTOR FIELD DIAGRAMS 19
Figure 12. Vector eld for f(t, x) = sin(t)
of the dynamics of solutions as shown in the next not so complicated
diagram,
Figure 13. Vector eld for f(t, x) = t x
2
To graph the vector eld diagram for y

= f(x, y) by hand over


rectangular region [a, b] [c, d], you would do the following:
(1) Divide interval [a, b] into N equal length subintervals and [c,
d] into M equal length subintervals, for [a, b] the length is
h =
ba
N
and the subintervals are [a, a+h], [a+h, a+2h], ;
for [c, d] the subinterval length is s =
dc
M
and the subintervals
are [c, c+s], [c+s, c+2s], .
(2) If we use x
i
= a + ih, i = 0, 1, , N to denote the endings
of subintervals of [a, b] and y
j
= c + js, j = 0, 1, 2, to
denote the endings of subintervals of [c, d], then (x
i
, y
j
) form
the grid points, i = 0, 1, , N; j = 0, 1, , M. For each
point (x
i
, y
j
) compute the slope m
ij
= f(x
i
, y
j
) and, from the
20 1. EXPLICITLY SOLVABLE FIRST ORDER DIFFERENTIAL EQUATIONS
equation of tangent line y y
j
= m
ij
(x x
i
) we get another
point ((x
i
+
h
2
, y
j
+ m
ij
h
2
).
(3) Draw line segment from (x
i
, y
j
) to ((x
i
+ h, y
j
+ m
ij
h) for i =
0, 1, , N; j = 0, 1, , M.
Example 5.3. Suppose we want to graph vector eld for y

= x
over [0,1][0,1] and divide [0, 1] into two subinterval, h = s = 0.5.
Then we will have nine grid points (0, 0), (0, 0.5), (0, 1), (0.5, 0),
(0.5, 0.5), (0.5, 1), (1, 0), (1, 0.5), and (1, 1). For the grid point
(0.5, 0.5) we have slop m = 0.5 as the function f(x, y) = x. So we can
get another point (0.5+
h
2
, 0.5+m
h
2
) = (0.75, 0.625), connect (0.5, 0.5)
to (0.75, 0.625) you get one line segment, continuous this we get the
following diagram.
Figure 14. Vector eld for f(x, y) = x
So it is obviously tedious to draw the vector eld by hand.
To graph vector eld in Mathcad is not an easy task. This is especially
true when you want to superimpose solution curve over the graph. You
need to write some code to instruct how you want Mathcad to graph the
vector eld for what function. you can get the code from the website
www.unf.edu/mzhan.
Project
At beginning you should enter: Project title, your name, ss#, and
due date in the following format
Project One: Dene and Graph Functions
John Doe
SS# 000-00-0000
Due: Mon. Nov. 23rd, 2003
You should format the text region so that the color of text is dierent
than math expression. You can choose color for text from Format
>Style select normal and click modify, then change the settings for
5. PHASE AND VECTOR FIELD DIAGRAMS 21
font. You can do this for headings etc. Graph Vector eld
Goal: Familiar your self with an many dierent kind of vector elds,
dened by x

= f(t, x), as possible and identify many general features


of solutions, especially the following features,
Does the equation has constant solutions? A constant solu-
tion is shown in vector eld as horizontal line segments since
constant solution has slope equals zero.
Does solutions converge to an particular solution in the lang
run?
Do solutions grow to innite an a nite time? Her vertical bars
indicate a solution might become unbounded in short time.
Do solutions display any periodicity? We know sin(t) has pe-
riod of 2 and solution curve repeats itself. Here large interval
for t might be needed.
You can use the following functions
f(t, x) = sin(x)
f(t, x) = cos(t)
f(t, x) = x(x 1)
f(t, x) = e
t
x + sin(x)
f(t, x) = x + xsin(t)
You should use the provide Mathcad le at the website
www.unf.edu/mzhan/vectoreld.mcd
as a starting point and superimpose solutions to the vector elds so
support your observation.
CHAPTER 1
Brief Introduction to Vectors and Matrices
In this chapter, we will discuss some needed concepts found in in-
troductory course in linear algebra. We will introduce matrix, vector,
vector-valued function, and linear independency of a group of vectors
and vector-valued functions.
1. Vectors and Matrices
A matrix is a group of numbers(elements) that are arranged in
rows and columns. In general, an mn matrix is a rectangular array
of mn numbers (or elements) arranged in m rows and n columns. If
m = n the matrix is called a square matrix. For example a 22 matrix
is
_
a
11
a
12
a
21
a
22
_
and an 3 3 matrix is
_
_
a
11
a
12
a
13
a
21
a
22
a
23
a
31
a
32
a
33
_
_
Generally, we use bold phase letter, like A, to denote a matrix,
and lower case letters with subscripts, like a
ij
, to denote element of
a matrix. Here a
ij
would be the element at i
th
row and j
th
column.
So a
11
is an element at 1
st
row and column. Sometime we use the
abbreviation A = (a
ij
) for a matrix with elements a
ij
.
1.1. Special matrices. 0 denotes the zero matrix whose elements
are all zeroes. So 2 2 and 3 3 zero matrices are
_
0 0
0 0
_
and
_
_
0 0 0
0 0 0
0 0 0
_
_
Another special matrix is the identity matrix, denoted by I, a iden-
tity matrix is an matrix whose main diagonal elements are 1, and all
1
2 1. BRIEF INTRODUCTION TO VECTORS AND MATRICES
other elements are 0. So 2 2 and 3 3 zero matrices are
_
1 0
0 1
_
and
_
_
1 0 0
0 1 0
0 0 1
_
_
A vector is a matrix with one row or one column. In this chapter,
a vector is always a matrix with one column as
_
x
1
x
2
_
for a two-dimensional vector and
_
_
x
1
x
2
x
3
_
_
for a three dimensional vector. Here the element has only one index
that denotes the row position (Sometimes we use dierent variable to
denote number in dierent position such as using
_
x
y
_
for a 2-dimensional vector). We use bold lower case, such as v, to
denote a vector.
1.2. Operations on Matrices. Arrange number in rectangular
fashion, as a matrix, itself is not something terribly interesting. The
most important advantage from that kind arrangement is that we can
dene matrix addition, multiplication, and scalar multiplication.
Definition 1.1.
(i) Equality: Two matrix A = (a
ij
) and B = (b
ij
) are equal
if corresponding elements are equal, i.e. a
ij
= b
ij
.
(ii) Addition: If A = (a
ij
) and B = (b
ij
) and the sum of Aand
B is A + B = (c
ij
) = a
ij
+ b
ij
.
(iii) Scalar Product: If A = (a
ij
) is matrix and k is num-
ber(scalar), the kA = (ka
ij
) is product of k and A.
From the above denition, we see that, to multiply a matrix by
a number k, we simply multiply each of its entries by k; to add two
matrices we just add their corresponding entries; AB = A+(1)B.
Example 1.1. Let
A =
_
2 3
1 4
_
1. VECTORS AND MATRICES 3
and
B =
_
0 5
3 4
_
,
nd (a) A + B, (b) 3A, (c) 4AB.
Solution
(a)
A + B =
_
2 3
1 4
_
+
_
0 5
3 4
_
=
_
2 + 0 3 + 5
1 + 3 4 + (4)
_
=
_
2 8
2 0
_
(b)
3A = 3
_
2 3
1 4
_
=
_
6 9
3 12
_
(c)
4AB =
_
8 12
4 16
_

_
0 5
3 4
_
=
_
8 7
7 20
_

The following fact lists all properties of matrix addition and scalar
product.
Theorem 1.1. Let A, bB, and C be matrices. Let a, b be scalars
(numbers). We have
(1) A + 0 = 0 + A = A, AA = 0;
(2) A + B = B + A (commutativity);
(3) A + (B + C) = (A + B) + C, (ab)A = a(bA) (associa-
tivity);
(4) a(A+B) = aA+aB, (a+b)A = aA+bA (distributivity)
When we have a row vector and a column vector with the same
number of elements, we can dene the dot product as
Definition 1.2. Dot Product:
in 2-dimension: Let x =
_
x
1
x
2

and y =
_
y
1
y
2
_
, the
dot product of x and y is,
x y = x
1
y
1
+ x
2
y
2
4 1. BRIEF INTRODUCTION TO VECTORS AND MATRICES
in 3-dimension: Let x =
_
x
1
x
2
x
3

and y =
_
_
y
1
y
2
y
3
_
_
,
the dot product of x and y is,
x y = x
1
y
1
+ x
2
y
2
+ x
3
y
3
Definition 1.3. Matrix product
Let A = (a
ij
) and B = (b
ij
), if the number of columns of A
is the same as number of rows of B, then the product of A and B is
given by AB = (c
ij
) where c
ij
is dot product of i
th
row of A with j
th
column of B.
Example 1.2. Let
A =
_
2 3
1 4
_
and
B =
_
0 5
3 4
_
,
nd AB
Solution
AB =
_
2 3
1 4
_ _
0 5
3 4
_
=
_
2 (0) + 3 (3) 2 5 + 3 (4)
(1) (0) + 4 3 1 5 + 4 (4)
_
=
_
9 2
12 21
_
Notice, the rst element of AB is 2 (0) + 3 (3) which is the dot
product of rst row of A,
_
2 3

and rst column of B,


_
0
3
_

The following fact gives properties of matrix product,
Theorem 1.2. Let A, B, C be three matrices and r be a scalar,
we have
A(BC) = (AB)C, r(AB) = A(rB) (associativity)
A(B + C) = AB + AC (distributivity)
Notice, in general AB = BA, that is for most of the times, AB
is not equal to BA.
Using the matrix notation and matrix product, we can write the
following system of equations
_
ax
1
+ bx
2
= y
1
cx
1
+ dx
2
= y
2
1. VECTORS AND MATRICES 5
as Ax = y with
A =
_
a b
c d
_
,
x =
_
x
1
x
2
_
, and y =
_
y
1
y
2
_
.
Definition 1.4. A square (ex. 2 2 or 3 3) matrix A is
invertible if there is a matrix A
-1
such that AA
-1
= A
-1
A = I.
Theorem 1.3. Let
A =
_
a b
c d
_
be a 2 2 matrix, if A is invertible, we have
A
-1
=
1
ad bc
_
d b
c d
_
So if A is invertible, to solve Ax = y, we need to simply multiply
both sides with A
-1
, that is
x = A
-1
y.
Example 1.3. Solve the system of equation
_
3x
1
4x
2
= 2
2x
1
+ 5x
2
= 7
Solution The equation can be rewrite Ax = y with
A =
_
3 4
2 5
_
,
x =
_
x
1
x
2
_
, and y =
_
2
7
_
. So in matrix form the system of
equation is
_
3 4
2 5
_ _
x
1
x
2
_
=
_
2
7
_
.
Now the inverse of A is
A
-1
=
1
3(5) (2)(4)
_
5 4
2 3
_
,
so the solution is
x = A
-1
y =
1
7
_
5 4
2 3
_ _
2
7
_
=
_
38
7
25
7
_

6 1. BRIEF INTRODUCTION TO VECTORS AND MATRICES


Example 1.4. Solve the system of equation
_
_
_
3x
1
4x
2
+ 5x
3
= 2
2x
1
+ 5x
2
= 7
x
1
5x
2
+ 8x
3
= 1
Solution The equation can be rewrite Ax = y with
A =
_
_
3 4 5
2 5 0
1 5 8
_
_
,
x =
_
_
x
1
x
2
x
3
_
_
, and y =
_
_
2
7
1
_
_
. So in matrix form the system of
equation, Ax = y, is
_
_
3 4 5
2 5 0
1 5 8
_
_
_
_
x
1
x
2
x
3
_
_
=
_
_
2
7
1
_
_
.
It is a little harder to compute the inverse of a 3 3 matrix, we
will use Mathcad to solve the equation. Here is how to do it,
Type A:[Ctrl][M] at a blank area to bring up the matrix
denition screen, put 3 in the both input boxes and click OK,
you will get a 3 3 matrix place holder like
A :=
_
_
_
_
Fill the entries of A in the corresponding position, using [Tab]
key to navigate among the place holders(or just click each one).
Type b:[Ctrl][M] in another blank area, the matrix deni-
tion screen is up again. This time put 3 in the number of row
box, and 1 in the number of column box and click OK. You
will get b:=
_
_
_
_
put the values of y in the corresponding
position.
Type A^-1 *b= you will get the solution, which is,
_
_
154
81
175
81
80
81
_
_
1. VECTORS AND MATRICES 7
Notice, by default, Mathcad will display the results as dec-
imal, you can double click on the result vector to change it
to fraction, after you double click the result you will have a
popup menu such as
Figure 1. Format Result

The next example shows how we can determine the unknown con-
stants typically found in the initial value problems of system of dier-
ential equations.
Example 1.5. Let x
1
(t) = C
1
e
t
+ C
2
e
2t
and x
2
= 2C
1
e
t

C
2
e
2t
. If x
1
(0) = 2, x
2
(0) = 3, nd C
1
and C
2
Solution From x
1
(t) = C
1
e
t
+ C
2
e
2t
, set t = 0 we have
x
1
(0) = C
1
e
0
+ C
2
e
2(0)
= C
1
+ C
2
.
Similarly, x
2
(t) = 2C
1
e
t
C
2
e
2t
, gives x
2
(0) = 2C
1
e
(
0)
C
2
e
2(0)
= 2C
1
C
2
.
Together with x
1
(0) = 2, x
2
(0) = 3 we have the following system
of equations,
_
C
1
+ C
2
= 1
2C
1
C
2
= 3
Rewrite the equation in matrix form
_
1 1
2 1
_ _
C
1
C
2
_
=
_
1
3
_
,
and using Mathcad we nd the solution is
_
C
1
C
2
_
=
_
4
3

1
3
_
8 1. BRIEF INTRODUCTION TO VECTORS AND MATRICES
So x
1
(t) =
4
3
e
t

1
3
e
2t
and x
2
=
8
3
e
t
+
1
3
e
2t
. They are solution of
the following system of dierential equations,
_
x

1
(t) = x
1
(t) + x
2
(t)
x

2
(t) = 2x
1

1.3. Eigenvalues and Eigenvectors. If A =


_
a b
c d
_
the de-
termined of A is dened as |A| =

a b
c d

= ad bc. For a 3 3
matrix
_
_
a
11
a
12
a
13
a
21
a
22
a
23
a
31
a
32
a
33
_
_
we can compute the matrix as

a
11
a
12
a
13
a
21
a
22
a
23
a
31
a
32
a
33

= a
11

a
22
a
23
a
32
a
33

a
12

a
21
a
23
a
31
a
33

+a
13

a
21
a
22
a
31
a
32

.
In Mathcad , type the vertical bar to bring up the absolute
evaluator | |, put the matrix in the place holder and press = to compute
the determinant. The following screen shot shows an example,
Figure 2. Compute determinant in Mathcad
The concepts of eigenvalue and eigenvector play an important role
in nd solutions to system of dierential equations.
Definition 1.5. We say is an eigenvalue of a matrix A (2 2
or 3 3) if the determinant
|AI| = 0.
An nonzero vector v is an eigenvector associated with if
Av = v.
Remark 1.1.
1. VECTORS AND MATRICES 9
- The above denition of eigenvector and eigenvalue is valid for
any square matrix with n rows and columns.
- p() = |AI| is a polynomial of degree n for nn matrix
A, which is called the characteristic polynomial of A.
- If we view A as an transform that maps a vector x to Ax,
an eigenvector v denes a straight line passing origin that is
invariant under A.
- If v is an eigenvector then for and number s = 0, sv is also
an eigenvector. This is especially useful when using Mathcad
to get eigenvectors, the result of Mathcad might look bad, you
might need to remove the common factor of the component of
the vector to make it better.
Computing eigenvalues and eigenvectors of a given matrix is quite
tedious, Mathcad provides two functions eigenvals() and eigenvecs()
to compute eigenvalues and eigenvectors of a matrix.
In Mathcad , eigenvecs(M) Returns a matrix containing the eigenvectors. The
nth column of the matrix returned is an eigenvector corresponding to the nth
eigenvalue returned by eigenvals.
The results of these functions by default is in decimal, you can
change it by using simplify key word as shown in the following dia-
gram.
(a) Find eigenvalue (b) Find eigenvector
Figure 3. Compute eigenvalue and eigenvector in Mathcad
Notice, in the diagram, the eigenvalues are listed as vector
_
3

3
_
and the eigenvectors are listed in a matrix
_
_
1+

3
(8+2

3)
1
2
-(

3-1)
(8-2

3)
1
2
2
(8+2

3)
1
2
2
(8-2

3)
1
2
_
_
,
10 1. BRIEF INTRODUCTION TO VECTORS AND MATRICES
each column represents a eigenvector. Since multiplying an eigenvector
by a nonzero constant you still get an eigenvector, so we can simplify
the eigenvectors as v
1
=
_
1 +

3
2
_
, and v
2
=
_
1

3
2
_
Here is how to use Mathcad ,
Dene the matrix by type A:[Ctrl][M] and specify the row
and column number, ll the entries.
type eigenvals(, you will get eigenvals( ) and in the place
holder type A.
Click at end of the eigenvals(A) and press [Shift][Ctrl][.],
you will get eigenvals(A) . In the place holder type in
key word simple. And click any area outside the box to get
result.
Using the same procedure for nd eigenvector using eigenvecs()
function.
2. Vector-valued functions
A vector-valued function over [a, b] is a function whose value is a
vector or matrix. For example the following functions are vector-valued
functions,
Example 2.1. (1) v(t) =
_
t
t
2
_
(2) x =
_
_
1
t
2
e
t
_
_
(3) A(t) =
_
1 t
3
4t + 5
0 sin(t)
_
2.1. Arithmetics of vector-valued function.
To add two vector-valued function is to add their correspond-
ing components.
To multiply a vector-valued function by a scalar function to
to multiply each entry by the scalar function.
To multiply a vector(matrix) valued function to another vector-
valued function is same as multiply a matrix with a vector.
The following example illustrate how to add/subtract two vector-valued
functions and how to multiply a vector-valued function by a scalar
function and how to apply a vector-valued function that is matrix to a
vector value function.
2. VECTOR-VALUED FUNCTIONS 11
Example 2.2. Suppose v(t) =
_
_
t
t
2
t
3
2
_
_
, x =
_
_
1
t
2
e
t
_
_
, and
A(t) =
_
_
1 t
3
4t + 5 1
0 2 sin(t)
2 0 1
_
_
.
(a) Find v(t) + x(t);
(b) Let f(t) = e
t
, nd f(t)x(t);
(c) Find A(t)x(t)
Solution
(a)
v(t) + x(t) =
_
_
t
t
2
t
3
2
_
_
+
_
_
1
t
2
e
t
_
_
==
_
_
t + 1
2t
2
t
3
2 + e
t
_
_
;
(b)
f(t)x(t) = e
t
_
_
1
t
2
e
t
_
_
=
_
_
e
t
t
2
e
t
e
2t
_
_
;
(c)
A(t)x(t) ==
_
_
1 t
3
4t + 5 1
0 2 sin(t)
2 0 1
_
_
_
_
1
t
2
e
t
_
_
=
_
_
1 + t
2
(t
3
4t + 5) + e
t
2t
2
+ e
t
sin(t)
2 + sin(t)
_
_

2.2. derivative and integrations of vector-valued functions.
A vector-valued function is continuous if each of its entries
are continuous.
A vector-valued function is dierentiable if each of its entries
are dierentiable.
If v(t) is an vector-valued function, then the derivative
dv(t)
dt
=
v

(t) of v(t) is a vector-valued function whose entries are the


derivative of corresponding entries of v(t). That is to nd
derivative of a vector-valued function we just need to nd de-
rivative of each of its component.
12 1. BRIEF INTRODUCTION TO VECTORS AND MATRICES
The antiderivative
_
v(t) dt of an vector-valued function v(t)
is a vector-valued function whose entries are the antiderivative
of corresponding entries of v(t).
Example 2.3. Find derivative of x(t) =
_
3t
2
5
sin(t)
_
Solution
x

(t) =
dx(t)
dt
=
d
dt
_
3t
2
5
sin(t)
_
=
_
d
dt
(3t
2
5)
d
dt
(sin(t))
_
=
_
6t
cos(t)
_

Example 2.4. Find antiderivative of x(t) =


_
3t
2
5
sin(t)
_
Solution
_
x(t) dt =
_
_
3t
2
5
sin(t)
_
dt =
_ _
(3t
2
5) dt
_
sin(t) dt
_
=
_
t
3
5t + C
1
cos(t) + C
2
_
=
_
t
3
5t
cos(t)
_
+
_
C
1
C
2
_

Theorem 2.1. Suppose v(t), x(t), A(t) are dierentiable vector-


valued functions (A(t) is matrix), and f(t) is dierentiable scalar
function. We have,
(1) Sum and Dierence rule:
- [v(t) x(t)]

= v

(t) x

(t),
-
_
v(t) x(t) dt =
_
v(t) dt
_
x(t) dt.
(2) Product rule:
- [f(t)v(t)]

= f

(t)v(t) + f(t)v

(t),
- [A(t)x(t)]

= A

(t)x(t) + A(t)x

(t),
Using Mathcad to nd derivative or antiderivative of a vector-
valued function using Mathcad , you need to nd derivative or anti-
derivative component wise as shown in the following screen shot,
2. VECTOR-VALUED FUNCTIONS 13
Figure 4. Dierentiate and integrate vector-valued function
14 1. BRIEF INTRODUCTION TO VECTORS AND MATRICES
Notice:
- Press [Shift][/]to get the derivative operator and press [Ctrl][I]
to get the antiderivative operator.
- To get dx(t)simplify you type dx(t) and press [Shift][Ctrl][.]
and type the key word simplify in the place holder before .
- To execute symbolically ( operator), just press [Ctrl][.]
3. Linearly independency
3.1. Linearly independency of vectors. Let x
1
, x
2
, , x
n
be n vectors, C
1
, C
2
, , C
n
are n scalars(numbers), the expression
C
1
x
1
+ C
2
x
2
+ + C
n
x
n
is called a linear combination of vectors x
1
, x
2
, , x
n
.
Definition 3.1. n vectors x
1
, x
2
, , x
n
is linearly independent
if
C
1
x
1
+ C
2
x
2
+ + C
n
x
n
= 0
leads to C
1
= 0, C
2
= 0, , C
n
= 0.
A set of vectors are linearly dependent if they are not linearly in-
dependent.
If 0 is one of x
1
, x
2
, , x
n
, then they linearly dependent.
Two nonzero vectors x and y are linearly dependent if and
only if x = sy for some s = 0.
n nonzero vectors are linearly independent if one can be rep-
resented as linear combination of the others.
Any three or more 2-dimensional vectors (vectors with two
entries) are linear dependent.
Any four or more 3-dimensional(vectors with three entries)
vectors are linear dependent.
To determine if a given set of vectors are linearly independent,
create a matrix so that the row of the matrix are given vectors. Using
Mathcad function rref( ) to nd the reduced echelon form of the
matrix, if the result contains one or more rows that are entirely zero
the vectors are linearly dependent, otherwise the vectors are linearly
independent.
3. LINEARLY INDEPENDENCY 15
Example 3.1. For x
1
=
_
_
2
3
4
_
_
, x
2
=
_
_
0
1
4
_
_
, and x
3
=
_
_
4
8
0
_
_
, we can form a matrix,
A =
_
_
2 3 4
0 1 4
4 8 0
_
_
,
apply rref(type rref and in the place holder type A, then press =),
rref(A) =
_
_
1 0 8
0 1 4
0 0 0
_
_
.
We see that the vectors are linearly dependent as the last row is
entirely zero.
3.2. Linearly independency of functions. We can also dene
linearly independency for a group of functions over an given inter-
val [a, b]. Let f
1
, f
2
, , f
n
be n functions dened over [a, b],
C
1
, C
2
, , C
n
are n scalars(numbers), the expression
C
1
f
1
+ C
2
f
2
+ + C
n
f
n
is called a linear combination of functions f
1
, f
2
, , f
n
.
Definition 3.2. n functions f
1
, f
2
, , f
n
is linearly indepen-
dent over [a, b]if
C
1
f
1
+ C
2
f
2
+ + C
n
f
n
= 0 for all a t b (1)
leads to C
1
= 0, C
2
= 0, , C
n
= 0.
A set of function are linearly dependent if they are not linearly
independent.
If 0 function is one of f
1
, f
2
, , f
n
, then they linearly de-
pendent.
Two nonzero functions f(t) and g(t) are linearly dependent
over [a, b] if and only if f(t) = sg(t) for a constant s = 0
and all a t b, for example, f(t) = t and g(t) = 4t
are linearly dependent but f(t) = t and g(t) = 4t
2
are not,
even f(0) = 4g(0) and f(1) = 4g(1).
There are exists innite many functions that are linearly in-
dependent. For example the set {1, t, t
2
, t
3
, , t
n
, } is
a linearly independent set.
16 1. BRIEF INTRODUCTION TO VECTORS AND MATRICES
Here are some sets of linearly independent functions that we en-
counter in solving a system of dierential equations, assume k
1
, k
2
, , k
n
are dierent numbers,
- {t
k
1
, t
k
2
, , t
k
n
}.
- {e
k
1
t
, e
k
1
t
, , e
k
1
t
}.
- {sin(k
1
t), sin(k
2
t), , sin(k
n
t)}.
- {cos(k
1
t), cos(k
2
t), , cos(k
n
t)}.
- The mixing of above sets.
- For each above set, when multiplying each element by an com-
mon nonzero factor, we get another linearly independent set.
The following screen shot displays a heuristic Mathcad function that
tries to determine if a given set of functions are linearly independent.
Figure 5. Calculus tool bar
One warning, the result of the program is not very reliable, the user
should check the result manually to conrm the result.
To manually check if an set of functions are linearly independent
on [a, b], one need to show that the only solutions are C
1
= 0, C
2
=
0, , C
n
= 0. if equation (1) holds for all t in [a, b], which requires
strong algebraic skill.
One method is to choose n dierent numbers {t
1
, t
2
, , t
n
}
from [a, b] and using the functions to create an matrix, the compute
the determinant of the matrix A = (f
i
(t
j
)), if the determinant is not
zero, the functions are linearly independent, but if the determinant is
zero, it is inconclusive(most likely are linearly dependent).
Example 3.2. Determine if f
1
(t) = t
2
2t +3, f
2
(t) = 2t
2

5t 6, and f
3
(t) = 5t
2
11t + 4 are linearly independent.
3. LINEARLY INDEPENDENCY 17
Solution Choose t
1
= 1, t
2
= 0, and t
3
= 1,
_
_
f
1
(t
1
) f
1
(t
2
) f
1
(t
3
)
f
2
(t
1
) f
2
(t
2
) f
2
(t
3
)
f
3
(t
1
) f
3
(t
2
) f
3
(t
3
)
_
_
=
_
_
7 3 2
1 6 9
20 4 2
_
_
Compute the determinant,

_
7 3 2
1 6 9
20 4
2
_

= 50,
so the functions are linearly independent.
Project
At beginning you should enter: Project title, your name, ss#, and
due date in the following format
Project One: Dene and Graph Functions
John Doe
SS# 000-00-0000
Due: Mon. Nov. 23rd, 2003
You should format the text region so that the color of text is dierent
than math expression. You can choose color for text from Format
>Style select normal and click modify, then change the settings for
font. You can do this for headings etc.
(1) Independent of functions as vectors
Goal: Familiar your self with the concept of linearly indepen-
dency.
Use the Mathcad code provided at at the website www.unf.edu/mzhan/linearindepent.mcd
to check if given set of functions are linearly independent
or not.
{sin(x), sin(2x), sin(3x)}
{t
2
, 2t
2
2t + 4, 3t, 6}
{e
t
, te
t
, t
3
e
t
}
{e
2t
, e
t
, e
3t
}
Using algebraic arguments or reasoning to verify the con-
clusion of the Mathcad code.
18 1. BRIEF INTRODUCTION TO VECTORS AND MATRICES
(2) Condition Number In solving Ax = b, one number is very
important, it is called the condition number, which can be de-
ned as C(A) = |
s

l
, where
s
is the eigenvalue with smallest
absolute value and lambda
l
is the eigenvalue with largest ab-
solute value, if C(A) is too large or too small, a little change
in b will result in a large in the solution x. We say the system
Ax = b is not stable. Now if A =
_
_
1
1
2
1
3
1
2
1
3
1
4
1
3
1
4
1
5
_
_
Find all eigenvalues, all eigenvectors, and C(A).
Find solution of Ax = b if b =
_
_
1
1
1
_
_
Change b a little to b =
_
_
1
1
1.1
_
_
we get dierent solu-
tion, which component of the new solution change most?
The change of the third component if 10% what is the
percentage change of the most changed component?
Note:
Our denition of condition number is not accurate, the
true denition is C(A) =
1
AA
-1
where is a
given norm (metric).
Mathcad provides three functions cond1(A), cond2(A)
and condi(A) in compute condition number for A in
dierent metric.
CHAPTER 1
System of First Order Dierential Equations
In this chapter, we will discuss system of rst order dierential equa-
tions. There are many applications that involving nd several unknown
functions simultaneously . Those unknown functions are related by a
set of equations that involving the unknown functions and their rst
derivatives. For example, in Chapter Two, we studied the epidemic of
contagious diseases. Now if
S(t) denotes number of people that is susceptible to the disease
but not infected yet.
I(t) denotes number of people actually infected.
R(t) denotes the number of people have recovered.
If we assume
The fraction of the susceptible who becomes infected per unit
time is proportional to the number infected, b is the propor-
tional number.
A xed fraction rS of the infected population recovers per unit
time, 0 r 1.
A xed fraction of the recovers g become susceptible and in-
fected, 0 g 1. proportional function.
The system of dierential equations model this phenomena are
S

= bIS + gR
I

= bIS rI
R

= rI gR
The numbers of unknown function in a system of dierential equa-
tions can be arbitrarily large, but we will concentrate ourselves on 2 to
3 unknown functions.
1. Principle of superposition
Let a
ij
(t), b
j
(t) i = 1, 2, , n and j = 1, 2, , n be known
function, and x
i
t, i = 1, 2, , n be unknown functions, the linear rst
1
2 1. SYSTEM OF FIRST ORDER DIFFERENTIAL EQUATIONS
order system of dierential equation for x
i
(t) is the following,
x

1
(t) = a
11
(t)x
1
(t) + a
12
(t)x
2
(t) + + a
1n
(t)x
n
(t) + b
1
(t)
x

2
(t) = a
21
(t)x
1
(t) + a
22
(t)x
2
(t) + + a
2n
(t)x
n
(t) + b
2
(t)
x

3
(t) = a
31
(t)x
1
(t) + a
32
(t)x
2
(t) + + a
3n
(t)x
n
(t) + b
3
(t)
.
.
.
x

n
(t) = a
n1
(t)x
1
(t) + a
n2
(t)x
2
(t) + + a
nn
(t)x
n
(t) + f
1
(t)
Let x(t) be the column vector of unknown functions x
i
t, i =
1, 2, , n, A(t) = (a
ij
(t), and b(t) be the column vector of known
functions b
i
t, i = 1, 2, , n, we can write the rst order system of
equations as
x

(t) = A(t)x(t) +b(t) (1)


When n = 2, the linear rst order system of equations for two
unknown functions in matrix form is,
_
x

1
(t)
x

2
(t)
_
=
_
a
11
(t) a
12
(t)
a
21
(t) a
22
(t)
_ _
x
1
(t)
x
2
(t)
_
+
_
b
1
(t)
b
2
(t)
_
When n = 3, the linear rst order system of equations for
three unknown functions in matrix form is,
_
_
x

1
(t)
x

2
(t)
x

3
(t)
_
_
=
_
_
a
11
(t) a
12
(t) a
13
a
21
(t) a
22
(t) a
23
a
31
(t) a
32
(t) a
33
_
_
_
_
x
1
(t)
x
2
(t)
x
3
t
_
_
+
_
_
b
1
(t)
b
2
(t)
b
3
(t)
_
_
A solution of equation (1) on the open interval I is a column vec-
tor function x(t) whose derivative (as a vector-values function) equals
A(t)x(t) +b(t). The following theorem gives existence and uniqueness
of solutions,
Theorem 1.1. If the vector-valued functions A(t) and b(t) are con-
tinuous over an open interval I contains t
0
, then the initial value prob-
lem
_
x

(t) = A(t)x(t) +b(t)


x(t
0
) = x
0
has an unique vector-values solution x(t) that is dened on entire in-
terval I for any given initial value x
0
.
When b(t) 0, the linear rst order system of equations becomes
x

(t) = A(t)x(t),
which is called a homogeneous equation.
As in the case of one equation, we want to nd out the general
solutions for the linear rst order system of equations. To this end, we
rst have the following results for the homogeneous equation,
1. PRINCIPLE OF SUPERPOSITION 3
Theorem 1.2. Principle of Superposition Let x
1
(t), bx
2
(t), , x
n
(t)
be n solutions of the homogeneous linear equation
x

(t) = A(t)x(t)
on the open interval I. If c
1
, c
2
, , c
n
are n constants, then the
linear combination
c
1
x
1
(t) + c
2
x
2
(t) + c
3
x
3
(t) + + c
n
x
n
(t)
is also a solution on I.
Example 1.1. Let
x

(t) =
_
1 0
0 2
_
x(t)
, x
1
(t) =
_
e
t
0
_
and x
2
(t) =
_
0
e
2t
_
are two solutions, as
bx

1
(t) =
_
(e
t
)

0
_
=
_
e
t
0
_
=
_
1 0
0 2
_ _
e
t
0
_
and
bx

2
(t) =
_
0
(e
2t
)

_
=
_
0
2e
2t
_
=
_
1 0
0 2
_ _
0
e
2t
_
By the Principle of Superposition, for any two constants c
1
and c
2
x(t) = c
1
x
1
(t) + c
2
x
2
(t) = c
1
_
e
t
0
_
+ c
2
_
0
e
2t
_
=
_
c
1
e
t
c
2
e
2t
_
is also solution. We shall see that it is actually the general solution.
The next theorem gives the general solution of linear system of
equations,
Theorem 1.3.
- Let x
1
(t), x
2
(t), , bx
n
(t) be n linearly independent (as vectors)
solution of the homogeneous system
x

(t) = A(t)x(t),
then for any solution x
c
(t) there exists n constants c
1
, c
2
, , c
n
such
that
x
c
(t) = c
1
x
1
(t) + c
2
x
2
(t) + + c
n
x
n
(t).
We call x
c
(t) the general solution of the homogeneous system.
4 1. SYSTEM OF FIRST ORDER DIFFERENTIAL EQUATIONS
If x
p
(t) is a particular solution of the nonhomogeneous system,
x(t) = B(t)x(t) +b(t),
and x
c
(t) is the general solution to the associate homogeneous system,
x(t) = B(t)x(t)
then x(t) = x
c
(t) +x
p
(t) is the general solution.
Example 1.2. Let
x

(t) =
_
4 3
6 7
_
x(t) +
_
4t
2
+ 5t
6t
2
+ 7t + 1
_
x(t)
, x
1
(t) =
_
3e
2t
2e
2t
_
and x
2
(t) =
_
e
5t
3e
5t
_
are two linearly independent
solutions. and x
p
(t) =
_
t
2
t
_
is a particular solution. By Theorem
1.3,
x(t) = c
1
x
1
(t) + c
2
x
2
(t) +x
p
(t) =
_
3c
1
e
2t
+ c
2
e
5t
+ t
2
2c
1
e
2t
+ 3c
2
e
5t
+ t
_
(2)
is the general solution. Now suppose we want to nd a particular so-
lution that satises the initial condition x(0) =
_
2
1
_
, then let t = 0
in (2), we have
x(0) =
_
3c
1
+ c
2
2c
1
+ 3c
2
_
=
_
2
1
_
,
which can be written in matrix form,
_
3 1
2 3
_ _
c
1
c
2
_
=
_
2
1
_
,
Solve this equation, we get
_
c
1
c
2
_
=
_
1
1
_
. So the particular
solution is x(t) =
_
3e
2t
e
5t
+ t
2
2e
2t
3e
5t
+ t
_
.
From the above example, we can summarize the general steps in
nd a solution to initial value problem,
_
x

(t) = A(t)x(t) +b(t)


x(t
0
) = x
0
2. HOMOGENEOUS SYSTEM 5
Step One: Find the general solution x
c
= c
1
x
1
(t) +c
2
x
2
(t) +
+ c
n
x
n
(t), where x
1
(t), x
2
(t), , x
n
(t) are a set of lin-
early independent solutions, to the associate homogeneous sys-
tem, x

(t) = A(t)x(t).
Step Two: Find a particular solution x
p
(t)to the nonhomo-
geneous system, x

(t) = A(t)x(t) +b(t).


Step Three: Set x(t) = x
c
(t) + x
p
(t) and use the equation
x(t
0
) = x
0
, to determine c
1
, c
2
, , c
n
.
2. Homogeneous System
We will use a powerful method called eigenvalue method to solve
the homogeneous system
x

(t) = Ax(t)
where A is a matrix with constant entry. We will present this method
for A is either a 2 2 or 3 3 cases. The method can be used for A
is an n n matrix. The idea is to nd solutions of form
x(t) = ve
t
, (3)
a straight line that passing origin in the direction v. Now taking deriv-
ative on x(t), we have
x

(t) = ve
t
(4)
put (3) and (2.2) into the homogeneous equation, we get
x

(t) = ve
t
= Ave
t
So
Av = v,
which indicates that must be an eigenvalue of A and v is an associate
eigenvector.
2.1. A is a 2 2 matrix. Suppose
A =
_
a
11
a
12
a
21
a
22
_
Then the characteristic polynomial p() of A is
p() = |AI| = (a
11
)(a
22
)a
12
a
21
=
2
(a
11
+a
22
)+(a
11
a
22
a
12
a
22
.
So p() is a quadratic polynomial of . From Algebra, we know that
p() = 0 has either 2 distinct real solutions, or a double solution, or
2 conjugate complex solutions. The following theorem summarize the
solution to the homogeneous system,
6 1. SYSTEM OF FIRST ORDER DIFFERENTIAL EQUATIONS
Theorem 2.1. Let p() be the characteristic polynomial of A, for
x

(t) = Ax(t),
Case 1: p() = 0 has two distinct real solutions
1
and
2
.
Suppose v
1
=
_
v
11
v
21
_
and v
2
=
_
v
12
v
22
_
are associate eigen-
vector (i.e, Av
1
=
1
v
1
and Av
2
=
2
v
2
) Then the general
solution is
x
c
(t) = c
1
v
1
e

1
t
+ c
2
v
2
e

2
t
And
(t) =
_
v
11
e

1
t
v
12
e

2
t
v
21
e

1
t
v
22
e

2
t
_
is called the fundamental matrix(A fundamental matrix
is a square matrix whose columns are linearly independent so-
lutions of the homogeneous system).
Case 2: p() = 0 has a double solutions
0
.
In this case p() = (
0
)
2
and
0
is a zero of p() with
multiplicity 2.
(1)
0
has two linearly independent eigenvectors:
Suppose v
1
=
_
v
11
v
21
_
and v
2
=
_
v
12
v
22
_
are associate linearly
independent eigenvectors. Then the general solution is
x
c
(t) = (c
1
v
1
+ c
2
v
2
)e

0
t
And
(t) = e

0
t
_
v
11
v
12
v
21
v
22
_
(2)
0
has only one associate eigenvector:
Suppose v
1
=
_
v
11
v
21
_
is the only associated eigenvector and
v
2
=
_
v
12
v
22
_
is a solution of
(
0
I A)v
2
= v
1
.
Then the general solution is,
x
c
(t) = (c
1
v
1
+ c
2
(tv
1
+v
2
)e

0
t
And
(t) = e

0
t
_
v
11
(v
11
t + v
12
)
v
21
(v
21
t + v
22
)
_
is the fundamental solution matrix.
2. HOMOGENEOUS SYSTEM 7
Case 3: p() = 0 has two conjugate complex solutions a+bi and abi.
Suppose v =
_
v
11
+ iv
12
v
21
+ iv
22
_
is the associate complex eigen-
vector with respect to a + bi, then the general solution is,
v
1
=
_
v
11
v
21
_
and v
2
=
_
v
12
v
22
_
x
c
(t) = [c
1
(v
1
cos(bt) v
2
sin(bt))c
2
(v
2
cos(bt) +v
1
sin(bt))]e
at
.
And
(t) = e
at
_
v
11
cos(bt) v
12
sin(bt) v
12
cos(bt) + v
11
sin(bt)
v
21
cos(bt) v
22
sin(bt) v
22
cos(bt) + v
21
sin(bt)
_
is the fundamental matrix.
From Theorem 2.1, let (t) be the fundamental matrix, the general
solution is given by x
c
(t) = (t)c, with c =
_
c
1
c
2
_
and the solution
that satises a given initial condition x(t
0
) = x
0
is given by
x(t) = (t)(t
0
)
-t
x
0
Example 2.1. Two distinct eigenvalues case Find the general
solution to x

(t) =
_
2 3
1 5
_
x(t)
Solution Using Mathcad , functions eigenvals() and eigen-
vecs()
In Mathcad , eigenvecs(M) Returns a matrix containing the eigenvectors. The
nth column of the matrix returned is an eigenvector corresponding to the nth
eigenvalue returned by eigenvals.
we nd,
1
=
3
2
+
1
2

61 and
2
=
3
2

1
2

61 with associated eigen-


vectors v
1
=
_
7

61
2
_
and v
2
=
_
7 +

61
2
_
respectively. So
the fundamental matrix is
(t) =
_
(7

61)e
(
3
2
+
1
2

61)t
(7 +

61)e
(
3
2

1
2

61)t
2e
(
3
2
+
1
2

61)t
2e
(
3
2

1
2

61)t
_
and the general solution is, for c =
_
c
1
c
2
_
,
x
c
(t) = (t)c

8 1. SYSTEM OF FIRST ORDER DIFFERENTIAL EQUATIONS


Example 2.2. One double eigenvalues with two linearly in-
dependent eigenvectors Find the general solution to x

(t) =
_
2 0
0 2
_
x(t).
Solution The eigenvalue is
0
= 2 and associated eigenvectors
are
_
1
0
_
and
_
0
1
_
, so the general solution is x
c
=
_
c
1
e
2t
c
2
e
2t
_

Example 2.3. One double eigenvalues with only one eigen-
vector Find the solution to x

(t) =
_
2 3
3 8
_
x(t) and x(0) =
_
2
3
_
Solution Using Mathcad , functions eigenvals() and eigen-
vecs() we can nd a double eigenvalue
0
= 5 and eigenvector
_
.707
.707
_
.
Notice, the symbolic operator (bring up by either [Shift][Ctrl][.] or
[Ctrl][.]) will not work with eigenvecs() this time, but since multiply
an eigenvector by a nonzero constant still get an eigenvector, we can
choose v
1
=
_
3
3
_
.
To nd w that satises (A
0
I)w = v
1

0
we will solve (A

0
I)
_
w
1
w
2
_
=
_
1
1
_
. That is,
_
3 3
3 3
_ _
w
1
w
2
_
=
_
3
3
_
One solution is w
1
= 1 and w
2
= 0
So the fundamental matrix is
(t) = e
5t
_
3 3t + 1
3 3t
_
and the general solution is, c =
_
c
1
c
2
_
,
x
c
(t) = (t)c
Now, (0) = e
5(0)
_
3 3(0) + 1
3 3(0)
_
=
_
3 1
3 0
_
and (0)
-1
=
1
3
_
0 1
3 3
_
.
Hence, the particular solution is x(t) = (t)(0)
-1
x
0
= e
5t
_
3t + 4
3t 3
_

2. HOMOGENEOUS SYSTEM 9
Example 2.4. Two conjugate complex eigenvalues case Find
the general solution to x

(t) =
_
2 3
1 2
_
x(t)
Solution Using Mathcad , functions eigenvals() and eigen-
vecs() we nd two conjugate complex eigenvalues,
1
= 2 + i

3 and

2
= 2i

3 with associated eigenvector v


1
=
_
3
i
_
with respect to

1
. Compare this with the Theorem 2.1, we have a = 2, b =

3, v
11
=

3, v
21
= 0, v
12
= 0, and v
22
= 1.
So the fundamental matrix is
(t) = e
2t
_
3 cos(bt) sin(bt)

3 sin(bt) cos(bt)
_
and the general solution is, c =
_
c
1
c
2
_
,
x
c
(t) = (t)c = e
2t
_
3 cos(

3t) sin(

3t)

3 sin(

3t) cos(

3t)
_ _
c
1
c
2
_
= e
2t
_
3c
1
cos(

3t) c
2
sin(

3t)

3c
1
sin(

3t) c
2
cos(

3t)
_
Suppose we want to nd a solution such that x(0) =
_
1
2
_
, then
x(t) = (t)(0)
-1
x(0)
= e
2t
_
3 cos(

3t) sin(

3t)

3 sin(

3t) cos(

3t)
_ _
3 0
0 1
_
-1
_
1
2
_
= e
2t
_
3 cos(

3t) sin(

3t)

3 sin(

3t) cos(

3t)
_ _
1

3
2
_
= e
2t
_
cos(

3t) + +2 sin(

3t)
sin(

3t) + 2 cos(

3t)
_

2.2. A is a 3 3 matrix. Suppose


A =
_
_
a
11
a
12
a
13
a
21
a
22
a
23
a
31
a
32
a
33
_
_
Then the characteristic polynomial p() of A given by
p() = |AI|,
10 1. SYSTEM OF FIRST ORDER DIFFERENTIAL EQUATIONS
is a cubic polynomial of . From Algebra, we know that p() = 0
has either 3 distinct real solutions, or 2 distinct solutions and one is a
double solution, or one real solution and 2 conjugate complex solutions,
or a triple solution. The following theorem summarize the solution to
the homogeneous system,
Theorem 2.2. Let p() be the characteristic polynomial of A, for
x

(t) = Ax(t),
Case 1: p() = 0 has three distinct real solutions
1
,
2
, and
3
.
Suppose v
1
=
_
_
v
11
v
21
v
31
_
_
, v
2
=
_
_
v
12
v
22
v
32
_
_
, and v
3
=
_
_
v
13
v
23
v
33
_
_
are associate eigenvector (i.e, Av
1
=
1
v
1
, Av
2
=
2
v
2
, and
Av
3
=
3
v
3
) Then the general solution is
x
c
(t) = c
1
v
1
e

1
t
+ c
2
v
2
e

2
t
+ c
3
v
3
e

3
t
And the fundamental matrix is
(t) =
_
_
v
11
e

1
t
v
12
e

2
t
v
13
e

3
t
v
21
e

1
t
v
22
e

2
t
v
23
e

3
t
v
31
e

1
t
v
32
e

2
t
v
33
e

3
t
_
_
.
Case 2: p() = 0 has a double solutions
0
.
So p() = (
0
)
2
(
1
), and
0
has multiplicity 2. Let
v
3
=
_
_
v
12
v
22
v
32
_
_
is the eigenvector associated with
1
.
[1]
0
has two linearly independent eigenvectors:
Suppose v
1
=
_
v
11
v
21
_
and v
2
=
_
v
12
v
22
_
are associate linearly
independent eigenvectors. Then the general solution is
x
c
(t) = (c
1
v
1
+ c
2
v
2
)e

0
t
+ c
3
v
3
e

1
t
And
(t) =
_
_
v
11
e

0
t
v
12
e

0
t
v
13
e

1
t
v
21
e

0
t
v
22
e

0
t
v
23
e

1
t
v
31
e

0
t
v
32
e

0
t
v
33
e

1
t
_
_
2. HOMOGENEOUS SYSTEM 11
[2]
0
has one eigenvector:
Suppose v
1
=
_
_
v
11
v
21
v
31
_
_
is the associated eigenvector with re-
spect to
0
and v
2
=
_
_
v
12
v
22
v
32
_
_
is a solution of
(
0
I A)v
2
= v
1
.
Then the general solution is,
x
c
(t) = (c
1
v
1
+ c
2
(tv
1
+v
2
))e

0
t
+ c
3
v
3
e

1
And
(t) =
_
_
v
11
e

0
t
(v
11
t + v
12
)e

0
t
v
13
e

1
v
21
e

0
t
(v
21
t + v
22
)e

0
t
v
23
e

1
v
31
e

0
t
(v
31
t + v
32
)e

0
t
v
33
e

1
_
_
is the fundamental solution matrix.
Case 3: p() = 0 has two conjugate complex solutions abi and a real
solution
1
.
Suppose v =
_
_
v
11
+ iv
12
v
21
+ iv
22
v
31
+ iv
32
_
_
is the associate complex eigen-
vector with respect to a + bi, then the general solution is, let
v
3
=
_
_
v
13
v
23
V
33
_
_
, are associated eigenvectors with respect to
1
,
x
c
(t) = [c
1
(v
1
cos(bt)v
2
sin(bt))c
2
(v
2
cos(bt)+v
1
sin(bt))]e
at
+c
3
v
3
e

1
.
And
(t) = e
at
_
_
v
11
cos(bt) v
12
sin(bt) v
12
cos(bt) + v
11
sin(bt) v
13
e

1
v
21
cos(bt) v
22
sin(bt) v
22
cos(bt) + v
21
sin(bt) v
23
e

1
v
31
cos(bt) v
32
sin(bt) v
32
cos(bt) + v
31
sin(bt) v
33
e

1
_
_
is the fundamental matrix.
Case 4: p() = 0 has solution
0
with multiplicity 3.
In this case, p() = (
0
)
3
.
[1]
0
has three linearly independent eigenvectors.
Let v
1
=
_
_
v
11
v
21
v
31
_
_
, v
2
=
_
_
v
12
v
22
V
32
_
_
, and v
3
=
_
_
v
13
v
23
V
33
_
_
be
the three linearly independent eigenvectors. Then the general
12 1. SYSTEM OF FIRST ORDER DIFFERENTIAL EQUATIONS
solution is x
c
(t) = (c
1
v
1
+ c
2
v
2
+ c
3
v
3
)e

0
t
and fundamental
matrix is (t) = e

0
t
_

_
v
11
v
12
v
13
v
21
v
22
V
23
v
31
v
32
V
33
_

_
[2]
0
has two linearly independent eigenvectors.
Suppose v
1
=
_
_
v
11
v
21
v
31
_
_
, v
2
=
_
_
v
12
v
22
V
32
_
_
are the linearly inde-
pendent eigenvectors. Let v
3
=
_
_
v
13
v
23
V
33
_
_
, then only one of the
two equations, (A
0
I)v
3
= v
1
or (A
0
I)v
3
= v
2
can
has a solution that is linearly independent with v
1
, v
2
.
Suppose (A
0
I)v
3
= v
2
generates such a solution. Then
the general solution is x
c
(t) = [c
1
v
1
+ c
2
v
2
+ c
3
(tv
2
+v
3
)]e

0
t
and fundamental matrix is (t) = e

0
t
_
_
v
11
v
12
tv
12
+ v
13
v
21
v
22
tv
22
+ V
23
v
31
v
32
tv
32
+ V
33
_
_
[3]
0
has only one eigenvector.
Let v
1
=
_
_
v
11
v
21
v
31
_
_
be the linearly independent eigenvectors.
Let v
2
=
_
_
v
12
v
22
V
32
_
_
and v
3
=
_
_
v
13
v
23
V
33
_
_
be two vectors that
satises
(A
0
I)v
2
= v
1
and (A
0
I)v
3
= v
2
.
Then the general solution is x
c
(t) = [c
1
v
1
+ c
2
(tv
1
+ v
2
) +
c
3
(t
2
v
1
+ tv
2
+ v
3
)]e

0
t
and fundamental matrix is (t) =
e

0
t
_
_
v
11
tv
11
+ v
12
t
2
v
11
+ tv
12
+ v
13
v
21
tv
21
+ v
22
t
2
v
21
+ tv
22
+ V
23
v
31
tv
31
+ v
32
t
2
v
31
+ tv
32
+ V
33
_
_
Remark 2.1. Suppose A is an n n matrix, for the homogeneous
system x

(t) = Ax(t), three general case would happen


Case 1: A has n distinct eigenvalues
i
, i = 1, 2, , n with linearly
independent eigenvectors v
i
, i = 1, 2, , n then the general
solution will be x
c
(t) = c
1
v
1
e

1
+ c
2
v
2
e

2
+ + c
n
v
n
e
n
2. HOMOGENEOUS SYSTEM 13
Case2: A has m < n distinct eigenvalues, in this case some eigenval-
ues would have multiplicity greater than 1.
Suppose
r
has multiplicity r. Depending on how many
linearly independent eigenvectors are associated with
r
the
situation could be very complex. Let p be the number of linearly
eigenvectors associated with
r
, then d = r p is called the
decit of
r
. The simply cases are either d = 0 or d = r 1.
When 0 < d < r 1 the situation could be very complex.
Suppose d = r 1 and v
1
is the only eigenvector associate
with
r
, then one will have to solve r 1 equations (A

r
)
i
v
i+1
= v
i
, i = 1, 2, , r 1. And the general solution
would contains terms like [c
1
v
1
+c
2
(v
1
t +v
2
) +c
3
(v
1
t
2
+v
2
t +
v
3
) + + c
r
(v
r
1
+v
2
t
r1
+ +v
r
)]e
r
.
Case 3: A complex root a+bi with associated eigenvector v
a
+iv
b
, then
the general solution contains term, [c
1
(v
a
cos(bt)v
b
sin(bt))+
c
2
(v
a
sin(bt) +v
b
cos(bt))]e
at
.
Remark 2.2. Suppose x
1
(t), x
2
(t), x
3
(t), , x
n
(t) are n linearly
independent solution for nn homogeneous system, x

(t) = Ax(t), the


fundamental matrix (t) is a matrix whose columns are x
i
(t), i =
1, 2, , n.
Example 2.5. (Two distinct eigenvalues) Find the general so-
lution to
x

1
= 3x
1
+ 4x
2
2x
3
x

2
= 2x
1
+ x
2
4x
3
x

3
= x
1
+ 2x
2
Solution Let x(t) =
_
_
x
1
(t)
x
2
(t)
x
3
(t)
_
_
and
_
_
3 4 2
2 1 4
1 2 0
_
_
The equa-
tions can be written in matrix form x

(t) = Ax(t).
Using Mathcad , functions eigenvals() and eigenvecs() we nd,
1
=
2 and
2
= 1 with associated eigenvectors v
1
=
_
_
4
1
2
_
_
and v
2
=
_
_
1
0
1
_
_
respectively. Since
1
has multiplicity 2 as 1 appeared twice
in the result of eigenvals() function, we need to solve the equation
(A
1
I)v
3
= v
2
.
14 1. SYSTEM OF FIRST ORDER DIFFERENTIAL EQUATIONS
To use Mathcad ,
(1) you rst compute (A
1
I)v
3
using the fol-
lowing sequences of key stroke,
[*] type ([Ctrl][M], set the rows and
columns in the matrix denition popup menu,
input the data for A,
[*] type -[Ctrl][M] set the row and col-
umn number and input data for
1
I,
[*] type )[Ctrl][M], now set 1 as column
number, enter a, b, c in the place holders,
[*] type [Ctrl][.] to compute symboli-
cally and you get.
(2) Using the Given Find block to nd a
solution. Type Given in a blank space, type
a+2b-c[Ctrl]= 1 and 2a-4c[Ctrl]=0 in two
rows, then type key word Find following by
typing (a,b)[Ctrl][.] you will get the solution
in terms of c.
Set c = 1, we get v
3
=
_
_
4
1
1
_
_
.
So the fundamental matrix is
(t) =
_
_
4e
2t
e
t
(t + 4)e
t
e
2t
0 e
t
2e
2t
e
t
(t + 1)e
t
_
_
and the general solution is,
x
c
(t) = c
1
v
1
e
2t
+ c
2
v
2
e
t
+ c
3
(tv
2
+v
3
)e
t

Example 2.6. (One eigenvalue with decit 1) Find the solution


to x

(t) =
_
_
3 0 1
2 1 1
4 0 1
_
_
x(t) and x(0) =
_
_
2
3
4
_
_
Solution Using Mathcad , functions eigenvals() (Notice the
eigenvecs() will not nd a good result in this case due to the rounding
error.) we nd,
0
= 1 is the only eigenvalue. To nd the associate
eigenvectors we compute (Using (A
0
I)v = 0)
(A
0
I)v =
_
_
2 0 1
2 0 1
4 0 2
_
_
_
_
v
1
v
2
v
3
_
_
_
_
2v
1
+ v
3
2v
1
+ v
3
4v
1
2v
3
_
_
= 0
2. HOMOGENEOUS SYSTEM 15
We have only 2v
1
+ v
3
= 0 for three variables v
1
, v
2
, v
3
, this indicates
that v
2
can be any value, and set v
1
= 1 nd v
3
= 2, So v
1
=
_
_
1
0
2
_
_
and v
2
=
_
_
1
1
2
_
_
are two eigenvectors.
To nd the generalize eigenvector associated with
0
we will have
to solve two equations
(A
0
I)
_
_
w
1
w
2
w
3
_
_
=
_
_
1
0
2
_
_
,
and
(A
0
I)
_
_
w
1
w
2
w
3
_
_
=
_
_
1
1
2
_
_
,
From (2.2),
_
_
2 0 1
2 0 1
4 0 2
_
_
_
w
1
w
2
_
=
_
_
1
0
2
_
_
,
we get two inconsistent equations 2w
1
+ w
3
= 1 and 2w
1
+ w
3
= 0. So
now solution can be found in this case.
From (2.2),
_
_
2 0 1
2 0 1
4 0 2
_
_
_
w
1
w
2
_
=
_
_
1
1
2
_
_
,
we get one equation 2w
1
+ w
3
= 1 choose w
3
= 1 we get w
1
= 0, since
w
2
can be anything, we set w
2
= 1. So v
3
=
_
_
0
1
1
_
_
and we can verify
that v
1
, v
2
, and v
3
are linearly independent.
So the fundamental matrix is
(t) = e
t
_
_
1 1 t
0 1 t + 1
2 2 2t + 1
_
_
and the general solution is,
x
c
(t) = [c
1
v
1
+ c
2
v
2
+ c
3
(tv
2
+v
3
)]e
t
16 1. SYSTEM OF FIRST ORDER DIFFERENTIAL EQUATIONS
Now, (0) =
_
_
1 1 0
0 1 1
2 2 1
_
_
and (0)
-1
_
_
2
3
4
_
_
=
_
_
1
3
0
_
_
.
Hence, the particular solution is x(t) = [v
1
+ 3v
2
]e
t

Example 2.7. (One eigenvalue with decit 2) Find the general


solution to x

(t) =
_
_
2 1 0
1 4 1
2 2 3
_
_
x(t).
Solution Using Mathcad , functions eigenvals() (Notice the
eigenvecs() will not nd a good result in this case due to the rounding
error.) we nd,
0
= 3 is the only eigenvalue. To nd the associate
eigenvectors we compute (Using (A
0
I)v = 0)
(A3I)v =
_
_
1 1 0
1 1 1
2 2 0
_
_
_
_
v
1
v
2
v
3
_
_
_
_
v
1
+ v
2
+ v
3
v
1
+ v
2
+ v
3
2v
1
2v
2
_
_
= 0
We have only one eigenvector v
1
=
_
_
1
1
2
_
_
.
To nd the generalize eigenvector associated with
0
we will have
to solve two equations
(A3I)v
2
= v
1
,
and
(A3I)v
3
= v
2
,
From (2.2),
_
_
1 1 0
1 1 1
2 2 0
_
_
_
_
a
b
c
_
_
=
_
_
1
1
2
_
_
,
we have two equations
_
b a = 1
a + b + c = 1
Choosing a = 0, we get b = 1, c = 0. Hence v
2
=
_
_
0
1
0
_
_
2. HOMOGENEOUS SYSTEM 17
From (2.2),
_
_
1 1 0
1 1 1
2 2 0
_
_
_
_
a
b
c
_
_
=
_
_
0
1
0
_
_
,
we have two equations
_
b a = 0
a + b + c = 1
Choosing a = 0, we get b = 0, c = 1. So v
3
=
_
_
0
0
1
_
_
and we can verify
that v
1
, v
2
, and v
3
are linearly independent.
So the fundamental matrix is
(t) = e
t
_
_
1 t t
2
1 1 + t t
2
+ t
2 2t 2t
2
+ 1
_
_
and the general solution is,
x
c
(t) = [c
1
v
1
+ c
2
(tv
1
+v
2
) + c
3
(t
2
v
1
+ tv
2
+v
3
)]e
3t

Example 2.8. (Two conjugate complex eigenvalues case)


Find the general solution to x

(t) =
_
_
1 1 3
2 0 3
1 0 1
_
_
x(t)
Solution Using Mathcad , functions eigenvals() and eigen-
vecs() we nd two conjugate complex eigenvalues and one real eigen-
value,
1
= 1,
2
=
1
2
+ i
1
2

19, and
3
=
1
2
i
1
2

19 with associ-
ated eigenvector v
1
=
_
_
0
1
1
_
_
and v =
_
_
1 + i

19
2 + i

19
2
_
_
=
_
_
1
2
2
_
_
+
i
_
_

19

19
0
_
_
with respect to
3
. Compare this with the Theorem 1.3,
18 1. SYSTEM OF FIRST ORDER DIFFERENTIAL EQUATIONS
we have a =
1
2
, b =
1
2

19, v
2
=
_
_
1
2
2
_
_
(real part of v), and v
3
=
_
_

19

19
0
_
_
(imaginary part of v).
The general solution is,
x
c
(t) = c
1
v
1
e
t
+c
2
(v
2
cos(
1
2

19)v
3
sin(
1
2

19))e
1
2
t
+c
3
(v
2
sin(
1
2

19)+v
3
cos(
1
2

19))e
1
2
t

3. Nonhomogeneous System of Equations


To nd solutions to the initial value problem of nonhomogeneous
equations x

(t) = Ax(t) +b(t), x(t


0
) = x
0
we follow the steps below,
(1) Find the general solution x
c
(t) = (t)c to homogeneous equa-
tion x

(t) = Ax(t), where (t) is the fundamental matrix.


(2) Find a particular solution x
p
to x

(t) = Ax(t)
(3) The general solution to the nonhomogeneous equation x

(t) =
Ax(t) is x(t) = x
c
(t) + x
p
(t). Using x(t
0
) = x
0
to determine
the coecient vector c.
The following theorem gives one way to nd a particular solution based
on the fundamental matrix,
Theorem 3.1. Let (t) be a fundamental matrix of x

(t) = Ax(t),
a particular solution to x

(t) = Ax(t) +b(t) is given by


x
p
(t) = (t)
_
(t)
-1
b(t) dt.
Example 3.1. Find the general solution to
x

1
= 3x
1
+ 4x
2
2x
3
+ t
2
x

2
= 2x
1
+ x
2
4x
3
x

3
= x
1
+ 2x
2
t
2
Solution Let x(t) =
_
_
x
1
(t)
x
2
(t)
x
3
(t)
_
_
, A =
_
_
3 4 2
2 1 4
1 2 0
_
_
, and
b(t) =
_
_
t
2
0
t
2
_
_
. The equations can be written in matrix form x

(t) =
3. NONHOMOGENEOUS SYSTEM OF EQUATIONS 19
Ax(t)+b(t). From Example 2.5, we know that the fundamental matrix
to x(t) = Ax(t) is
(t) =
_
_
4e
2t
e
t
(t + 4)e
t
e
2t
0 e
t
2e
2t
e
t
(t + 1)e
t
_
_
To nd a particular solution, we rst compute
-1
(t)b(t) =
_
_

2
5
t
2
e
2t
(
2
5
t
3
+
11
5
t
2
)e
t
2
5
t
2
e
t
_
_
then we compute
(t)
_

-1
(t)b(t) dt = (t)
_
_
_

2
5
t
2
e
2t
dt
_
(
2
5
t
3
+
11
5
t
2
)e
t
dt
_
2
5
t
2
e
t
dt
_
_
=
_
_
1
5
t
2
+ 2t +
16
5

1
5
t
2

3
5
t
7
10
9
5
t
2
+
24
5
t +
29
5
_
_
.
And so the general solution is,
x(t) = c
1
_
_
4
1
2
_
_
e
2t
+ c
2
_
_
1
0
1
_
_
e
t
+ c
3
_
t
_
_
1
0
1
_
_
+
_
_
4
1
1
_
_
_
e
t
+
_
_
1
5
t
2
+ 2t +
16
5

1
5
t
2

3
5
t
7
10
9
5
t
2
+
24
5
t +
29
5
_
_
The following is a screen shot that shows how to carry out the compu-
tation in Mathcad ,
To use Mathcad ,
(1) Dene fundamental ma-
trix A(t) and b(t) in the
same line (not as shown in
graph), and compute in the
next line A
1
b(t)
(2) type A(t)*[Ctrl][M] choose
column as 1, at each place
holder, type [Ctrl][I] to get
the indenite integral,
(3) and put the corresponding
entry of A
1
b(t) in the in-
tegrant position.
(4) press [Shift][Ctrl][.] type
key work simplify

20 1. SYSTEM OF FIRST ORDER DIFFERENTIAL EQUATIONS


Theorem 3.2. If (t) is the fundamental matrix for x

(t) = Ax(t),
, and x
p
(t) =
_

-1
(t)b(t) dt, then x(t) = (t)
-1
(t
0
)(x
0
x
p
(t
0
)) +
x
p
(t) is the solution to the nonhomogeneous initial value problem,
x

(t) = Ax(t) +b(t), x(t


0
) = x
0
Example 3.2. Find the solution to x

(t) =
_
2 3
3 8
_
x(t) +
_
e
2t
2e
2t
_
and x(0) =
_
2
1
_
Solution From Example 2.3 is the fundamental matrix is
(t) = e
5t
_
3 3t + 1
3 3t
_
and (0)
-1
=
1
3
_
0 1
3 3
_
.
Now b(t) =
_
e
2t
2e
2t
_
, using the formula x
p
(t) = (t)
_

-1
(t)b(t) dt
and Mathcad , we have x
p
(t) =
_
0
1
3
e
2t
_
Therefore,
(0)
-1
(x(0) x
p
(0)) =
1
3
_
0 1
3 3
_
_
_
2
1
_

_
0
1
3
_
_
=
_

2
3
8
_
.
and the solution is
x(t) = (t)(0)
-1
(x(0) x
p
(0)) +x
p
(t) = e
5t
_
24t 6
24t 2 +
1
3
e
3t
_

4. Higher order dierential equations


One can transform equations that involving higher order derivatives
of unknown functions to system of rst order equations. For example,
suppose x(t) is an unknown scalar function that satises
mx

(t) + cx

(t) + kx(t) = f(t)


an equation can be used to model a spring system with external force
f(t) or an RCL electronic circuit with an energy source f(t).
4. HIGHER ORDER DIFFERENTIAL EQUATIONS 21
Now if we set x
1
(t) = x(t) and x
2
(t) = x

(t) we then get an system


of rst order equations
x

1
(t) = x
2
(t) (5)
x

2
(t) =
c
m
x
2
(t)
k
m
x
1
(t) +
f(t)
m
(6)
In general, if we have an dierential equation that involving nth
order derivative x
(n)
(t) of unknown function x(t),
x
(n)
= a
0
x(t) + a
1
x

(t) + + a
n1
x
(n1)
+ f(t),
we can transform it into an system of rst order equations of n unknown
functions x
1
(t) = x(t), x
2
(t) = x

(t), x
3
(t) = x
(2)
(t), , x
n
(t) =
x
(n1)
(t), and using the eigenvalue method for system of dierential
equation to solve the higher order equation.
Example 4.1. Transform the dierential equation x
(3)
+ 3x
(2)

7x

(t) 9x = sin(t) into system of rst order equations.


Solution Here the highest order of derivative is third derivative
x
(3)
of x(t). So we transfer it into system of 3 equations.
Let x
1
(t) = x(t), x
2
(t) = x

(t), x
3
(t) = x

(t), we have
x

1
(t) = x
2
(t) (7)
x

2
(t) = x
3
(t) (8)
x

3
(t) = 3x
3
(t) + 7x
2
(t) + 9x
1
(t) sin(t) (9)
Let x(t) =
_
_
x
1
(t)
x
2
(t)
x
3
(t)
_
_
, A =
_
_
1 0 0
0 1 0
9 7 3
_
_
, and b(t) =
_
_
0
0
f(t)
_
_
we can write the system of equation in matrix form x

(t) = Ax(t) +
b(t).
Example 4.2. Find the general solution for the 3rd order dieren-
tial equation x
(3)
+ 3x
(2)
7x

(t) 9x = sin(t).
Solution From previous example, Example 4.1, Let x(t) =
_
_
x
1
(t)
x
2
(t)
x
3
(t)
_
_
, A =
_
_
1 0 0
0 1 0
9 7 3
_
_
, and b(t) =
_
_
0
0
f(t)
_
_
we can write
the system of equation in matrix form x

(t) = Ax(t) + b(t). Using


Mathcad we nd the eigenvalues are
1
= 1,
2
= 1 +

10,
3
=
1

10 with associate eigenvectors, v


1
=
_
_
1
1
1
_
_
, v
2
=
_
_
1
1 +

10
11 2

10
_
_
,
22 1. SYSTEM OF FIRST ORDER DIFFERENTIAL EQUATIONS
and v
3
=
_
_
1
1

10
11 + 2

10
_
_
respectively (after multiply the results of
Mathcad by some constants). So the fundamental matrix is
(t) =
_
_
e
t
e
(1+

10)t
e
(1+

10)t
e
t
(1 +

10)e
(1+

10)t
(1 +

10)e
(1+

10)t
e
t
(11 2

10)e
(1+

10)t
(11 + 2

10)e
(1+

10)t
_
_
From (t) we nd a particular solution
x
p
(t) = (t)
_

-1
(t)b(t) dt =
_
_
3
52
cos(t)
5
39
sin(t)
1
26
cos(t)
35
156
sin(t)

3
52
cos(t)
8
39
sin(t)
_
_
Hence the general solution to the system is
_
_
x
1
(t)
x
2
(t)
x
3
(t)
_
_
=
_
_
c
1
e
t
+ c
2
e
(1+

10)t
+ c
3
e
(1+

10)t
+
3
52
cos(t)
5
39
sin(t)
c
1
e
t
+ c
2
(1 +

10e
(1+

10)t
c
3
(1 +

10)e
(1+

10)t
+
1
26
cos(t)
35
156
sin(t)
c
1
e
t
+ c
2
(11 2

10)e
(1+

10)t
+ c
3
(11 + 2

10)e
(1+

10)t

3
52
cos(t)
8
39
sin(t)
_
_
and x
1
(t) = c
1
e
1t
+ c
2
e
(1+

10)t
+ c
3
e
(1+

10)t
+
3
52
cos(t)
5
39
sin(t) is
the general solution to the third order ordinary dierential equation
x
(3)
+ 3x
(2)
7x

(t) 9x = sin(t)
.
Example 4.3. Find the solution to the initial value problem
x

10x

+ 9x = te
t
, x(0) = 1, x

(0) = 1.
Solution Since the given equation is of second order, we will have
two unknowns x
1
(t) = x(t), x
2
(t) = x

(t) to transform the equation into


a system of rst order equations,
x

1
(t) = x
2
x

2
(t) = 10x
2
9x
1
+ te
t
,
and the initial conditions are x
1
(0) = x(0) = 1 x
2
(0) = x

(0) = 1.
Now let x(t) =
_
x
1
(t)
x
2
(t)
_
, A =
_
0 1
9 10
_
, and b(t) =
_
0
te
t
_
.
We have the matrix version of this equation, x

(t) = Ax(t) +b(t)


4. HIGHER ORDER DIFFERENTIAL EQUATIONS 23
Using Mathcad , we nd the eigenvalues
1
= 1,
1
= 9, and
associate eigenvectors v
1
=
_
1
1
_
, v
2
=
_
1
9
_
. And fundamental
matrix (t) =
_
e
t
e
9t
e
t
9e
9t
_
.
From (t) we nd a particular solution
x
p
(t) = (t)
_

-1
(t)b(t) dt =
_

1
512
(32t
2
+ 8t + 1)e
t

1
512
(32t
2
+ 72t + 9)e
t
_
The solution with initial values x
0
=
_
1
1
_
is given by
x(t) = (t)
-1
(0)(x
0
b(0)) +b(t)
=
_

_
_

1
16
t
2

1
64
t +
639
512
_
e
t

127
512
e
9t
_

1
16
t
2

9
64
t +
631
512
_
e
t

1143
512
e
9t
_

_
.
Hence the solution to the initial value problem of the second order
dierential equation is x(t) = x
1
(t) =
_

1
16
t
2

1
64
t +
639
512
_
e
t

127
512
e
9t
.
Project
At beginning you should enter: Project title, your name, ss#, and
due date in the following format
Project One: Dene and Graph Functions
John Doe
SS# 000-00-0000
Due: Mon. Nov. 23rd, 2003
You should format the text region so that the color of text is dierent
than math expression. You can choose color for text from Format
>Style select normal and click modify, then change the settings for
font. You can do this for headings etc.
(1) Solutions To System of Equations
Finding solution to linear system using Mathcad and study
the long time dynamic behavior of the solutions.
Find general solution to
_
x

= y
y

= x
24 1. SYSTEM OF FIRST ORDER DIFFERENTIAL EQUATIONS
Plot several solutions with dierent initial values in
[-] xt-plane, yt-plane
xy-plane. Here you will need to dene range variable
t = 0, 0.1 7 and set X := x(t), Y := y(t). The graph
in xy-plane is called the trajectory. If this models the
movement of a satellite, what is its trajectory.
Find general solution to
_
x

= 8y
y

= 18x
Plot several solutions with dierent initial values in
[-] xt-plane, yt-plane
xy-plane. Here you will need to dene range variable
t = 0, 0.1 7 and set X := x(t), Y := y(t). The graph
in xy-plane is called the trajectory. If this models the
movement of a satellite, what is its trajectory.
Find general solution to
_
x

= 2x y
y

= y 3x
Plot several solutions with dierent initial values in
[-] xt-plane, yt-plane
xy-plane. Here you will need to dene range variable
t = 0, 0.1 7 and set X := x(t), Y := y(t). The graph
in xy-plane is called the trajectory. If this models the
movement of a system of two species, what is you con-
clusion about interdependency of these species? Can you
nd initial value such that x(t) = 0 (distinct) for some t?
what about y(t).
(2) Solution of Higher order equation In general mx

+cx

+
kx = f(t) models a object with mass m attached to a spring
with constant k and damping force that is proportional to
the velocity x

, c 0, k > 0. Suppose m = 1 and f(t) =


Ae
at
sin(bt), that is the external force is oscillatory (b > 0)
and diminishing (a > 0) Find solutions and graph the solu-
tions.
- c = b = 0 Find general solution and graph some particular
solutions.
- c = 20, k = 10, a = 0, b =
1
4
, A = 1
- c = 2, k = 3, A = 100, a = 2, b =

2
CHAPTER 1
Numerical Methods for Ordinary Dierential
Equations
In this chapter we discuss numerical method for ODE . We will
discuss the two basic methods, Eulers Method and Runge-Kutta
Method.
1. Numerical Algorithm and Programming in Mathcad
1.1. Numerical Algorithm. If you look at dictionary, you will
the following denition for algorithm,
1. a set of rules for solving a problem in a nite
number of steps; 2. a sequence of steps designed for
programming a computer to solve a specic problem.
A numerical algorithm is a set of rules for solving a problem in nite
number of steps that can be easily implemented in computer using any
programming language. The following is an algorithm for compute the
root of f(x) = 0,
Input f, a, N and tol .
Output: the approximate solution to f(x) = 0 with
initial guess a or failure message.
Step One: Set x = a
Step Two: For i=0 to N do Step Three - Four
Step Three: Compute x = x
f(x)
f

(x)
Step Four: If f(x) tol return x
Step Five return failure.
In analogy, a numerical algorithm is like a cook recipe that specify the
input cooking material, the outputthe cooking product, and steps
of carrying computation cooking steps.
In an algorithm, you will see loops (for, while), decision making
statements(if, then, else(otherwise)) and return statements.
for loop: Typically used when specic number of steps need
to be carried out. You can break a for loop with return or
break statement.
1
2 1. NUMERICAL METHODS FOR ORDINARY DIFFERENTIAL EQUATIONS
while loop: Typically used when unknown number of steps
need to be carried out. You can break a while loop with a
break statement or a return statement.
if else(otherwise): Used when condition(s) must meet be-
fore carrying out some steps. The else(otherwise) provide al-
ternative steps if any.
1.2. Programming in Mathcad. To translate a numerical al-
gorithm into a program in Mathcad , you need to dene a function
name with function arguments and function body. The function
name can be any sequence of alphabetic letter begin with an English
letter, such any myFunction, Myfunction1 etc. The function ar-
guments specify the input to the function, typically the items specied
in the input statement of an algorithm and is an comma(,) separated
list enclose by () after function name, such as myFunction(f, a, N, tol),
myOne(a,b). Notice the function argument is optional, you can dene
a function with out argument as myFunction(). The function body
implements the step section of an algorithm and the output statement.
In Mathcad the function body is on the right side of := with vertical
bars as grouping symbol. The entire function body is considered as
a group, inside, it might has many subgroups. For the algorithm of
nding f(x) = 0, there is an subgroup that contains step three and
four, as shown in the following screen shot, the screen shot also shows
how to get the programming toolbar from the math toolbar.
Figure 1. mySolver and Programming toolbar
1. NUMERICAL ALGORITHM AND PROGRAMMING IN Mathcad 3
To enter code in Mathcad ,
(1) First enter the function name with arguments list and assignment operator
:=, with sequence of typing,
mySolver(f,a,N,tol):
(2) Click the Add Line button or press ] to get a vertical bar and two (you
should add more by press ] several times).
(3) enter x and hold [Shift] type ] to get the local assignment or click on the
programming toolbar, at the type a. Notice x a reads as assign a to x.
(4) Click for on the programming menu or [Shift][Ctrl][] to get
for
in after for enter i, in after , enter 1;N, and in under for, press left
bracket ] to get a vertical line and several .
(5) To get if operator, you need either click on the toolbar or press [Shift][Ctrl][
] ]. you will get
if
enter condition in after if and other statements in before if.
(6) To get return operator, you need either click on the toolbar or press
[Shift][Ctrl][ ], you get
return
in type any information you want to return.
After dening a function, we call it with concrete input data, as
shown in the screen shot, that call the mySolver function to nd zero
for both f(x) = x
2
1, with initial guess x = 2 and g(t) = t
3
3t
2
2t,
with initial guess t = 2. Notice there is two ways to call a function,
one way is to dene all arguments before calling the function, another
is to dene some arguments and call the function with concrete values
for the undened arguments.
As in all programming language, Mathcad allows you to call one
function from within another. For example, we could create a function
called myDerivative which will compute derivative of a given func-
tion f(x) at a given number x and step size h > 0 using the forward
dierence formula: f

(s)
f(x+h)f(x)
h
. The following screen shot shows
the call of myDerivative inside mySolver,
Figure 2. Call another function
4 1. NUMERICAL METHODS FOR ORDINARY DIFFERENTIAL EQUATIONS
The algorithm for this function is very simple (here, we break down
the computation in three steps),
Input f, x, and h .
Output: the approximation to f

(x) .
Step One: Set w = f(x + h)
Step Two: Set d = f(x)
Step Three: return
wd
h
2. Eulers Method
2.1. Eulers Method. Eulers method is the simplest method in
nd approximate solutions to rst order equations. From the forward
dierence formula
f

(x)
f(x + h) f(x)
h
,
we have
f(x + h) f(x) + f

(x)h (1)
Now if x

(t) = f(t, x) is a rst order dierential equations, apply (1),


we have
x(t + h) x(t) + f(t, x(t))h.
Suppose we want to nd approximate solution over interval [a, b] with
initial value x(a) = x
0
, we divided the interval into n subintervals
each with length h =
ba
n
, the ends of the subintervals is t
0
= a, t
1
=
a +h, t
2
= a +2h, , t
n
= a +nh = b. Start with x
0
we can compute
x
1
= x
0
+ f(t
0
, x
0
)h
x
2
= x
1
+ f(t
1
, x
1
)h
.
.
.x
n
= x
n1
+ f(t
n1
, x
n1
)h
Example 2.1. Find approximate to x(1) if x

(t) = t
2
e
x
sin(t), x(0) =
1 with h = 0.25.
Solution Here the interval is [0, 1], so a = 0, b = 1. Since h =
ba
n
= 0.25 we have n = 4 and we need to compute x
1
, x
2
, x
3
, x
4
starting
with x
0
= x(0) = 1.
x
1
= x
0
+ f(t
0
, x
0
)h = 1 + f(0, 1) 0.25 = 0.15853
x
2
= x
1
+ f(t
1
, x
1
)h = 0.15853 + f(0.25, 0.15853) 0.25 = 0.01833
x
3
= x
2
+ f(t
2
, x
2
)h = 0.01833 + f(0.5, 0.01833) 0.25 = 0.23811
x
4
= x
3
+ f(t
3
, x
3
)h = 0.23811 + f(0.75, 0.15853) 0.25 = 0.30128
So the approximation to x(1) is x(1) x
4
= 0.30128. Also x(0.25)
x
1
= 0.15853, x(0.5) x
2
= 0.01833, x(0.75) x
3
= 0.23811.
2. EULERS METHOD 5
2.2. Mathcad implementation of Eulers Method. First, we
have the following simple algorithm for the Eulers method,
Input f, a, b, x0 n.
Output: the approximate solution to x

= f(t, x)
with initial guess x0 over interval [a, b].
Step One: Initialization
Set h =
ba
n
Set x
0
= x0
Set t
0
= a
Step Two: For i=1 to n do Step Three
Step Three: Set x
i
= x
i1
f(t
i1
, x
i1
) h
Set t
i
= t
i1
+ h
Step Four return x.
Notice, algorithm return an array of values, the ith element of the
return array is an approximations of x(t) at t = a + ih.
The following screen shot shows Mathcad code for implementing
the algorithm. Notice, we also create a function tMesh(a, b, N) to
compute the ending of subinterval for graphing purpose.
Figure 3. Mathcad code for Eulers Method
Notice the line to line corresponding between the Mathcad and the
algorithm. Since Mathcad programming language is a scripting lan-
guage, the translation between algorithm and code is straight forward,
and you dont need to worry about the variable type, io, etc. Also,
without explicit return statement, the result of last is, by default, will
be returned.
6 1. NUMERICAL METHODS FOR ORDINARY DIFFERENTIAL EQUATIONS
The next screen shot shows a call to the myEuler and tMesh for
the equation x

= t
2
x + t
2
sin(t
3
). It also shows the graph of approxi-
mate solution comparing with the exact solution x(t) =
3
10
cos(t
3
)
1
10
sin(t
3
) +
3
10
e
1
10
t
3
Figure 4. Mathcad Eulers Approximation to x

= t
2
x + t
2
sin(t
3
)
2.3. Error analysis of Eulers Method. There are two source
of error in every numerical method used to approximate a solution of
x

(t) = f(t, x),


Local Truncation Error
The roundo error.
The local truncation error is due to the method and roundo error
is due to computer that is used. For Eulers method, we use x
i
=
x
i1
+f(t
i1
, x
i1
) h to approximate the value of x(t
i
), the dierence,
assuming no rounding is introduced, is |x
i
x(t
i
)|, and is called the
local truncation error. The following theorem shows how the local
truncation error is depending on f(t, x) and h,
Theorem 2.1. Suppose f(t, x),
f(t,x)
t
, and
f(t,x)
x
are continuous
on [a, b], and h =
b1
n
is the step size. Furthermore let x(t) be the
solution of initial value problem x

= f(t, x), x(a) = x


0
and x
i
= x
i1
+
f(t
i1
, x
i1
) h be the approximate of x(t
i
), and let e
i
= x(t
i
) x
i
be
3. RUNGE-KUTTA METHOD 7
the local truncation error, then
e
i+1
(1 + hK)|e
i
| +
1
2
h
2
M, i = 1, ...n.
, where |
f(t,x)
x
| K, and |x

(t)| M.
Theorem 2.2 indicates that, without roundo error, the smaller h
gives better approximate solution. However, due the roundo error
introduced in each step of computation, (such as compute can only
give approximate value for

2) we cant choose h arbitrarily small.


The following result gives the optimal step size h,
Theorem 2.2. With the same assumption of Theorem 2.2,and sup-
pose at each step the roundo error is bounded by then the optimal
value for the step length is
h
opt
=

2
M
3. Runge-Kutta Method
3.1. Runge-Kutta Method. There are several Runge-Kutta meth-
ods, but the fourth order Runge-Kutta method is most popular. Sup-
pose x

(t) = f(t, x), x(a) = x


0
. and h =
ba
n
is the step length, the
fourth order Runge-Kutta method is given below,
k
1
= hf(t
i
, x
i
)
k
2
= hf(t
i
+
1
2
h, x
i
+
1
2
k
1
)
k
3
= hf(t
i
+
1
2
h, x
i
+
1
2
k
2
)
k
4
= hf(t
i
+ h, x
i
+ k
3
)
x
i+1
= x
i
+
1
6
(k
1
+ 2k
2
+ 2k
3
+ k
4
)
In general Runge-Kutta method gives more accurate result than Eu-
lers method at the same step length. However, Runge-Kutta method
is more expensive to implement, that is, at each step, Runge-Kutta
method requires more computation than Eulers method( four func-
tion evaluations compare one in Eulers method).
Example 3.1.
Example 3.2. Find approximate to x(1) if x

(t) = t
2
e
x
sin(t), x(0) =
1 with h = 0.25.
Solution Here the interval is [0, 1], so a = 0, b = 1. Since
h =
ba
n
= 0.25 we have n = 4 and we need to compute x
1
, x
2
, x
3
, x
4
starting with x
0
= x(0) = 1, t
0
= 0
8 1. NUMERICAL METHODS FOR ORDINARY DIFFERENTIAL EQUATIONS
x
1
:
k
1
= hf(t
0
, x
0
) = 0.25 f(0, 1) = 0
k
2
= hf(t
0
+
1
2
h, x
0
+
1
2
k
1
) = f(0.125, 1) = 0.373276
k
3
= hf(t
0
+
1
2
h, x
0
+
1
2
k
2
)
= 0.25f(0.125, 1 + 0.5(0.373276)) = 0.373276
k
4
= hf(t
0
+ h, x
0
+ k
3
) = 0.25f(0.25, 1 0.373276) = 0.309854
x
1
= x
0
+
1
6
(k
1
+ 2k
2
+ 2k
3
+ k
4
)
= 1 +
1
6
(0 + 2 (0.373276) + 2 (0.373276) 0.309854)
= 0.923911
t
1
= t
0
+ h = 0 + 0.25 = 0.25
x
2
:
k
1
= hf(t
1
, x
1
) = 0.25 f(.25, 0.923911) = 0.560741
k
2
= hf(t
1
+
1
2
h, x
1
+
1
2
k
1
)
= f(0.125, 0.923911 + 0.5(0.560741)) = 0.719601
k
3
= hf(t
1
+
1
2
h, x
1
+
1
2
k
2
)
= 0.25f(0.125, 0.923911 + 0.5(0.719601)) = 0.702688
k
4
= hf(t
1
+ h, x
1
+ k
3
)
= 0.25f(0.5, 0.923911 0.702688) = 0.763158
x
2
= x
1
+
1
6
(k
1
+ 2k
2
+ 2k
3
+ k
4
)
= 0.923911 +
1
6
(0.560741 + 2 (0.719601) + 2 (0.702688) 0.763158)
= 0.750224
t
2
= t
1
+ h = 0.25 + 0.25 = 0.5
x
3
:
k
1
= hf(t
2
, x
2
) = 0.25 f(.5, 0.750224) = 0.765171
k
2
= hf(t
2
+
1
2
h, x
2
+
1
2
k
1
)
= f(0.625, 0.750224 + 0.5(0.765171)) = 0.735295
k
3
= hf(t
2
+
1
2
h, x
2
+
1
2
k
2
)
= 0.25f(0.625, 0.750224 + 0.5(0.735295)) = 0.739508
k
4
= hf(t
2
+ h, x
2
+ k
3
)
= 0.25f(0.75, 0.750224 0.739508) = 0.637224
x
3
= x
2
+
1
6
(k
1
+ 2k
2
+ 2k
3
+ k
4
)
= 0.750224 +
1
6
(0.765171 + 2 (0.735295) + 2 (0.739508) 0.637224)
= 0.568891
t
3
= t
2
+ h = 0.5 + 0.25 = 0.75
3. RUNGE-KUTTA METHOD 9
x
4
:
k
1
= hf(t
3
, x
3
) = 0.25 f(0.75, 0.568891) = 0.641483
k
2
= hf(t
3
+
1
2
h, x
3
+
1
2
k
1
)
= f(0.875, 0.568891 + 0.5(0.641483)) = 0.485628
k
3
= hf(t
3
+
1
2
h, x
3
+
1
2
k
2
)
= 0.25f(0.875, 0.568891 + 0.5(0.485628)) = 0.510243
k
4
= hf(t
3
+ h, x
3
+ k
3
)
= 0.25f(1, 0.568891 0.510243) = 0.308297
x
4
= x
3
+
1
6
(k
1
+ 2k
2
+ 2k
3
+ k
4
)
= 0.568891 +
1
6
(0.641483 + 2 (0.485628) + 2 (0.510243) 0.308297)
= 0.446327
t
4
= t
3
+ h = 0.75 + 0.25 = 1.0
So the approximation to x(1) is x(1) x
4
= 0.446327.
3.2. Mathcad implementation. First, we have the following sim-
ple algorithm for the Eulers method,
Input f, a, b, x0 n.
Output: the approximate solution to x

= f(t, x)
with initial guess x0 over interval [a, b].
Step One: Initialization
Set h =
ba
n
Set x
0
= x0
Set t
0
= a
Step Two: For i=1 to n do Step Three
Step Three:
Set k1 = hf(t
i1
, x
i1
)
Set k2 = hf(t
i1
+
1
2
h, x
i1
+
1
2
k
1
)
Set k3 = hf(t
i1
+
1
2
h, x
i1
+
1
2
k
2
)
Set k4 = hf(t
i1
+ h, x
i1
+ k
3
)
Set x
i
= x
i
+
1
6
(k
1
+ 2k
2
+ 2k
3
+ k
4
)
Set t
i
= t
i1
+ h
Step Four return x.
This algorithm returns an array of values, the ith element of the
return array is an approximations of x(t) at t = a + ih.
The following screen shot shows Mathcad code for implementing
the algorithm. Again notice the line to line corresponding between the
Mathcad and the algorithm.
10 1. NUMERICAL METHODS FOR ORDINARY DIFFERENTIAL EQUATIONS
Figure 5. Mathcad code for Eulers Method
The next screen shot shows a call to the myRungeKutta and tMesh
for the equation x

= t
2
x+t
2
sin(t
3
). It also shows the graph of approx-
imate solution comparing with the exact solution x(t) =
3
10
cos(t
3
)
1
10
sin(t
3
) +
3
10
e
1
10
t
3
, and with the approximate solution using Eulers
method. In this case Runge-Kutta provides much superior result, an
almost exact match!
Figure 6. Mathcad Runge-Kuttas Approximation to x

= t
2
x + t
2
sin(t
3
)
4. NUMERICAL METHOD FOR SYSTEM OF EQUATIONS 11
4. Numerical Method for System of Equations
Both Eulers method and Runge-Kutta method can be used to nd
the approximate solution to the system of rst order dierential equa-
tions. In fact, the Mathcad codes for system of rst dierential equa-
tions are exactly the same as Mathcad does not dierentiate scalar and
vectors when performs most computations. The only thing needs to be
taken care is that at each step the result is vector instead of a scalar.
Suppose x(t) is a vector-valued function that satises
x

(t) = F(t, x(t)),


where F(t, x) is also vector-valued function, t
i
= a+ih then the Eulers
method compute the ith approximate,
x
i
= x
i1
+F(t
i1
, x
i1
). (2)
Example 4.1. Let
x

(t) = t
2
sin(x(t)) + e
t
cos(y(t))
y

(t) = 2tx(t) + e
y(t)
x(0) = 1, y(0) = 1
Find approximate solution for x(t), y(t) over interval [0, 1] with h =
0.1
Solution Set x(t) =

x(t)
y(t)

and F(t, x) =

t
2
sin(x) + e
t
cos(y)
2tx + e
y

The equation can then be written, in vector form,


x

(t) = F(t, x(t)),


x(0) =

1
1

From (2) we can nd, with t


0
= 0,
x
1
= x
0
+ h F(t
0
, x
0
)
=

1
1

t
2
0
sin(x
0
) + e
t
0
cos(y
0
)
2t
0
x
0
+ e
y
0

cos(1)
e
1

The following screen shot shows the results obtain by calling our
Mathcad implementation of Eulers method. Notice that in dening
the vector-valued function F(t, X), for Mathcad to know that X is an
vector, in the denition, we use subscript to access the component of
X, as shown in the screen shot.
12 1. NUMERICAL METHODS FOR ORDINARY DIFFERENTIAL EQUATIONS
Figure 7. Eulers method for system of equations

4. NUMERICAL METHOD FOR SYSTEM OF EQUATIONS 13


Similarly, we can use the same Mathcad code of Runge-Kutta method
to nd approximate solution as shown in the following screen shot for
the above system of equations,
Figure 8. Runge-Kuttas method for system of equations
4.1. Numerical Method for Higher Order Equations. To
nd numerical approximate for solutions of higher order dierential
equations using either Eulers method or Runge-Kutta method, we
rst transform an higher order dierential equations into a system of
rst order dierential equations and then apply the methods.
Example 4.2. Rayleigh Equation In modeling the oscillations
of a clarinet reed. Lord Rayleigh introduced an equation of the form
mx

+ kx = ax

b(x

)
3
Find approximate solution for m = 1, k = 1, a = 2, b = 3. and initial
conditions x(0) = 1, x

(0) = 2
14 1. NUMERICAL METHODS FOR ORDINARY DIFFERENTIAL EQUATIONS
Solution Suppose y(t) = x

(t) is the velocity, then Rayleigh


equation becomes
x

= y
y

= 2y 3y
3
2x
So we apply the numerical method for F =

y
2y 3y
3
2x

and
x

(t) = F(t, x) with

x(t) = x(t)
y(t)

, x(0) =

1
2

. The following
screen shot gives approximate solution using Runge-Kutta method,
Figure 9. Runge-Kuttas method for Rayleighs equation

we also plot the solution in xy-plane, which is called the velocity-


position phase plane, with y-axis represent the velocity and x-axis is the
4. NUMERICAL METHOD FOR SYSTEM OF EQUATIONS 15
position. The velocity-position plane shows that all velocity-position
solution pairs are eventually being attracted to an closed orbit, the
closed orbit is called the global attractor.
CHAPTER 1
Laplace Transform Methods
Laplace transform is a method frequently employed by engineers.
By applying the Laplace transform, one can change an ordinary dif-
ferential equation into an algebraic equation, as algebraic equation is
generally easier to deal with. Another advantage of Laplace transform
is in dealing the external force is either impulsive , (the force lasts a
very shot time period such as the bat hits a baseball) or the force is on
and o for some regular or irregular period of time.
1. The Laplace Transform
If f(t) is dened over interval [0, ), the Laplace transform of f,
denoted as

f(s), is
L(f) =

f(s) =
_

0
e
st
f(t) dt
Our rst theorem states when Laplace transform can be performed,
Theorem 1.1. If f(t) is (piecewise) continuous and there are pos-
itive numbers M, a such that
|f(t)| Me
at
for all t c Then

f(s) is dened for all s > c
The next result shows that Laplace transform is unique in the sense
that dierent continuous functions will have dierent Laplace trans-
form.
Theorem 1.2. If

f(s) = g(s) for all s > c, then f(t) = g(t) at all
t where both are continuous.
Notice if f(t) and g(t) are piecewise continuous (continuous except
at nite points where left and right limits exists,) their Laplace trans-
forms can be same for all s > c even if they are dierent at the isolated
discontinuous point. Since solutions of ordinary equations must be
continuous, so this is of no important concern.
1
2 1. LAPLACE TRANSFORM METHODS
Due the uniqueness, we can dene the inverse Laplace transform
L
1
as
L
1
(

f)(t) = f(t).
Theorem 1.3. If both

f(s) and g(s) exist for all s > c, then af(t)+
bg(t) has Laplace transform for all constant a and b and

af + bg(s) = a

f(s) + b g(s), for all s > c


So to nd Laplace transform of summation, we just need to nd
Laplace transform of each term.
The next result shows that Laplace transform changes derivative
into scalar multiplication, it is this property enable Laplace transform
to change ODE into algebraic equation.
Theorem 1.4. Suppose that the function f(t) is continuous and
piecewise smooth (f

(t) is piecewise continuous) for all t 0 and there


are constants M, a such that
|f(t)| Me
at
for t T,
Then

f

(s) is dened for all s > a and

(s) = s

f(s) f(0).
Now if nth derivative f
n
(t) is piecewise smooth, then

f
(n)
(s) = s
n

f(s) s
n1
f(0) s
n2
f

(0) f
(n1)
(0).
For example,
When n = 2

f
(2)
(s) = s
2

f(s) sf(0) f

(0).
When n = 3

f
(3)
(s) = s
3

f(s) s
2
f(0) sf

(0) f

(0).
When n = 4

f
(4)
(s) = s
4

f(s) s
3
f(0) s
2
f

(0) sf

(0) f
(3)
(0).
The following table list most commonly used functions, and
u
a
(t) = u(t a) =
_
0 if t < a
1 if t a
is the Heaviside function.
1. THE LAPLACE TRANSFORM 3
f = L
1
(

f)

f f = L
1
(

f)

f
1
1
s
(s > 0) t
1
s
2
(s > 0)
t
n
(n 0)
n!
s
n+1
(s > 0) t
a
(a > 1)
(a+1)
s
a+1
(s > 0)
e
at 1
sa
(s > 0) sin(kt)
k
s
2
+k
2
(s > 0)
cos(kt)
s
s
2
+k
2
(s > 0) sinh(kt)
k
s
2
k
2
(s > |k|)
cosh(kt)
s
s
2
k
2
(s > |k|) u(t a)
e
as
s
(s > 0)
Example 1.1. Find x(s) if x

+2x

3x = e
t
, x(0) = 1, x

(0) = 1.
Solution Apply Laplace transform on both side of the equation,
L(x

+ 2x

3x)(s) = L(e
t
)(s)
Using the linear property

af + bg(s) = a

f(s) + b g(s) we have


L(x

+ 2x

3x)(s) =

x

(s) + 2

(s) 3 x(s).
Together with

x

(s) = s
2
x(s) sx(0) x

(0) and

x

(s) = s x(s) x(0)


We have, due to x(0) = 1, x

(0) = 1,
L(x

+ 2x

3x)(s) =

x

(s) + 2

(s) 3 x(s)
= [s
2
x(s) sx(0) x

(0)] + 2[s x(s) x(0)] 3 x(s)


= (s
2
+ 2s 3) x(s) s 1
So we have an algebraic equation for x(s),
(s
2
+ 2s 3) x(s) s 1 =

e
t
(s) =
1
s 1
Solve this equation for x(s),
(s
2
+ 2s 3) x(s) s 1 =

e
t
(s) =
1
s1
(s
2
+ 2s 3) x(s) =
1
s1
+ s + 1
(s
2
+ 2s 3) x(s) =
1
s1
+
(s+1)(s1)
s1
(s
2
+ 2s 3) x(s) =
1+(s+1)(s1)
s1
(s
2
+ 2s 3) x(s) =
1+(s
2
1)
s1
(s
2
+ 2s 3) x(s) =
s
2
s1
4 1. LAPLACE TRANSFORM METHODS
we get
x(s) =
s
2
(s1)(s
2
+2s3)

2. Using Mathcad
Mathcad can help us in nd both Laplace transform and inverse
Laplace transform.
To use Mathcad to nd Laplace transform, we rst enter the expres-
sion of the function, then press [Shift][Ctrl][.], in the place holder type
the key word laplace followed by comma(,) and the variable name.
For example, to nd the Laplace of f(t) = t
2
sin(at), you rs enter the
expression t
2
sin(at) by typing,
t^2*sin(a*t),
then press [Shift][Ctrl][.], and entering keyword laplace followed by
comma(,) and t, you will get
t
2
sin(at)laplace, t
8as
2
(s
2
+ a
2
)
3

2a
(s
2
+ a
2
)
2
If you want a simplied result, you type comma(,) after entering
the variable name and keyword simplify, so the following input
t^2*sin(a*t)[Shift][Ctrl][.]laplace,t,simplify
will produce the result
t
2
sin(at)laplace, t, simplify
2a(a
2
3s
2
)
(s
2
+ a
2
)
3
Similarly, to use Mathcad to nd inverse Laplace transform, we rst
enter the expression, then press [Shift][Ctrl][.], in the place holder type
the key word invlaplace followed by comma(,) and the variable name.
For example, to nd the inverse Laplace of
8as
2
(s
2
+a
2
)
3
, you rs enter the
expression
8as
2
(s
2
+a
2
)
3
as,
8a*s^2/(s^2+a^2)^3,
then press [Shift][Ctrl][.], and entering keyword invlaplace followed by
comma(,) and s, and for simplifying the result, by another comma(,)
and keyword simplify, we get
8as
2
(s
2
+ a
2
)
3
invlaplace, s, simplify
1
a
2
_
sin(at)ta cos(at)+t
2
a
2
sin(at)
_
2. USING Mathcad 5
When using Mathcad together with Laplace transform to solve an
ODE
a
n
x
(n)
+ a
n1
x
(n1)
+ + a
1
x

+ a
0
x = f(t)
we follow these steps,
Step One: Apply Laplace to both sides of equation. Using
Mathcad to nd Laplace transform of f(t).
Step Two: Using the linear property and

f
(n)
(s) = s
n

f(s) s
n1
f(0) s
n2
f

(0) f
(n1)
(0).
to nd an algebraic equation for x(s),
Step Three: Solve the equation obtained in Step Two for
x(s) and using Mathcad to nd inverse transform which will
be the solution x(t).
Example 2.1. Find general solution to x

+ 2x

+ 3x = t
2
e
t
.
Solution Since we want to nd general solution, we set x(0) = a
and x

(0) = b
Step One Apply Laplace transform to both sides of the equa-
tion and nd Laplace transform for t
2
e
t
.
L(x

+ 2x

+ 3x)(s) = L(t
2
e
2
)(s)
Type,
t^2*e^t[Shift][Ctrl][.]laplace,t,simplify
we nd
L(t
2
e
2
)(s) =
2
(s 1)
3
Step Two: Using linear property to nd an equation for x(s).
L(x

+ 2x

+ 3x)(s) = (

+ 2

+ 3 x(s)
= s
2
x(s) sa b + 2(s x(s) a) + 3 x(s)
= (s
2
+ 2s + 3) x(s) sa b 2a
The equation for x(s) is
(s
2
+ 2s + 3) x(s) sa b 2a =
2
(s1)
3
Hence,
x(s) =
sa+b+2a
(s
2
+2s+3)
+
2
(s1)
3
(s
2
+2s+3)
Step Three: Using Mathcad to nd inverse Laplace trans-
form and x(t), we enter,
s*a+b+a/(s^2+2s+3)+2/(s-1)^3(s^2+2s+3)[Shift][Ctrl][.]laplace,s
6 1. LAPLACE TRANSFORM METHODS
and get
x(t) = ae
t
_

2
2
sin(

2t) + cos(

2t)
_
+ b

2
2
e
t
sin(

2t)
+e
t
_
1
3
t +
2
9
+
2
9
cos(

2t)
_
+

2
18
e
t
sin(

2t)

2.1. Solving System of equations. We can use Laplace trans-


form method to solve system of dierential equations. The procedure
is the same as solving a higher order ODE . But, after applying Laplace
transform to each equation, we get a system of linear equations whose
unknowns are the Laplace transform of the unknown functions. The
following example shows how we can use Laplace method with Mathcad
to solve system of dierential equations.
Example 2.2. Find solution to
x

= 3x 4y + t
2
y

= x + 5y + e
t
x(0) = 1, y(0) = 1
Solution
Step One: Apply Laplace transform to both sides of the equa-
tions and use Mathcad to nd Laplace transform of t
2
and e
t
,
L(x

) = L(3x 4y + t
2
)
L(y

) = L(x + 5y + e
t
)
and L(t
2
)(s) =
6
s
3
and L(e
t
)(s) =
1
s1
,
Step Two: Apply linear property to get a system of equations
for x(s) and y(s), due to L(x

) = s x(s) x(0) and L(y

) =
s y(s) y(0),
s x(s) 1 = 3 x(s) 4 y(s) +
6
s
3
s y + 1 = x(s) + 5 y(s) +
1
s1
from which we get
(s 3) x(s) + 4 y(s) = 1 +
6
s
3
x(s) + (s 5) y = 1 +
1
s1
Dene x(s) =
_
x(s)
y(s)
_
, A =
_
s 3 4
1 s 5
_
, and b(s) =
_
1 +
6
s
3
1 +
1
s1
_
, we have, in matrix form,
A x(s) = b(s)
3. THE PIECEWISE DEFINED FUNCTIONS 7
Step Three: Solve the algebraic equation and apply the in-
verse Laplace transform, using Mathcad we have
x(s) = A
-1
b(s) =
1
s
2
8s + 11
_
(s5)(s
3
+6)
s
3
4
2s
s1
(s3)(2s)
s1

s
3
+6
s
3
_
x(t) =
_
x(t)
y(t)
_
=
_

15
11
t
2

174
121
t
1062
1331
+ e
4t
_
3742
1331
cosh(

5t)
2334
6655
sinh(

5t)
_
e
t

3
11
t
2

48
121
t
318
1331
e
4t
_
695
2662
cosh(

5t) +
8143
1331
sinh(

5t)
_

1
2
e
t
_

3. The Piecewise dened Functions


When solving an ODE a
n
x
(n)
+a
n1
x
(n1)
+ +a
1
x

+a
0
x = f(t)
with multiple dened function f(t), we need to change f(t) into linear
combinations of step functions u
a
(t).
Here u
a
(t) = u(t a) =
_
0 if t < a
1 if t a
and
u(t) =
_
0 if t < 0
1 if t 0
is called Heaviside function or unit step function.
We have graphed some step functions,
Figure 1. Step Functions
8 1. LAPLACE TRANSFORM METHODS
In general, if b > a, u
a
(t) u
b
(t) =
_
_
_
0 if 0 < t < a
1 if a < t b
0 if t > b
To express a multiple dened function as linear combination of step
functions, we need, for each nite interval [a, b] on which f has a
dierent expression, multiply the expression by the dierence of step
functions u
a
(t) u
b
(t); for the expression dened on an innite interval
[c, ) we just multiply the expression by u
c
(t). f(t) is the summation
of all the products, as illustrated in the following examples,
Example 3.1. Express
f(t) =
_
_
_
t
2
t + 3 if 0 < t < 2
e
t
if 2 t < 5
2t sin(t) if t 5
as linear combination of step functions.
Solution Notice f(t) has three dierent expresses over interval
[0, 2), [2, 5) and [5, ), so we have two dierence, u(t) u
2
(t) and
u
2
(t) u
5
(t), and three products,
(t
2
t + 3)(u(t) u
2
(t)) for (t
2
t + 3) dened on [0,2);
e
t
(u
2
(t) u
5
(t)) for e
t
dened on [2, 5);
2t sin(t)u
5
(t) for 2t dened on [5, ).
f(t) is sum of these three products,
f(t) = (t
2
t + 3)(u(t) u
2
(t)) + e
t
(u
2
(t) u
5
(t)) + 2t sin(t)u
5
(t)
= (t
2
t + 3)u(t) + (e
t
t
2
+ t 3)u
2
(t) + (2t sin(t) e
t
)u
5
(t).

Example 3.2. Express


f(t) =
_
_
_
t
2
e
t
if 0 < t < 3
cos(t) if 3 t < 6
2t if t 6
as linear combination of step functions.
Solution Notice f(t) has three dierent expresses over interval
[0, 3), [3, 6) and [6, ), so we need to have two dierence, u(t) u
3
(t)
and u
3
(t) u
5
(t) and
f(t) = t
2
e
t
(u(t) u
3
(t)) + cos(t)(u
3
(t) u
6
(t)) + 2tu
6
(t)
= t
2
e
t
u(t) + (cos(t) t
2
e
t
)u
3
(t) + (2t cos(t))u
6
(t).

3. THE PIECEWISE DEFINED FUNCTIONS 9


3.1. Heaviside Function in Mathcad. You can get Heaviside
function from Insert>functions, click on all and the box of the func-
tion list, type heaviside, Click Ok, to insert the function.
Figure 2. Insert Heaviside Function
The step function is given by u
a
(t) = (t a). Hence the function
f(t) =
_
_
_
t
2
e

t
3
if 0 < t < 3
cos(t) if 3 t < 6
2t if t 6
can be dened in Mathcad as
f(t) = t
2
e

t
3
(t) + (cos(t) t
2
e

t
3
)(t 3) + (2t cos(t))(t 6).
The following graph shows this function in Mathcad and its graph,
10 1. LAPLACE TRANSFORM METHODS
3.2. Solve ODE With Piecewise Input Function.
Example 3.3. Find solution to x

+ 4x = f(t), x(0) = 0, x

(0) =
1, where f(t) =
_
cos(2t) if 0 t <
0 if t
Solution First we express f(t) as linear combination of step
function, f(t) = cos(2t)(u(t) u
2
(t)) Apply Laplace transform to
both sides of the equation and using Mathcad we get
(s
2
+ 4) x(s) = 1 + (1 e
s
)
s
s
2
+ 4
x(s) =
1
s
2
+ 4
+ (1 e
s
)
s
(s
2
+ 4)
2
Apply inverse Laplace transform, we get,
x(t) =
_

1
2
sin(2t) +
1
4
t sin(2t) if 0 t <
0 if
2
4
sin(2t)

The equation x

+4x = f(t) models a spring system that with one


spring, one end of the spring is xed and a object with 1 unit mass
attached at one end. The Hooks constant k = 4. f(t) is external force
applied to the system. In the Example 3.3, the force sin(2t) only applied
at rst unit of time (second). The following diagram compares the
solution of this equation with dierent input f(t).
4. DELTA FUNCTION 11
The graph contains solutions for the following three cases,
(1) No external force is applied(blue curve).
(2) Force of sin(2t) is applied at rst seconds and turno(red
curve).
(3) Force of sin(2t) is constantly applied (green curve).
The initial conguration is that the spring is at equilibrium position
x(0) = 0 and is compressed at 1 unit speed (feet/s) x

(0) = 1. From
the graph we can clearly see that when the force is turno at t = its
eect is immediately gone(as shown below)!
4. Delta Function
Delta function is one of so-called generalized functions, which are
not functions in ordinary sense but as an operators that sometimes can
be represented by ordinary functions.
Definition 4.1. The Dirac delta function at a,
a
(t), is an op-
erator that satises
_

0
g(t)
a
(t) dt = g(a)
for any continuous function g(t).
In Physics, if f(t), a t b is a force that acts only during a short
period of time interval [a, b], the impulse p of force f(t) is computed
as
_
b
a
f(t) dt.

a
(t) can be viewed as an instantaneous unit impulse that occurs pre-
cisely at the instant t = a. And p
a
(t) is an instantaneous p units
impulse that occurs precisely at the time t = a.

a
(t) is an important function used in modelling real phenomena,
for example,
12 1. LAPLACE TRANSFORM METHODS
In modelling the movement of a baseball after being hit by
bat.
In spring-mass system, where a object with given mass it at-
tached to one end of a spring whose other end is attached to
a steady object (such as wall), modelling the movement when
hits the object with a hammer.
Modelling the current in a closed circuit when the switch is
turn on and o instantly.
It turns out that we can stretch ourself a little and compute the
Laplace transform of
a
(t). Let (t) =
0
(t) then
a
(t) = (t a).
Theorem 4.1.

(s) = 1 and

a
(s) = e
as
.
Example 4.1. A mass m = 1 is attached to a spring with constant
k = 4; there is not dashpot. The mass is released from the rest with
x(0) = 3. At the instant t = the mass is struck with a hammer,
providing an impulse p = 8. Determine the motion of the mass.
Solution In general mx

+ kx = f(t) models the movement of


a mass attached to the end of spring with no dashpot. So we need to
solve
x

+ 4x = 8

(t), x(0) = 3, x

(0) = 0.
Applying Laplace transform to both sides of the equation,

(s) + 4 x(s) = 8

(s)
s
2
x sx(0) x

(0) + 4 x(s) = 8e
s
(s
2
+ 4) x(s) 3s = 8e
s
Solve for x(s), we get
x(s) =
3s
s
2
+ 4
+
8
s
2
+ 4
e
s
Using Mathcad , we can nd inverse Laplace transform,
x(t) = 2 cos(2t) + 4u

(t) sin(2t) =
_
2 cos(2t) if 0 t <
2 cos(2t) + 4 sin(2t) if t
So clearly the impact of the impulse is felt by the spring and change
the its movement immediately. The solution curve is shown below,

4. DELTA FUNCTION 13

You might also like