Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as pdf or txt
Download as pdf or txt
You are on page 1of 55

MA1512 Week 1

Lecture materials
1.1 Ordinary differential equations
Terminology 1.1. (1) A differential equation (DE ) is an equation that contains one or
more derivatives of a differentiable function.
(2) An ordinary differential equation (ODE ) is a DE in which the differentiable function
is of one variable only.
(3) The order of a DE is the order of the equation’s highest order derivative.
(4) A DE is linear if it can be put in the form

an y (n) (x) + an−1 y (n−1) (x) + · · · + a1 y (1) (x) + a0 y(x) = r,

where a0 , a1 , . . . , an , r are all functions of x.


Example 1.2. (1) y 0 = 5y and xy 0 − sin x = 0 are linear first-order ODEs.
(2) (y 000 )2 + (y 00 )5 − y 0 = ex is a non-linear third-order ODE.
Terminology 1.3. (1) A particular solution to a DE is a function that satisfies the DE.
(2) A general solution to a DE is a description of all the particular solutions to the DE.
Example 1.4. Consider the DE y 0 = cos x.
(1) A general solution to this DE is y = sin x + c, where c is an arbitrary constant.
(2) Some particular solutions to this DE are

y = sin x, y = sin x + 1, y = sin x + 2, ...

Remark 1.5. (1) DEs are solved using integration.


(2) A general solution to an nth-order DE involves n arbitrary constants.
(3) For this module, we may omit finitely many particular solutions that do not fit in with
a general solution.

1.2 Separable equations


Definition 1.6. A first-order DE is separable if it can be written in the form

N (y) y 0 = M (x),

where M, N are functions.

1
Strategy 1.7 (solving a separable DE).

(0) Write it in separable form N (y) y 0 = M (x).


(1) Integrate both sides wrt x to give
Z Z
N (y) dy = M (x) dx + c.

(2) Solve for y.

Example 1.8. Solve y 0 = (1 + y 2 ) ex .

Solution. y 0 = (1 + y 2 ) ex
1
⇔ y 0 = ex
1 + y2
Z Z
1
⇔ dy = ex dx
1 + y2
⇔ tan−1 y = ex + c for some constant c
x
⇔ y = tan(e + c) for some constant c.

Strategy 1.9 (solving a DE of the form y 0 = g(y/x)).


(1) Let v = y/x.
(2) Rearrange to y = vx.

(3) Differentiate both sides with respect to x using the product rule to give y 0 =
v + v 0 x.
(4) Substitute v = y/x and y 0 = v + v 0 x into the DE to get v + v 0 x = g(v).
(5) Rearrange into separable form
1 1
v0 = .
g(v) − v x

(6) Solve this separable equation for v.


(7) Substitute v = y/x into this solution to obtain a solution to the original DE.

Example 1.10. Solve 2xyy 0 − y 2 + x2 = 0.


Solution. Rewrite the DE as
y 2 − x2 (y/x)2 − 1
y0 = = . (∗)
2xy 2(y/x)

Let v = y/x. Then y = vx and so y 0 = v + v 0 x by the product rule. Substituting these

2
into (∗) gives

v2 − 1
v + v0 x =
2v
1 0 1
⇔ v 2 −1
v =
2v − v
x
2v 1
⇔ − 2 v0 =
v +1 x
⇔ − ln(v 2 + 1) = ln |x| + C
⇔ v 2 + 1 = A |1/x|

for some constants C, A with A > 0. Substituting in v = y/x gives

y2 1
+1=A·
x2 |x|
⇔ y 2 + x2 = A |x| .

Strategy 1.11 (solving a DE of the form y 0 = f (ax + by + c), where b 6= 0).


(1) Let u = ax + by + c.
(2) Differentiate with respect to x to get u0 = a + by 0 , so that y 0 = (u0 − a)/b.
u0 −a
(3) Substitute these into the DE to give b = f (u).
(4) Rearrange to get u0 = b f (u) + a and thus
1
u0 = 1.
b f (u) + a

(5) Solve this separable equation for u.

(6) Substitute u = ax + by + c into the result to obtain a solution to the original


DE.

Example 1.12. Solve (2x − 4y + 5)y 0 + x − 2y + 3 = 0.


Solution. Rewrite the DE as
(x − 2y) + 3
y0 = − .
2(x − 2y) + 5
Let u = x − 2y. Then u0 = 1 − 2y 0 , so that y 0 = −(u0 − 1)/2. Substituting these into the DE
gives
u0 − 1 u+3
− =−
2 2u + 5
1
⇔ u+3
 u0 = 1
−2 − 2u+5+1
 
2u + 5
⇔ u0 = 1.
4u + 11
 
1 1
⇔ 1− u0 = 1.
2 4u + 11
Integrating with respect to x gives
u ln |4u + 11|
− =x+d
2 8

3
for some constant d. Substituting in u = x − 2y gives
x − 2y ln |4(x − 2y) + 11|
− =x+d
2 8
⇔ 4x + 8y + ln |4x − 8y + 11| = k

for some constant k.

1.3 Linear first-order ODEs

Strategy 1.13 (solving a DE of the form y 0 + P (x) y = Q(x)).


R
P (x) dx
(1) Find the integrating factor R(x) = e .
(2) The solution is y = R1 QR dx.
R

Why Strategy 1.13 works (non-examinable). Note that


dR d R P (x) dx 
= e by the definition of R;
dx dx
Z
P (x) dx d
R 
=e P (x) dx by the Chain Rule;
dx
R
P (x) dx
=e P (x) by the Fundamental Theorem of Arithmetic;
= RP by the definition of R.

On the one hand,


d dR dy
(Ry) = y+R by the Product Rule;
dx dx dx
= RP y + Ry 0 by the calculations above.

On the other hand,


Z
d d  1 
(Ry) = R· QR dx by the definition of y;
dx dx R
Z
d  
= QR dx
dx
= QR by the Fundamental Theorem of Arithmetic.

Equating the two, we deduce that RP y + Ry 0 = QR. Dividing both sides by R gives
y 0 + P (x) y = Q(x), as required.
Example 1.14. Find a general solution to y 0 − y = e2x .
R
−dx
Solution. Note that e = e−x+C for some constant C. Let R(x) = e−x . Then
Z Z
1 2x −x x
y = −x e · e dx = e ex dx = ex (ex + D)
e
for some constant D.

Strategy 1.15 (solving a Bernoulli equation, i.e., a DE of the form


y 0 + p(x) y = q(x) y n , where 0 6= n 6= 1).
(1) Let z = y 1−n , so that z 0 = (1 − n)y −n y 0 .

4
(2) Rearrange the DE into (1 − n) y 0 y −n + (1 − n) p(x) y 1−n = (1 − n) q(x).
(3) Substitute in the expressions of z and z 0 above to get z 0 + (1 − n) p(x) z =
(1 − n) q(x).

(4) Solve this linear first-order ODE for z using an integrating factor.
(5) Substitute z = y 1−n into the result to obtain a solution to the original DE.

Example 1.16. Solve y 0 + y = x2 y 2 .


Solution. Let z = y 1−2 = y −1 , so that z 0 = −y −2 y 0 . Rearrange the DE into

−y 0 y −2 − y −1 = −x2 .
0 0 2
R in the expressions for z and z above gives z − z = −x .
Substituting
−dx −x+C −x
Note e =e where C is a constant. Let R(x) = e . Then
Z Z
1
y −1 = z = −x −x2 e−x dx = ex x2 e−x − e−x · 2x dx

e
Z
= x2 + 2ex xe−x − e−x dx = x2 + 2x − 2ex (−e−x + D) = x2 + 2x + 2 + Aex


where D, A are constants.

Video materials
Example 1.17 (radioactive decay). Experiments show that a radioactive substance decom-
poses at a rate proportional to the amount present.
Let m(t) denote the mass of the radioactive substance present at time t in mg. Then
dm
= −km,
dt
where k is a positive constant. So
1 dm
· = −k
mZ dt Z
dm
⇔ = −k dt
m
⇔ ln m = −kt + C as m > 0;
−kt+C −kt
⇔ m=e = Ae ,

where C, A are constants.


Suppose m0 denotes the amount of the substance present at time 0. Then Ae−k·0 = m0
and thus A = m0 . So m = m0 e−kt .
Example 1.18 (cooling). Experiments show that the rate of change of the temperature
T of an object is proportional to the difference between T and the temperature T0 of the
surrounding medium.
A copper ball is heated to 100 ◦C. At time t = 0, it is immersed in water that is maintained
at 30 ◦C. After 3 minutes, the temperature of the ball is reduced to 70 ◦C. Find the time at
which the temperature of the ball is 31 ◦C.
We know T (0) = 100 and T (3) = 70 and T0 = 30 and
dT
= −k(T − T0 ) = −k(T − 30),
dt

5
where k is a positive constant. Hence
1 dT
· = −k
TZ− 30 dt Z
dT
⇔ = −k dt
T − 30
⇔ ln(T − 30) = −kt + C as T > 30
−kt
⇔ T = Ae + 30,

where C, A are constants. Substituting this into T (0) = 100 and T (3) = 70 gives

Ae−k·0 + 30 = 100and Ae−k·3 + 30 = 70


1 A 1 7
∴ A = 100 − 30 = 70 and k = ln = ln .
3 40 3 4
1 7
So T = 70e− 3 ln( 4 ) t + 30 and the time at which the temperature is 31 ◦C is
70
3 ln 31−30
= 22.7754 . . . minutes
ln 74

after the ball is immersed in water.


Example 1.19 (mixing). A tank contains 20 g of salt dissolved in 100 L of water at time
t = 0. Water containing 0.25 g of salt per litre is entering the tank at a rate of 3 L/min, and
the well stirred solution is leaving the tank at the same rate. Find the amount of salt N (t)
in the tank at any time t. Here N (t) is in g and t is in min.
Now N (0) = 20, and since the rate of change of the amount of salt in the tank equals the
inflow minus the outflow,
dN 3
= 3 × 0.25 − N
dt 100
dN
⇔ + 0.03 × N = 0.75.
dt
R
0.03 dt
Note e = e0.03 t+C , where C is a constant. Using the integrating factor e0.03 t ,

1
Z  e0.03 t 
N = 0.03 t e0.03 t × 0.75 dt = e−0.03 t × 0.75 + D = 25 + Ae−0.03 t ,
e 0.03
where D, A are constants. Substituting this into N (0) = 20 gives A = 20 − 25 = −5. So

N = 25 − 5e−0.03 t .

Example 1.20 (Uranium–Thorium Dating). In Example 1.17, we saw that radioactive sub-
stances typically decay at a rate proportional to the amount present. Sometimes the product
of a radioactive decay is itself a radioactive substance which in turn decays (at a different
rate). An interesting example of this is provided by Uranium–Thorium Dating, which is
a method used by palaeontologists to determine how old certain fossils (especially ancient
corals) are. Corals filter the sea-water in which they live. Sea-water contains a tiny amount
of a certain kind of uranium-234 and the corals absorb this into their bodies. Uranium-234
decays, with a half-life of 245000 years, into thorium-230, which itself decays with a half-life
of 75000 years. Thorium-230 is not found in sea-water; so when the coral dies, it has a
certain amount of uranium-234 in it but virtually no thorium-23, because the lifetime of a
coral polyp is negligible compared with 245000 years. It is possible to measure the ratio of
the amounts of uranium-234 and thorium-230 in any given sample. From this ratio we want
to work out the age of the sample, i.e., the time when it died. This is important if we want
to know whether global warming is causing corals to die now.

6
Let U (t) be the number of atoms of uranium-234 in a particular sample of ancient coral
and let T (t) be the number of atoms of thorium-230. Since each decay of one uranium-234
atom produces one thorium-230 atom, thorium-230 atoms are being born at exactly the same
rate at which uranium-234 atoms die. So we have
dU
= −kU U , (†)
dt
dT
= kU U − kT T, (‡)
dt
where kU , kT are constants (related to the half-lives) with kU 6= kT , and U (0) = U0 , T (0) = 0.
We want to find the age of the coral given the current values of T and U .
Start with (†). As in Example 1.17,
1 dU
· = −kU
ZU dt Z
1
⇔ dU = −kU dt
U
⇔ ln(U ) = −kU t + C
⇔ U = Ae−kU t ,

where C, A are constants with A > 0. Substituting this into U (0) = U0 gives A = U0 . So

U = U0 e−kU t . (§)

Substituting this into (‡) gives


dT
+ kT T = kU U0 e−kU t .
dt
R
kT dt
Note e = ekT t+D , where D is a constant. Using the integrating factor ekT t , we have

kU U0  e(kT −kU )t
Z Z
1 −kU t kU U0 
T = kT t e kT t
· kU U0 e dt = kT t e(kT −kU )t dt = kT t +E ,
e e e kT − kU
where E is a constant. Substituting this into T (0) = 0 gives E = −1/(kT − kU ). So

kU U0  e(kT −kU )t 1  kU U0
e−kU t − e−kT t .

T = − = (¶)
ek T t kT − kU kT − kU kT − kU
Dividing (¶) by (§) gives
T kU U0 1 kU
e−kU t − e−kT t · 1 − e(kU −kT )t .
 
= =
U kT − kU U0 e−kU t kT − kU
So now if we measure the ratio T /U at the present time, we can solve this for t and we have
our answer.

