Differential Equations
Differential Equations
Michaelmas 2014
These notes are not endorsed by the lecturers, and I have modified them (often
significantly) after lectures. They are nowhere near accurate representations of what
was actually lectured, and in particular, all errors are almost surely mine.
Basic calculus
Informal treatment of differentiation as a limit, the chain rule, Leibnitz’s rule, Taylor
series, informal treatment of O and o notation and l’Hôpital’s rule; integration as an
area, fundamental theorem of calculus, integration by substitution and parts. [3]
Informal treatment of partial derivatives, geometrical interpretation, statement (only)
of symmetry of mixed partial derivatives, chain rule, implicit differentiation. Informal
treatment of differentials, including exact differentials. Differentiation of an integral
with respect to a parameter. [2]
1
Contents IA Differential Equations
Contents
0 Introduction 4
1 Differentiation 5
1.1 Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Small o and big O notations . . . . . . . . . . . . . . . . . . . . . 5
1.3 Methods of differentiation . . . . . . . . . . . . . . . . . . . . . . 6
1.4 Taylor’s theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5 L’Hopital’s rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 Integration 8
2.1 Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Methods of integration . . . . . . . . . . . . . . . . . . . . . . . . 9
3 Partial differentiation 11
3.1 Partial differentiation . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2 Chain rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3 Implicit differentiation . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4 Differentiation of an integral wrt parameter in the integrand . . . 13
2
Contents IA Differential Equations
6 Series solutions 45
7 Directional derivative 50
7.1 Gradient vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
7.2 Stationary points . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
7.3 Taylor series for multi-variable functions . . . . . . . . . . . . . . 51
7.4 Classification of stationary points . . . . . . . . . . . . . . . . . . 52
7.5 Contours of f (x, y) . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3
0 Introduction IA Differential Equations
0 Introduction
In this course, it is assumed that students already know how to do calculus.
While we will define all of calculus from scratch, it is there mostly to introduce
the big and small o notation which will be used extensively in this and future
courses (as well as for the sake of completeness). It is impossible for a person
who hasn’t seen calculus before to learn calculus from those few pages.
Calculus is often used to model physical systems. For example, if we know
that the force F = mẍ on a particle at any time t is given by t2 − 1, then we
can write this as
mẍ = t2 − 1.
We can easily integrate this twice with respect to t, and find the position x as a
function of time.
However, often the rules governing a physical system are not like this. Instead,
the force on the particle is more likely to depend on the position of the particle,
instead of what time it is. Hence the actual equation of motion might be
mẍ = x2 − 1.
4
1 Differentiation IA Differential Equations
1 Differentiation
We will first quickly go through basic notions of differentiation and integration.
You should already be familiar with these from A levels or equivalent.
1.1 Differentiation
Definition (Derivative of function). The derivative of a function f (x) with
respect to x, interpreted as the rate of change of f (x) with x, is
df f (x + h) − f (x)
= lim .
dx h→0 h
A function f (x) is differentiable at x if the limit exists (i.e. the left-hand and
right-hand limits are equal).
|h|−|0|
Example. f (x) = |x| is not differentiable at x = 0 as lim h = 1 and
h→0+
|h|−|0|
lim h = −1.
h→0−
d2
Notation. We write df 0 d d d
dx = f (x) = dx f (x). Also, dx dx f (x) = dx2 f (x) =
f 00 (x).
Note that the notation f 0 represents the derivative with respect to the
df
argument. For example, f 0 (2x) = d(2x)
Example.
√ √
– x = o( x) as x → 0 and x = o(x) as x → ∞.
– sin 2x = O(x) as x → 0 as sin θ ≈ θ for small θ.
5
1 Differentiation IA Differential Equations
Proof. We have
f (x0 + h) − f (x0 ) o(h)
f 0 (x0 ) = +
h h
by the definition of the derivative and the small o notation. The result follows.
df dF dg
= .
dx dg dx
dg
Proof. Assuming that dx exists and is therefore finite, we have
6
1 Differentiation IA Differential Equations
h2 00 hn (n)
f (x + h) = f (x) + hf 0 (x) + f (x) + · · · + f (x) + En ,
2! n!
where En = o(hn ) as h → 0. If f (n+1) exists, then En = O(hn+1 ).
Note that this only gives a local approximation around x. This does not
necessarily tell anything about values of f far from x (but sometimes does).
An alternative form of the sum above is:
(x − x0 )n (n)
f (x) = f (x0 ) + (x − x0 )f 0 (x0 ) + · · · + f (x0 ) + En .
n!
When the limit as n → ∞ is taken, the Taylor series of f (x) about the point
x = x0 is obtained.
f (x) f 0 (x)
lim = lim 0 .
x→x0 g(x) x→x0 g (x)
7
2 Integration IA Differential Equations
2 Integration
2.1 Integration
Definition (Integral). An integral is the limit of a sum, e.g.
Z b N
X
f (x) dx = lim f (xn )∆x.
a ∆x→0
n=0
For example, we can take ∆x = b−a N and xn = a + n∆x. Note that an integral
need not be defined with this particular ∆x and xn . The term “integral” simply
refers to any limit of a sum (The usual integrals we use are a special kind known
as Riemann integral, which we will study formally in Analysis I). Pictorially, we
have
y
···
···
x
a x1 x2 x3 xn xn+1 · · · b
The area under the graph from xn to xn+1 is f (xn )∆x + O(∆x2 ). Provided
that f is differentiable, the total area under the graph from a to b is
N
X −1 N
X −1 Z b
2
lim (f (xn )∆x)+N ·O(∆x ) = lim (f (xn )∆x)+O(∆x) = f (x) dx
N →∞ N →∞ a
n=0 n=0
Rx
Theorem (Fundamental Theorem of Calculus). Let F (x) = a
f (t) dt. Then
F 0 (x) = f (x).
Proof.
"Z #
x+h Z x
d 1
F (x) = lim f (t) dt − f (t) dt
dx h→0 h a a
1 x+h
Z
= lim f (t) dt
h→0 h x
1
= lim [f (x)h + O(h2 )]
h→0 h
= f (x)
8
2 Integration IA Differential Equations
Similarly, we have
Z b
d
f (t) dt = −f (x)
dx x
and Z g(x)
d
f (t) dt = f (g(x))g 0 (x).
dx a
R Rx
Notation. We write f (x) dx = f (t) dt, where the unspecified lower limit
gives rise to the constant of integration.
Proof. From the product rule, we have (uv)0 = uv 0 + u0 v. Integrating the whole
expression and rearranging gives the formula above.
9
2 Integration IA Differential Equations
R∞
Example. Consider 0
xe−x dx. Let u = x ad v 0 = e−x . Then u0 = 1 and
v = −e−x . We have
Z ∞ Z ∞
xe−x dx = [−xe−x ]∞
0 + e−x dx
0 0
= 0 + [e−x ]∞
0
=1
= x log x − x + C
10
3 Partial differentiation IA Differential Equations
3 Partial differentiation
3.1 Partial differentiation
So far, we have only considered functions of one variable. If we have a function
of multiple variables, say f (x, y), we can either differentiate it with respect to x
or with respect to y.
∂2f 2
= 2 + y 4 exy
∂x2
∂2f
∂ ∂f 2 2
= = 2yexy + 2xy 3 exy
∂y∂x ∂y ∂x
It is often cumbersome to write out the variables that are kept constant. If
all other variables are being held constant, we simply don’t write them out, and
just say ∂f
∂x .
Another convenient notation is
Notation.
∂f ∂2f
fx = , fxy = .
∂x ∂y∂x
It is important to know how the order works in the second case. The left
hand side should be interpreted as (fx )y . So we first differentiate with respect
to x, and then y. However, in most cases, this is not important, since we have
Theorem. If f has continuous second partial derivatives, then fxy = fyx .
We will not prove this statement and just assume it to be true (since this is
an applied course).
11
3 Partial differentiation IA Differential Equations
The chain rule can also be used for the change of independent variables, e.g.
change to polar coordinates x = x(r, θ), y = y(r, θ). Then
∂f ∂f ∂x ∂f ∂y
= + .
∂θ r ∂x y ∂θ r ∂y x ∂θ r
12
3 Partial differentiation IA Differential Equations
(involves solving quintic equation), the derivatives of z(x, y) can still be found
by differentiating F (x, y, z) = const w.r.t. x holding y constant. e.g.
∂ ∂
(xy 2 + yz 2 + z 5 x) = 5
∂x ∂x
∂z ∂z
y 2 + 2yz + z 5 + 5z 4 x =0
∂x ∂x
∂z y2 + z5
=−
∂x 2yz + 5z 4 x
In general, we can derive the following formula:
F (x, y, z) = c
Proof.
∂F ∂F ∂F
dF = dx + dy + dz
∂x ∂y ∂z
∂F ∂F ∂x ∂F ∂y ∂F ∂z
= + + =0
∂x y ∂x ∂x y ∂y ∂x y ∂z ∂x y
∂F ∂F ∂z
+ =0
∂x ∂z ∂x y
∂z (∂F )/(∂x)
=−
∂x y (∂F )/(∂z)
13
3 Partial differentiation IA Differential Equations
R b(x)
In general, if I(b(x), c(x)) = 0
f (y, c(x))dy, then by the chain rule, we have
Z b
dI ∂I db ∂I dc ∂f
= + = f (b, c)b0 (x) + c0 (x) dy.
dx ∂b dx ∂c dx 0 ∂c
So we obtain
Theorem (Differentiation under the integral sign).
Z b(x) Z b
d ∂f
f (x, c(x)) dx = f (b, c)b0 (x) + c0 (x) dy
dx 0 0 ∂c
14
4 First-order differential equations IA Differential Equations
1
x
O
df ax+h − ax
= lim
dx h→0 h
h
a −1
= ax lim
h→0 h
= λax
= λf (x)
ah − 1
where λ = lim = f 0 (0) = const. So the derivative of an exponential
h→0 h
function is a multiple of the original function. In particular,
Definition (Exponential function). exp(x) = ex is the unique function f satis-
fying f 0 (x) = f (x) and f (0) = 1.
We write the inverse function as ln x or log x.
Then if y = ax = ex ln a , then y 0 = ex ln a ln a = ax ln a. So λ = ln a.
Using this property, we find that the value of e is given by
k
1
e = lim 1+ ≈ 2.718281828 · · · .
k→∞ k
15
4 First-order differential equations IA Differential Equations
dy
= memx
dx
5memx − 3emx = 0
Since this must hold for all values of x, there exists some value x for which
emx 6= 0 and we can divide by emx (note in this case this justification is not
necessary, because emx is never equal to 0. However, we should justify as above
if we are dividing, say, xm ). Thus 5m − 3 = 0 and m = 3/5. So y = e3x/5 is a
solution.
Because the equation is linear and homogeneous, any multiple of a solution
is also a solution. Therefore y = Ae3x/5 is a solution for any value of A.
But is this the most general form of the solution? One can show that an
nth -order linear differential equation has n and only n independent solutions. So
y = Ae3x/5 is indeed the most general solution.
We can determine A by applying a given boundary condition.
16
4 First-order differential equations IA Differential Equations
Discrete equations
Suppose that we are given the equation 5y 0 − 3y = 0 with boundary condition
y = y0 at x = 0. This gives a unique function y. We can approximate this by
considering discrete steps of length h between xn and xn+1 . (Using the simple
Euler numerical scheme,) we can approximate the equation by
yn+1 − yn
5 − 3yn ≈ 0.
h
Rearranging the terms, we have yn+1 ≈ (1 + 35 h)yn . Applying the relation
successively, we have
3
yn = 1 + h yn−1
5
3 3
= 1+ h 1 + h yn−2
5 5
n
3
= 1 + h y0
5
For each given value of x, choose h = x/n, so
n
3
yn = y0 1 + (x/n) .
5
Taking the limit as n → ∞, we have
n
3x/5
y(x) = lim y0 1 + = y0 e3x/5 ,
n→∞ n
in agreement with the solution of the differential equation.
y
discrete approximation
1
x
O x0 x1 x2 x3
Series solution
∞
an xn .
P
We can also try to find a solution in the form of a Taylor Series y =
n=0
We have y 0 = an nxn−1 . Substituting these into our equation
P
5y 0 − 3y = 0
5(xy 0 ) − 3x(y) = 0
X
an (5n − 3x)xn = 0
17
4 First-order differential equations IA Differential Equations
Consider the coefficient of xn : 5nan − 3an−1 = 0. Since this holds for all values
of n, when n = 0, we get 0a0 = 0. This tells that a0 is arbitrary. If n > 0, then
n
3 32 1 3 1
an = an−1 = 2 an−2 = · · · = a0 .
5n 5 n(n − 1) 5 n!
Therefore we have
∞ n
X 3x 1 h i
y = a0 = a0 e3x/5 .
n=0
5 n!
This is the general method of solving forced equations. We first find one
particular solution to the problem, often via educated guesses. Then we solve
the homogeneous equation to get a general complementary solution. Then the
general solution to the full equation is the sum of the particular solution and
the general complementary solution.
18
4 First-order differential equations IA Differential Equations
−ka C + kb C = ka a0
ka
C= a0 .
kb − ka
x
O
19
4 First-order differential equations IA Differential Equations
y 0 + p(x)y = f (x).
20
4 First-order differential equations IA Differential Equations
21
4 First-order differential equations IA Differential Equations
Example.
dy
6y(y − x) + (2x − 3y 2 ) = 0.
dx
We have
P = 2x − 3y 2 , Q = 6y(y − x).
∂P ∂Q
Then ∂y = ∂x = −6y. So the differential form is exact. We now have
∂f ∂f
= 2x − 3y 2 , = 6y 2 − 6xy.
∂x ∂y
Integrating the first equation, we have
f = x2 − 3xy 2 + h(y).
Note that since it was a partial derivative w.r.t. x holding y constant, the
“constant” term can be any function of y. Differentiating the derived f w.r.t y,
we have
∂f
= −6xy + h0 (y).
∂y
Thus h0 (y) = 6y 2 and h(y) = 2y 3 + C, and
f = x2 − 3xy 2 + 2y 3 + C.
Since the original equation was df = 0, we have f = constant. Thus the final
solution is
x2 − 3xy 2 + 3y 3 = C.
22
4 First-order differential equations IA Differential Equations
−1
But can we understand the nature of the family of solutions without solving
the equation? Can we sketch the graph without solving it?
We can spot that y = ±1 are two constant solutions and we can plot them
first. We also note (and mark on our graph) that y 0 = 0 at t = 0 for any y.
Then notice that for t > 0, y 0 > 0 if −1 < y < 1. Otherwise, y 0 < 0.
Now we can find isoclines, which are curves along which dy
dt (i.e. f ) is constant:
t(1 − y 2 ) = D for some constant D. Then y 2 = 1 − D/t. After marking a few
isoclines, can sketch the approximate form of our solution:
y
−1
23
4 First-order differential equations IA Differential Equations
24
4 First-order differential equations IA Differential Equations
If the reaction is in dilute solution, then the reaction rate is proportional to ab.
Thus
dc
= λab
dt
= λ(a0 − c)(b0 − c)
= f (c)
dc
We can plot dt as a function of c, and wlog a0 < b0 .
ċ
c
a0 b0
We can also plot a phase portrait, which is a plot of the dependent variable only,
where arrows show the evolution with time,
c
a0 b0
25
4 First-order differential equations IA Differential Equations
y
O Y
y
O Y
26
4 First-order differential equations IA Differential Equations
xn+1 = λxn (1 − xn ).
This can be derived from the continuous equation with a discrete approximation
yn+1 − yn yn
= ryn 1 −
∆t Y
yn
yn+1 = yn + r∆tyn 1 −
Y
r∆t 2
= (1 + r∆t)yn − yn
Y
r∆t yn
= (1 + r∆t)yn 1 −
1 + r∆t Y
Write
r∆t yn
λ = 1 + r∆t, xn = ,
1 + r∆t Y
then
xn+1 = λxn (1 − xn ).
This is the discrete logistic equation or logistic map.
If λ < 1, then deaths exceed births and the population decays to zero.
xn+1
xn+1 = xn
xn
x0
27
4 First-order differential equations IA Differential Equations
λxn (1 − xn ) = xn
xn [1 − λ(1 − xn )] = 0
1
xn = 0 or xn = 1 −
λ
When 1 < λ < 2, we have
xn+1
xn+1 = xn
xn
x0
1
We see that xn = 0 is an unstable fixed point and xn = 1 − λ is a stable fixed
point.
When 2 < λ < 3, we have
xn+1
xn+1 = xn
xn
x0
28
4 First-order differential equations IA Differential Equations
xn+1
xn+1 = xn
xn
x0
We have the following plot of the stable solutions for different values of λ (plotted
as r in the horizontal axis)
29
5 Second-order differential equations IA Differential Equations
ay 00 + by 0 + cy = f (x).
aλ2 + bλ + c = 0.
In this case there are two solutions to the characteristic equation, giving (in
principle) two complementary functions y1 = eλ1 x and y2 = eλ2 x .
If λ1 and λ2 are distinct, then y1 and y2 are linearly independent and complete
— they form a basis of the solution space. The (most) general complementary
function is
yc = Aeλ1 x + Beλ2 x .
Example. y 00 − 5y 0 + 6y = 0. Try y = eλx . The characteristic equation is
λ2 − 5λ + 6 = 0. Then λ = 2 or 3. So the general solution is y = Ae2x + Be3x .
Note that A and B can be complex constants.
Example (Simple harmonic motion). y 00 + 4y = 0. Try y = eλx . The character-
istic equation is λ2 + 4 = 0, with solutions λ = ±2i. Then our general solution
is y = Ae2ix + Be−2ix . However, if this is in a case of simple harmonic motion
in physics, we want the function to be real (or look real). We can write
30
5 Second-order differential equations IA Differential Equations
Example (Degeneracy). y 00 − 4y 0 + 4y = 0.
Try y = eλx . We have λ2 − 4λ + 4 = 0 and (λ − 2)2 = 0. So λ = 2 or 2. But
e2x and e2x are clearly not linearly independent. We have only managed to find
one basis function of the solution space, but a second order equation has a 2
dimensional solution space. We need to find a second solution.
We can perform detuning. We can separate the two functions found above
from each other by considering y 00 − 4y 0 + (4 − ε2 )y = 0. This turns into the
equation we want to solve as ε → 0. Try y = eλx . We obtain λ2 − 4λ + 4 − ε2 .
The two roots are λ = 2 ± ε. Then
y = Ae(2+ε)x + Be(2−ε)X
= e2x [Aeεx + Be−εx ]
Taking the limit as ε → 0, we use the Taylor expansion of eεx to obtain
y = e2x [(A + B) + εx(A − B) + O(Aε2 , Bε2 )]
We let (A + B) = α and ε(A − B) = β. This is perfectly valid for any non-zero
ε. Then A = 21 (α + βε ) and B = 12 (α − βε ). So we have
y = e2x [α + βx + O(ε)]
→ e2x (α + βx)
In this way, we have derived two separate basis functions. In general, if y1 (x)
is a degenerate complementary function of a linear differential equation with
constant coefficients, then y2 (x) = xy1 (x) is an independent complementary
function.
31
5 Second-order differential equations IA Differential Equations
and we have a solution y, then we can plot a graph of y versus x, and see how y
evolves with x.
However, one problem is that for such an equation, the solution is not just
determined by the initial condition y(x0 ), but also y 0 (x0 ), y 00 (x0 ) etc. So if we
just have a snapshot of the value of y at a particular point x0 , we have completely
no idea how it would evolve in the future.
So how much information do we actually need? At any point x0 , if we
are given the first n − 1 derivatives, i.e. y(x0 ), y 0 (x0 ), · · · , y (n−1) (x0 ), we can
then get the nth derivative and also any higher derivatives from the differential
equation. This means that we know the Taylor series of y about x0 , and it follows
that the solution is uniquely determined by these conditions (note that it takes
considerably more extra work to actually prove rigorously that the solution is
uniquely determined by these initial conditions, but it can be done for sufficiently
sensible f , as will be done in IB Analysis II).
Thus we are led to consider the solution vector
We say such a vector lies in the phase space, which is an n-dimensional space. So
for each x, we thus get a point Y(x) lying in the n-dimensional space. Moreover,
given any point in the phase space, if we view it as the initial conditions for our
differential equation, we get a unique trajectory in the phase space.
Example. Consider y 00 + 4y = 0. Suppose we have an initial condition of
y1 (0) = 1, y10 (0) = 0. Then we can solve the equation to obtain y1 (x) = cos 2x.
Thus the initial solution vector is Y1 (0) = (1, 0), and the trajectory as x varies is
given by Y1 (x) = (cos 2x, −2 sin 2x). Thus as x changes, we trace out an ellipse
in the clockwise direction:
y0
Y1 (x)
Another possible initial condition is y2 (0) = 0, y20 (0) = 2. In this case, we obtain
the solution y(x) = sin 2x, with a solution vector Y2 (x) = (sin 2x, 2 cos 2x).
Note that as vectors, our two initial conditions (1, 0) and (0, 2) are indepen-
dent. Moreover, as x changes, the two solution vectors Y1 (x), Y2 (x) remain
independent. This is an important observation that allows the method of varia-
tion of parameters later on.
32
5 Second-order differential equations IA Differential Equations
In general, for a 2nd order equation, the phase space is a 2-dimensional space,
and we can take the two complementary functions Y1 and Y2 as basis vectors
for the phase space at each particular value of x. Of course, we need the two
solutions to be linearly independent.
Definition (Wronskian). Given a differential equations with solutions y1 , y2 ,
the Wronskian is the determinant
y1 y2
W (x) = 0 .
y1 y20
Definition (Independent solutions). Two solutions y1 (x) and y2 (x) are indepen-
dent solutions of the differential equation if and only if Y1 and Y2 are linearly
independent as vectors in the phase space for some x, i.e. iff the Wronskian is
non-zero for some x.
In our example, we have W (x) = 2 cos2 2x + 2 sin2 2x = 2 6= 0 for all x.
Example. In our earlier example, y1 = e2x and y2 = xe2x . We have
2x
e xe2x 4x 4x
W = 2x 2x = e (1 + 2x − 2x) = e 6= 0.
2x
2e e + 2xe
In both cases, the Wronskian is never zero. Is it possible that it is zero for
some x while non-zero for others? The answer is no.
Theorem (Abel’s Theorem). Given an equation y 00 + p(x)y 0 + q(x)y = 0, either
W = 0 for all x, or W 6= 0 for all x. i.e. iff two solutions are independent for
some particular x, then they are independent for all x.
Proof. If y1 and y2 are both solutions, then
y2 (y100 + py10 + qy1 ) = 0
y1 (y200 + py20 + qy2 ) = 0
Subtracting the two equations, we have
y1 y200 − y2 y100 + p(y1 y20 − y2 y10 ) = 0
Note that W = y1 y20 − y2 y10 and W 0 = y1 y200 + y10 y20 − (y20 y10 + y2 y100 ) = y1 y200 − y2 y100
W 0 + P (x)W = 0
R
W (x) = W0 e− P dx
,
Where W0 = const. Since the exponential function is never zero, either W0 = 0,
in which case W = 0, or W0 6= 0 and W 6= 0 for any value of x.
In general, any linear nth-order homogeneous differential equation can be
written in the form Y0 + AY = 0, a system of first-order
R equations. It can then
be shown that W 0 + tr(A)W = 0, and W = W0 e− tr A dx . So Abel’s theorem
holds.
33
5 Second-order differential equations IA Differential Equations
5.2.1 Guessing
If the forcing terms are simple, we can easily “guess” the form of the particular
integral, as we’ve previously done for first-order equations.
f (x) yp (x)
mx
e Aemx
sin kx
A sin kx + B cos kx
cos kx
polynomial pn (x) qn (x) = an xn + · · · + a1 x + a0
yp = ax + b + ce4x
yp0 = a + 4ce4x
yp00 = 16ce4x
5.2.2 Resonance
Consider ÿ + ω02 y = sin ω0 t. The complementary solution is yc = A sin ω0 t +
B cos w0 t. We notice that the forcing is itself a complementary function. So
if we guess a particular integral yp = C sin ω0 t + D cos ω0 t, we’ll simply find
ÿp + ω02 yp = 0, so we can’t balance the forcing.
This is an example of a simple harmonic oscillator being forced at its natural
frequency.
We can detune our forcing away from the natural frequency, and consider
ÿ + ω02 y = sin ωt with ω 6= ω0 . Try
34
5 Second-order differential equations IA Differential Equations
We have
ÿp = C(−ω 2 sin ωt + ω02 sin ω0 t).
Substituting into the differential equation, we have C(ω02 − ω 2 ) = 1. Then
sin ωt − sin ω0 t
yp = .
ω02 − ω 2
We can simplify this to
2 ω0 + ω ω − ω0
yp = 2 cos t sin t
ω0 − ω 2 2 2
We let ω0 − ω = ∆ω. Then
−2 ∆ω ∆ω
yp = cos ω+ t sin t .
(2ω + ∆ω)∆ω 2 2
yp
yp
∆ω
t sin 2 t
∆ω
− sin 2 t
1
O ∆ω
This oscillation in the amplitude of the cos wave is known as beating. This
happens when the forcing frequency is close to the natural frequency. The
1
wavelength of the sin function has order O( ∆ω ) and cos has wavelength O( ω10 ).
As ∆ω → 0, the wavelength of the beating envelope → ∞ and we just have the
initial linear growth.
Mathematically, since sin θ ≈ θ as θ → 0, as ∆ω → 0, we have
−t
yp → cos ω0 t.
2ω0
In general, if the forcing is a linear combination of complementary functions,
then the particular integral is proportional to t (the independent variable) times
the non-resonant guess.
35
5 Second-order differential equations IA Differential Equations
We then know any particular solution vector can be written in the form
y(x)
Y(x) = ,
y 0 (x)
and our job is to find one solution vector that satisfies the equation. We
presuppose such a solution actually exists, and we will try to find out what it is.
The trick is to pick a convenient basis for this space. Let y1 (x) and y2 (x) be
linearly independent complementary functions of the ODE. Then for each x, the
solution vectors Y1 (x) = (y1 (x), y10 (x)) and Y2 (x) = (y2 (x), y20 (x)) form a basis
of the solution space. So for each particular x, we can find some constants u, v
(depending on x) such that the following equality holds:
36
5 Second-order differential equations IA Differential Equations
Therefore
1 x 1 x
yp = (− cos 4x sin 2x + sin 4x cos 2x − cos 2x) = sin 2x − cos 2x
16 4 16 4
Note that − 14 x cos 2x is what we found previously by detuning, and 1
16 sin 2x is
a complementary function, so the results agree.
It is generally not a good idea to remember the exact formula for the results
we’ve obtained above. Instead, whenever faced with such questions, you should
be able to re-derive the results instead.
Solving by eigenfunctions
d
Note that y = xk is an eigenfunction of x dx . We can try an eigenfunction y = xk .
0
We have y = kx k−1
and thus xy = kx = ky; and y 00 = k(k − 1)xk−2 and
0 k
2 00 k
x y = k(k − 1)x .
Substituting in, we have
ak(k − 1) + bk + c = 0,
which we can solve, in general, to give two roots k1 and k2 , and yc = Axk1 +Bxk2 .
Solving by substitution
Alternatively, we can make a substitution z = ln x. Then we can show that
d2 y dy
a2 2
+ (b − a) + cy = f (ez ).
dz dz
This turns an equidimensional equation into an equation with constant coefficients.
The characteristic equation for solutions in the form y = eλz is of form a2 λ2 +
(b − a)λ + c = 0, which we can rearrange to become aλ(λ − 1) + bλ + c = 0. So
λ = k1 , k2 .
Then the complementary function is yc = Aek1 z + Bek2 z = Axk1 + Bxk2 .
37
5 Second-order differential equations IA Differential Equations
Degenerate solutions
If the roots of the characteristic equation are equal, then yc = {ekz , zekz } =
{xk , xk ln x}. Similarly, if there is a resonant forcing proportional to xk1 (or xk2 ),
then there is a particular integral of the form xk1 ln x.
These results can be easily obtained by considering the substitution method
of solving, and then applying our results from homogeneous linear equations
with constant coefficients.
ak n+2 + bk n+1 + ck n = 0
ak 2 + bk + c = 0
fn ynp
kn Ak n if k 6= k1 , k2
k1n nk1n
np p
An + Bn p−1
+ · · · + Cn + D
yn = yn−1 + yn−2
with y0 = y1 = 1.
We can write this as
yn+2 − yn+1 − yn = 0
We try yn = k n . Then k 2 − k − 1 = 0. Then
k2 − k − 1 = 0
√
1± 5
k=
2
38
5 Second-order differential equations IA Differential Equations
A+B =1
Aϕ1 + Bϕ2 = 1
ϕ1 −ϕ2
We get A = √ and B = √ . So
5 5
n+1
−1
ϕn+1 − ϕn+1 ϕn+1
1 − ϕ1
1 2
yn = √ = √
5 5
M ẍ = F (t) − kx − lẋ.
So we have
l k 1
ẍ + ẋ + x= F (t).
M M M
Note that if we don’t have the damping and p
the forcing, we end uppwith a simple
harmonic motion with angular frequency
p k/M . Write t = τ M/k, where
τ is dimensionless. The timescale M/k is proportional to the period of the
undamped, unforced system (or 1 over its natural frequency). Then we obtain
ẍ + 2κẋ + x = f (τ )
where, ẋ means dx √l F
dτ , κ = 2 kM and f = k .
By this substitution, we are now left with only one parameter κ instead of
the original three (M, l, k).
We will consider different possible cases.
ẍ + 2κẋ + x = 0
We try x = eλτ
λ2 + 2κλ + 1 = 0
p
λ = −κ ± κ2 − 1
= −λ1 , −λ2
39
5 Second-order differential equations IA Differential Equations
Underdamping
√ √
If κ < 1, we have x = e−κτ (A sin 1 − κ2 τ + B cos 1 − κ2 τ ).
2π
The period is √1−κ 2
and its amplitude decays in a characteristic of O( κ1 ).
Note that the damping increases the period. As κ → 1, the oscillation period
→ ∞.
x
Critically damping
If κ = 1, then x = (A + Bτ )e−κτ .
The rise time and decay time are both O( κ1 ) = O(1). So the dimensional rise
p
and decay times are O( M/k).
x
Overdamping
If κ > 1, then x = Ae−λ1 τ + Be−λ2 τ with λ1 < λ2 . Then the decay time is
O(1/λ1 ) and the rise time is O(1/λ2 ).
x
40
5 Second-order differential equations IA Differential Equations
Note that in all cases, it is possible to get a large initial increase in amplitude.
Forcing
In a forced system, the complementary functions typically determine the short-
time transient response, while the particular integral determines the long-time
(asymptotic) response. For example, if f (τ ) = sin τ , then we can guess xp =
1
C sin τ + D cos τ . In this case, it turns out that xp = − 2κ cos τ .
The general solution is thus x = Ae−λ1 τ + Be−λτ − 2κ 1 1
cos τ ∼ − 2κ cos τ as
τ → ∞ since Re(λ1,2 ) > 0.
It is important to note that the forcing response is out of phase with the
forcing.
∆p = I
Assuming that F only acts on a negligible amount of time ε, all that matters to
us is its integral I, i.e. the area under the force curve.
wlog, assume T = 0 for easier mathematical treatment. We can consider a
family of functions D(t; ε) such that
41
5 Second-order differential equations IA Differential Equations
So we can replace the force in our example by ID(t; ε), and then take the limit
as ε → 0.
For example, we can choose
1 2 2
D(t; ε) = √ e−t /ε
ε π
ε=1
ε = 0.5
on the understanding that we can only use its integral properties. For example,
when we write Z ∞
g(x)δ(x) dx,
−∞
we actually mean Z ∞
lim g(x)D(x; ε) dx.
ε→0 −∞
42
5 Second-order differential equations IA Differential Equations
Since we assume that y is well behaved, the second integral is 0. So we are left
with π+
[y 0 ] π2 − = 3
2
So we have
π π
−C cosh − A cosh = 3
2 2
−3
A=C=
2 cosh π2
43
5 Second-order differential equations IA Differential Equations
We have
0
x<0
H(x) = 1 x>0
undefined x = 0
44
6 Series solutions IA Differential Equations
6 Series solutions
Often, it is difficult to solve a differential equation directly. However, we can
attempt to find a Taylor series for the solution.
We will consider equations of the form
i.e. Taylor series about x0 . The solution must be convergent in some neighbour-
hood of x0 .
If x0 is a regular singular point, then there is at least one solution of the form
∞
X
y= an (x − x0 )n+σ
n=0
with a0 6= 0 (to ensure σ is unique). The index σ can be any complex number.
This is called a Frobenius series.
Alternatively, it can be nice to think of the Frobenius series as
∞
X
y = (x − x0 )σ an (x − x0 )n
n=0
σ
= (x − x0 ) f (x)
45
6 Series solutions IA Differential Equations
Ordinary points
Example. Consider (1 − x2 )y 00 − 2xy 0 + 2y = 0. Find a series solution about
x = 0 (which is an
P∞ ordinary point).
We try y = n=0 an xn . First, we write the equation in the form of an
equidimensional equation with polynomial coefficients by multiplying both sides
by x2 . This little trick will make subsequent calculations slightly nicer. We
obtain
So
−1
a2k = a0 ,
2k − 1
a2k+1 = 0.
So we obtain
x2 x4 x6
y = a0 [1 − − − − · · · ] + a1 x
1 3 5
x 1+x
= a0 1 − ln + a1 x
2 1−x
Notice the logarithmic behaviour near x = ±1 which are regular singular points.
46
6 Series solutions IA Differential Equations
2σ(2σ − 1)a0 = 0.
47
6 Series solutions IA Differential Equations
Resonance of solutions
Note that the indicial equation has two roots σ1 , σ2 . Consider the two different
cases:
with σ2 ≥ σ1 .
In this case, σ = σ1 will not give a valid solution, as we will later see.
Instead, the other solution is (usually) in the form
∞
X
y2 = ln(x − x0 )y1 + bn (x − x0 )n .
n=0
This form arises from resonance between the two solutions. But if the
resonance somehow avoids itself, we can possibly end up with two regular
Frobenius series solutions.
We can substitute this form of solution into the differential equation to
determine bn .
with a0 6= 0. We obtain
X
an xn+σ [(n + σ)(n + σ − 1) − x] = 0.
48
6 Series solutions IA Differential Equations
σ(σ − 1) = 0.
(n + 1)nan = an−1 .
So
x x2 x3
y1 = a0 x 1 + + + + ··· .
2 12 144
When σ = 0, we obtain
n(n − 1)an = an−1 .
When n = 0, 0 · a0 = 0 and a0 is arbitrary. When n = 1, 0 · a1 = a0 . However,
a0 6= 0 by our initial constraint. Contradiction. So there is no solution in this
form (If we ignore the constraint that a0 6= 0, we know that a0 is arbitrary. But
this gives exactly the same solution we found previously with σ = 1)
The other solution is thus in the form
∞
X
y2 = y1 ln x + bn xn .
n=0
49
7 Directional derivative IA Differential Equations
7 Directional derivative
7.1 Gradient vector
Consider a function f (x, y) and a displacement ds = (dx, dy). The change in
f (x, y) during that displacement is
∂f ∂f
df = dx + dy
∂x ∂y
We can also write this as
∂f ∂f
df = (dx, dy) · ,
∂x ∂y
= ds · ∇f
where ∇f = gradf = ∂f , ∂f
∂x ∂y are the Cartesian components of the gradient of
f.
We write ds = ŝ ds, where |ŝ| = 1. Then
Definition (Directional derivative). The directional derivative of f in the
direction of ŝ is
df
= ŝ · ∇f.
ds
Definition (Gradient vector). The gradient vector ∇f is defined as the vector
that satisfies
df
= ŝ · ∇f.
ds
Officially, we take this to be the definition of ∇f . Then ∇f = ∂f , ∂f
∂x ∂y is a
theorem that can be proved from this definition.
We know that the directional derivative is given by
df
= ŝ · ∇f = |∇f | cos θ
ds
where θ is the angle between the displacement and ∇f . Then when cos θ is
maximized, df
ds = |∇f |. So we know that
(i) ∇f has magnitude equal to the maximum rate of change of f (x, y) in the
xy plane.
50
7 Directional derivative IA Differential Equations
51
7 Directional derivative IA Differential Equations
and
In conclusion, we have
52
7 Directional derivative IA Differential Equations
fx = 12x2 − 12y
fy = −12x + 2y + 10
fxx = 24x
fxy = −12
fyy = 2
53
7 Directional derivative IA Differential Equations
The first equation gives y = x2 . Substituting into the second equation, we obtain
x = 1, 5 and y = 1, 25 respectively. So the stationary points are (1,1) and (5, 25)
24 −12
To classify them, first consider (1, 1). Our Hessian matrix H = .
−12 2
Our signature is |H1 | = 24 and |H2 | = −96. Since we have a +, − signature, this
an indefinite case and it is a saddle
point.
120 −12
At (5, 25), H = So |H1 | = 120 and |H2 | = 240 − 144 = 96.
−12 2
Since the signature is +, +, it is a minimum.
To draw the contours, we draw what the contours look like near the stationary
points, and then try to join them together, noting that contours cross only at
saddles.
30
(5,25)
20
10
(1,1)
0
-10
-2 0 2 4 6
54
8 Systems of differential equations IA Differential Equations
so
ÿ1 − (a + d)ẏ1 + (ad − bc)y1 = bf2 − df1 + f˙1
and we know how to solve this. However, this actually complicates the equation.
So what we usually do is the other way round: if we have a high-order
equation, we can do this to change it to a system of first-order equations:
y
If ÿ + aẏ + by = f , write y1 = y and y2 = ẏ. Then let Y =
ẏ
Our system of equations becomes
ẏ1 = y2
ẏ2 = f − ay2 − by1
or
0 1 y1 0
Ẏ = .
−b −a y2 f
Now consider the general equation
Ẏ = M Y + F
Ẏ − M Y = F
55
8 Systems of differential equations IA Differential Equations
Example.
−4
24 4 t
Ẏ = Y+ e
−2
1 1
−4 − λ 24
The characteristic equation of M is
= 0, which gives (λ +
1 −2 − λ
8)(λ − 2) = 0 and λ = 2, −8.
When λ = 2, v satisfies
−6 24 v1
= 0,
1 −4 v2
4
and we obtain v1 = .
1
When λ = −8, we have
4 24 v1
= 0,
1 6 v2
−6
and v2 = . So the complementary solution is
1
4 2t −6 −8t
Y=A e +B e
1 1
v1 = (4, 1)
y1
v2 = (−6, 1)
56
8 Systems of differential equations IA Differential Equations
y2
v1 = (4, 1)
y1
v2 = (−6, 1)
v1 = (4, 1)
v2 = (−6, 1)
(ii) If λ1 , λ2 are real with λ1 λ2 > 0. wlog assume |λ1 | ≥ |λ2 |. Then the phase
portrait is
57
8 Systems of differential equations IA Differential Equations
v2
v1
If both λ1 , λ2 < 0, then the arrows point towards the intersection and we
say there is a stable node. If both are positive, they point outwards and
there is an unstable node.
(iii) If λ1 , λ2 are complex conjugates, then we obtain a spiral
ẋ = f (x, y)
ẏ = g(x, y)
It can be difficult to solve the equations, but we can learn a lot about phase-space
trajectories of these solutions by studying the equilibria and their stability.
Definition (Equilibrium point). An equilibrium point is a point in which ẋ =
ẏ = 0 at x0 = (x0 , y0 ).
Clearly this occurs when f (x0 , y0 ) = g(x0 , y0 ) = 0. We solve these simultane-
ously for x0 , y0 .
58
8 Systems of differential equations IA Differential Equations
ξ˙ = f (x0 + ξ, y0 + η)
∂f ∂f
= f (x0 , y0 ) + ξ (x0 ) + η (x0 ) + O(ξ 2 , η 2 )
∂x ∂y
So if ξ, η 1,
ξ˙
fx fy ξ
=
η̇ gx gy η
This is a linear system, and we can determine its character from the eigensolu-
tions.
Example. (Population dynamics - predator-prey system) Suppose that there
are x prey and y predators. Then we have the following for the prey:
ẋ = αx
|{z} − βx2 − γxy .
|{z} |{z}
births - deaths natural competition killed by predators
ẏ = εxy − δy
|{z} |{z}
birth/survival rate natural death rate
ẋ = 8x − 2x2 − 2xy
ẏ = xy − y
ξ˙ = (4 + ξ)(8 − 8 − 2ξ − 2η)
= −8ξ − 8η − 2ξ 2 − 2ξη
η̇ = η(4 + ξ − 1)
= 3η + ξη
59
8 Systems of differential equations IA Differential Equations
ξ˙
−8 −8 ξ
=
η̇ 0 3 η
The eigenvalues are −8 and 3, with associated eigenvectors (1, 0), (8, −11).
0
0 1 2 3 4 5
We see that (1, 3) is a stable solution in which almost all solutions spiral towards.
60
9 Partial differential equations (PDEs) IA Differential Equations
contours of y
x
O
61
9 Partial differential equations (PDEs) IA Differential Equations
Note that as we move up the time axis, we are simply taking the t = 0 solution
and translating it to the left.
The paths we’ve identified are called the “characteristics” of the wave equation.
In this particular example, y is constant along the characteristics (because the
equation is unforced).
We usually have initial conditions e.g.
y(x, 0) = x2 − 3
y = (x + ct)2 − 3.
∂2y 2
2∂ y
= c .
∂t2 ∂x2
This is the second-order wave equation, and is often known as the “hyperbolic
equation” because the form resembles that of a hyperbola (which has the form
x2 − b2 y 2 = 0). However, the differential equation has no connections to
hyperbolae whatsoever.
62
9 Partial differential equations (PDEs) IA Differential Equations
Suppose that ρ(x) is the mass per unit length of a string. Then the restoring
∂2y ∂2y
force on the string ma = ρ 2 is proportional to the second derivative . So
∂t ∂x2
we obtain this wave equation.
(Why is it proportional to the second derivative? It certainly cannot be
proportional to y, because we get no force if we just move the whole string
upwards. It also cannot be proportional to ∂y/∂x: if we have a straight slope,
then the force pulling upwards is the same as the force pulling downwards, and
we should have no force. We have a force only if the string is curved, and
curvature is measured by the second derivative)
To solve the equation, suppose that c is constant. Then we can write
∂2y 2
2∂ y
2
− c 2
=0
∂t ∂x
∂ ∂ ∂ ∂
+c −c y=0
∂t ∂x ∂t ∂x
63
9 Partial differential equations (PDEs) IA Differential Equations
So, overall,
1 1 1
y= +
2 1 + (x + ct)2 1 + (x − ct)2
Where we substituted x for x + ct and x − ct in f and g respectively.
∂T ∂2T
=κ 2
∂t ∂x
This is known as a parabolic PDE (parabolic because it resembles y = ax2 ).
Here T (x, t) is the temperature and the constant κ is the diffusivity.
Example. Consider an infinitely long bar heated at one end (x = 0). Note
in general the “velocity” ∂T /∂t is proportional to curvature ∂ 2 T /∂x2 , while in
the wave equation, it is the “acceleration” that is proportional to curvature.
In this case, instead of oscillatory, the diffusion equation is dissipative and all
unevenness simply decays away. (
0 t<0
Suppose T (x, 0) = 0, T (0, t) = H(t) = , and T (x, t) → 0 as
1 t>0
x → ∞. In words, this says that the rod is initially cool (at temperature 0), and
then the end is heated up on one end after t = 0.
There is a similarity solution of the diffusion equation valid on an infinite
x
domain (or our semi-infinite domain) in which T (x, t) = θ(η), where η = √ .
2 κt
64
9 Partial differential equations (PDEs) IA Differential Equations
This is an ordinary differential equation for θ(η). This can be seen as a first-
order equation for θ0 with non-constant coefficients. Use the integrating factor
2
µ = exp( 2η dη) = eη . So
R
2
(eη θ0 )0 = 0
2
θ0 = Ae−η
Z η
2
θ=A e−u du + B
0
= α erf(η) + B
Rη 2
where erf(η) = √2
π
e−u du from statistics, and erf(η) → 1 as η → ∞.
0
√
Now look at the boundary and initial conditions, (recall η = x/(2 κt)) and
express them in terms of η. As x → 0, we have η → 0. So θ = 1 at η = 0.
Also, if x → ∞, t → 0+ , then η → ∞. So θ → 0 as η → ∞.
So θ(0) = 1 ⇒ B = 1. Colloquially, θ(∞) = 0 gives α = −1. So θ = 1−erf(η).
This is also sometimes written as erfc(η), the error function complement of η. So
x
T = erfc √
2 κt
65
9 Partial differential equations (PDEs) IA Differential Equations
x
√
with decay length O( κt). √ So if we actually have a finite bar of length L, we
can treat it as infinite if κt L, or t L2 /κ
66