Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Differential Equations
Copyright Brian G. Higgins (2004)
1. Introduction
In this notebook we present an introductory review of the properties and solutions of 1st order ordinary differential equations. In section 2 we introduce the concept of 1-parameter family of level curves which we show in later
sections forms the building block for understanding the solution properties of 1st order ODEs. We then review
some basic definitions regarding ordinary differential equations, and then proceed with the main discussion on
several methods for solving ODEs. The first method we consider is for linear differential equations which can be
solved by finding an integrating factor. The next section introduces a solution method based on separation of
variables that can be used to solve nonlinear 1st order ODES. Each section has numerous worked out examples.
These notes do not discuss exact ODEs or the use of homogeneous functions to solve first order ODES
2. Level Curves
Concept 1:
A function g Hx, yL = c defines a one-parameter family of plane curves called level curves.
Let T Hx, yL define the temperature of a plane body. Then the function defined by T Hx, yL = c (where c is a
constant) represents a curve in the x - y plane of constant temperature called an isotherm. Each value of the
constant c defines a different isotherm. Isotherms defined by T Hx, yL = c are also called level curves.
g Hx, yL = y2 + 3 xy + x2 = c
(1)
FirstOrderODEs_Primer.nb
Solution
For each value of c we need to find the Hx, yL pair that satisfies
g Hx, yL = y2 + 3 xy + x2 = c
Since g Hx, yL = c defines a surface of height c, we need to determine a contour plot of this function. This can
be readily done in Mathematica using the ContourPlot function. Here is the code that achieves the desired result.
ContourPlot@y2 + 3 x y + x2 ,
8x, -3, 3<, 8y, -3, 3<, ContourShading -> False,
PlotPoints -> 100, ContourStyle -> RGBColor@0, 0, 1DD;
3
-1
-2
-3
-3
-2
-1
It is more instructive to plot particular level curves. For example, suppose we want the level curves for
c = 8-3, -2, -1, 0, 1, 2, 3<. This can be done in ContourPlot by specifying the option
Contours. The result is shown below
FirstOrderODEs_Primer.nb
-1
-2
-3
-3
-2
-1
Note that in this example the point H0, 0L lies at the intersection of two contours. It follows from the function
g Hx, yL that H0, 0L must lie on the contour for c = 0. Indeed, one can show that for each value of c 0 there
are two level curves that satisfy g Hx, yL = c. We show this in the next plot for c = -2
FirstOrderODEs_Primer.nb
-1
-2
-3
Thus when c = 0, there is a an Hx, yL pair, namely, H0, 0L that is common to both level curves. The implication of this point will be discussed later.
-3
-2
-1
g Hx, yL = y2 - 2 y - x3 - 2 x = c
Determine the value of c such that a curve passes through the point x = 0, y = -1.5. Plot the level curve and
show its relationship to the family
Solution
For x = 0, y = -1.5 we have
Thus c = 5.25
Here is a plot of the level curve
FirstOrderODEs_Primer.nb
-2
-4
-3
-2
-1
We can display this level curve within the family as follows. First we construct contours for
c = 8-5, -3, -1, 0, 1, 3, 6, 7<. We plot these using ContourPlot but suppress output using the option
DisplayFunction->Identity.
Then we combine the two plots using the function Show, with the option DisplayFunction->$DisplayFunction
plt2 = ContourPlot@y2 - 2 y - x3 - 2 x, 8x, -3, 3<,
8y, -4, 4<, Contours -> 8-5, -3, -1, 0, 1, 3, 6, 7<,
ContourShading -> False, PlotPoints -> 100,
ContourStyle -> RGBColor@1, 0, .5D, DisplayFunction -> IdentityD;
FirstOrderODEs_Primer.nb
-2
-4
-1
Concept 2:
dx = F Hx, yL
where
g
g -1
F Hx, yL = -
x H
y L
y
dx +
x = 0
dx = -
x H
y L
-1
FirstOrderODEs_Primer.nb
3. Definitions
This section discusses some general concepts for ordinary differential equations. These concepts apply to first
order equations as well as n-th order equations. The student should study and understand the concepts in this
section before preceding with subsequent sections.
An differential equation is an equation involving a function and its derivatives. If y HxL is a function of x, then
the most general form for a ordinary differential equation involving y HxL is
F Hx, y, y ', y ' ', yH3L , , yHnL L = 0
to represent the nth derivative of y HxL. In the above equation y is referred to the dependent variable, and x the
independent variable. Differential equation involving two or more independent variables are called partial
differential equations. In this module we will be focussing on ordinary differential equations(ODEs).
d u
F Ht, u, uH2L L = 0, where F Ht, u, uH2L L =
+ u - Log HtL
dt 2
2
du
H
dt L
+ t2 u = 0
d y
dy
+ 3 t
dt + 4 y = Sin HtL
dt3
3
d y
dy
F Ht, y, y ', yH3L L
+ 3 t
dt + 4 y - Sin HtL
dt3
3
(iv)
d y
dy
2
4 x2
+ 3 x
dx + xy = y Sin HxL
dx2
2
In this example the dependent variable is y, and the independent variable is x. Also
d y
dy
2
F Hx, y, y ', yH3L L 4 x2
+ 3 x
dx + xy - y Sin HxL
dx2
2
In this example the dependent variable is u and the independent variables are t and x.
FirstOrderODEs_Primer.nb
Concept 3:
The order of a differential equation is the highest derivative of the dependent variable appearing in the equation.
d u
+ u - Log HtL = 0
dt2
2
du
H
dt L
+ t2 u = 0
d u
du
d u
I
M + H
+ t3 u = e-t
dt L
dt2
dt 3
2
d u
du
4 x2
+ 3 x
dx + xu = u Sin HxL
dx2
2
u
2 u
u
t + x
x2 = Cos HtL
2
Solution
2
d u
(i) The order is 2, since the highest derivative of u is
dt 2
du
(ii) The order is 1, since the highest derivative of u is
dt . Note that even though the derivative is raised to the
third power, the order of the differential equation is still determined by the highest derivative.
3
d u
(iii) The order is 3, since the highest derivative is
dt 3
2
d u
(iv) The order is 2, since the highest derivative is
dx 2
(v) In this case we have a partial differential equation. It is first order in the t derivative, and second order in the x
derivative.
Concept 4:
A variable y HxL is said to be of nth degree if it has the form yn HxL. Likewise, a derivative of y is of nth
degree if it has the form
dy n
H
dx L
Higher order derivatives of nth degree are given by
d2 y n
dp y n
I
M , H
L
dx p
dx2
FirstOrderODEs_Primer.nb
Concept 4:
An ordinary differential equation (ODE)
F Hx, y, y ', y ' ', yH3L , , yHnL L = 0
is said to be linear if
(i) the dependent variable and its derivatives are all of 1st degree, and
(ii) the coefficients multiplying the derivatives are at most a function of the independent variable,x.
The most general form for a nth order linear ODE is
dn y
dn-1 y
dy
an HxL
+ an-1 HxL
+ + a1 HxL
dx + a0 HxL = f HxL
dxn
dxt n-1
In this module we will use either x or t to denote the independent variable. The dependent variable may be
denoted by y, u or w. The alphabetic choice for a variable is often dictated by personal factors, or to conform to
physical variables, e.g. time is often denoted by the variable t. Thus it is imperative the student understand how to
determine which are the independent and dependent variables in any given problem. We will see shortly that
calculus allows us to often to interchange the dependent and independent variables. That is we can write y HxL or
x HyL.
d u
+ u - Log HtL = 0
dt2
2
du
H
dt L
+ t2 u = 0
d u
du
d u
I
M + H
+ t3 u = e-t
dt L
dt2
dt 3
2
d u
du
4 x2
+ 3 x
dx + xu = u Sin HxL
dx2
2
Solution
(i) This is a linear second order ODE with variable coefficients
(ii) This is a nonlinear first order ODE with variable coefficients. Note that the first derivative is of degree 2.
(iii) This is a nonlinear third order ODE with variable coefficients. Note that the second derivative is of degree
du
two and the coefficient multiplying the third derivative depends on u, (actually
dt )
(iv) This is a linear, second order ODE with variable coefficients.
10
FirstOrderODEs_Primer.nb
Concept 6:
dx =
2 Hy-1L
2
d y
+9t = 0
dt 2
2 ce
(iii) y HtL =
t is a solution to
1+ce2
2t
dy
dt = y H2 - yL
Solution
(i) In this case g Hx, yL yields y as an implicit function of t. Differentiating g Hx, tL with respect to x gives
dy
dy
2
2 y
dx - 2
dt = 3 x - 2 x
dy
Solving for
dx gives
dy
3 x +2
dx =
2 Hy-1L
2
Note that g Hx, y, cL = 0 defines a 1-parameter family of level curves that according to Concept 2 must
satisfy
dy
g
g
3 x +2
dx = -
x H
y L =
2 Hy-1L
-1
= -9 c1 Cos H3 tL - 9 c2 Sin H3 tL
dt 2
2
d y
Thus
d y
= -9 c1 Cos H3 tL - 9 c2 Sin H3 tL
dt 2
FirstOrderODEs_Primer.nb
2
11
d y
Thus
2 ce2 t =
2 t L -
dt =
H1+ce
2t 2
2t 2
H1+ce
2t
2t
H1+ce
2t
Now from
2 ce
y HtL =
t
1+ce2
2t
dy
Substituting for c in the expression found for
dt gives
dy
y
y H2-yL
4 ce
1
= 4
2 = 4
2t 2
dt =
2-y y
4 = y H2 - yL
H1+ce
2t
H1+
2-y L
Note we can deduce from the differential equation that y = 2, and y = 0 are also solutions to the ODE. These
solutions can be found as special cases of the 1-parameter family y HtL = 2 ce2 t 1 + ce2 t when c = 0, and
when t -> , respectively. This behavior of multiple solutions occurs because the ODE is nonlinear . We will
discuss this point later.
Concept 7:
The
solution
y HtL = 0
is
called
the
trivial
solution
to
the
F Ht, y, y ', y ' ', yH3L , , yHnL L = 0 if on substitution it satisfies the differential equation.
ODE:
Concept 8:
Suppose every solution of a nth order ODE in a given interval is determined from
g Ht, y; c1 , c2 , , cn L = 0
by suitable choice of the parameters ci . Then we say that
g Ht, y; c1 , c2 , , cn L = 0
is the general solution of the nth order ODE:
F Ht, y, y ', y ' ', yH3L , , yHnL L = 0
Concept 8 implies that the general solution of a nth order ODE is a n-parameter family. Although this is strictly
true for a nth order linear ODEs, the situation may be more complicated for nonlinear ODEs. The following
example illustrates this point.
12
FirstOrderODEs_Primer.nb
Solution
dy
Let us differentiate y HtL = c1 t + c1 3 . This gives
dt = c1 . Thus substituting into the ODE gives
c1 t + c1 3 = c1 t + c1 3
4
3
which shows that y HtL = c1 t + c1 3 is a solution. Next consider y2 = -
27 t . Differentiating gives
2
dy
dy
12
2 t
2
2 y
dt = -
27 t fl
dt = -
9
y
2t
8
t
y = -
9 y -
981
y3
t6 =
t6 =
t6
927 t -
27 2
27 2
272
4
3
Hence y2 = -
27 t is also a solution. Note however that this solution is not contained within the one-parameter
solution y HtL = c1 t + c1 3 . It is called a singular solution
Concept 9:
Suppose that g Ht, y; c1 , c2 , , cn L = 0 is a general solution of a nth order ODE. We say that the function
yp HtL is a particular solution of the nth order ODE if it satisfies the ODE and is free of any parameters.
Clearly, a particular solution can always be found by choosing specific values for the parameters in the general
solution.
FirstOrderODEs_Primer.nb
d x
+ 9 y = e2 t
dt 2
1
2t
Show that xp HtL =
is a particular solution.
13 e
Solution
To be a particular solution it must satisfy the ODE and have no free parameters. By direct differentiation we can
show
4
9
2t
2t
+
= e2 t
13 e
13 e
and since it does not have any free parameters xp HtL is a particular solution to the ODE.
The equation is said to be homogeneous if the function f HxL vanishes. If f HxL does not vanish, the equation is
said to be inhomogeneous. In our analysis we will assume that the functions a1 HxL, a0 HxL, and f HxL are
continuous over some finite interval a < x < b.
It is helpful to use the concepts and definitions from Section 3 and apply them to first order ODEs:
(a) A solution to a 1st order ODE is a relationship between the dependent variable y and the independent variable
x, free of any derivatives, which satisfies the ODE identically.
(b) We can classify solutions to 1st order ODEs in the following ways:
(i) A general solution of a 1st order ODE is a solution that involves one arbitrary constant (See Concept 8).
(ii) A particular solution of a 1st order ODE is found from the general solution by assigning a value to the arbitrary constant in the general solution (See Concept 9).
(iii) A singular solution of a 1st order ODE is a solution that cannot be derived from the general solution by
assigning a value to the arbitrary constant in the general solution.
(iv) An equilibrium solution of a 1st order ODE is given by y = constant, which satisfies the ODE.
(c) Two additional definitions related to existence and uniqueness of solutions to ODEs will be studied in this
section.
(i) The question of existence addresses whether a ODE has a solution.
(ii) The question of uniqueness addresses whether the ODE has more than one solution for a given set of
parameters.
The solution of linear homogeneous 1st order ODE is given by the following concept:
13
14
FirstOrderODEs_Primer.nb
Concept 10:
If a1 HxL,and a0 HxL are continuous over some interval a < x < b, then the general solution to the linear
homogeneous 1st order ODE :
dy
a1 HxL
dx + a0 HxL y = 0
is given by
a0 HxL
y HxL = C Exp H-
xL
a1 HxL
where C is an arbitrary constant
dy
a1 HxL
dx + a0 HxL y = 0
is
a0 HtL
y HxL = C Exp H-
tL
a1 HtL
we proceed as follows. First, we rearrange the equation by separating variables: we collect terms involving y on
one side, and terms involving x are collected on the other side of the equation:
dy
a0 HxL
dx
y = -
a1 HxL
a0 HxL
a0 HxL
1
x fl Ln H y L = -
x + C '
y y = -
a1 HxL
a1 HxL
Thus
a0 HxL
y HxL = Exp@C 'D Exp H-
x L
a1 HxL
a0 HxL
y HxL = Exp@C 'D Exp H-
x L
a1 HxL
So finally we have
a0 HxL
y HxL = C Exp H-
x L
a1 HxL
When the 1st order ODE is inhomogeneous, the general solution can be found by the method of integrating
factors. We motivate the method by solving a simple inhomogeneous ODE, given in Example 4.2.
FirstOrderODEs_Primer.nb
15
dx +2y = 4
Solution
First, we rearrange the terms so that
dy
d x = 2 H2 - yL
fl
dy
1
= 2
d x
H2-yL
dy
d
1
dx 8Ln H 2 - y L< = -
2-y
dx
dx 8ln H 2 - y L< = -2
Integrating gives
Ln H 2 - y L = -2 x + C '
or
y HxL = 2 + C E-2 x
g Hx, yL = H2 - yL E2 x = C
Thus the general solution to a 1st order ODE defines a family of level curves (See Section 2), also known as
integral curves. Here is a plot of the level curves for select values of C.
16
FirstOrderODEs_Primer.nb
y2
0
0
3
x
For large x, the general solution asymptotes toward y = 2. Note that in our derivation we assumed that y 2, as
1 H2 - yL = .
If we reverse the steps leading to the solution given in Example 4.2, we can devise a method for solving linear
inhomogeneous 1st order ODEs.
(i) First, we multiple the original ODE in Example 4.2 by E2 x . This gives
dy
2x
H
= 4 E2 x
dx + 2 yL E
d
2x
L = 4 E2 x
dx HyE
FirstOrderODEs_Primer.nb
17
The function m HxL E2 x that we multiplied the original ODE with is called an integrating factor. Our goal then
is to devise a general method for finding integrating factors m HxL. The following concept addresses that goal:
Concept 11:
The general solution to a linear 1st order ODE :
dy
dx + p HxL y = f HxL
is given by
1
y HxL =
m HxL 9 m HxL f HxL x + C=
where
m HxL = E
p HxL x
Thus it follows from Concept 11 that once an integrating factor m HxL is found (which entails integrating the
function p HxL), the general solution can be found by doing one more additional integration. The proof of Concept 11 is given in Example 4.3.
dy
d
m HxL H
dx + p HxL yL
dx Hm HxL yL
If we can find such a function then the original ODE can be written as
d
18
FirstOrderODEs_Primer.nb
dy
d
m HxL H
dx + p HxL yL
dx Hm HxL yL
is true if
dm
dx = m p
p HxL x
The constant of integration C can be set equal to unity without loss of generality since the ODE for m HxL is
homogeneous
Concept 12:
The Initial value problem for 1st order linear ODEs is given by:
dy
dx + p HxL y = f HxL
The solution to the initial value problem must satisfy both the ODE and the initial condition. The initial condition
selects a level curve from the family of level curves that satisfy the ODE.
dy
(ii) H1 - x2 L
dx = 7 xy
dy
-3 x
(iii) x
dx + H3 x + 1L y = 2 E
FirstOrderODEs_Primer.nb
19
Solution
1
1
1
5x
3x
y HxL =
+ C< =
+ CE-2 x
E2 x 8
5 E
5 E
x
p HxL = -7
H1-x2
L , f HxL = 0
= Hx2 - 1L
y =
C
72
2
H3 x+1L
2
-3 x .
(iii) In this case p HxL =
x and f HxL =
x E
The integrating factor is
H3 x+1L
1
m HxL = ExpA
x xE = ExpA 3 x +
x xE
= Exp@3 x + Ln HxLD = x E3 x
Thus the general solution is
1
2
1
-3 x
y HxL =
9 xE3 x
x + C= =
82 x + C<
x E
xE3 x
xE3 x
C
-3 x
= 2 E-3 x +
x E
20
FirstOrderODEs_Primer.nb
dy
dy
3
(i) x
dx - 3 y = 2 x , y H1L = 3 (ii) Hx + 1L
dx + 2 y = Ln HxL, y H1L = 3
dy
(iii) Cos2 HxL
dx + 2 y = 1, y H0L = 1
Solution
3
2
(i) In this problem p HxL = -
x and f HxL = 2 x . The integrating factor is:
3
-3
m HxL = ExpA-
x xE = Exp@-3 Ln HxLD = x
= x3 82 Ln HxL + C<
The initial condition gives
Ln HxL
2
(ii) For this problem p HxL =
and f HxL =
Hx+1L
Hx+1L
The integrating factor is
1
m HxL = ExpA2
xE = Exp@2 Ln H2 x + 1LD
Hx+1L
= Hx + 1L2
The general solution is
Ln HxL
1
y HxL =
9 Hx + 1L2
x + C=
Hx+1L
Hx+1L2
1
x
1
=
9-x -
4 +
2 x H2 + xL Ln HxL + C=
Hx+1L2
2
1
1
1
y H1L 3 =
4 8-1 -
4 + C< fl C = 13
4
1
x
1
1
y HxL =
9-x -
4 +
2 x H2 + xL Ln HxL + 13
4 =
Hx+1L2
2
=
9-x -
+
x H2 + xL Ln HxL + C=
4
2
Hx+1L2
Next we apply the initial condition:
FirstOrderODEs_Primer.nb
y H1L 3 =
8-1 -
21
+ C< fl C = 13
1
x
1
1
y HxL =
9-x -
4 +
2 x H2 + xL Ln HxL + 13
4 =
Hx+1L2
2
2
1
(iii) For this case p HxL =
and f HxL =
Cos2 HxL
Cos 2 HxL
1
1
1
0L + C< fl C =
y H0L 1 =
E0L 8
2 E
2
1
1
1
2 Tan HxL
y HxL = =
+
HxL 8
E2 Tan
2 E
2 <
In Example 4.5 we showed how to determine the constant of integration from the specified initial condition.
Because the general solution represented as g Hx, yL = C, is in general a nonlinear function of x and y , there is
usually not a one-to-one relation between the initial conditions Hxi , yi L and the value of C. In other words,
different initial conditions may yield the same value of C., as we show and discussed in Example 4.6.
dx +
x = 2
Plot the level curves for the values of C determined from the initial condition.
22
FirstOrderODEs_Primer.nb
Solution
The integrating factor for this problem is
1
m HxL = ExpA
x xE = Exp@Ln HxLD = x
y 0
-1
-2
-3
-3
-2
-1
0
x
The solution curves that have a red marker are the solutions to the initial value problem. Note that for each value
of C there are two sets of trajectories. This illustrates the lack of one-to-one correspondence between initial values
and the parameter C. Note further that two trajectories intersect each other at the point 80, 0<. This means that if
we specify y H0L = 0as our initial condition, the solution is not unique! We can trace out either of the trajectories that intersect at 80, 0<. In the next section we will discuss what conditions must be met to ensure that we
have the existence of a unique of solution to IVP.
The solution curves that have a red marker are the solutions to the initial value problem. Note that for each value
FirstOrderODEs_Primer.nb
of C there are two sets of trajectories. This illustrates the lack of one-to-one correspondence between initial values
and the parameter C. Note further that two trajectories intersect each other at the point 80, 0<. This means that if
we specify y H0L = 0as our initial condition, the solution is not unique! We can trace out either of the trajectories that intersect at 80, 0<. In the next section we will discuss what conditions must be met to ensure that we
have the existence of a unique of solution to IVP.
5. Separation of Variables
In Section 4 the key assumption was that the 1st Order ODE was linear. This allowed us to introduce the concept
of an integrating factor, and through simple quadrature formulas the general solution to the ODE could be found.
When the ODE is nonlinear (i.e. the ODE contains terms involving yn , or transcendental functions of y such as
Sin HyL), then it is not possible to use the recipe based on integrating factors. However, if the nonlinear ODE has
a special form given by
dy
then it is possible to reorganize terms such that the general solution can once again be found by quadrature, as
explained in the following concept:
Concept 13:
If a differential equation
dy
dx = F Hx, yL
dy
The general solution can also be expressed as a 1-parameter family of level curves
g Hx, yL = C
where
23
24
FirstOrderODEs_Primer.nb
dy
-y + E-2 x+ y ,
(iii) Sin HxL y
dx = E
dy
(iv) Log Hy2
dx L = x
dy
(v) Sin@x + yD
dx = Tan HxL + Tan HyL,
dy
x y+x+y
(vi)
dx =
x y
Solution
Hy+1L
(i) Here F Hx, yL =
Hy- y
x 2 L . Thus we can write this expression as
3
Hy+1L
Hy+1L
Hy- y
x2 L =
y H1-
x 2 L
3
so that
dy
Hy+1L
dt =
y H1-
x2 L = f HxL y HyL
3
where
Hy+1L
1
f HxL =
H1-x2
L , y HyL =
y
3
y x
(ii) Here F Hx, yL =
H1+ x2 + y2
+ x2
y2 L . We can regroup terms in the denominator to give
dy
yx
yx
= f HxL y HyL
2 LL =
dx =
H1+x2 + y 2
H1+ x
H1+x2 L H1+
y2 L
where
y
x
f HxL =
H1+x2
L , y HyL =
H1+y2
L
E +E
(iii) Here F Hx, yL =
Sin HxL y
. We can reorganize the terms in the numerator to obtain
-y
-2 x+ y
dy
E
H1+ E
L
= f HxL y HyL
dx =
Sin HxL
y
-y
where
-2 x
H1+ E
L
E
f HxL =
Sin
HxL , and y HyL =
y
-2 x
dy
2 dy
x
Log Hy2
dx L = x as y
dx = E
Then
dy
E
dx =
y2 = f HxL y HyL
x
where
1
f HxL = Ex and y HyL =
y2
-y
Then
dy
dx L
= x as y
dy
dx
25
=E
dy
E
dx =
y2 = f HxL y HyL
x
where
1
f HxL = Ex and y HyL =
y2
Thus
where
dy
Tan HxL+Tan HyL
1
= f HxL y HyL
dx =
Cos HxL Cos HyL 8Tan
HxL+Tan
HyL<
Cos HxL Cos
HyL
1
f HxL =
and
Cos HxL
1
y HyL =
Cos HyL
x y+x+y
(vi) Here F Hx, yL =
x y . We can reorganize the numerator as
=
dx =
xy
y +
x
dy
(iii) Sin@x + yD
dx = Tan HxL + Tan HyL
26
FirstOrderODEs_Primer.nb
Solution
(i) From Example 5.1 we can express the ODE as
dy
Hy+1L
dt =
y H1-
x2 L
3
Integrating gives
y
1
y =
H1-x2
L x
Hy+1L3
Hx+1L
1
2
-
D = C
1+y - Log@
Hx-1L
H1+yL2
or
H1+2 yL
Hx+1L
+ Log@
D = C
Hx-1L
H1+yL2
dx ==
H1+x 2 L H1+
y2 L
Integrating gives
H1+y L
x
y y =
H1+x2
L x
2
to yield
y
1
2
2 + Log HyL =
2 Log H1 + x L + C
2
(iii) From Example 5.1 we can rewrite the ODE in the form
dy
1
dx =
Cos HxL Cos
HyL
Integrating gives
1
x
Cos HyL y =
Cos HxL
x
x
x
x
Sin HyL = -Log@Cos H
2 L - Sin H
2 LD + Log@Cos H
2 L + Sin H
2 LD + C
dy
1
dx
Cos HxL Cos HyL
Integrating gives
FirstOrderODEs_Primer.nb
1
x
Cos HyL y =
Cos HxL
x
x
x
x
Sin HyL = -Log@Cos H
2 L - Sin H
2 LD + Log@Cos H
2 L + Sin H
2 LD + C
The general solutions obtained in Example 5.2 are complicated implicit functions of x and y . Thus graphical tools
are essential for visualizing how the solution behaves and its dependence on the constant of integration. A
convenient way of visualizing the solution is to plot the family of level curves g Hx, yL = G HyL - H HxL = C .
This can best be achieved using Mathematica's ContourPlot routine, as shown in Example 5.3.
H1+2 yL
Hx+1L
(i) g Hx, yL =
+ Log@
D = C. Note since we plan to plot our level curves for negative x values ,
Hx-1L
H1+yL2
we must replace the arguments of any logarithmic functions with absolute values. Thus we define our function
g Hx, yL
H1 + 2 yL
Hx + 1L
g@x_, y_D := + LogA E . Log@a_D -> Log@Abs@aDD
2
Hx - 1L
H1 + yL
g@x, yD
1+2y
1+x
+ LogAAbsA EE
2
-1
+x
H1 + yL
Next we use ContourPlot to display the level curves for representative values of C.
27
28
FirstOrderODEs_Primer.nb
y 0
-2
-4
-4
-2
0
x
Observe that the function g Hx, yL is not defined for y = -1, and x = 1. The level curves have singularities at
these values.
y
1
2
(ii) g(x,y)=
2 + Log HyL -
2 Log H1 + x L
2
y2
1
g@x_, y_D := + Log@yD - Log@1 + x2 D . Log@a_D -> Log@Abs@aDD
2
2
g@x, yD
y2
1
- Log@Abs@1 + x2 DD + Log@Abs@yDD
2
2
FirstOrderODEs_Primer.nb
29
y 0
-2
-4
-4
-2
0
x
x
x
x
x
(iii) g Hx, yL = Sin HyL + Log@Cos H
2 L - Sin H
2 LD - Log@Cos H
2 L + Sin H
2 LD
g@x_, y_D :=
x
x
x
x
JSin@yD + LogACosA E - SinA EE - LogACosA E + SinA EEN .
2
2
2
2
Log@a_D -> Log@Abs@aDD
g@x, yD
x
x
x
x
LogAAbsACosA E - SinA EEE - LogAAbsACosA E + SinA EEE + Sin@yD
2
2
2
2
30
FirstOrderODEs_Primer.nb
y 0
-2
-4
-4
-2
0
x
x
In this example we have singularities when Tan H
2 L = 1, or x = 1.5708
The solutions that we have examined in the previous examples were generated by nonlinear ODEs. Before undertaking an analysis of an ODE, it is useful to know beforehand whether a solution exists, and if so, is it unique. The
following concept is provides the analysis tools for determining existence and uniqueness.
Concept 14:
Consider the initial value problem
dy
dx = F Hx, yL,
y Hxi L = yi
If F and F y are continuous in some region !, defined by a < x < b, and c < y < d, then there exists an
interval x - xi < h centered at xi in which there exists a unique solution to the IVP.
We apply this test for uniqueness defined by Concept 14 in the following examples
FirstOrderODEs_Primer.nb
31
dy
Cos HxL
2
dt = F Hx, yL = -
x y +
x , y Hxi L = yi
It follows from Concept 14 that F and F y are continuous everywhere except at x = 0 . Since F and
F y are not continuous at x = 0, we cannot be assured that a solution exists or if it does exists that it is
unique. Let us explore what happens when we consider the following initial value points:
xi = 0, yi = 1; xi = 1, 1; xi = 2, yi = 1. The general solution to this problem can be readily found by
seeking an integrating factor (see Section 4). The result is
m HxL = x2
C+ Cos@xD+ x Sin@xD
y HxL =
2
x
If we apply the initial conditions we find that the constant of integration takes on the following values for the three
cases: C = -1., C = -0.381773, C = 2.59755
The level curves of the general solution with the above values of C are shown below. The red dots define the
initial conditions. Note that there is a unique curve that passes through two of the initial values that have
xi 0. The case xi = 0 has no level curve passing through the initial value. A solution does not exist for this
IVP.
4
-1
-3
-2
-1
32
FirstOrderODEs_Primer.nb
dx =
y ,
y H0L = 0
Determine the general solution and then solve the IVP. Discuss the solution behavior at y H0L = 0
Solution
The equation can be solved by separation of variables
y
G HyL = y y =
2 ,
2
x
H HxL = x x =
2
2
1
2
2
g Hx, yL =
2 Hy - x L = C
This means we have two trajectories passing through the point H0, 0L. Hence the solution is non-unique. It
follows from Concept 14 that the condition for uniqueness is not satisfied at H0, 0L as both F Hx, yL and
F y are not continuous at H0, 0L. The solution trajectories are shown below for a set of initial conditions.
4
y 0
-2
-4
-4
-2
0
x
FirstOrderODEs_Primer.nb
33
dx = y , y H0L = a
H HxL = 1 x = x
y +x = C
1
Applying the initial value gives c =
a Thus the solution is
a
y HxL =
1-a x
For positive a, the solution is defined on the interval - < x < 1 a. At x = 1 a the solution blows up an
becomes undefined. Thus even though the conditions of Concept 14 hold for - < x < , the global properties
of the solution are not defined over this interval.
6. References
These notes were developed using several sources. In particular I found the textbook by Zill and Cullen most
useful and followed their approach in presenting the material in this notebook.
(1) Dennis G. Zill and Michael R. Cullen, Advanced Engineering Mathematics, PWS-KENT, Boston, MA, 1992
(2) Arvind Varma and Massimo Morbidelli, Mathematical Methods in Chemical Engineering, Oxford University Press, 1997.
(3) Martha L. Abell andJames P.Braselton, Differential Equations with Mathematica, 2nd Edition, Academic Press, 1997
(4) George Arfken, Mathematical Methods for Physicists, 3rd Edition, Academic Press, 1985
(5) Michael D. Greenberg, Foundations of Applied Mathematics, Prentice-Hall, Englewood Cliffs, NJ, 1978