Summary
Strategy 1.7 (solving a separable DE). (0) Write it in separable form N (y) y 0 = M (x).
(1) Integrate both sides wrt x to give
Z Z
N (y) dy = M (x) dx + c.

(2) Solve for y.

7
Reduction to separable form. • y 0 = g(y/x) → let v = y/x. (Strategy 1.9)
• y 0 = f (ax + by + c), where b 6= 0 → let u = ax + by + c. (Strategy 1.11)
0
Strategy 1.13 (solving a DE of the form y + P (x) y = Q(x)).
R
P (x) dx
(1) Find the integrating factor R(x) = e .
(2) The solution is y = R1 QR dx.
R

Strategy 1.15 (solving a Bernoulli equation, i.e., a DE of the form y 0 + p(x) y = q(x) y n ,
where 0 6= n 6= 1). Let z = y 1−n .

Matlab materials
1.4 Matlab installation
The National University of Singapore has a Total Academic Headcount licence for Matlab.
Students may use it for academic, research, and learning. The license allows students to
install Matlab on personally-owned computers.
(1) If you are not using NUS network, you are required to use nVPN:

https://webvpn.nus.edu.sg/

and sign in with your NUSNET ID in the format nusstu\nusnetid and password.
If you are using NUS network, proceed directly to Step 2.
(2) Go to https://sm05.stf.nus.edu.sg/studentmatlab/ to download Matlab. You
need to sign in with your NUSNET ID in the format nusstu\nusnetid and password.
Then follow the instructions.
(3) Follow the instructions in Section 1.5 to create a MathWorks account.
(4) If you are not logged in to MathWorks yet, then do so at https://www.mathworks.
com/login. When you are logged in, click “Download”, then choose “R2020b” and
your operating system. After the download finishes, run the installer.
(a) When prompted, log in with your MathWorks Account (your NUS e-mail address).
(b) Select your licence (40707750, Student, Academic—Total Headcount).
(c) Choose installation folder.
(d) Select products to install.

1.5 MathWorks account creation


(1) Go to https://www.mathworks.com/mwaccount/register:
Email Address: Your NUS e-mail address
(e.g., e0012345@u.nus.edu)
Location: Singapore
How will you use MathWorks software? Student
Are you at least 13 years or older? Yes

(2) You will receive an e-mail from service@mathworks.com with title “Verify Email Ad-
dress”. Click the link in the e-mail to verify your account.
(3) Finish creating the profile. Then you should be able to see the following information:
Your account has been created and license 40707750 has been associated with
your account.

8
1.6 Basic Matlab operation
1.6.1 Arithmetic and standard mathematical functions
In its most elementary use, Matlab is an extremely powerful calculator. For example, type
>> (50^2 - 4*10)/3 + 61
Here the symbol ^ stands for exponentiation, i.e., the expression we were evaluating was
actually (502 − 4 × 10) ÷ 3 + 61.
There is a list of mathematical functions that are built into Matlab, for example:
abs(x) returns the absolute valuep |x| of x;
sqrt(x) returns the square root x of x;
exp(x) returns the exponential ex of x;
log(x) returns the natural logarithm ln x of x;
log10(x) returns the base-10 logarithm log10 x of x;
sin(x) returns the sine sin x of x;
asin(x) returns the inverse sine sin−1 x of x.
The following functions are also included in the list:
cos(x), tan(x), csc(x), sec(x), cot(x),
acos(x), atan(x), acsc(x), asec(x), acot(x),
sinh(x), cosh(x), tanh(x), csch(x), sech(x), coth(x),
asinh(x), acosh(x), atanh(x), acsch(x), asech(x), acoth(x).
Use the following command to see the list of elementary functions supported by Matlab:
>> help elfun
All of these functions can be combined to give complicated expressions. For example,
>> sinh(1)*exp(sqrt(2))+1
Matlab also contains the standard
√ constant π and is able to compute in complex numbers,
using i (as well as j) to denote −1. Try the following:
>> sqrt(-1)
>> sqrt(-3)
>> i^2
>> 16/(8i)
>> pi
>> exp(2*pi*i)

1.6.2 Expressions and variables


In general, Matlab commands are entered as statements in the following form:

variable = expression

which assigns the result of expression to variable. For example,


>> x = sinh(1)*exp(sqrt(2))+1
Note that if you did not assign a variable for your expression the result of expression
is assigned to a special variable called ans (which stands for answer ). In your Matlab
program, you should see a window named Workspace. (Otherwise go to the Home tab →
Environment section → Layout button → Default.) Whenever a new variable is assigned,
it will appear here. Double clicking the variable will reveal its current value. You can also
change the value in this window called Array Editor.
Do the following series of commands and observe what happens to the variables.

9
>> x = 1 + 10
>> x
>> x + 2
>> ans
>> y = ans + 3

1.6.3 Useful tips


• You can use the up arrow key to recall previously typed commands
• clc will clear your command window

• clear will clear all previously assigned variables. You can clear variables individually
by typing “clear variable”.
• Typing the statement “help topic” will give information and usage about the specified
topic. Try typing “help clc” or “help i”.

1.6.4 Precision
All numeric computations in Matlab are performed with about 16 decimal digits of precision.
The format of the displayed output can be controlled by the following commands:
format short fixed point, 4 decimal places, default setting
format long fixed point, 15 decimal places (for double values)
format shortE scientific notation, 4 decimal places
format longE scientific notation, 15 decimal places (for double values)
format rat approximate fractions
Type the following:
>> format shortE
>> 235.556
>> format long
>> pi
>> format short
>> pi

1.6.5 Plotting graphs in Matlab


Suppose we want to plot the graph of y = sin2 (x). The most straightforward way is to pick
several x-values x1 = 0, x2 = 1, etc., plot the points xi , sin2 (xi ) , and join these points.


It is clear that this method will only work well when we choose a large number of points
which are close together. Matlab allows us to very efficiently replicate this process. Type
the following:

>> x = 0 : 0.2 : 1;
>> y = sin(x).*sin(x);
>> plot(x,y)
We get

10
0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
0 0.2 0.4 0.6 0.8 1

This does not look like the graph that we want because we used a bad choice of points. Type
the following:
>> x = 0 : 0.01 : 6.28;
>> y = sin(x).*sin(x);
>> plot(x,y)
We get
1

0.8

0.6

0.4

0.2

0
0 1 2 3 4 5 6

This graph looks much better because we used 629 points to plot our graph. Let us dissect
these commands line by line.
(1) The first line was

>> x = 0 : 0.01 : 6.28;

Here we are declaring x as an array (or a row vector) containing the numbers from 0
to 6.28, in increments of 0.01. So x contains 629 values. Notice that the size of x in the
Workspace window now says 1 × 629. Double-click on x to see all the individual values.
The semicolon “;” asks Matlab to execute the command but suppresses the output.
Type the same line again, this time without the semicolon and see what happens.
You can also work with individual elements in your array. For example,

11
>> x(10) * 2

will get the value of the 10th element of your array x and multiply it by 2.
(2) The second line was

>> y = sin(x).*sin(x);

This command computes sin(x) × sin(x) and saves the answer into an array y. Notice
that we used .* instead of the usual * to denote array multiplication, i.e., multiplying
629 values to 629 values. The “.” reminds Matlab to do the right thing and operate
element by element in order. Other examples are:

>> z = 2 + x.*exp(-x.^2);

Pay attention to where we need to add the “.” and note that mathematical functions
like sin(x) are smart enough to compute element by element.

(3) The third line

>> plot(x,y)

simply plots the graph of y against x.

Matlab can also plot graphs via the fplot command using ‘anonymous function handles’
as in
>> f = @(x) sin(x).*sin(x);
>> fplot(f,[0,2*pi])

or using ‘symbolic expressions’ as in


>> syms x
>> fplot(sin(x)*sin(x),[0,2*pi])

12
MA1512 Week 2

Lecture materials
2.1 Linear second-order ODEs
Definition 2.1. A linear second-order ODE

y 00 + p(x) y 0 + q(x) y = r(x)

is said to be homogeneous if r(x) ≡ 0; otherwise, it is said to be non-homogeneous.


Example 2.2. (1) y 00 + 4y = e−x sin x is a non-homogeneous linear second-order ODE.
(2) (1 − x2 )y 00 − 2xy 0 + 6y = 0 can be rewritten in the standard form of a homogeneous
linear second-order ODE as
2x 6
y 00 − 2
y0 + y = 0.
1−x 1 − x2
p
(3) x y 00 y + (y 0 )2 + 2y 0 y = 0 and y 00 = 1 + (y 0 )2 are nonlinear second-order ODEs.


2.1.1 Homogeneous linear ODEs


Theorem 2.3. Let y1 , y2 be solutions to a homogeneous linear second-order ODE. Then
c1 y1 + c2 y2 is again a solution to the same ODE, whenever c1 , c2 are constants.
Definition 2.4. Two functions y1 , y2 are said to be linearly dependent if y1 ≡ 0 or y2 ≡ 0
or y2 = cy1 for some constant c; otherwise they are said to be linearly independent.
Fact 2.5. Let y1 , y2 be linearly independent solutions to a homogeneous linear second-order
ODE. Then a general solution to this ODE is y = c1 y1 + c2 y2 , where c1 , c2 are arbitrary
constants.
Example 2.6. y1 = cos x and y2 = sin x are linearly independent solutions to y 00 + y = 0.
So a general solution to this DE is y = c1 cos x + c2 sin x, where c1 , c2 are arbitrary constants.
Definition 2.7. Let a, b be constants. Then the characteristic equation of the DE

y 00 + ay 0 + by = r(x)

is λ2 + aλ + b = 0.

Strategy 2.8 (solving a DE of the form y 00 + ay 0 + by = 0, where a, b are constants).


Case 1: a2 − 4b > 0. A general solution is y = c1 eλ1 x + c2 eλ2 x , where λ1 , λ2 are the
roots of the characteristic equation of the DE, and c1 , c2 are constants.
Case 2: a2 − 4b = 0. A general solution is y = (c1 + c2 x)e−ax/2 , where c1 , c2 are

13
constants. (Note that −a/2 is the (double) root of the characteristic equation
of the DE.)
2
Case 3: ap − 4b < 0. A general solution is y = e−ax/2 (c1 cos(wx)+c2 sin(wx)), where
w = b − a2 /4 and c1 , c2 are constants. (Note that the solutions to the char-
acteristic equation of the DE are (−a/2) ± iw.)

Why Strategy 2.8 works (non-examinable). As an example, consider Case 2. Suppose


a2 −4b = 0. Using this and the fact that −a/2 is a root of the characteristic equation, one can
directly verify that y = e−ax/2 and y = xe−ax/2 are linearly independent particular solution
to the DE. So y = c1 e−ax/2 + c2 xe−ax/2 , where c1 , c2 are arbitrary constants, is a general
solution to the DE by Fact 2.5.

Example 2.9. Solve y 00 + y 0 − 2y = 0.


Solution. We are in Case 1 because 12 − 4(−2) = 9 > 0. Now
√ √
−1 + 9 −1 − 9
λ1 = = 1 and λ2 = = −2.
2 2
So a general solution is y = c1 ex + c2 e−2x , where c1 , c2 are constants.
Example 2.10. Solve y 00 + 8y 0 + 16y = 0.

Solution. We are in Case 2 because 82 −4×16 = 0. So a general solution is y = (c1 +c2 x)e−4x ,
where c1 , c2 are constants.
Example 2.11. Solve y 00 + 2y 0 + 5y = 0.
p
Solution. We are in Case 3 because 22 − 4 × 5 = −16 < 0. Now w = 5 − 22 /4 = 2. So a
general solution is y = e−x (c1 cos(2x) + c2 sin(2x)), where c1 , c2 are constants.

2.1.2 Nonhomogeneous linear ODEs


Fact 2.12. A general solution to the nonhomogeneous linear second-order ODE

y 00 + p(x) y 0 + q(x) y = r(x). (∗)

is y = c1 y1 + c2 y2 + yp , where
• c1 , c2 are arbitrary constants;
• y1 , y2 are linearly independent solutions to the homogeneous DE

y 00 + p(x) y 0 + q(x) y = 0

corresponding to (∗); and


• yp is a particular solution to (∗).

Remark 2.13. In view of Fact 2.5, another way to write the general solution to (∗)
given by Fact 2.12 is
y = yh + yp ,
where yh is a general solution to the homogeneous DE corresponding to (∗).

14
Theorem 2.14 (Superposition Principle). Let c1 , c2 be constants and y1 , y2 be particular
solutions to the DEs
y 00 + p(x) y 0 + q(x) y = r1 (x) and y 00 + p(x) y 0 + q(x) y = r2 (x)
respectively. Then y = c1 y1 + c2 y2 is a particular solution to the DE
y 00 + p(x) y 0 + q(x) y = c1 r1 (x) + c2 r2 (x).
Proof (non-examinable). If y = c1 y1 + c2 y2 , then
y 00 + p(x) y 0 + q(x) y
= (c1 y1 + c2 y2 )00 + p(x) (c1 y1 + c2 y2 )0 + q(x) (c1 y1 + c2 y2 )
= c1 (y100 + p(x) y10 + q(x) y1 ) + c2 (y200 + p(x) y20 + q(x) y2 ) by the linearity of differentiation;
= c1 r1 (x) + c2 r2 (x) by the choice of y1 , y2 .
Strategy 2.15 (Method of Undetermined Coefficients, polynomial case). Given the DE
y 00 + ay 0 + by = p(x),
where p(x) is a polynomial of degree n and a, b are constants, try

 u(x),
 if 0 is not a root of the characteristic equation of the DE;
