Professional Documents
Culture Documents
Spring 2019/20
Outline
Notation
For ordinary differential equations
y is called the ‘dependent’ variable, and x is the ‘independent’
variable.
We may use other notation for derivatives, e.g.
y 00 (x) + 4y 0 (x) + 6y (x) = 0 is an equivalent form of equation (2).
We may change the letters used for variables, such as an ODE for
d2 x dx
x as a function of t, e.g. 3 2 + 5 + 7x = 0.
dt dt
When the independent variable is time t, derivatives are often
denoted by dots: 3ẍ(t) + 5ẋ(t) + 7x(t) = 0.
ODEs arise quite naturally in a wide variety of practical engineering
situations. Some examples of this now follow...
6.1.1 Motion of a mass on a spring in a resistive
medium
x =0 x = X (t)
dX
Resistive force: −k1 × (speed) = −k1 ,
dt
Spring restoring force: −k2 × (extension) = −k2 (X − l),
where k1 and k2 are constants and l is the natural length of the spring.
Newton’s Second Law (F = ma = mẍ) ⇒
dX d 2X
−k1 − k2 (X − l) = m 2
dt dt
d 2X dX
i.e. m 2 + k1 + k2 X = k2 l
dt dt
L C R
I(t)
V(t)
Z
dI 1
Kirchhoff’s Law: L + IR + I(t)dt = V (t)
dt C
d 2I dI 1 dV
Differentiating gives L 2 + R + I =
dt dt C dt
— an ODE for I(t).
6.1.3 Newton’s law of cooling
The rate of decrease of temperature of a body is proportional to the
temperature difference between the body and the surrounding air
dT dT
that is, ∝ T − T0 or, equivalently = −k(T − T0 )
dt dt
for some constant k.
dV
F = ma ⇒ mg − R = m
dt
mg dV
⇒ m = mg − kV 2 for V = V (t).
dt
We can rewrite this in other ways: • for y as a function of t, using y (t)
dy d 2y
2
V = ⇒ m dt 2 = mg − k dy dt ;
dt
• for V as a function of y, that is V (y),
d dy d d dV
using = =V implies mV = mg − kV 2
dt dt dy dy dy
6.2 Order of an ODE
The order of an ODE is the highest derivative occurring in the
equation. For example,
d 2y dy
+ 6 − 10y = 0 is second-order;
dx 2 dx
dy
3 + 4y 3 x = 0 is first-order.
dx
We only consider first and second-order ODEs in this module, though
some of the ideas carry over to higher-order examples.
6.3 Linearity
dy
= f (x, y)
dx
dy
= g(x)h(y ).
dx
1 dy
We can then rearrange this into the form = g(x).
h(y) dx
Hence, the solution is obtained by
Z Z
1
dy = g(x) dx + c,
h(y )
Example 6.5.3
dy
Find the general solution of = y 1/2 x.
dx
Solution. Z Z
dy 1 dy
= y 2x ⇒ 1
= xdx + c.
dx y 2
Hence,
1/2 x2 1/2 1 2
2y = + c or y = x +A ,
2 4
where A = 2c is an arbitrary constant. Finally,
1 2 2
y= x +A .
16
Example 6.5.4
dy
Find the general solution of (1 − x 2 ) = −2xe−y
dx
Solution This is separable - divide by (1 − x 2 ) and multiply by ey .
In this case, when the variables have been separated, we get
−2x
Z Z
ey dy = dx + c.
(1 − x 2 )
Hence, ey = ln |1 − x 2 | + c
or, if you prefer,
2
y = ln ln |1 − x | + c .
− cos y = sin x + c.
The strategy here is to find a function r (x) such that when we multiply
our linear ODE by r (x) the left-hand-side becomes an exact derivative:
dy d dy dr
r (x)+ r (x)p(x)y (x) = [r (x)y(x)] = r (x) + y(x).
dx dx dx dx
Therefore the function r (x) must satisfy the separable ODE
Z Z Z
dr 1
= r (x)p(x) ⇒ dr = p(x) dx ⇒ ln(r (x)) = p(x) dx
dx r (x)
Thus R
Integrating factor (I.F.) r (x) = e p(x) dx .
6.6.2 Solution of First order linear equations
Multiplying our first order linear equation by this integrating factor r (x)
we have
d
[r (x)y(x)] = r (x)q(x).
dx
Now integrate to find that
Z
r (x)y(x) = r (x)q(x) dx + C
Example 6.6.1
dy
Find the general solution of − 2y = ex .
dx
Solution. We identify p(x) = −2, q(x) = ex
R R
The integrating factor is e p(x)dx = e− 2dx = e−2x
dy
Hence, e−2x − 2y = e−2x ex = e−x .
dx
Then Z
d −2x
ye = e−x ⇒ ye −2x
= e−x dx + c
dx
⇒ ye−2x = −e−x + c ⇒ y = −e−x e2x + ce2x .
⇒ y = −ex + ce2x for arbitrary constant c.
Example 6.6.2
dy
Find the general solution of + 2y = 3x 3
x
dx
dy dy 2
Solution: Divide by the coefficient of to obtain + y = 3x 2 (1)
dx dx x
Identify p(x) = 2/x and hence find the integrating factor:
2 2
= e2 ln |x| = e(ln x ) = x 2 .
R R
p(x)dx dx
e =e x
Multiply (1) by IF = x 2 :
2 dy 4 d 2
x + 2xy = 3x ⇒ x y = 3x 4
dx dx
3 5 3 3 c
⇒ x 2y = x +c ⇒ y= x + 2.
5 5 x
We have seen that the solution for a first-order ODE involves one
unknown constant. This is called the general solution.
Generally, the number of unknown constants in the general
solution equals the order of the ODE.
To determine a specific solution, we must find these constants.
We therefore need as many conditions on the solution as there
are unknown constants.
These conditions usually involve the value of the unknown
function and/or some of its derivatives at certain points.
For a first-order equation we only need one such condition, and
this is called a boundary condition.
If the independent variable in the ODE is time t, then we normally
specify the condition at time t = 0. Then the boundary condition is
called an initial condition.
Example 6.7.1
dy x
Find the general solution of + y =x
dx 1 + x2
and the solution subject to the boundary condition y(1) = 0.
Solution. This is a linear ODE with
x
p(x) = , q(x) = x.
1 + x2
Hence we find the integrating factor
Z Z
x 1 2
2
1/2
p(x)dx = dx = ln 1 + x = ln 1 + x .
1 + x2 2
1/2 1/2
ln(1+x 2 )
R
p(x)dx 2
⇒ e =e = 1+x .
The effect of multiplying the ODE by the integrating factor is to put the
equation into the form
1/2
d 2
2
1/2
y 1+x =x 1+x
dx
Z
2
1/2
2
1/2 1 2
3/2
⇒ y 1+x = x 1+x dx + c = 1+x + c,
3
1 −1/2
2 2
⇒ y= 1+x +c 1+x .
3
This is the general solution to the ODE.
Suppose that we insist that y = 0 when x = 1, i.e. y (1) = 0. Then
1 1
(1 + 1) + c(1 + 1)− 2 = 0,
3
√
2 2
which can be solved to give the value of c in this case as c=− .
3
The solution for y is then
√ −1/2
1 2 2
y= 1 + x2 − 1+x 2
.
3 3
Example 6.7.2
Find the general solution of dy 2 −y
dt = 3t e
and the solution subject to the initial condition y(0) = 1.
Solution This is a separable ODE where we can write
Z Z
ey dy = 3t 2 dt
1 = ln(c) ⇒ c = e.
Example 6.7.3
The rate of increase of the concentration of a chemical is proportional
to the concentration at that time.
Experiment shows that the concentration doubles in four hours.
If the initial concentration is c0 , what is the concentration after five
hours?
dc
Solution: Let c(t) denote the concentration at time t. Then = kc,
dt
for some constant k. This is a separable ODE and so we obtain
Z Z
1
dc = kdt + ln |A| ⇒ ln |c(t)| = kt + ln |A| ⇒ c(t) = Aekt
c
where A is a constant.
Using c = Aekt and the initial condition
c = c0 at t = 0 ⇒ c0 = Ae0 = A,
gives
c(t) = c0 ekt .
At t = 4 (in units of hours), c = 2c0 . So
2c0 = c0 e4k
or
1
k= ln 2 ⇒ c(t) = c0 e(t/4) ln 2 .
4
If t = 5,
5/4
c(5) = c0 e(5/4) ln 2 = c0 eln 2 = 25/4 c0 .
Example 6.7.4
Find the curve in the (x, y ) plane that passes through (0,3) and whose
tangent line at a point (x, y ) has slope 2x/y 2 .
Solution
dy dy 2x
Since the slope of the curve y = y (x) is , we have = 2
dx dx y
and since it must pass through (0,3)
Z we have Zthe condition y (0) = 3.
Separating the variables, we find y 2 dy = 2xdx + c
1 3
where c is an arbitrary constant. Hence 3y = x 2 + c.
1 3
y(0) = 3 ⇒ 3 =0+c so c = 9.
3
Finally
1 3 1
3
y = x2 + 9 or y = 3x + 27 2
.
3
6.8 Exact equations
6.8.1 Motivation
Consider the first order ODE
dy 2x + y 2 dy
=− ⇒ (2x + y 2 ) + 2xy = 0.
dx 2xy dx
∂F ∂F
= 2x + y 2 and = 2xy.
∂x ∂y
∂F ∂F dy
Therefore the original ODE can be written as + = 0.
∂x ∂y dx
Recall also the Total derivative (see section 5.10):
d ∂F dx ∂F dy ∂F ∂F dy
(F (x, y(x))) = + = + .
dx ∂x dx ∂y dx ∂x ∂y dx
So we can see that the ODE can be written as the exact derivative
d
(F (x, y(x))) = 0
dx
Integrating this gives
F (x, y(x)) = c
for an arbitrary constant c.
x 2 + xy 2 = c.
6.8.2 Exact equations
dy
We can express any first order ODE, = f (x, y) in the form
dx
dy
M(x, y) + N(x, y) = 0, (6.1)
dx
M(x, y)
by setting f (x, y) = − .
N(x, y)
If we can find a function F (x, y) such that
∂F ∂F
M(x, y) = and N(x, y) = (6.2)
∂x ∂y
∂F ∂F dy
then the ODE (6.1) can be written as + = 0, or
∂x ∂y dx
d
(F (x, y(x))) = 0 ⇒ F (x, y(x)) = c
dx
for arbitrary constant c.
We say that (6.1) is an exact equation.
∂2F ∂2F ∂M ∂N
= ⇒ = .
∂y∂x ∂x∂y ∂y ∂x
∂F ∂F
M(x, y) = and N(x, y) =
∂x ∂y
d
3 Finally, since (*) is equivalent to (F (x, y(x))) = 0, the solution
dx
is
F (x, y) = c for an arbitrary constant c.
Example 6.8.1
dy
Find the general solution of the ODE y +x = 0.
dx
Solution:
1
∂M ∂N
M(x, y) = y , N(x, y) = x ⇒ =1= .
∂y ∂x
Therefore the equation is exact.
2 Now compute F (x, y):
∂F ∂F
= M(x, y) = y and = N(x, y) = x.
∂x ∂y
∂F
=y ⇒ F = xy + g(y).
∂x
∂F ∂
=x ⇒ (xy + g(y )) = x + g 0 (y) = x
∂y ∂y
⇒ g 0 (y) = 0 or g(y ) = const.
So F (x, y ) = xy + constant.
3 Therefore the general solution is xy = constant.
Example 6.8.2
x 2 dy 2x
Find the general solution of the ODE − 2 + = 0,
y dx y
and also the particular solution which satisfies y(2) = 1.
Solution:
2x x2 ∂M 2x ∂N
1 M(x, y ) = , N(x, y ) = − 2 . ⇒ = − 2 =
y y ∂y y ∂x
so the equation is exact.
2x x2
2 Compute F (x, y): Fx = M = and Fy = N = − 2 .
y y
∂F 2x x2
= ⇒ F = + g(y ).
∂x y y
x2 ∂ x2 x2 x2
∂F 0
=− 2 ⇒ + g(y) = − 2 + g (y) = − 2 .
∂y y ∂y y y y
Hence, g 0 (y) = 0 ⇒ g(y) = constant.
Then F (x, y ) = x 2 /y + constant.
3 Therefore the general solution is x 2 /y = constant.
4 Finally, use the boundary condition to find the particular solution:
22
y = 1 when x = 2 so = constant. Therefore the solution
1
satisfying the boundary condition is
x 2 /y = 4.
Example 6.8.3
dy
2
Check the solvability and, if possible, solve 2xy + x − 1 = 0.
dx
Solution:
∂M ∂N
1 M(x, y ) = 2xy, N(x, y) = x 2 − 1 ⇒ = 2x =
∂y ∂x
so the equation is exact.
2 Now compute F (x, y):
∂F ∂F
= M(x, y) = 2xy and = N(x, y) = x 2 − 1.
∂x ∂y
∂F
= 2xy ⇒ F = x 2 y + g(y ).
∂x
∂F
Therefore = x 2 + g 0 (y ) = x 2 − 1
∂y
⇒ g 0 (y) = −1, implying g(y) = −y + const.
Then F (x, y) = x 2 y − y + const.
3 The general solution of the ODE is x 2 y − y = c.
c
This can be re-expressed in the form y = 2 .
x −1