11Ma2aPracLectures1 5
11Ma2aPracLectures1 5
∗
Based on notes taken in class by Stephanie Laga, with a few added comments
1
Lecture 1
A differential equation, often shortened as diffEq or just DE, is an equa-
tion involving the derivatives of a function y = f (t), where t is an independent
variable. Here the dependent variable y could be just a single variable, which
is what we will consider at the beginning, or a vector (y1 , . . . , yn ) in n-space;
our main focus will be on n = 2, 3. The diffEq is called ordinary, and written
as ODE, unless the equation contains partial derivatives, in which is case it is
called a partial differential equation, abbreviated as PDE. In this course we
will deal mostly with ODE’s, though some partial derivatives will at times
be used in their analysis. The order of an ODE is the highest order of the
derivatives which appear.
Examples:
dv
F = ma, a = , t ≥ 0.
dt
It is a first order ODE in v, the velocity.
2
Moreover, v = dx
dt
, where x is the position, so the force is F = m ddt2x ,
and we obtain a second order ODE in the independent variable x.
Suppose you want to solve F = m dv
dt
, with fixed mass m. One can
break up into three cases:
dv
⇒ = 0 =⇒ v = v0 , the initial value :
dt
This is the principle of inertia: If there is no force acting on a
particle, it stays its course, i.e., remains at rest (for v0 = 0), or it
moves at constant non-zero speed (when v0 ̸= 0); the sign of v0
gives the direction.
(ii) F = c ̸= 0 (constant non-zero force)
e.g. c = mg: the case of a “freely falling particle”
dv
F =m = mg =⇒ v = gt + v0
dt
2
dx t2
v= =⇒ x = g + v0 t + x0 ,
dt 2
where x0 is the initial position.
(iii) F non-constant:
F = mg − γv
dv
m = mg − γv Two forces : ↓ mg ↑ drag = −γv, γ : constant
dt ( )
mg
= −γ v −
γ
mg dv
Stationary point: v = ⇔ =0
γ dt
To get non-stationary solutions v ̸= mgγ
, divide by v − mg
γ
̸= 0 and
obtain
1 dv γ
=−
(v − γ ) dt
mg
m
∫ ( ) ∫
1 dv γ
⇒ dt = − dt + C
v − mgγ
dt m
Want to find a function φ(v) such that
dφ 1
=
dv v − mg
γ
3
So, including the stationary solution as well, we get
γ
v= mg
γ
+ Be− m t ,
P = ±Ae−λt
At t = 0, P0 = B, so
P = P0 e−λt .
5
Lecture 2
Recall that an ordinary diffEQ is an equation involving derivatives of a
function y = f (x) of an independent variable x. We write
dm y
y (m) = , the m-th derivative
dxm
dy
Convention: y (1) = dx , y (0) = y.
Such an ODE is of order n if the highest derivative which occurs in the
equation is
dn y
,
dxn
so an ODE (in one independent variable x) of order n looks like
F (y, y ′ ) = y ′ , g(x) = ax + b
∫
Solution : y = (ax + b)dx + c
2
Get y = a x2 + bx + c, c = y0 = y(0)
6
Definition: An ODE F (y, y (1) , . . . , y (n) ) = g(x) is linear iff each term in
F is linear. In particular, if we scale y to ay, then each term should multiply
by a. This means F cannot have terms like y 2 or yy ′ . For the latter case, note
that when y 7→ ay, y ′ also gets scaled by a, and so yy ′ becomes multiplied by
a2 . (We say yy ′ is a quadratic term.) Note that the coefficients of a linear
equation can be functions of the independent variable x.
Examples of other non-linear equations:
(a) yy ′′ = x + 2
(b) y ′′ + 3y ′ + 4y 3 = 0
(c) y ′′ = sin y
The last equation is non-linear as sin(y1 +y2 ) ̸= sin(y1 )+sin(y2 ). Note also
that the first order equation (y ′ )2 − 2y = 3 mentioned earlier is non-linear.
A linear ODE of order n looks like
an (x) ̸= 0
A simple but commonly occurring example of a linear ODE is
d2 y
= ct,
dt2
where c is a constant. This is the case, for instance, in Hooke’s law for
springs, where y is the displacement and c = −k/m, k: spring constant and
m: mass.
A linear ODE has constant coefficients iff it is of the form
a0 y + a1 y ′ + a2 y ′′ + · · · + an y n = g(x)
y ′ = ay + b.
7
If y1 is a solution, then (cy1 )′ = cy1′ = c(ay1 + b) = a(cy1 ) + bc. Thus cy1
won’t be a solution (for c ̸= 1), except when b = 0; RHS is 0.
Same argument for order m:
Scaling gives new solutions to (∗) iff g(x) is identically 0.
Definition A linear ODE is homogeneous iff it’s of the form
Suppose we have a linear ODE (∗). If y1 and y2 are two different solutions,
then y1 − y2 is a solution of the homogeneous cousin of (∗), namely
We may rewrite it as
a0 g
y ′ = −b0 (x)y + h(x), b0 = , h= .
a1 a1
Suppose y1 = u1 (x) and y2 = u2 (x) are both solutions of
y ′ = ay + b.
( )
We wrote the right hand side (RHS) as a y + ab and first noted that there
is a unique stationary point given by y = − ab . Moreover, when y ̸= f racba,
we may divide both sides by y + ab and get
dy
dx
b
= a.
y+ a
8
Integrating both sides relative to x,
∫ ∫
dy/dx
dx = adx + c.
y + ab
If u(x) = ln |y + ab |, then du
dy
= 1
b , and by chain rule,
y+
a
du 1 dy
= b
· .
dx y+ a
dx
Thus
b
ln |y + | = ax + c
a
b
⇒ |y + | = eax+c = Aeax
a
b
⇒ y = − + Aeax
a
When x = 0, y = y0 = − ab ± A, and consequently, the final solution is
y = − ab + (y0 + ab )eax .
If we had started with the stationary solution, i.e., with y0 = − ab , y will for-
ever remain the same as y0 . Otherwise, the term involving eax will dominate
for large ax.
9
Lecture 3
First Order ODE:
dy
= f (t, y)
dt
- Very hard in general to solve explicitly in closed form.
Things to do:
1) To get a qualitative picture, look at the slope field (or the gradient
field), obtained by drawing short arrows in the direction of y ′ (t) at
a grid of points in the (t, y)-plane. One calculates the slope (of the
arrows) as f (ti , yi ) at the selected points (ti , yi ). Of importance are the
equilibrium points, which are the points where dy/dt = 0; these are
the stationary points.
dy
− φ(y) = 0 (*)
dt
the equilibrium solution is given by φ(y) = 0. When φ(y) ̸= 0, (∗)
becomes
1 dy
φ(y) dt
= 1.
Integrating, ∫ ( )
1 dy
dt = t + c
φ(y) dt
1
We can solve this if we can integrate φ(y)
dy/dt.
10
For example, when φ(y) = y + a
∫
dy/dt
dt = t + c
y+a
| {z }
ln |y+a|
By chain rule,
d dy/dt
ln |y + a| = ,
dt y+a
and exponentiating both sides, we obtain |y + a| = et+c , an thus, for
a non-stationary solution, y = −a + (±ec )et . Clearly, ±ec can take on
any non-zero value B. The final solution is
y = −a + Bet ,
11
5) The case of Leibniz:
u′ (t) = u(t)h(t),
d u′ (t)
(ln |u(t)|) = = h(t),
dt u(t)
12
implying that we may choose u such that
∫
ln|u(t)| = h(t)dt + c,
so that ∫
h(t)dt
u(t) = Be ,
for a constant B, which we may take to be 1. (We just need to find
some factor u which works.) In other words,
∫
∫
− h(t)dt
y=e eh(t)dt g(t)dt + c
(∗) y ′ = t2 − ty.
y ′ + ty = t2 ,
so that
h(t) = t, and g(t) = t2
in the notation above. Then
∫ ∫ 1 2
h(t)dt tdt
u(t) = e =e = e2t ,
so that ∫
− 12 t2 1 2
y = e e 2 t · t2 dt + c,
13
Mathematical Models
Given a physical (chemical, biological, financial, . . . ) system, do the fol-
lowing:
II) Try to solve the equation analytically, and many practical situations
are described by differential equations;
III) Check if the solutions obtained from the model are compatible with
experimental observation.
where M (t) is the amount of money in your account at time t, I the interest
rate (which could depend on t, but often taken to be fixed), ∆t a small incre-
ment in time, and g(t) the amount deposited minus the amount withdrawn
between t and t + ∆t. Subtracting M (t) from both sides and dividing by ∆t,
one gets
M (t + ∆t) − M (t)
= I(t)M (t) + g(t).
∆t
If one imagines that ∆t is very small, one can approximate this equation by
the first order, linear ODE
dM
= I(t)M + g(t).
dt
It has constant coefficients iff I(t) and g(t) are independent of t.
14
Lecture 4
Exact Equations
We have been looking at 1st order ODEs with one independent variable,
say x, and one dependent variable, say y, given by:
dy
= f (x, y).
dx
It is said to be a linear ODE if f (x, y) is linear in y, i.e., of the form
a(x)y + b(x), and the ODE is linear with constant coefficients when a, b
are independent of x. Note that we do not require f to be linear in both x
and y for the ODE to be linear.
Often f (x, y) is a quotient of functions such as
x2 sin y
.
y
(Clearly, the ODE is not linear in this example.)
We can clear denominators, and rewrite the ODE in the form
M (x, y) + N (x, y)y ′ = 0 (*)
Often it is not easy to solve for y explicitly in terms of x, but it may be
possible to express the solution as a relation ψ(x, y) = 0.
Example:
dy
(x + 1) − yy ′ = 0, y ′ = .
dx
Since yy ′ = 12 d(y 2 )/dx, we can show that the solutions are given by the points
on the hyperbola
(x + 1)2 − y 2 = c,
for an undetermined constant c. (Strictly speaking, in the degenerate case
c = 0, this describes the union of two lines with equations y = x + 1 and
y = −x − 1; moreover, for c ̸= 0, there is no (real) y if (x + 1)2 < c.) The
solutions can be written as
√ √
y = (x + 1)2 − c or y = − (x + 1)2 − c.
This is a simple example. In general, it is not so easy to solve for y precisely.
We may only be able to express y implicitly by writing the solution as a
relation between x and y.
15
Another Example:
dy
(ex sin y − 2y sin x) + (ex cos y + 2 cos x + sin y) =0
dx
The general solution will turn out to be
In this case, the general solution will simply be given by the relation
ψ(x, y) = c,
∂ψ ∂ψ
ψx = , ψy =
∂x ∂y
16
In other words, since φ(x) = y = ψx and φ′ (x) = dy/dx,
dψ
= ψx + ψy y ′ . (1)
dx
This holds in general for ψ(x, φ(x)), not just in this example.
Let’s go back to (∗). We now realize that it can be rewritten as an exact
equation (∗∗) IFF we have
M = ψx , and N = ψy ,
for some function ψ(x, y). We need even a better criterion for the equation
(∗) to be exact, because in general we don’t know how to guess ψ(x, y). Some
times one can guess ψ, however!
Example:
(x + y) + (x − y) y ′ = 0.
| {z } | {z }
M (x,y) N (x,y)
Put
ψ(x, y) = (x2 + 2xy − y 2 )/2,
which is an easy guess! Then
ψx = x + y = M, and ψy = x − y = N.
∂ 2ψ ∂ 2ψ
ψxy = , ψyx = ,
∂x∂y ∂y∂x
assuming ψ is twice differentiable.
Recall from Ma1a: If ψ is twice differentiable and has continuous 2nd
partial derivatives, denoted ψ ∈ C 2 , then
ψxy = ψyx .
17
Given (∗), we want to know if ∃ψ(x, y) and ψx = M and ψy = N . Sup-
pose M, N are continuously differentiable (i.e., M, N ∈ C 1 ). Then ψyx =
My , ψxy = Nx , so My = Nx .
Thus we have the following
Theorem Suppose M (x, y), N (x, y) are continuously differentiable in an
open rectangular region (a, b) × (c, d)in R2 . Then,
(∗∗) My = Nx .
Then ψx = Qx = M
Equation (1) implies ψy = Qy + g ′ (y). This should be N (x, y), so we need
g ′ (y) = N − Qy . ∫
⇒ g(y) = (N − Qy )dy + c1 ,
for a constant c1 (which we may take to be zero, as we want just any ψ which
works), and the integration over y is performed keeping x constant. Thus
∫ ∫
ψ(x, y) = M (x, y)dx + (N (x, y) − Qy ) dy.
18
dy
Summary: Given M (x, y) + N (x, y) dx = 0 with M, N continuously differ-
entiable, we can express it as an exact equation dψ
dx
= 0 iff we have My = Nx .
In such a case, the general solution is given by ψ(x, y) = c. If we are given
an initial condition, say y = b when x = 0, then we can solve for c.
19
Lecture 5
Integrating Factors
Last time we looked at exact equations and obtained solutions of the form
ψ(x, y) = 0.
x2 y 2
+ 2 = 1.
a2 b
Differentiating with respect to x,
2x 2y
(∗) M (x, y) + N (x, y)y ′ = 0, with M= 2
, N = 2.
a b
We also learned of a procedure to find ψ when the given equation (∗) is exact.
The idea is to find a function ψ(x, y) such that ψx = M and ψy = N . There
are two stages in finding a candidate ψ:
(i) ψ(x, y) = Q(x, y)
∫ + g(y),
with Q(x, y) = M (x, y)dx (integration with y fixed);
∫
(ii) g(y) = (N (x, y) − Qy )dy (integration with x fixed)
Remark:
1) The exactness condition on (∗) is not always satisfied. However, one
has exactness if M is purely a function of x (i.e., independent of y)
and (simultaneously) N is purely a function of y (i.e., independent of
x), since in this case My = 0 = Nx ; this is the case of separation of
variables.
20
=⇒ My = ex cos y − 2 sin x ∗∗, Nx = ex cos y − 2 sin y.
Hence (∗) is exact. (All this makes sense because M and N are continuously
differentiable.) To find ψ, first solve for Q, then for g, and take ψ(x, y) =
Q(x, y) + g(y):
∫
Q(x, y) = M (x, y)dx keeping y fixed in the integral
= ex sin y + 2y cos x
ψ(x, y) = Q(x, y) + g(y)
Qy = ex cos y + 2 cos x
N = ex cos y + 2 cos x + 3 sin y
∫
g(y) = N (x, y) − Q(y)dy keeping x fixed
∫
= 3 sin ydy = −3 cos y + c
Take
ψ(x, y) = Q(x, y) + (y)
= ex sin y + 2y cos x − 3 cos y
Solution of (∗): ex sin y + 2y cos x − 3 cos y = c.
If we had the initial condition y = 0 when x = 0, then we can solve for c:
e0 sin(0) + 2(0) cos(0) − 3 cos(0) = c so c = −3.
M = (x + 2) sin y, so My = (x + 2) cos y
N = x cos y, so Nx = cos y, and My ̸= Nx .
Sometimes, it may happen that the given ODE (∗) is not exact, but it
becomes exact after multiplying it by an integrating factor. In other words,
dy
given M (x, y) + N (x, y) dx = 0,
My ̸= Nx , but for some u(t) we may have
21
(uM )y = (uN )x
In other words, the modified ODE
dy
u(x, y)M (x, y) + u(x, y)(N x, y) =0
dx
is an exact equation. Note:
Even when such a u exists for (∗), it’s not easy to find. Here are a few tricks
to try (which work sometimes):
1) Take u to be purely a function of x. Then we need
−ux N = u(Nx − My )
If non zero,
−u′ (x) Nx − My
=
u(x) N
Nx −My
For this it is necessary and sufficient that N
is independent of y
Nx −My u′ (x)
Suppose N
= −φ(x) then = φx
u(x)
∫
⇒ ln |u(x)| = φ(x)dx
∫
⇒ u(x) = Be φ(x)dx
; can take B = 1.
Example:
(x + 2) sin y dx + x cos ydy = 0
| {z } | {z }
M N
22
2) Same as 1) with x and y switched. Try to choose u to be just a function
of y
uy M = u(Nx − My ),
u′ (y) Nx −My
i.e., u(y)
= M
needs to be a function of y alone.
dy
3) Given M (x, y) + N (x, y) dx = 0 with My ̸= Nx , see if you can find a
u(x, y) st uN is independent of x. In this case, we only have to solve
(uM )y = (uN )x , whence (uM )y = 0.
Example:
(∗) x2 y 3 + x(1 + y 2 ) y ′ = 0.
|{z} | {z }
M (x,y) N (x,y)
My = 3x2 y 2 , Nx = 1 + y 2 =⇒ My ̸= Nx .
So we need, for xy ̸= 0,
h(y) = y −3 .
u(x, y) = y −3 (1 + y 2 ).
This can be used to get all the non-equilibrium solutions. (The equi-
librium solutions occur when xy = 0.)
23