y = x u(x), if 0 is a simple root of the characteristic equation of the DE;

 2
x u(x), if 0 is a double root of the characteristic equation of the DE,
where u(x) is a polynomial of degree n with undetermined coefficients.
Example 2.16. Find a particular solution to y 00 − 4y 0 + y = x2 + x + 2.
Solution. Note that 0 is not a root of the characteristic equation λ2 − 4λ + 1 = 0. So try
y = Ax2 + Bx + C. Then y 0 = 2Ax + B and y 00 = 2A. Substituting into the DE gives
2A − 4(2Ax + B) + (Ax2 + Bx + C) = x2 + x + 2.
Equating coefficients gives A = 1 and −8A + B = 1 and 2A − 4B + C = 2. Solving this
system of equations gives A = 1 and B = 9 and C = 36. Substituting these back into
y = Ax2 + Bx + C gives the particular solution y = x2 + 9x + 36 to the DE.
Strategy 2.17 (Method of Undetermined Coefficients, exponential case). Given the DE
y 00 + ay 0 + by = p(x) ekx ,
where p(x) is a polynomial of degree n and a, b, k are constants, try

kx
 u(x) e ,
 if k is not a root of the characteristic equation of the DE;
kx
y = x u(x) e , if k is a simple root of the characteristic equation of the DE;

 2
x u(x) ekx , if k is a double root of the characteristic equation of the DE,
where u(x) is a polynomial of degree n with undetermined coefficients.
Example 2.18. Find a particular solution to y 00 − 4y 0 + 4y = 20x3 e2x .
Solution. Note that 2 is a double root of the characteristic equation λ2 − 4λ + 4 = 0. So try
y = x2 ue2x , where u = Ax3 + Bx2 + Cx + D. Then
y 0 = (x2 u)0 e2x + 2(x2 u)e2x and y 00 = (x2 u)00 e2x + 4(x2 u)0 e2x + 4(x2 u)e2x .
Substituting into the DE gives (x2 u)00 e2x = 20x3 e2x . Note
(x2 u)00 = (Ax5 + Bx4 + Cx3 + Dx2 )00 = (5Ax4 + 4Bx3 + 3Cx2 + 2Dx)0
= 20Ax3 + 12Bx2 + 6Cx + 2D.
Equating coefficients gives A = 1 and B = C = D = 0. So a particular solution to the DE is
y = x2 x3 e2x = x5 e2x .

15
Strategy 2.19 (Method of Undetermined Coefficients, special exponential case). Given the
DE
y 00 + ay 0 + by = cxn ekx ,
where n is a non-negative integer and a, b, c, k are constants with c 6= 0 6= k, if k is a double
root of the characteristic equation of the DE, then try

y = Axn+2 ekx ,

where A is an undetermined coefficient.

Fact 2.20 (Euler’s formula). ex+iy = ex (cos y + i sin y) for all real numbers x, y.

Strategy 2.21 (Method of Undetermined Coefficients, sine case). Given the DE

y 00 + ay 0 + by = p(x) e`x sin(mx),

where p(x) is a polynomial and a, b, `, m are constants,


(1) use the exponential case to find a particular solution z to the complex DE

z 00 + az 0 + bz = p(x) e(`+im)x ;

(2) then y = Im(z) is a particular solution to the original DE.


Example 2.22. Find a particular solution to y 00 + 4y = 16x sin(2x).

Solution. Consider the complex DE z 00 + 4z = 16xei2x . Note that 2i is a (simple) root of the
characteristic equation λ2 + 4 = 0. So try z = xuei2x , where u = Ax + B. Then

z 0 = (xu)0 ei2x + 2i(xu)ei2x and z 00 = (xu)00 ei2x + 4i(xu)0 ei2x − 4(xu)ei2x .

Substituting into the complex DE gives (xu)00 ei2x + 4i(xu)0 ei2x = 16xei2x . Since xu =
Ax2 + Bx, we have
(xu)0 = 2Ax + B and (xu)00 = 2A.
Equating coefficients gives 8iA = 16 and 2A + 4iB = 0. So A = −2i and B = 1. Hence

z = x(−2ix + 1)ei2x = (−2ix2 + x)(cos(2x) + i sin(2x)).

A particular solution to the original DE is y = Im(z) = −2x2 cos(2x) + x sin(2x).


Strategy 2.23 (Method of Undetermined Coefficients, cosine case). Given the DE

y 00 + ay 0 + by = p(x) e`x cos(mx),

where p(x) is a polynomial and a, b, `, m are constants,


(1) use the exponential case to find a particular solution z to the complex DE

z 00 + az 0 + bz = p(x) e(`+im)x ;

(2) then y = Re(z) is a particular solution to the original DE.

Strategy 2.24 (Method of Undetermined Coefficients, all cases). Let p(x) be a poly-

16
nomial of degree n. Consider the DE

 p(x)
 (polynomial case)
 p(x) ekx

(exponential case)
y 00 + ay 0 + by = `x
 p(x) e cos(mx) (cosine case)


p(x) e`x sin(mx) (sine case)

where a, b, k, `, m are constants. Denote by (♦) the characteristic equation λ2 + aλ +


b = 0.

polynomial cosine sine


case exponential
Set k = 0. Set k = ` + im.
Consider z 00 + az 0 + bz = p(x) e(`+im)x .
k is not a
Try y = u. Try y = uekx . Try z = ue(`+im)x .
root of (♦)
Take y = Re(z). Take y = Im(z).
Consider z 00 + az 0 + bz = p(x) e(`+im)x .
k is a simple
Try y = xu. Try y = xuekx . Try z = xue(`+im)x .
root of (♦)
Take y = Re(z). Take y = Im(z).
Consider z 00 + az 0 + bz = p(x) e(`+im)x .
k is a double
Try y = x2 u. Try y = x2 uekx . Try z = x2 ue(`+im)x .
root of (♦)
Take y = Re(z). Take y = Im(z).

Here u(x) is a polynomial of degree n with undetermined coefficients.

Video materials

Strategy 2.25 (Method of Variation of Parameters). Given the DE

y 00 + p(x) y 0 + q(x) y = r(x),

(1) find linearly independent solutions y1 , y2 to the corresponding homogeneous DE

y 00 + p(x) y 0 + q(x) y = 0;

(2) then a particular solution is y = uy1 + vy2 , where


Z Z
y2 r y1 r
u=− dx and v = dx.
y1 y20 − y10 y2 y1 y20 − y10 y2

Example 2.26. Find a particular solution to y 00 + y = tan x.


Solution. Recall from Example 2.6 that y1 = cos x and y2 sin x are linearly independent
solutions to the corresponding homogeneous DE y 00 + y = 0. With these choices of y1 and y2 ,
y1 y20 − y10 y2 = (cos x)(cos x) − (− sin x)(sin x) = 1.

sin2 x cos2 (x) − 1


Z Z Z
Let u = − sin(x) tan(x) dx = − dx = dx
cos x cos x
Z

= cos(x) − sec(x) dx = sin(x) − ln |sec(x) + tan(x)| + C and
Z Z
v = cos(x) tan(x) dx = sin x dx = − cos x + D,

17
where C, D are constants. Choosing C = D = 0 gives the particular solution

y = uy1 + vy2 = sin(x) − ln |sec(x) + tan(x)| (cos x) + (− cos x)(sin x)
= − cos(x) ln |sec(x) + tan(x)| .

Observation 2.27. Let x be function of t. Then


d  ẋ2  dẋ dx dẋ dẋ
= ẋ = · = = ẍ.
dx 2 dx dt dx dt

Strategy 2.28 (solving a DE of the form ẍ = f (x) for ẋ > 0).


d ẋ2 d ẋ2
   
(1) Substitute ẍ = into the DE to get = f (x).
dx 2 dx 2
(2) Integrate both sides with respect to x to get ẋ2 /2 = F (x) + E, where F (x) is
an antiderivative of f (x) with respect to x, and E is a constant.
(3) Proceed to solve for x if needed.

Example 2.29 (energy conservation). Consider the DE mẍ = −kx, where m, k are con-
stants. By Observation 2.27, the DE can be rewritten as

d ẋ2
 
k
= − x.
dx 2 m

Integrating both sides with respect to x gives

ẋ2
Z
k
= −
x dx
2 m
k x2
=− · +E
m 2
1 1
⇔ mẋ2 + kx2 = E,
2 2
where E is a constant.

Summary
Strategy 2.8 (solving a DE of the form y 00 + ay 0 + by = 0, where a, b are constants).

Case 1: a2 − 4b > 0. A general solution is y = c1 eλ1 x + c2 eλ2 x , where λ1 , λ2 are the roots
of the characteristic equation of the DE, and c1 , c2 are constants.
Case 2: a2 − 4b = 0. A general solution is y = (c1 + c2 x)e−ax/2 , where c1 , c2 are constants.
(Note that −a/2 is the (double) root of the characteristic equation of the DE.)
Case p3: a2 − 4b < 0. A general solution is y = e−ax/2 (c1 cos(wx) + c2 sin(wx)), where w =
b − a2 /4 and c1 , c2 are constants. (Note that the solutions to the characteristic
equation of the DE are (−a/2) ± iw.)
Fact 2.12 (formulated informally). A general solution to the nonhomogeneous linear
second-order ODE
y 00 + p(x) y 0 + q(x) y = r(x).
is
y = (general solution to y 00 + p(x) y 0 + q(x) y = 0) + (any particular solution).

18
Strategy 2.24 (Method of Undetermined Coefficients). Let p(x) be a polynomial of
degree n. Consider the DE


 p(x) (polynomial case)
 p(x) ekx

(exponential case)
y 00 + ay 0 + by = `x


 p(x) e cos(mx) (cosine case)
`x
p(x) e sin(mx) (sine case)

where a, b, k, `, m are constants. Denote by (♦) the characteristic equation λ2 + aλ + b = 0.


polynomial cosine sine
case exponential
Set k = 0. Set k = ` + im.
Consider z 00 + az 0 + bz = p(x) e(`+im)x .
k is not a kx
root of (♦)
Try y = u. Try y = ue . Try z = ue(`+im)x .
Take y = Re(z). Take y = Im(z).
Consider z 00 + az 0 + bz = p(x) e(`+im)x .
k is a simple
Try y = xu. Try y = xuekx . Try z = xue(`+im)x .
root of (♦)
Take y = Re(z). Take y = Im(z).
00 0
Consider z + az + bz = p(x) e(`+im)x .
k is a double
Try y = x2 u. Try y = x2 uekx . Try z = x2 ue(`+im)x .
root of (♦)
Take y = Re(z). Take y = Im(z).

Here u(x) is a polynomial of degree n with undetermined coefficients.


Strategy 2.25 (Method of Variation of Parameters). Given the DE

y 00 + p(x) y 0 + q(x) y = r(x),

(1) find linearly independent solutions y1 , y2 to the corresponding homogeneous DE

y 00 + p(x) y 0 + q(x) y = 0;

(2) then a particular solution is y = uy1 + vy2 , where


Z Z
y2 r y1 r
u=− 0 0 dx and v = dx.
y1 y2 − y1 y2 y1 y2 − y10 y2
0

Strategy 2.28 (solving a DE of the form ẍ = f (x) for ẋ > 0 via energy conservation).
d ẋ2 d ẋ2
   
(1) Substitute ẍ = into the DE to get = f (x).
dx 2 dx 2
(2) Integrate both sides with respect to x to get ẋ2 /2 = F (x) + D, where F (x) is an
antiderivative of f (x) with respect to x, and D is a constant.
(3) Proceed to solve for x if needed.

Matlab materials
Suppose we want to plot several graphs on the same diagram, we can use the command
hold on to superimpose any new graphs on the current one. The command hold off turns
off this feature, i.e., any new plot will overwrite the current graph.
Several other commands are available for enhancing your plots. For example, you can use
the following commands to label the x- and the y-axis and to title your graph.

19
>> xlabel(’t’)
>> ylabel(’y’)
>> title(’Graph of y = t^2’)
You can also use the command
>> axis([xmin xmax ymin ymax])
to set the maximum and minimum values of your x- and your y-axis. Lastly, use
>> plot(x,y,’b’)
to plot in blue. In place of “b”, use “g” for green, “r” for red, “y” for yellow, and “k” for
black. For black-and-white plots, we can use
>> plot(x,y,’-’); plot(x,y,’-.’); plot(x,y,’--’)
for solid lines, dash-dotted lines and dashed lines respectively. More options can be found
with help plot.
Example 2.30. A forced (undamped) harmonic oscillator has a beat if the natural frequency
is close to the forcing frequency. An example of such a solution is
   
t 23t
x(t) = 2 sin sin .
2 2
We can graph this solution as follows:
>> t = linspace(0,4*pi,1000);
>> x = 2*sin(t/2).*sin(23*t/2);
>> plot(t,x)
>> xlabel(’t’)
>> ylabel(’x(t)’)
>> title(’Beats’)
>> axis([0 4*pi -2 2])
>> hold on
>> y = 2*sin(t/2);
>> plot(t,y,’r--’)
>> hold off
Here the linspace command produces 1000 equally spaced points between 0 and 4π.
Beats
2

1.5

0.5
x(t)

-0.5

-1

-1.5

-2
0 2 4 6 8 10 12
t

20
MA1512 Week 3

Lecture materials
3.1 Oscillation
Convention 3.1. Unless otherwise stated, all inputs to trigonometric functions are in radi-
ans.
Notation 3.2. Dots above a function denote derivatives with respect to time, e.g.,

dx d2 x
ẋ = , ẍ = , ....
dt dt2
Terminology 3.3. (1) Let x = A cos(γt) + B sin(γt) + C, where A, B, C, γ are constants.
Then the angular frequency of x is γ.
(2) Let x = A cos(γt) or x = A sin(γt), where A, γ are constants and A > 0. Then the
amplitude of x is A.
Fact 3.4. Let x = A cos(γt) + B sin(γt) + C, where A, B, C, γ are constants. Then the period
of x, i.e., the smallest T > 0 such that x(t + T ) = x(t) for all t, is 2π/γ.

Newton’s Second Law. Let F~ be the net force applied to a body, m be the mass of the
body, and ~a be the body’s acceleration. Then

F~ = m~a.

spring motor
−kx F0 cos(αt)

α>0
mass
m
spring constant k > 0

x
natural position

Figure 3.1: An object attached to a spring horizontally

Situation 3.5. Consider the situation depicted in Figure 3.1. By Newton’s Second Law,

−kx + F0 cos(αt) = mẍ


⇔ mẍ + kx = F0 cos(αt).

21

A= C 2 + D2 D
δ
C

Figure 3.2: Combining sine and cosine

3.1.1 When F0 = 0
The corresponding homogeneous DE is

mẍ + kx = 0
k
⇔ ẍ + ω 2 x = ẍ + x = 0,
m
p
where ω = k/m. Note x1 = cos(ωt) and x2 = sin(ωt) are linearly independent solutions to
the homogeneous DE. So, by Fact 2.5, a general solution to the homogeneous DE is
p  C D 
x = C cos(ωt) + D sin(ωt) = C 2 + D2 cos(ωt) √ + sin(ωt) √
C 2 + D2 C 2 + D2

= A cos(ωt) cos(δ) + sin(ωt) sin(δ) = A cos(ωt − δ),

where C, D, A, δ are constants satisfying A > 0 and the relationship depicted in Figure 3.2.

3.1.2 When F0 6= 0 and α 6= ω


F0
Consider the complex DE mz̈ + kz = F0 eiαt , or equivalently, the DE z̈ + ω 2 z = m eiαt .
• The roots of the characteristic equation λ2 + ω 2 = 0 are ±iω 6= iα, as 0 < α 6= ω.

• Try z = Ceiαt . Then ż = iαCeiαt and z̈ = −α2 Ceiαt .


• Substituting these into the complex DE gives
F0 iαt
−α2 Ceiαt + ω 2 · Ceiαt = e
m
F0 /m
⇔ C= 2 .
ω − α2

F0 /m F0 /m
• So z = ω 2 −α2 eiαt = ω 2 −α2 (cos(αt) + i sin(αt)) by Euler’s Formula.
A particular solution to the original DE is

F0 /m
x = Re(z) = cos(αt)
ω 2 − α2
A general solution to the original DE is

F0 /m
x = A cos(ωt − δ) + 2 cos(αt),
| {z } ω − α2
| {z }
general solution
particular
to the corresponding
solution
homogeneous equation

where A, δ are constants with A > 0.

22
3.1.3 When F0 6= 0 and α = ω
F0
Consider the complex DE mz̈ + kz = F0 eiαt , or equivalently, the DE z̈ + ω 2 z = m eiαt .
• iα = iω is a (simple) root of the characteristic equation λ2 + ω 2 = 0.
• Try z = Dteiαt . Then ż = iαDteiαt + Deiαt and z̈ = −α2 Dteiαt + 2iαDeiαt .
• Substituting these into the complex DE gives
F0 iαt
(−α2 Dteiαt + 2iαDeiαt ) + ω 2 · Dteiαt = e
m
F0 /m F0 /m
⇔ D= =− i.
2iα 2α

• So z = − F02α
/m
iteiαt = − F02α
/m
it(cos(αt) + i sin(αt)) by Euler’s Formula.
A particular solution to the original DE is
F0 /m F0 /m
x = Re(z) = t sin(αt) = t sin(ωt).
2α 2ω
A general solution to the original DE is
F0 /m
x = A cos(ωt − δ) + t sin(ωt),
| {z } | 2ω {z }
general solution
particular
to the corresponding
solution
homogeneous equation

where A, δ are constants with A > 0.

Definition 3.6. This situation in which the external frequency α is equal to the
natural frequency ω of the system is called resonance.

3.2 Population
3.2.1 The Malthus model
Let N (t) denote the size of the population at time t, and N̂ = N (0).
Definition 3.7. The per capita birth rate is the number of individuals born per unit of time,
divided by the number of individuals. The per capita death rate is the number of individuals
died per unit of time, divided by the number of individuals.

Model 3.8 (Malthus). Denote by B and D the per capita birth rate and the per
capita death rate respectively. Then B, D are positive constants and
dN
= (B − D)N.
dt

Solution. Rearranging the DE gives the separable form


1 dN
= B − D.
N dt
Integrate both sides with respect to t to get
Z Z
dN
ln N = = (B − D) dt = (B − D)t + C
N
⇔ N = e(B−D)t+C = Ae(B−D)t ,

23
N B>D

B=D

t B<D

Figure 3.3: The Malthus Model

N̂ > N∞

N∞ N̂ = N∞

N̂ < N∞

Figure 3.4: The Logistic Model

where A, C are constants with A > 0. Substituting in N (0) = N̂ reveals that N̂ = N (0) =
Ae(B−D)·0 = A. So
N (t) = N̂ e(B−D)t .

3.2.2 The Logistic Model


Let N (t) denote the size of the population at time t, and N̂ = N (0).

Model 3.9 (Logistic).


dN
= (B − sN )N,
dt
where B, s are positive constants.

Note 3.10. In the Logistic Model above, the B is the per capita birth rate, and the sN is
the per capita death rate.

Solution (working given at the end of the section).



 0,
 if N̂ = 0;
N (t) = N∞
 1 + N∞ − 1e−Bt , if N̂ > 0,

where N∞ ..= B/s.

Terminology 3.11. The N∞ , which is defined to be B/s above, is called the carrying
capacity.
Definition 3.12. An equilibrium solution to a DE is a solution of the form N (t) ≡ c, where
c is a constant.

24
Terminology 3.13. An equilibrium solution N (t) ≡ c to a DE is stable if N (t) stays close
to c whenever N (t) is a solution to the same DE such that N (0) is sufficiently close to c. An
equilibrium solution is unstable if it is not stable.
Remark 3.14. Note N → N∞ as t → ∞ whenever N̂ > 0. So N ≡ 0 is an unstable
equilibrium, while N ≡ N∞ is a stable equilibrium.

Working. Suppose N̂ > 0. Rearranging the DE gives the Bernoulli form Ṅ + (−B)N =
(−s)N 2 or equivalently,
N −2 Ṅ − BN −1 = −s.
Let z = N 1−2 = N −1 . Then ż = −N −2 Ṅ . Substituting these in gives

ż + Bz = s.
R
B dt
Note e = eBt+C , where C is a constant. Use the integrating factor eBt to get
Z  Bt 
1 1 1 e s
= z = Bt Bt
se dt = Bt s + C0 = + C0 e−Bt ,
N e e B B

where C0 is a constant. Substituting this into the initial condition N (0) = N̂ gives
1 s
+ C0 e−B·0
=
N̂ B
1 s
∴ C0 = − .
N̂ B

Therefore, as N∞ = B/s,

1 N∞
N= s 1 s
 = N∞
.
e−Bt

B + N̂
− B 1+ N̂
− 1 e−Bt

3.2.3 The Logistic Model with Harvesting


Let N (t) denote the size of the population at time t, and N̂ = N (0).

Model 3.15 (Logistic with Harvesting).

dN
= (B − sN )N − E,
dt
where B, s, E are positive constants.

Note 3.16. In the Logistic Model with Harvesting above, the B is the per capita birth rate,
the sN is the per capita death rate, and the E is the harvest rate.
Behaviour of solutions. Let F (N ) = (B − sN )N − E = −sN 2 + BN − E. Consider B 2 −
4(−s)(−E) = B 2 − 4sE.
Case 1: B 2 − 4sE < 0. This means E > B 2 /4s.

• dN
dt = F (N ) < 0 for all N because the coefficient of N 2 in F (N ) is negative.
• So there is no equilibrium solution.
• N decreases until it reaches 0, no matter what N̂ is.
Case 2: B 2 − 4sE > 0. This means E < B 2 /4s.

• Let β1 , β2 be the roots of F (N ) = 0, where β1 < β2 .

25
dN dN dN
F (N ) = dt F (N ) = dt F (N ) = dt
N N
0 0 β
N
0 β1 β2

E > B 2 /4s E < B 2 /4s E = B 2 /4s

Figure 3.5: The Logistic Model with Harvesting

• N ≡ β1 and N ≡ β2 are the equilibrium solutions.


dN
Case 2a: N̂ = β1 or N̂ = β2 . Then dt = F (N ) = 0. So N ≡ N̂ .
dN
Case 2b: N̂ < β1 . Then dt = F (N ) < 0. So N decreases until it reaches 0.
dN
Case 2c: β1 < N̂ < β2 . Then dt = F (N ) > 0. So N increases and N → β2 as
t → ∞.
dN
Case 2d: N̂ > β2 . Then dt = F (N ) < 0. So N decreases and N → β2 as t → ∞.

• β1 is an unstable equilibrium, and β2 is a stable equilibrium.

Case 3: B 2 − 4sE = 0. This means E = B 2 /4s.


• β ..= −B/(2 · −s) = B/2s is the only root of F (N ) = 0.
• So N ≡ β is the only equilibrium solution.
dN
Case 3a: N̂ = β. Then dt = F (N ) = 0. So N ≡ β.
dN
Case 3b: N̂ < β. Then dt = F (N ) < 0. So N decreases until it reaches 0.
dN
Case 3c: N̂ > β. Then dt = F (N ) < 0. So N decreases and N → β as t → ∞.

• β is an unstable equilibrium.

Video materials
Taylor’s Theorem (informal version). If f (x) is a differentiable function and a is a constant,
then for all x near a,
f (x) ≈ f (a) + f 0 (a)(x − a).
Example 3.17 (pendulum). Consider the situation depicted in Figure 3.6. Applying New-
ton’s Second Law in the tangential direction, we get
d2
−mg sin θ = m (Lθ)
dt2
d2 θ
⇔ −g sin θ = L 2
dt
= Lθ̈,

where m, g, L are positive constants. Now sin θ ≈ sin(0) + cos(0) (θ − 0) = 0 + 1 · θ = θ. So


approximately,
g
Lθ̈ = −gθ ⇔ θ̈ = − θ = −ω 2 θ ⇔ θ̈ + ω 2 θ = 0,
L

26
θ

mg sin θ
mg mg cos θ
θ

Figure 3.6: The pendulum

p
where ω = g/L. As in Section 3.1.1, the solution is

θ = A cos(ωt − δ),

where A, δ are constants with A > 0. Thus −A 6 θ 6 A and θ remains small.


Note 3.18. The analysis of the Logistic Model with Harvesting (Model 3.15) in Section 3.2.3
shows that one can avoid extinction with any harvest rate E < B 2 /4s in theory. In practice, a
variety of factors may cause the size of the population to fluctuate. So it is wise to keep E away
from B 2 /4s, so that extinction does not occur even when some unexpected disaster strikes.
To have a sustainable population, we want to be in Case 2, where E < B 2 /4s. Moreover, we
want the population to be close the stable equilibrium β2 , and be away from the unstable
equilibrium β1 . (Recall that β1 , β2 are the roots of F (N ) = 0, where F (N ) = (B − sN )N − E
and β1 < β2 .) To ensure β2 − ε > β1 , where ε > 0, we find δ > 0 such that E < B 2 /4s − δ.

Summary
• Simple harmonic motions are modelled by DE’s of the form ẍ + ω 2 x = 0, where ω is
the natural frequency of the oscillator. A general solution is x = A cos(ωt − δ).
• Forced oscillations are modelled by DE’s of the form ẍ + ω 2 x = F (t), where F (t)
represents the external force.
• In a forced oscillation, resonance occurs when the frequency of the external force,
represented by F (t) above, is equal to the natural frequency ω of the oscillator.

Let N (t) denote the size of the population at time t, and N̂ = N (0). Then
dN
= (B − D)N − E,
dt
where B is the per capita birth rate, D is the per capita death rate, and E is the harvest
rate.

The Malthus Model (Model 3.8): B, D are constants and E = 0.


Then N grows or decays exponentially.
The Logistic Model (Model 3.9): D = sN where B, s are constants, and E = 0.
Then N → B/s as t → ∞ unless N̂ = 0. Here B/s is called the carrying capacity.

27
The Logistic Model with Harvesting (Model 3.15): D = sN where B, s, E are con-
stants.
• If E > B 2 /4s, then N decreases until it reaches 0.
• If E < B 2 /4s, then
– if 0 < N̂ < β1 , then N decreases until it reaches 0;
– if N̂ > β1 , then N → β2 as t → ∞,
where β1 , β2 are roots of (B − sN )N − E = 0 with β1 < β2 .

Matlab materials
We shall learn how to approximate solutions using Matlab’s numerical solver called ode45:
ode45(f ,[a,b],x0 )
solves the initial value problem (IVP)
dx
= f (t, x), a 6 x 6 b, x(a) = x0 .
dt
Note that the initial condition should always be supplied because we are approximating a
unique particular solution and not the whole family of solutions.
Let us start with the following simple IVP:
dx t
= , 0 6 t 6 2, x(0) = 1.
dt x
>> f = @(t,x) t/x;
>> ode45(f, [0 2], 1)
• The first line creates a function f (t, x) with two input arguments t, x. Unlike previously
where we had to input specific values into an array, this syntax allows us to define a
function. Note that there is no need to use “./” for dividing in inline functions.
• The second command plots an approximate solution to f on the interval [0, 2] with the
last argument specifying the initial value, i.e., the value of x at the left end-point of
the interval.
2.4

2.2

1.8

1.6

1.4

1.2

1
0 0.5 1 1.5 2

In the graph, the circles indicate points at which ode45 computed the approximate solution
and the centers of these circles are connected by line segments. √
Since the DE involved is separable, we can solve the IVP to get x(t) = t2 + 1. In order
to compare the two graphs, we get the numerical values from ode45 by specifying, continuing
from the above,

28
>> [t, xa] = ode45(f, [0 2], 1);
>> X = sqrt(t.^2+1);
>> plot(t, xa, ’b’)
>> hold on
>> plot(t, X, ’r--’)
>> hold off
The array t stores the values where approximations were computed with the corresponding
approximated values stored in xa.
2.4

2.2

1.8

1.6

1.4

1.2

1
0 0.5 1 1.5 2

Note that you actually cannot see any difference graphically. To see how good the approx-
imations are, we use the following commands (again continuing from the above) and note
how many decimal places the two sets of values agree to.
>> format long
>> [X, xa]

ans =

1.000000000000000 1.000000000000000
1.001249219725039 1.001249322543948
1.004987562112089 1.004987583459220
1.011187420807834 1.011187326457656
1.019803902718557 1.019803900300028
1.030776406404415 1.030776612066473
1.044030650891055 1.044030686115661
1.059481005020855 1.059480836490066
1.077032961426901 1.077032958001759
1.096585609973066 1.096585753293474
1.118033988749895 1.118034010569499
1.141271221051333 1.141271106376989
1.166190378969060 1.166190374350517
1.192686044187656 1.192686089325686
1.220655561573370 1.220655563240067
1.250000000000000 1.249999957951388
1.280624847486570 1.280624841656901
1.312440474840669 1.312440463130154
1.345362404707371 1.345362394665262

29
1.379311422413372 1.379311419833795
1.414213562373095 1.414213555992425
1.450000000000000 1.449999970112113
1.486606874731851 1.486606861428621
1.523975065412817 1.523975075188232
1.562049935181331 1.562049928842014
1.600781059358212 1.600781029466687
1.640121946685672 1.640121934170242
1.680029761641144 1.680029771788671
1.720465053408525 1.720465047403860
1.761391495380854 1.761391470858097
1.802775637731995 1.802775627123471
1.844586674569672 1.844586681704933
1.886796226411321 1.886796220832688
1.929378138157474 1.929378119272440
1.972308292331602 1.972308283568230
2.015564437074637 2.015564441077208
2.059126028197400 2.059126023043852
2.102974084481309 2.102974070103894
2.147091055358389 2.147091048072739
2.191460700081113 2.191460701682836
2.236067977499790 2.236067972737249

We remark that ode45 is one of several numerical solvers available and is sufficient for
our purposes. More advanced users can try to study the difference between ode45 and ode23
or ode113 etc.

30
MA1512 Week 4

Lecture materials
4.1 Laplace transform
Definition 4.1. Let f be a function defined for all t > 0. The Laplace transform of f ,
denoted L(f ), is the function F (s) defined by
Z ∞
F (s) = e−st f (t) dt,
0
R∞ Rb
where 0 e−st f (t) dt ..= limb→∞ 0 e−st f (t) dt and we treat s as a constant when we evaluate
the integral. If F (s) = L(f ), then we call f (t) the inverse Laplace transform of F (s), and
write L−1 (F ) = f (t).

Convention 4.2. Original functions are denoted by lowercase letters with variable t, and
their Laplace transforms by the same letters in uppercase with variable s.
Fact 4.3. The inverse Laplace transform of a function, if it exists, is unique up to a “zero-
length set”.
Example 4.4. (The intermediate calculations are not examinable.) Let a be a constant and
f (t) = eat . Then
Z ∞ Z b
at −st at
F (s) = L(f ) = L(e ) = e e dt = lim e(a−s)t dt
0 b→∞ 0
  (a−s)t b  (a−s)b
e(a−s)·0

 e e

 lim = lim − = ∞, if s < a;



 b→∞ a − s 0 b→∞ a − s a−s


  (a−s)t b  (a−s)b
e(a−s)·0
 
= e e −1 1
lim = lim − = = , if s > a;
 b→∞ a − s 0 b→∞ a − s a−s a−s s−a





 Z b

  b
 lim
 dt = lim t 0 = lim (b − 0) = lim b = ∞, if s = a.
b→∞ 0 b→∞ b→∞ b→∞

Hence
1
F (s) = for s > a.
s−a

Example 4.5. (The intermediate calculations are not examinable.) Let n be a fixed non-

31
negative integer. Then
Z ∞
−1 ∞ n de−st
Z
L(tn ) = e−st tn dt = t · dt
0 s 0 dt
 Z ∞ n

−1  n −st ∞ −st dt
= t e 0
− e · dt integrating by parts;
s 0 dt
Z ∞
as tn e−st → 0 as t → ∞,
 
−1
= (0 − 0) − n e−st tn−1 dt
s 0 and tn = 0 when t = 0;
n n n−1 n n−1 1
= L(tn−1 ) = · L(tn−2 ) = · · · = · · · · · · L(t0 )
s s s s s s
n! 1 n! 1
= n · = n+1 as L(e0·t ) = by Example 4.4
s s s s−0
for s > 0. Hence
n!
L(tn ) = for s > 0.
sn+1
Proposition 4.6 (linearity of the Laplace transform). Let f, g be functions defined for all
t > 0, and a, b be constants. Then

L(a f (t) + b g(t)) = a L(f ) + b L(g).

Proof (non-examinable). This follows from the linearity of integrals and limits.
Proposition 4.7 (linearity of the inverse Laplace transform). Let f, g be functions defined
for all t > 0, and a, b be constants. If F (s) = L(f ) and G(s) = L(g), then

L−1 (a F (s) + b G(s)) = a L−1 (F ) + b L−1 (G).

Proof (non-examinable).

L−1 (a F (s) + b G(s)) = L−1 (a L(f ) + b L(g)) = L−1 (L(af + bg))


= af + bg = a L−1 (F ) + b L−1 (G).

Example 4.8. (The intermediate calculations are not examinable.) Let a, b be complex
constants. Let w be a real constant. On the one hand, Euler’s formula implies

L(eiwt ) = L cos(wt) + i sin(wt) = L cos(wt) + i L sin(wt) .


  

On the other hand, for s > Re(iw) = 0,

1 1 s + iw s w
L(eiwt ) = = · = 2 2
+i 2 .
s − iw s − iw s + iw s +w s + w2
Equating the real and the imaginary parts gives, for all s > 0,

s w
L(cos(wt)) = and L(sin(wt)) = .
s2 + w2 s2 + w2
   
2s + 5 s 5 3
Example 4.9. L−1 = L−1 2 · 2 + ·
s2 + 9 s + 32 3 s2 + 32
   
s 5 −1 3
= 2 L−1 + L
s2 + 32 3 s2 + 32
5
= 2 cos(3t) + sin(3t).
3

32
fh (t)
δ(t)
1
h

t t
0
0 h

Figure 4.1: The Dirac delta function and its approximations

u(t) u(t − a)
1 1

t t
0 0 a

Figure 4.2: The unit step function

Definition 4.10. The Dirac delta function δ(t) satisfies


Z ∞
δ(t) dt = 1 and δ(t) = 0 for all t 6= 0.
0

Think of δ(t) = limh→0 fh (t), where



 0,
 if t < 0;
fh (t) = 1/h, if 0 6 t 6 h;

0, if t > h.

Fact 4.11 (non-examinable). Let g(t) be a function and a be a non-negative constant. Then
Z ∞ Z ∞ Z a+h
1
g(t) δ(t − a) dt = g(t) · lim fh (t − a) dt = lim g(t) · dt
0 0 h→0 h→0 a h
Z a+h Z a+h
1
= lim g(t) dt = g(a) as g(t) dt ≈ g(a) · h when h is small.
h→0 h a a

Example 4.12. L(δ(t − a)) = e−as for all a > 0. In particular, we have L(δ(t)) = 1.

R∞
Proof (non-examinable). L(δ(t − a)) = 0
e−st δ(t − a) dt = e−sa .

4.2 Shifts

Definition 4.13. The unit step function u satisfies, for all t,


(
0, if t < 0;
u(t) =
1, if t > 0.

Example 4.14. Let a, b be constants such that a < b, and g(t) be a function.

33
(
0, t < a;
(1) u(t − a) =
1, t > a.

 0,
 if t < a;
(2) u(t − a) − u(t − b) = 1, if a < t < b;

0, if t > b.


 0, if t < a;
 
(3) g(t) u(t − a) − u(t − b) = g(t), if a < t < b;

0, if t > b.

Proposition 4.15 (t-shifting). Let f (t) be a function. Then for all a > 0,

L f (t − a) u(t − a) = e−as L(f (t)).




Proof (non-examinable).
Z ∞ Z ∞
e−st · f (t − a) u(t − a) dt = e−st f (t − a) dt

L f (t − a) u(t − a) =
0 a
Z ∞
= e−s(τ +a) f (τ ) dτ = e−as L(f ) = e−as F (s).
0

e−as
Example 4.16. t-shifting implies L(u(t − a)) = e−as L(1) = for all a > 0.
s
L(t2 u(t − 1)) = L ((t − 1) + 1)2 u(t − 1)

Example 4.17.
= L (t − 1)2 + 2(t − 1) + 1) u(t − 1)


= e−1·s L t2 + 2t + 1 = e−s L(t2 ) + 2 L(t) + L(1)


 
by t-shifting;
   
2! 1! 1 2 2 1
= e−s + 2 · + = e −s
+ + .
s2+1 s1+1 s s3 s2 s

Proposition 4.18 (s-shifting). Let f (t) be a function and a, c be constants. Suppose


F (s) ..= L(f ) is defined for all s > a. Then

L(ect f (t)) = F (s − c) for s > a + c.

Proof (non-examinable).
Z ∞ Z ∞
L(ect f (t)) = e−st · ect f (t) dt = e−(s−c)t f (t) dt = F (s − c).
0 0

Example 4.19. Let a, c, w be constants, and n be a non-negative integer. Then


n!
L(ect tn ) = for s > c;
(s − c)n+1
s−c w
L(ect cos(wt)) = and L(ect sin(wt)) = for s > c.
(s − c)2 + w2 (s − c)2 + w2

34
4.3 Derivatives

Theorem 4.20. Let a be a constant and f (t) be a continuous function such that
L(f ) exists at all s > a and f 0 (t) is piecewise continuous on [0, ∞). Then

L(f 0 ) = s L(f ) − f (0) for s > a.

Proof for the case when f 0 (t) is continuous at all t > 0 (non-examinable). For all s > a,
Z ∞ Z ∞
0 −st 0
 −st ∞ de−st
L(f ) = e f (t) dt = e f (t) 0 − f (t) dt
0 dt
Z ∞ 0
= lim e−sb f (b) − e−s·0 f (0) − f (t) · e−st · (−s) dt
b→∞ 0
Z ∞
= 0 − f (0) + s e−st f (t) dt = s L(f ) − f (0)
0

as L(f ) exists at s.

Corollary 4.21. Let n be a positive integer and f (t) be a function such that
f (t), f 0 (t), . . . , f (n−1) (t) are continuous and their Laplace transforms exist at all s > a.
Suppose further that f (n) (t) is piecewise continuous on [0, ∞). Then

L(f (n) ) = sn L(f ) − sn−1 f (0) − sn−2 f 0 (0) − · · · − s1 f (n−2) (0) − f (n−1) (0).

Proof when n = 2 (non-examinable).

L(f 00 ) = s L(f 0 ) − f 0 (0) by Theorem 4.20 applied to f 0 ;


= s s L(f ) − f (0) − f 0 (0)

by Theorem 4.20 applied to f ;
2 0
= s L(f ) − s f (0) − f (0).

Strategy 4.22 (solving initial value problems using the Laplace transform). Consider
the initial value problem
(
y 00 + ay 0 + by = r(t)
y(0) = k0 , y 0 (0) = k1

where a, b, k0 , k1 are constants and r(t) is a function with Laplace transform R(s).
(1) Take the Laplace transform on both sides of the DE to get, via linearity,
s2 L(y) − s y(0) − y 0 (0) + a s L(y) − y(0) + b L(y) = L(r).
 

(2) Substitute in the initial conditions and L(r) = R(s) to get


s2 L(y) − sk0 − k1 + a s L(y) − k0 + b L(y) = R(s).
 

(3) Solve for L(y) to get


R(s) + (s + a)k0 + k1
L(y) = .
s2 + as + b

(4) Reduce the expression above to a sum of terms whose inverse Laplace transforms
can be found. The sum of the inverse Laplace transforms is the solution y(t) to
the initial value problem.

35
Example 4.23. Solve y 00 + 2y 0 + 5y = 0, y(0) = 2, y 0 (0) = −4.
Solution. Taking the Laplace transform on both sides of the DE gives, via linearity,

s2 L(y) − s y(0) − y 0 (0) + 2 s L(y) − y(0) + 5 L(y) = L(0)


 

∴ s2 L(y) − s · 2 − (−4) + 2s L(y) − 2 · 2 + 5 L(y) = 0


2s 2(s + 1 − 1)
∴ L(y) = =
s2
+ 2s + 5 (s + 1)2 + 4
s − (−1) 2
=2 2 2

(s − (−1)) + 2 (s − (−1))2 + 22
∴ y = 2e−1·t cos(2t) − e−1·t sin(2t) = 2e−t cos(2t) − e−t sin(2t).

Video materials
Example 4.24. Let w be a constant. Find L(t sin wt).
Solution. Let f (t) = t sin wt. Then

f 0 (t) = sin(wt) + wt cos(wt),


f 00 (t) = w cos(wt) + w cos(wt) − w2 t sin(wt) = 2w cos(wt) − w2 f (t).

On the one hand, by Corollary 4.21,

L(f 00 ) = s2 L(f ) − s f (0) − f 0 (0) = s2 L(f )

as f (0) = 0 and f 0 (0) = 0. On the other hand,


s
L(f 00 ) = L 2w cos(wt) − w2 f (t) = 2w − w2 L(f )

s2 + w2
by Example 4.8. Putting the two together, we have
s
s2 L(f ) = 2w − w2 L(f )
s2 + w2
2ws
⇔ L(t sin wt) = L(f ) = 2 .
(s + w2 )2

Theorem 4.25. Let a be a constant and f (t) be a function that is piecewise con-
tinuous on [0, ∞) and whose Laplace transform exists at all s > a. Then, for all
s > max{0, a}, Z t 
L(f )
L f (τ ) dτ = .
0 s

Rt
Proof (non-examinable). Let g(t) = 0 f (τ ) dτ . Then g(0) = 0 and g 0 (t) = f (t) by the
Fundamental Theorem of Calculus. The latter implies g is continuous and L(g) exists at all
s > a. In view of Theorem 4.20, for all s > a,

L(f ) = L(g 0 ) = s L(g) − g(0) = s L(g).

So if s > max{0, a}, then L(g) = L(f )/s.


Example 4.26. Fix a constant w. On the one hand, an application of Theorem 4.25 gives
Z t 
1 1 L(sin(wt)) 1 w 1
L sin(wτ ) dτ = · = · 2 2
= .
w 0 w s sw s + w s(s + w2 )
2

36
On the other hand,
Z t   t !  
1 1 − cos(wτ ) (− cos(wt)) − (−1)
L sin(wτ ) dτ = L =L .
w 0 w w 0 w2

1−cos(wt)  1
So L w2 = s(s2 +w2 ) .

Example 4.27 (parameter reconstruction). We have a spring with a mass attached which
is initially at rest at the equilibrium position. Then by Newton’s Second Law, the displace-
ment x of the mass satisfies
M ẍ = −kx − bẋ
where M is the mass, k is the spring constant, and b is the frictional coefficient. We poke it
with a unit impulse at time t = 1; in other words, the applied force is δ(t − 1). We observe
that the displacement of the mass is

x(t) = u(t − 1) e−(t−1) sin(t − 1).

What are the values of M , k and b?


On the one hand, Newton’s Second Law in this case says:

M ẍ = −kx − bẋ + δ(t − 1).


M s X(s) − s x(0) − ẋ(0) = −k X(s) − b s X(s) − x(0) + e−s
2
 
∴ by Example 4.12.
2 −s
∴ M s X(s) = −k X(s) − bs X(s) + e as x(0) = 0 = ẋ(0).
−s
e
∴ X(s) = .
M s2 + bs + k
On the other hand, we can also find X(s) using what we observed:

X(s) = L(x) = L u(t − 1) e−(t−1) sin(t − 1)




= e−s L e−t sin(t)



by t-shifting;
1
= e−s · by s-shifting;
(s + 1)2 + 1
e−s
= 2 .
s + 2s + 2
Comparing the two, we have M = 1, b = 2, and k = 2.

Summary
See Table 4.1 for some Laplace transforms we established.
Strategy 4.22 (solving initial value problems using the Laplace transform). Con-
sider the initial value problem
(
y 00 + ay 0 + by = r(t)
y(0) = k0 , y 0 (0) = k1

where a, b, k0 , k1 are constants and r(t) is a function with Laplace transform R(s).

(1) Take the Laplace transform on both sides of the DE to get, via linearity,

s2 L(y) − s y(0) − y 0 (0) + a s L(y) − y(0) + b L(y) = L(r).


 

(2) Substitute in the initial conditions and L(r) = R(s) to get

s2 L(y) − sk0 − k1 + a s L(y) − k0 + b L(y) = R(s).


 

37
g(t) G(s) = L(g) hypothesis
1
eat for s > a
s−a
1
1 for s > 0
s
n!
tn for s > 0 n>0
sn+1
s
cos(wt) for s > 0
s2 + w2
w
sin(wt) for s > 0
s2 + w2
δ(t − a) e−as a>0

δ(t) 1

f (t − a) u(t − a) e−as L(f (t)) a>0

ect f (t) F (s − c) for s > a + c F (s) = L(f ) and it is defined for all s > a
n!
ect tn for s > c n>0
(s − c)n+1
s−c
ect cos(wt) for s > c
(s − c)2 + w2
w
ect sin(wt) for s > c
(s − c)2 + w2
f (t) is continuous and
f 0 (t) s L(f ) − f (0)
f 0 (t) is piecewise continuous on [0, ∞)
f (t), f 0 (t) are continuous and
f 00 (t) s2 L(f ) − s f (0) − f 0 (0)
f 00 (t) is piecewise continuous on [0, ∞)
Z t
f (t) is piecewise continuous on [0, ∞) and
f (τ ) dτ L(f )/s for s > 0
0 its Laplace transform exists at all s > 0
Here a, c, n, w are constants, n is an integer, f (t) is a function.

Table 4.1: Some Laplace transforms

38
(3) Solve for L(y) to get
R(s) + (s + a)k0 + k1
L(y) = .
s2 + as + b
(4) Reduce the expression above to a sum of terms whose inverse Laplace transforms can
be found. The sum of the inverse Laplace transforms is the solution y(t) to the initial
value problem.

39
MA1512 Week 5

Lecture materials
5.1 Partial differential equations
Definition 5.1. A partial differential equation (PDE ) is an equation containing an unknown
function u(x, y, . . . ) of two or more independent variables x, y, . . . and its partial derivatives
with respect to these variables.
Example 5.2. Consider the PDE uxy − 2x + y = 0. A solution is
1 2
u(x, y) = x2 y − xy + F (x) + G(y),
2
where F (x) and G(y) are arbitrary functions, because then
1 2 1
ux = 2xy − y + F 0 (x) and uxy = 2x − · 2y = 2x − y.
2 2
Adding to the PDE the conditions u(x, 0) = x3 and u(0, y) = sin(3y) gives
(
x2 · 0 − 12 x · 02 + F (x) + G(0) = u(x, 0) = x3 , (∗)
2 1 2
0 ·y− 2 0 · y + F (0) + G(y) = u(0, y) = sin(3y). (†)

Setting x = 0 or y = 0 reveals that F (0) + G(0) = 0. So adding (∗) to (†) gives

F (x) + G(0) + F (0) + G(y) = x3 + sin(3y).


 

1
Hence u(x, y) = x2 y − 2 xy 2 + x3 + sin(3y).
Remark 5.3. General solutions to ODEs contain arbitrary constants, while general solutions
to PDEs contain arbitrary functions.
Definition 5.4. (1) The order of a PDE is the order of the equation’s highest order deriva-
tive.
(2) A first-order linear PDE in u(x, y) has the form

Aux + Buy + Cu = Z, (‡)

where A, B, C, Z are (possibly constant) functions of x, y (but not u).


(3) A second-order linear PDE in u(x, y) has the form

Auxx + Buxy + Cuyy + Dux + Euy + F u = Z, (§)

where A, B, C, D, E, F, Z are (possibly constant) functions of x, y (but not u).


(4) The PDE in (‡) or (§) is homogeneous if Z ≡ 0.

40
PDE order linear homogeneous
4uxx − ut = 0 2 yes yes
x2 Ryyy = y 3 Rxx 3 yes yes
tutx + 2ux = x2 2 yes no
4uxx − uut = 0 2 no N/A
(ux )2 + (uy )2 = 2 1 no N/A

Table 5.1: Examples of PDEs

Theorem 5.5 (Superposition Principle). If u1 , u2 are solutions to a linear homogeneous DE,


then so is
u = c1 u1 + c2 u2 ,
for any constants c1 , c2 .
Proof. This follows from the linearity of differentiation.
Example 5.6. Consider the Laplace equation uxx + uyy = 0, which is a linear homogeneous
PDE. Its solutions include

u(x, y) = x2 − y 2 and u(x, y) = ex cos y and u(x, y) = ln(x2 + y 2 ).

So u(x, y) = 3(x2 −y 2 )−7ex cos y+10 ln(x2 +y 2 ) is again a solution to the DE by Theorem 5.5.

5.2 Separation of variables


Observation 5.7. If u(x, y) = X(x) Y (y) where X, Y are functions of one variable, then

ux (x, y) = X 0 (x) Y (y), uy (x, y) = X(x) Y 0 (y),


uxx (x, y) = X 00 (x) Y (y), uxy (x, y) = X 0 (x) Y 0 (y), uyy (x, y) = X(x) Y 00 (y), etc.

Strategy 5.8 (separation of variables for first-order PDEs). Suppose a first-order


PDE has a solution of the form u(x, y) = X(x) Y (y).
(1) Substitute the expressions for u, ux , uy from Observation 5.7 into the PDE.
(2) Rearrange into the form f (x, X(x), X 0 (x)) = g(y, Y (y), Y 0 (y)).
(3) This implies that f (x, X(x), X 0 (x)) = k = g(y, Y (y), Y 0 (y)), where k is a con-
stant.
(4) Solve these two ODEs for X(x) and Y (y).
(5) Then u(x, y) = X(x) Y (y) is a solution to the PDE.

Remark 5.9. A similar strategy applies to higher-order PDEs with 2 independent variables.
Example 5.10. Solve ux + xuy = 0 by separating the variables.
Solution. Let u(x, y) ..= X(x) Y (y) which satisfies the PDE. Then

X 0 (x) Y (y) + x X(x) Y 0 (y) = 0


X 0 (x) Y 0 (y)
⇔ =− .
x X(x) Y (y)
Let k be a constant such that
X 0 (x) Y 0 (y)
=k=− .
x X(x) Y (y)

41
Temperature
u uxx < 0

uxx < 0

x
0 L

uxx > 0

Figure 5.1: The Heat Equation

• Rewrite the first equation as X 0 /X = kx. Integrating gives ln |X| = kx2 /2 + C, or


equivalently X = A exp(kx2 /2), where A, C are constants.
• Rewrite the second equation as Y 0 /Y = −k. Integrating gives ln |Y | = −ky + D, or
equivalently Y = B exp(−ky), where B, D are constants.
Thus u(x, y) = E exp(kx2 /2 − ky), where E is a constant.

5.3 The Heat Equation


Equation 5.11 (The Heat Equation). Consider the temperature u of a long thin bar of
constant cross section and homogeneous material, oriented along the x-axis and is perfectly
insulated laterally, so that heat only flows in the x-direction. The temperature u(x, t) is given
by
ut = c2 uxx ,
where c2 is a constant called the thermal diffusivity of the substance of which the bar is
made.
Boundary and initial conditions 5.12. (1) The ends x = 0 and x = L are kept at zero
temperature, so that for all t,

u(0, t) = 0 and u(L, t) = 0.

(2) At position x, the initial temperature of the bar is f (x), so that

u(x, 0) = f (x).

Solution. The method of separation of variables gives the following solutions to the
Heat Equation with Boundary Conditions 5.12(1):
 nπ    nπ 2 
u(x, t) = B sin x exp − c2 t ,
L L
where B is a constant and n is an integer. One can then fit such solutions to Initial
Condition 5.12(2), using Theorem 5.5 if needed.

Example 5.13. Solve ut = 2uxx , 0 6 x 6 3, t > 0, u(0, t) = 0, u(3, t) = 0, u(x, 0) =


5 sin(4πx).

42
Solution. Let u(x, t) = X(x) T (t) be the solution. Then X(x) T 0 (t) = 2X 00 (x) T (t), or
2X 00 (x) T 0 (t)
=k= ,
X(x) T (t)
where k is a constant. Rewrite the two ODEs as X 00 − (k/2)X = 0 and T 0 /T = k.
(1) The boundary conditions tell us X(0) T (t) = 0 = X(3) T (t) for all t > 0. If T ≡ 0 or
X ≡ 0, then u = XT ≡ 0, which contradicts the initial condition. So T (t) 6= 0 for
some t > 0. This implies X(0) = 0 = X(3) by the boundary conditions.
√ √
(2) Suppose k/2 > 0. Then 02 − 4 × (−k/2) = 2k > 0. So X = Ce k/2 x + De− k/2 x ,
where
√ C, D are constants.
√ Substituting into X(0) = 0 gives C√ + D = 0. √ Thus X =
k/2 x − k/2 x 3 k/2 −6 k/2
Ce − Ce . Substituting into X(3) = 0 gives Ce (1 − e ) = 0.
The second and the third factors on the LHS cannot be 0 because k 6= 0. Hence C = 0.
This implies X ≡ 0, which contradicts point (1) above.
(3) Suppose k/2 = 0. Integrating the first ODE twice gives X = Cx + D, where C, D are
constants. Substituting into X(0) = 0 gives D = 0. Thus X = Cx. Substituting into
X(3) = 0 gives C = 0. This implies X ≡ 0, which contradicts point (1) above again.
(4) The two contradictions here show k/2 < 0. Let a be such that −k/2 = a2 . Then the
ODEs become X 00 + a2 X = 0 and T 0 /T = −2a2 .
(5) Observe that X = cos(ax) and X = sin(ax) are linearly independent solutions to the
first ODE. So X = c1 cos(ax) + c2 sin(ax), where c1 , c2 are constants. Putting this into
the first boundary condition gives
c1 cos(a · 0) + c2 sin(a · 0) = X(0) = 0.
So c1 = 0. This makes X = c2 sin(ax). Putting this into the second boundary condition
gives
c2 sin(a · 3) = X(3) = 0.
If c2 = 0, then X = 0 · sin(ax) ≡ 0, which is not true by point (1). So sin(3a) = 0, or
equivalently 3a = nπ for some integer n. Fix an integer n such that a = nπ/3.
(6) Integrating both sides of the second ODE with respect to t gives ln |T | = −2a2 t + d
and thus T = A exp(−2a2 t), where A, d are constants.
2
(7) Hence u(x, t) = B sin(ax) exp(−2a2 t) = B sin n3 πx exp −2n
 2

9 π t , where B is a con-
stant.
(8) Substituting this into the initial condition gives
n   −2n2  n 
5 sin(4πx) = u(x, 0) = B sin πx exp π 2 · 0 = B sin πx .
3 9 3
Comparing the two sides gives B = 5 and n/3 = 4. This implies n = 12. Thus
 −2 × 122 
u(x, t) = 5 sin(4πx) exp π 2 t = 5 sin(4πx) exp(−32π 2 t).
9

Video materials
Equation 5.14 (The Wave Equation). A light string which lies stretched tightly along the
x-axis has its ends fixed at x = 0 and x = π, and is stationary at t = 0. Assuming tension is
the only force acting on the string, its position y(t, x) in the y-direction follows
ytt = c2 yxx , y(t, 0) = 0, y(t, π) = 0, y(0, x) = f (x), yt (0, x) = 0,
where c is a positive constant, and f (x) is a continuous bounded function on [0, π] describing
the initial shape of the string.

43
Solution (D’Alembert). The following function satisfies the Wave Equation with the
initial and boundary conditions above when one extends f to an odd function of
period 2π:
1 
y(t, x) = f (x + ct) + f (x − ct) .
2

Example 5.15 (2017/18 Semester 1 Exam Question 4(b)(ii)). Let y(t, x) be the solution of
the Wave Equation
ytt = yxx , 0 6 t, 0 6 x 6 π,
with y(t, 0) = y(t, π) = 0, y(0, x) = sin3 x, yt (0, x) = 0. Find the value of y( π6 , π3 ).

Solution. D’Alembert gives the solution y(t, x) = 21 sin3 (x + 1 · t) + sin3 (x − 1 · t) . So




π π 1  π π  π π 
y , = sin3 + + sin3 − = 0.562 . . . .
6 3 2 3 6 3 6

Summary
Strategy 5.8 (separation of variables for first-order PDEs). Suppose a first-order
PDE has a solution of the form u(x, y) = X(x) Y (y).
(1) Substitute u = XY and ux = X 0 Y and uy = XY 0 into the PDE.
(2) Rearrange into the form f (x, X, X 0 ) = g(y, Y, Y 0 ).

(3) This implies that f (x, X, X 0 ) = k = g(y, Y, Y 0 ), where k is a constant.


(4) Solve these two ODEs for X(x) and Y (y).
(5) Then u(x, y) = X(x) Y (y) is a solution to the PDE.

Remark 5.9. In the notation above,

uxx (x, y) = X 00 (x) Y (y), uxy (x, y) = X 0 (x) Y 0 (y), uyy (x, y) = X(x) Y 00 (y), ....

A similar strategy applies to higher-order PDEs with 2 independent variables.


Separable solution to the Heat Equation (Equation 5.11). The method of separation
of variables gives the following solutions to the Heat Equation ut = c2 uxx with the boundary
conditions u(0, t) = 0 and u(L, t) = 0:
 nπ    nπ 2 
u(x, t) = B sin x exp − c2 t ,
L L
where B is a constant and n is an integer. One can then fit such solutions to an initial
condition u(x, 0) = f (x), using the Superposition Principle (Theorem 5.5) if needed.
D’Alembert’s solution to the Wave Equation (Equation 5.14). Let f (x) be an odd
function of period 2π. Then
1 
y(t, x) = f (x + ct) + f (x − ct)
2
satisfies the Wave Equation ytt = c2 yxx together with the boundary conditions y(t, 0) = 0
and y(t, π) = 0, and the initial conditions y(0, x) = f (x) and yt (0, x) = 0.

44
Matlab materials
5.4 Surface plots
Solutions to the Heat Equation and the Wave Equation have two independent variables. One
way to visualize them is to use a 3-dimensional surface plot.
We can make such plots in Matlab using the surf command. As a demonstration, let
us plot the solution u(x, t) = 5 sin(4πx) exp(−32π 2 t) to Example 5.13 from x = 0 to x = 3
and from t = 0 to t = 0.02. We first need to decide what sample values of x and t we use to
make our plot. After some trials, it seems the following choice works fine.
>> x = 0:0.06:3;
>> t = 0:0.001:0.02;
As we saw before, the first line produces an array x that starts from 0 and progresses to 3 in
steps of 0.06, i.e., this array contains

0, 0.06, 0.12, 0.18, ..., 2.94, 3.

Similarly, the second line produces an array t that starts from 0 and progresses to 0.02 in
steps of 0.001, i.e., this array contains

0, 0.001, 0.002, 0.003, ..., 0.019, 0.02.

We then multiply these into the following grid of (x, t) values

(0, 0) (0.06, 0) (0.12, 0) (0.18, 0) ... (2.94, 0) (3, 0)


(0, 0.001) (0.06, 0.001) (0.12, 0.001) (0.18, 0.001) ... (2.94, 0.001) (3, 0.001)
(0, 0.002) (0.06, 0.002) (0.12, 0.002) (0.18, 0.002) ... (2.94, 0.002) (3, 0.002)
(0, 0.003) (0.06, 0.003) (0.12, 0.003) (0.18, 0.003) ... (2.94, 0.003) (3, 0.003)
.. .. .. .. ... .. ..
. . . . . .
(0, 0.019) (0.06, 0.019) (0.12, 0.019) (0.18, 0.019) ... (2.94, 0.019) (3, 0.019)
(0, 0.02) (0.06, 0.02) (0.12, 0.02) (0.18, 0.02) ... (2.94, 0.02) (3, 0.02)
on which we calculate the sample values for our plot. This is achieved using the meshgrid
command.
>> [X,T] = meshgrid(x,t);
This creates a matrix X containing
0 0.06 0.12 0.18 . . . 2.94 3
0 0.06 0.12 0.18 . . . 2.94 3
0 0.06 0.12 0.18 . . . 2.94 3
0 0.06 0.12 0.18 . . . 2.94 3
.. .. .. .. ... .. ..
. . . . . .
0 0.06 0.12 0.18 . . . 2.94 3
0 0.06 0.12 0.18 . . . 2.94 3
and a matrix T containing
0 0 0 0 ... 0 0
0.001 0.001 0.001 0.001 ... 0.001 0.001
0.002 0.002 0.002 0.002 ... 0.002 0.002
0.003 0.003 0.003 0.003 ... 0.003 0.003
.. .. .. .. ... .. ..
. . . . . .
0.019 0.019 0.019 0.019 ... 0.019 0.019
0.02 0.02 0.02 0.0) ... 0.02 0.02.

45
Note that the overlapping of these two matrices gives the matrix of pairs we want. So these
can readily be used calculate the required sample values of u.
>> U = 5*sin(4*pi*X).*exp(-32*pi*pi*T);
>> surf(x,t,U)
>> title(’Analytic solution’)
>> xlabel(’Distance x’)
>> ylabel(’Time t’)

One can rotate the plot, zoom in, or zoom out in Matlab.

5.5 Approximating solutions to PDEs using pdepe


We will use the pdepe command to solve numerically PDEs of the form
!
 ∂u  ∂u −m ∂ m
 ∂u   ∂u 
c x, t, u, =x x f x, t, u, + s x, t, u, ,
∂x ∂t ∂x ∂x ∂x

where m is either 0, 1, or 2, and c, f , s are functions. Note that the Heat Equation is of this
form, but the Wave Equation is not. For demonstration, let us use Example 5.13 again. To
fit into the form where pdepe is applicable, let us rewrite the PDE ut = 2uxx there as
∂u ∂  0 ∂u 
1· = x−0 x ·2 + 0,
∂t ∂x ∂x
so that
 ∂u   ∂u  ∂u  ∂u 
m = 0, c x, t, u, = 1, f x, t, u, =2 , s x, t, u, = 0.
∂x ∂x ∂x ∂x
Recall that we saw function handles at the end of Section 1.6.

46
• Let us store m in a new variable.

>> m=0;

• The command pdepe takes in c, f and s via one function handle, in exactly that order.

>> pdefun = @(x,t,u,dudx) deal(1,2*dudx,0)

The deal here puts the c, f and s into a form (called a comma-separated list in Matlab)
that is suitable to be fed into pdepe.
• We define a function handle for the initial condition u(x, 0) = 5 sin(4πx) via:

>> icfun = @(x) 5*sin(4*pi*x)

• Assume the x’s of interest satisfy

xL 6 x 6 xR ,

where xL , xR are constants. Instead of taking in boundary conditions as u(xL , t) =


uL (t) and u(xR , t) = uR (t), the command pdepe takes in boundary conditions in the
following more general form for the left and the right boundaries respectively:
 ∂u 
pL (xL , t, uL ) + qL (xL , t) f xL , t, uL , =0 and
∂x x=xL
 ∂u 
pR (xR , t, uR ) + qR (xR , t) f xR , t, uR , = 0,
∂x x=xR

where pL , qL , pR , qR are functions and f is as above.


In our example, we have 0 6 x 6 3, so that

xL = 0 and xR = 3.

Rewrite our boundary conditions u(0, t) = 0 and u(3, t) = 0 into the required form as
 ∂u 
uL + 0 · f xL , t, uL , =0 and
∂x x=xL
 ∂u 
uR + 0 · f xR , t, uR , = 0,
∂x x=xR

so that

pL (xL , t, uL ) = uL , qL (xL , t) = 0, pR (xR , t, uR ) = uR , qR (xR , t) = 0.

The command pdepe takes in pL , qL , pR , qR via one function handle, in exactly that
order.

>> bcfun = @(xl,ul,xr,ur,t) deal(ul,0,ur,0)

We do not need to include f here as this can be inferred from the other inputs of pdepe.
• One then specifies the x values at which we want the solution approximated. In general,
if these are denser, then the approximation is better, but the computation is heavier.

>> xmesh = linspace(0,3,50);

47
This command makes an array (i.e., a row vector) called xmesh with 50 equally spaced
entries starting from 0 and ending at 3. So the array xmesh will contain as entries
approximately
3 3 3 3 3 3
0=0× , 1× , 2× , 3× , ..., 48 × , 49 × = 3.
49 49 49 49 49 49

• Finally, we specify the t values at which we want the solutions approximated.

>> tspan = linspace(0,0.02,20);

Feed everything into pdepe. Let us store the approximated solution in sol.

>> sol = pdepe(m,pdefun,icfun,bcfun,xmesh,tspan)


The approximated solution is returned as a 3-dimensional array, i.e., it is an array in which
each entry has three indices; the (j, k, i)-th entry here is the ith component of approximated
solution at x = the kth entry of xmesh and t = the jth entry of tspan. Since the values of
the solution function u are numbers (not vectors), we only have i = 1 here. Thus we can
turn sol into a more usual 2-dimensional array:
>> uapprox = sol(:,:,1);
Then we can plot the solution using surf as described in Section 5.4.
>> surf(xmesh,tspan,uapprox)
>> title(’Numerical solution computed with 50 mesh points’)
>> xlabel(’Distance x’)
>> ylabel(’Time t’)

48
Compare this with what we got from the analytic solution in Section 5.4.
We can also extract numerical values from the approximated solution. For instance,
suppose we want to get an approximated value for u(1.1, 0.001). We first find an entry in
xmesh that is closest to 1.1, and an entry in tspan that is closest to 0.001.
>> [xmindiff,xindex]=min(abs(xmesh-1.1));
>> [tmindiff,tindex]=min(abs(tspan-0.001));
Then we extract the approximated u value using the indices obtained. Note that the order
of the inputs in the output of pdepe is different from our usual order.
>> uapprox(tindex,xindex)

ans =

3.7483
One may compare this with the value that is found analytically.

>> 5*sin(4*pi*1.1)*exp(-32*pi*pi*0.001)

ans =

3.4675

49
MA1512 Summary

This summary contains all the important information. For full information, see the main
part of the notes. Formulas not listed in this summary (or in the notes/tutorials) may not
be quoted in the examination.

First-order ordinary differential equations


Strategy 1.7 (solving a separable DE). (0) Write it in separable form N (y) y 0 = M (x).
(1) Integrate both sides wrt x to give
Z Z
N (y) dy = M (x) dx + c.

(2) Solve for y.


Reduction to separable form. • y 0 = g(y/x) → let v = y/x. (Strategy 1.9)
• y 0 = f (ax + by + c), where b 6= 0 → let u = ax + by + c. (Strategy 1.11)
Strategy 1.13 (solving a DE of the form y 0 + P (x) y = Q(x)).
R
P (x) dx
(1) Find the integrating factor R(x) = e .
(2) The solution is y = R1 QR dx.
R

Strategy 1.15 (solving a Bernoulli equation, i.e., a DE of the form y 0 + p(x) y = q(x) y n ,
where 0 6= n 6= 1). Let z = y 1−n , then rearrange to apply Strategy 1.13.
Example 1.17 (radioactive decay). Let m(t) denote the mass of the radioactive substance
present at time t. Then
dm
= −km,
dt
where k is a positive constant. Suppose m0 denotes the amount of the substance present at
time 0. Then
m = m0 e−kt .
Here k can be calculated from the half-life t1/2 of the radioactive substance via the formula
ln 2
k= .
t1/2
Example 1.18 (cooling). The rate of change of the temperature T of an object is propor-
tional to the difference between T and the temperature Tenv of the surrounding medium:
dT
= −k(T − Tenv ),
dt
where k is a positive constant. If T0 = T (0), then
T = Tenv + (T0 − Tenv ) e−kt .

50
Example 1.19 (mixing). A tank contains N0 grams of salt dissolved in V litres of water
at time t = 0. Water containing ρ grams of salt per litre is entering the tank at a rate of
a litres per minute, and the well stirred solution is leaving the tank at the same rate. Let
N (t) denotes the amount of salt in the tank at time t. Then
dN a
= ρa − N.
dt V
Solving gives
a
N = ρV + (N0 − ρV )e− V t .
Example 1.20 (Uranium–Thorium Dating). Let U (t) be the number of atoms of uranium-
234 in a particular sample of ancient coral and let T (t) be the number of atoms of thorium-230.
We have U (0) = U0 and T (0) = 0, and
dU
= −kU U ,
dt
dT
= kU U − kT T,
dt
where kU , kT are constants that can be calculated from the half lives of uranium-234 and
thorium-230 as in Example 1.17. Solving the DEs:
kU U0
U = U0 e−kU t e−kU t − e−kT t .

and T =
kT − kU
Dividing gives
T kU
1 − e(kU −kT )t .

=
U kT − kU

Linear second-order ordinary differential equations


Strategy 2.8 (solving a DE of the form y 00 + ay 0 + by = 0, where a, b are constants).
Case 1: a2 − 4b > 0. A general solution is y = c1 eλ1 x + c2 eλ2 x , where λ1 , λ2 are the roots
of the characteristic equation of the DE, and c1 , c2 are constants.
Case 2: a2 − 4b = 0. A general solution is y = (c1 + c2 x)e−ax/2 , where c1 , c2 are constants.
(Note that −a/2 is the (double) root of the characteristic equation of the DE.)
Case p3: a2 − 4b < 0. A general solution is y = e−ax/2 (c1 cos(wx) + c2 sin(wx)), where w =
b − a2 /4 and c1 , c2 are constants. (Note that the solutions to the characteristic
equation of the DE are (−a/2) ± iw.)
Fact 2.12 (formulated informally). A general solution to the nonhomogeneous linear second-
order ODE
y 00 + p(x) y 0 + q(x) y = r(x).
is
y = (general solution to y 00 + p(x) y 0 + q(x) y = 0) + (any particular solution).
Strategy 2.24 (Method of Undetermined Coefficients). Let p(x) be a polynomial of degree n.
Consider the DE

 p(x)
 (polynomial case)
 p(x) ekx

(exponential case)
y 00 + ay 0 + by = `x
 p(x) e cos(mx) (cosine case)


p(x) e`x sin(mx) (sine case)

where a, b, k, `, m are constants. Denote by (♦) the characteristic equation λ2 + aλ + b = 0.

51
polynomial cosine sine
case exponential
Set k = 0. Set k = ` + im.
Consider z 00 + az 0 + bz = p(x) e(`+im)x .
k is not a
Try y = u. Try y = uekx . Try z = ue(`+im)x .
root of (♦)
Take y = Re(z). Take y = Im(z).
00 0
Consider z + az + bz = p(x) e(`+im)x .
k is a simple
Try y = xu. Try y = xuekx . Try z = xue(`+im)x .
root of (♦)
Take y = Re(z). Take y = Im(z).
00 0
Consider z + az + bz = p(x) e(`+im)x .
k is a double
Try y = x2 u. Try y = x2 uekx . Try z = x2 ue(`+im)x .
root of (♦)
Take y = Re(z). Take y = Im(z).
Here u(x) is a polynomial of degree n with undetermined coefficients.
Strategy 2.25 (Method of Variation of Parameters). Given the DE

y 00 + p(x) y 0 + q(x) y = r(x),

(1) find linearly independent solutions y1 , y2 to the corresponding homogeneous DE

y 00 + p(x) y 0 + q(x) y = 0;

(2) then a particular solution is y = uy1 + vy2 , where


Z Z
y2 r y1 r
u=− 0 0 dx and v = dx.
y1 y2 − y1 y2 0
y1 y2 − y10 y2

Strategy 2.28 (solving a DE of the form ẍ = f (x) for ẋ > 0; energy conservation).
d ẋ2 d ẋ2
   
(1) Substitute ẍ = into the DE to get = f (x).
dx 2 dx 2
(2) Integrate both sides with respect to x to get ẋ2 /2 = F (x) + D, where F (x) is an
antiderivative of f (x) with respect to x, and D is a constant.
(3) Proceed to solve for x if needed.

Oscillation
Terminology 3.3(1). Let x = A cos(γt) + B sin(γt) + C, where A, B, C, γ are constants.
Then the angular frequency of x is γ.
Section 3.1.1. Simple harmonic motions are modelled by DE’s of the form ẍ + ω 2 x = 0,
where ω is the natural frequency of the oscillator. General solutions are

x = C cos(ωt) + D sin(ωt) and x = A cos(ωt − δ).

One may assume 0 6 δ < π here.


Sections 3.1.2 and 3.1.3; Tutorial 3 Question 2. A general solution to

ẍ + ω 2 x = B cos(αt)

is (
B
A cos(ωt − δ) + ω 2 −α2 cos(αt), if α 6= ω;
x= B
A cos(ωt − δ) + 2ω t sin(ωt), if α = ω.
B
In the case when α = ω, if x(0) = 0 and ẋ(0) = 0, then x = 2ω t sin(ωt).

52
Definition 3.6. Forced oscillations are modelled by DE’s of the form ẍ + ω 2 x = F (t), where
F (t) represents the external force. Resonance occurs when the frequency of the external
force, represented by F (t) above, is equal to the natural frequency ω of the oscillator.
Example 3.17 (pendulum). When a pendulum is near its stable equilibrium position, its
angular displacement θ exhibits simple harmonic motion with frequency
r
g
ω= ,
L

where g denotes gravitational acceleration, and L is the length of the pendulum.

Models of population
Let N (t) denote the size of the population at time t, and N̂ = N (0). Then

dN
= (B − D)N − E,
dt
where B is the per capita birth rate, D is the per capita death rate, and E is the harvest
rate.

The Malthus Model (Model 3.8): B, D are constants and E = 0.


Then N (t) = N̂ e(B−D)t .
The Logistic Model (Model 3.9): D = sN where B, s are constants, and E = 0.

 0,
 if N̂ = 0;
N (t) = N ∞
 1 + N∞ − 1e−Bt , if N̂ > 0,

where N∞ ..= B/s is called the carrying capacity. Note N → N∞ as t → ∞ unless


N̂ = 0.
The Logistic Model with Harvesting (Model 3.15): D = sN where B, s, E are con-
stants.
• If E > B 2 /4s, then N decreases until it reaches 0.
• If E < B 2 /4s, then
– if 0 < N̂ < β1 , then N decreases until it reaches 0;
– if N̂ > β1 , then N → β2 as t → ∞,
where β1 , β2 are roots of (B − sN )N − E = 0 with β1 < β2 .

dN
F (N ) = dt

N
0 β1 β2

Here β1 is an unstable equilibrium; and


β2 is a stable equilibrium

53
Laplace transform
Table 4.1. Here a, c, n, w are constants, n is an integer, and f (t) is a function.

g(t) G(s) = L(g) hypothesis


1
eat for s > a
s−a
1
1 for s > 0
s
n!
tn for s > 0 n>0
sn+1
s
cos(wt) for s > 0
s2 + w2
w
sin(wt) for s > 0
s2 + w2
δ(t − a) e−as a>0

δ(t) 1

f (t − a) u(t − a) e−as L(f (t)) a>0

ect f (t) F (s − c) for s > a + c F (s) = L(f ) and it is defined for all s > a
n!
ect tn for s > c n>0
(s − c)n+1
s−c
ect cos(wt) for s > c
(s − c)2 + w2
w
ect sin(wt) for s > c
(s − c)2 + w2
f (t) is continuous and
f 0 (t) s L(f ) − f (0)
f 0 (t) is piecewise continuous on [0, ∞)
f (t), f 0 (t) are continuous and
f 00 (t) s2 L(f ) − s f (0) − f 0 (0)
f 00 (t) is piecewise continuous on [0, ∞)
Z t
f (t) is piecewise continuous on [0, ∞) and
f (τ ) dτ L(f )/s for s > 0
0 its Laplace transform exists at all s > 0
2ws
t sin(wt)
(s2 + w2 )2
w2
1 − cos(wt)
s(s + w2 )
2

2
sin2 t 2
s(s + 4)

Strategy 4.22 (solving initial value problems using the Laplace transform). Consider the
initial value problem (
y 00 + ay 0 + by = r(t)
y(0) = k0 , y 0 (0) = k1
where a, b, k0 , k1 are constants and r(t) is a function with Laplace transform R(s).

(1) Take the Laplace transform on both sides of the DE to get, via linearity,

s2 L(y) − s y(0) − y 0 (0) + a s L(y) − y(0) + b L(y) = L(r).


 

54
(2) Substitute in the initial conditions and L(r) = R(s) to get
s2 L(y) − sk0 − k1 + a s L(y) − k0 + b L(y) = R(s).
 

(3) Solve for L(y) to get


R(s) + (s + a)k0 + k1
L(y) = .
s2 + as + b
(4) Reduce the expression above to a sum of terms whose inverse Laplace transforms can
be found. The sum of the inverse Laplace transforms is the solution y(t) to the initial
value problem.
Example 4.27 (parameter reconstruction). Suppose we have a system with a control-
lable component and an observable component related by a law in which some parameters
are not known. We can reconstruct the unknown parameters as follows.
(1) Introduce an impulse into the controllable component.
(2) Via this controllable component and the law, calculate the Laplace transform of the
observable component.
(3) Apply the Laplace transform directly to the observed values.
(4) Equate the coefficients one obtains in (2) and (3).

Partial differential equations


Strategy 5.8 (separation of variables for first-order PDEs). Suppose a first-order PDE has
a solution of the form u(x, y) = X(x) Y (y).
(1) Substitute u = XY and ux = X 0 Y and uy = XY 0 into the PDE.
(2) Rearrange into the form f (x, X, X 0 ) = g(y, Y, Y 0 ).
(3) This implies that f (x, X, X 0 ) = k = g(y, Y, Y 0 ), where k is a constant.
(4) Solve these two ODEs for X(x) and Y (y).
(5) Then u(x, y) = X(x) Y (y) is a solution to the PDE.
Remark 5.9. In the notation above,
uxx (x, y) = X 00 (x) Y (y), uxy (x, y) = X 0 (x) Y 0 (y), uyy (x, y) = X(x) Y 00 (y), ....
A similar strategy applies to higher-order PDEs with 2 independent variables.
Separable solution to the Heat Equation (Equation 5.11). The method of separation
of variables gives the following solutions to the Heat Equation ut = c2 uxx with the boundary
conditions u(0, t) = 0 and u(L, t) = 0:
 nπ    nπ 2 
u(x, t) = B sin x exp − c2 t ,
L L
where B is a constant and n is an integer. One can then fit such solutions to an initial
condition u(x, 0) = f (x), using the Superposition Principle (Theorem 5.5) if needed.
D’Alembert’s solution to the Wave Equation (Equation 5.14). Let f (x) be an odd
function of period 2π. Then
1 
y(t, x) = f (x + ct) + f (x − ct)
2
satisfies the Wave Equation ytt = c2 yxx together with the boundary conditions y(t, 0) = 0
and y(t, π) = 0, and the initial conditions y(0, x) = f (x) and yt (0, x) = 0.

55

You might also like