You are on page 1of 17

Dierential Equations (part 1) : First-Order Dierential Equations

(by Evan Dummit, 2012, v. 1.12)

Contents
1 First-Order Dierential Equations

1.1

Introduction and Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.2

Some Motivating Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.3

Existence-Uniqueness Theorem

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.4

First-Order: Separable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.5

First-Order: Linear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.6

Substitution Methods

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.6.1

Bernoulli Equations

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.6.2

Homogeneous Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.7

First Order: Exact Equations and Integrating Factors

. . . . . . . . . . . . . . . . . . . . . . . . . .

1.8

First Order: General Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10

1.9

First Order: General Problems and Solutions

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

1.9.1

Problems

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

1.9.2

Solutions

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

1.10 Autonomous Equations, Equilibria, and Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

13

1.11 Euler's Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

1.12 First Order: Some Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

1.12.1 The Logistic Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

1.12.2 The General Mixing Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

1 First-Order Dierential Equations


1.1

Introduction and Terminology


A dierential equation is merely an equation involving a derivative (or several derivatives) of a function or
functions. In every branch of science  from physics to chemistry to biology (as well as 'other' elds such as
engineering, economics, and demography)  virtually any interesting kind of process is modeled by a dierential
equation, or a system of dierential equations.

The reason for this is that most anything interesting involves change of some kind, and the derivative
expresses the rate of change.

Thus, anything that can be measured numerically with values that change in some known manner will
give rise to a dierential equation.

Example: The populations of several species in an ecosystem which aect one another in some way.
Example: The position, velocity, and acceleration of a physical object which has external forces acting
on it.

Example: The concentrations of molecules involved in a chemical reaction.


Example: The production of goods, availability of labor, prices of supplies, and many other quantities
over time in economic processes.

Here are some examples of single dierential equations and systems of dierential equations, with and without
additional conditions.

Example:

Answer:

Example:

y(x) = Cex

00

for any constant

y + 2y + y = 3x

Answer:

Example:

y 0 + y = 0.

, with

C.

y(0) = y 0 (0) = 1

y(x) = 3x2 12x + 18 4xex 17ex .

f 00 f = (f 0 )2 ,

Answer:

with

f (1) = f 0 (1) = 1.

f (x) = ex1 .

g 0 = f + 2g , with f (0) = g(0) = 2.

Answer: f (x) = 2e2x cos(x ) and g(x) = 2e2x sin(x ).


4
4
df
df
Example:
+
= s + t.
ds dt

Example:

f 0 = 2f g

and

Answer: Many solutions. Two examples are

f (s, t) = st

and

f (s, t) =

1 2 1 2
s + t .
2
2

Most dierential equations (very much unlike the carefully chosen ones above) are dicult if not impossible
to nd exact solutions to, in the same way that most random integrals or innite series are hard to evaluate
exactly.
0

(f 00 )7 2ef f = sin20 (x) + ex .

Prototypical example:

However, it is generally possible to nd very accurate approximate solutions using numerical techniques
or by using Taylor series.

In this course we will only cover how to solve some of the more basic types of equations and systems:
rst-order separable, linear, and exact equations; higher-order linear equations with constant coecients;
and systems of rst-order linear equations with constant coecients.

If a dierential equation involves functions of only a single variable (i.e., if

is a function only of

x)

then it

is called an ordinary dierential equation (or ODE).

We will only talk about ODEs in this course. But for completeness, dierential equations involving functions of several variables are called partial dierential equations, or PDEs. (Recall that the derivatives
of functions of more than one variable are called partial derivatives, hence the name.)

PDEs, obviously, arise when functions depend on more than one variable. They occur often in physics
(with functions that depend on space and time) and economics (with functions that depend on time and
other parameters).

An

nth

order dierential equation is an equation in which the highest derivative is the

Example: The equations


Example: The equation
Example: The equation

y 0 + xy = 3x2
00

0000

y +y +y =0
e =y

and

y0 y = 2

y2 ,

or

(y 0 )3 ,

or

derivative.

are rst-order.

is second-order.

is fourth-order.

A dierential equation is linear if it is linear in the terms involving


there are no terms like

nth

y y0 ,

or

ln(y),

or

Example: The equations

y 0 + xy = 3x2

Example: The equations

y 0 y = 3x2 , x2 + (y 0 )2 = 1,

and

and its derivatives. In other words, if

ey .

y 00 + y 0 + y = 0
and

are linear.

y 00 = sin(y)

are not linear.

1.2

Some Motivating Applications


Simple motivating example: A population (unrestricted by space or resources) tends to grow at a rate proportional to its size. [Reason: imagine each male pairing o with a female and having a xed number of ospring
each year.]

In symbols, this means that

dP
= k P,
dt

where

P (t)

is the population at time

and

is the growth rate.

This is a homogeneous rst-order linear dierential equation with constant coecients.

It's not hard to see that one population model that works is

P (t) = ekt

 hence, exponential growth.

More complicated example: The Happy Sunshine Valley is home to Cute Mice and Adorable Kittens. The
Cute Mice grow at a rate proportional to their population, minus the number of Mice that are eaten by their
predators, the Kittens. The population of Adorable Kittens grows proportional to the number of mice (since
they have to catch Mice to survive and reproduce).

of Mice and Kittens,

dK
dM
= k1 M k2 K , and
= k3 M , where M (t) and K(t) are the populations
dt
dt
and k1 , k2 , k3 are some constants.

Symbolically, this says

This is a system of two linear dierential equations; we will learn how to solve a system like this later in
the course.

The conditions here are fairly natural for a simple predator-prey system.

But in general, there could

be non-linear terms too  perhaps when two Kittens meet, they ght with each other and cause injury,
which might change the equation to

dK
= k3 M k4 K 2 .
dt

This system would get even more dicult if we added additional species each of which interacts in some
way with the others.

Non-linear example: A simple pendulum consists of a weight suspended on a string, with gravity the only
force acting on the weight. If

is the angle the pendulum's string makes with a vertical line, then horizontal

force on the weight toward the vertical is proportional to

d2
= k sin().
dt2

Symbolically, this says

This equation cannot be solved exactly for the function


can be found by using the rough estimate
dierential equation

1.3

sin().

d2
= k ,
dt2

This is a non-linear second-order dierential equation.

(t). However, a reasonably good approximation


sin() , which turns the problem into the linear second-order

whose solutions are much easier to nd.

Existence-Uniqueness Theorem
Before we discuss how to solve various classes of rst-order dierential equations, we would like to know when
(in general) we can say that a rst-order dierential solution has an equation, and when we can say that
solution is unique.

Theorem (Existence-Uniqueness):

The initial value problem

solution (on some interval containing

a)

if the function

with

y(a) = b

has at least one

is continuous on a rectangle containing

IVP has exactly one solution (on some interval containing


rectangle containing

y 0 = f (x, y)

a)

if the partial derivative

f
y

(a, b).

The

is continuous on a

(a, b).

The proof of the theorem is fairly dicult. The general idea of one proof of the theorem is to construct
a sequence of functions (dened on some small interval around

a),

such that taking the limit of the

sequence yields a solution to the dierential equation.

The continuity of
of

ensures that the sequence will converge; one way of doing this is to use the continuity

to show that the functions far out in the sequence eventually become very close together.

The continuity of the partial derivative


this is to use the continuity of

f
y

f
y

ensures that the solution function is unique; one way of doing

to show that the integral of the absolute value of the dierences of

two solutions is zero on an interval containing

Example:

Determine the initial conditions

a.

y(a) = b

for which the dierential equation

y 0 = ey + xy

is

guaranteed to have a solution, and where it is guaranteed to have a unique solution.

All initial conditions lead to a solution, because

In fact,

f (x, y) = ey + xy

is continuous everywhere.

all initial conditions lead to a unique solution , because the partial derivative

fy (x, y) = ey + x

is also continuous everywhere.

It is, in fact, not possible to solve this equation explicitly using any of the techniques we will learn.
Nonetheless, the theorem guarantees that it has a unique solution!

Example: Determine the initial conditions

y(a) = b for which the dierential equation y 0 = y 2/3

is guaranteed

to have a solution, and where it is guaranteed to have a unique solution.

All initial conditions lead to a solution , because since


However, the partial derivative

2 1/3
y
3
(a, 0) for

fy =

not guaranteed to be unique around

zero at

x = 0,

y=0

and the function

is continuous everywhere.

is not continuous near


any

a,

but

1 3
y=
x .
27

y = 0,

and so the solution is

unique otherwise .

In fact, we can even write down two dierent solutions to the IVP
constant function

f (x, y) = y 2/3

y 0 = y 1/3

with

y(0) = 0:

namely, the

(They both satisfy the equation and take the value

but are not the same function.)

Example: Determine the initial conditions

y(a) = b

for which the dierential equation

y0 =

yx

is guar-

anteed to have a solution, and where it is guaranteed to have a unique solution.

The function is not dened if


any rectangle around a point

y x to be continuous in a rectangle containing (a, b).


x > y , and it is not continuous near any point with x = y either, because
(a, a) will capture some points with x > y .

In order to have a solution, we need

f (x, y) =

Thus, the solution is

guaranteed to exist only for

The partial derivative

1
fy (x, y) =
2 yx

(a, b)

with

is not dened if

b>a

xy

(since in addition to taking the square

root of a negative number, we cannot divide by zero). So the solution is

Note: If we decide that we are not afraid of complex numbers, then the function
dened and continuous on the entire plane (although it will take non-real values
this convention, the solution is guaranteed to exist for all

(a, b)

1.4

unique for all

(a, b)

with

because the function is now continuous

(a, a) because dividing


(a, b) with a 6= b .

everywhere. The derivative is discontinuous at points of the form


not allowed, so the solution is guaranteed to be

b>a.

f (x, y) = y x is
if x > y ). So with

unique for

by zero is still

First-Order: Separable
A separable equation is of the form

y 0 = f (x)g(y) for some functions f (x) and g(y), or an equation equivalent

to something of this form.

Here is the method for solving such equations:

Step 1:

Replace

(including

dy
)
dx

y0

with

dy
,
dx

and all of the

and then cross-multiply as necessary to get all the

x-stu

on the other.

y -stu

on one side

Step 2: Integrate both sides (indenitely, with respect to

For the integral involving


in terms of

x).

terms, remember that you can cancel

only.

Don't forget to put the

+C

on the side with the

dy
dx
dx

to get

dy

and an integral

x-terms.

Step 3: If given, plug in the initial condition to solve for the constant

C.

(Otherwise, just leave it where

it is.)

1.5

Example: Solve

as a function of

y0 = k y,

where

x,

if possible.

is some constant.

1 dy
= k.
y dx
1 dy

to get
dx = k dx,
y dx

Step 1: Rewrite as

Step 2: Integrate

Step 4: Exponentiate to get

Evaluate to get

ln(y) = kx + C .

dy
= ex .
dx
y dy

get
e
dx = ex dx.
dx

ey

Step 2: Integrate to

Step 4: Take the natural logarithm to get

dy = k dx.
y

y 0 = exy .

Step 1: Rewrite as

Example: Find

or

y = ekx+C = C ekx

given that

y 0 = x + xy 2

and

Simplify to then evaluate to get

y = ln(ex + C)

ey = ex + C .

y(0) = 1.

dy
= x dx.
1 + y2

dy
1
dx = x dx,
to get
1 + y 2 dx

Step 1: Rewrite as

Step 2: Integrate

Step 3: Plug in the initial condition to get

Step 4: Take the natural logarithm to get

then simplify and evaluate to get

tan1 (y) =

1 2
x + C.
2

tan1 (1) = C hence C = /4.




1 2
y = tan
x +
.
2
4

First-Order: Linear
The general form for a rst-order linear dierential equation is (upon dividing by the coecient of

y + P (x) y = Q(x),

where

P (x)

and

Q(x)

are some functions of

y0 )

given

x.

We would really like it if we could just integrate both sides to solve the equation. However, in general, we
cannot: the

Example: Solve the dierential equation

by

Step 4: Solve for

y0

term is easy to integrate, but the

P (x) y

term causes trouble.

To solve this equation we use an integrating factor: we multiply by a function

I(x)

which will turn the

left-hand side into the derivative of a single function.


What we would like to happen is for

When written this way, this sum looks sort of like the output of the product rule. If we can nd
that the derivative of

What we want is
and the solution

I(x) y 0 + I(x)P (x) y

I(x)

is

I(x)P (x),

to be the derivative of something nice.

then this sum will be the derivative

0
I(x)P (x) =
I (x). This
P (x) dx
is I(x) = e
.

I(x)

so

d
[I(x) y].
dx

is now a (very easy) separable equation for the function

Motivated by the above logic, here is the method for solving rst-order linear equations:

I(x),

y 0 + P (x) y = Q(x).

Step 1: Put the equation into the form

Step
2: Multiply both sides by the integrating factor

P (x) dx

P (x) dx

to get

P (x) dx 0

y +e

P (x) dx

P (x) y =

Q(x).

Step 3: Observe that the left-hand side is

C.

Don't forget the constant of integration

d h P (x) dx i
e
y ,
dx

and take the antiderivative on both sides.

Step 4: If given, plug in the initial condition to solve for the constant

C.

(Otherwise, just leave it where

it is.)

Example: Find

as a function of

given that

x.

y 0 + 2xy = x

Step 1: We have

Step 2: Multiply both sides by

Step 3:

Step 4:

Step 5:

P (x) = 2x

y(0) = 1.

and

Q(x) = x.

and

ex y 0 + ex 2x y = x ex
1 x2
x2
e + C.
Taking the antiderivative on both sides yields e y =
2
1
1 0
0
e + C hence C = .
Plugging in yields e 1 =
2
2
1 1 x2
Solving for y gives y =
.
+ e
2 2

Example: Find all functions

P (x) dx

for which

Step 1: We have

Step 2:

Step 3:

Step 5:

Example: Find

y0 +

4
y = x3 ,
x

= ex

to get

xy 0 = x4 4y .

4
3
and Q(x) = x .
x

P (x) dx
Multiply both sides by e
= e4 ln(x) = x4 to get x4 y 0 + 4x3 y = x7 ,
1 8
4
x + C.
Taking the antiderivative on both sides yields x y =
8
1 4
Solving for y gives y =
x + C x4 .
8

1.6

Step 5: Solve for

given that

Step 1: We have

so

P (x) =

y 0 cot(x) = y + 2 cos(x)

y 0 y tan(x) = 2 sin(x),

P (x) dx

with

Step 2: Multiply both sides by

Step 3: Taking the antiderivative on both sides

Step 4: Plugging in yields

Step 5: Solving for

gives

=e

1
1
= 1+C
2
2

y=

cos(2x)
2 cos(x)

y(0) =

1
.
2

P (x) = tan(x)

Q(x) = 2 sin(x).

and

ln(cos(x))

and

= cos(x) to get y cos(x)ysin(x) = 2 sin(x) cos(x).


1
yields [y cos(x)] = cos(2x) + C .
2

hence

C = 0.

Substitution Methods
Just like with integration, sometimes we come across dierential equations which we cannot obviously solve,
but which, if we change variables, will turn into a form we know how to solve.

Determining what substitutions to try is a matter of practice, in much the same way as in integral calculus.
In general, there are two kinds of substitutions: obvious ones that arise from the form of the dierential
equation, and formulaic ones which are standard substitutions to use if a dierential equation has a particular
form.

The general procedure is the following:

Step 1: Express the new variable

Step 2: Find

Step 3: Rewrite the original dierential equation in

dv
dx

in terms of

y0 , y,

Step 4: Solve the new equation in

in terms of

and

v.

and

x.

using implicit dierentiation.

as a dierential equation in

v.

(The hope is, after making the substitution, the new equation is in

a form that can be solved with one of the other methods.)

Step 5: Substitute back for

Example: Solve the equation

y.

y 0 = (x + y)2 .

This equation is not linear, nor is it separable as written. The obstruction is that the term
both

and

Step 1: Let us try substituting

Step 2:

Step 3:

Step 4: The equation in


or

x+y

involves

y.

v = x + y.
dv
dy
0
0
=1+
, so y = v 1.
Dierentiating yields
dx
dx
0
2
0
2
The new equation is v 1 = v , or v = v + 1.
v

is separable. Separating it gives

dv
= 1 dx,
+1

v2

so that

tan1 (v) = x + C ,

v = tan(x + C).

Step 5: Substituting back yields

y = tan(x + C) x

1.6.1 Bernoulli Equations

y 0 + P (x)y = Q(x) y n for some integer n 6= 0, 1 is called a Bernoulli equation. (The


n not be 0 or 1 is not really a restriction, because if n = 0 then the equation is rst-order
n = 1 then the equation is the same as y 0 = (Q(x) P (x))y , which is separable.)

An equation of the form


restriction that
linear, and if

As with rst-order linear equations, sometimes Bernoulli equations can be hidden in a slightly dierent
form.

The trick for solving a Bernoulli equation is to make the substitution


if we rst multiply both sides of the original equation by

(1 n)y 0 y n + (1 n)P (x) y 1n = (1 n)Q(x).

So we have

For

Substituting in to the original equation then yields the rst-order linear equation

v = y 1n

we have

for

v 0 = (1 n)y n y 0 .

y 0 + 2xy = xy 3 .
P (x) = 2x, Q(x) = x,
v 0 4xv = 2x.

This equation is of Bernoulli type, with

v = y 2

thus results in the equation

Next, we compute the integrating factor

I(x) = e

4x dx

2x2 0

2x2

Scaling by the integrating factor gives

Taking the antiderivative on both sides then yields

Finally, solving for

gives

Example: Solve the equation

v 0 + (1 n)P (x) v =

v.

Example: Solve the equation

The algebra is simplied

, and then make the substitution.

(1 n) Q(x)

(1 n) y

v = y 1n .

y=

n = 3.

Making the substitution

.
2

v = 2xe2x .
1
2
2
e2x v = e2x + C ,
2

v 4xe

2
1
+ Ce2x
2

= e2x

and

so that

v=

1/2
.

y 2 y 0 = ex y 3 .
y 3 and then divide
P (x) = 1, Q(x) = ex , and

The equation as written is not of Bernoulli type. However, if to both sides we add

by y , we
n = 2.

1
2
+ Ce2x .
2

obtain the equation

x 2

y +y = e y

, which is now Bernoulli with

Making the substitution

v = y3

results in the equation

v 0 + 3v = 3ex .

e3x v 0 + 3e3x v = 3e4x .



1/3
3
3
3 x
e + Ce3x
Taking the antiderivative then gives e3x v = e4x + C , so v = ex + Ce3x and y =
4
4
4

The integrating factor is

I(x) = e

3 dx

= e3x ,

so the new equation is

1.6.2 Homogeneous Equations

An equation of the form

y0 = f

y
x

for some function

is called a homogeneous equation.

The trick to solving an equation of this form is to make the substitution

v=

y = vx.

Then dierentiating

y = vx

shows

separable once written in the form

Example: Solve the dierential equation

y 0 = v + xv 0 , hence
1
v0
= .
f (v) v
x

the equation becomes

y
,
x

or equivalently to set

v + xv 0 = f (v),

which is

2x2 y 0 = x2 + y 2 .

This equation is not separable nor linear, and it is not a Bernoulli equation. If we divide both sides by

2x2

then we obtain

y0 =

1 1  y 2
,
+
2 2 x

which is homogeneous.

1 2
1
2v 0
1
v v + , and rearranging gives
= .
2
2
(v 1)2
x
2dv
1
2
2
Then integrating yields
=
dx, so
= ln(x)+C . Solving for v gives v = 1
,
2
(v 1)
x
v1
ln(x) + C
2x
.
so y = x
ln(x) + C

Setting

v = y/x

yields the equation

Example: Solve the dierential equation

xv 0 =

y0 =

x2 + y 2
.
xy

If we divide the numerator and denominator of the fraction by

x2 ,

we obtain

y0 =

1 + (y/x)2
,
(y/x)

which is

homogeneous.
Setting

Separating and integrating


then

1.7

v = y/x

y=x

yields

1 + v2
1
v = .
v
v

1
yields
v dv =
dx,
x

xv 0 =

2 ln(x) + C

so that

1 2
v = ln(x) + C ,
2

so

v=

p
2 ln(x) + C

and

First Order: Exact Equations and Integrating Factors

M (x, y) and N (x, y) with My = Nx (on some rectangle), there


F (x, y) with Fx = M and Fy = N (on that rectangle). Then the solutions to the dierential
M (x, y) + N (x, y) y 0 = 0 are given (implicitly) by F (x, y) = C where C is an arbitrary constant.

Theorem (Exact Equations): For functions


exists a function
equation

My

denotes the partial derivative of

with respect to

y,

namely

M
,
y

and similarly for the other

functions.

The equation

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

is also sometimes written

form, it is more symmetric between the variables

and

y.

M (x, y) dx + N (x, y) dy = 0.

I will generally do this.

In this

My = Nx implies the existence of a function F such


Fx = M and Gy = N is a theorem from vector calculus: the criterion My = Nx is equivalent to the
vector eld hM, N i being conservative. The function F is the corresponding potential function, with
F = hM, N i. The rest of the theorem is really just an application of this result.
1
is a function only of y , then our
Remark: Note that if M = f (x) is a function only of x and N =
g(y)
1 0
equation looks like f (x)
y = 0. Rearranging it gives the general form y 0 = f (x) g(y) of a separable
g(y)
equation. Since My = 0 = Nx in this case, separable equations are a special case of exact equations.
Fun Fact: The part of the theorem stating that

that

We can use the theorem to solve exact equations, where

M y = Nx .

If the partial derivatives are not equal,

we are not necessarily out of luck  like with rst-order linear equations, there may exist an integrating factor

I(x, y)

which we can multiply the equation by, in order to make the equation exact.

Unfortunately, we don't really get much for free: trying to solve for the integrating factor is often as hard
as solving the original equation. Finding

I (My Nx ) = 0,

I(x, y),

in general, requires solving the PDE

which is just as tricky to solve as the original equation. Only in a few special cases

are there methods for computing the integrating factor

I
I
M
N +
y
x

I(x, y).

Case 1: Suppose we want to see if there exists an integrating factor that depends only on
on

y ).

I
y

Then

would be zero, since

I0
M y Nx
=
. This can
I
N
P (x) dx
then I(x) = e
.

only happen if the ratio

M y Nx
N

(and not

and so

I(x)

would need to satisfy

is a function

P (x)

only of

does not depend on

y,

(and not

y );

The form of this integrating factor should look familiar  it is the same as the one from a rst-order
linear equation. There is a very good reason for this; namely, a rst-order linear equation is a special
case of this form of equation.

Case 2: We could also look to see if there is an integrating factor that depends only on
We can do the same calculation, this time using
the ratio

Nx M y
M

is a function

Q(y)

only of

I
= 0,
x

(and not

and not on

x.

to see that such an integrating factor exists if

x);

then

I(y) = e

Q(y) dy

Remark: There is no really good reason only to consider these cases, aside from the fact that they're the
easiest. We could just as well try to look for integrating factors that are a function of the variable
Or of

v = x/y .

Or of

w = y + ln(x).

t = xy .

In each case we'd end up with some other kind of condition. But

we won't think about those things  we really just care about the two kinds of integrating factors above.

Example: Solve for

y(x),

if

(4y 2 + 2x) + (8xy)y 0 = 0.

There is no obvious substitution to make, and it is not separable, linear, homogeneous, or Bernoulli. So
we must check for exactness.

In dierential form the equation is

Therefore we have

So we want to nd

My = 8y

and

(4y 2 + 2x) dx + 8xy dy = 0.

Nx = 8y .

Therefore,

M = 4y 2 + 2x

and

N = 8xy .

Since these are equal, the equation is exact.

F with Fx = M and Fy = N . Taking the anti-partial-derivative of M with respect


x yields F (x, y) = 4xy 2 + x2 + g(y) for some function g(y). Checking then shows Fy = 8xy + g 0 (y) so
g 0 (y) = 0.
to

Therefore, our solutions are given implicitly by

Example: Solve for

y(x),

if

4xy 2 + x2 = C

(2xy 2 4y) + (3x2 y 8x)y 0 = 0.

There is no obvious substitution to make, and it is not separable, linear, homogeneous, or Bernoulli. So
we must check for exactness.

In dierential form the equation is

N = 3x y 8x.

(2xy 2 4y) dx + (3x2 y 8x) dy = 0.

Therefore,

M = 2xy 2 4y

and

Therefore we have

My = 4xy 4

We look for integrating factors using the two criteria we know.

and

Nx = 6xy 8.

These are not equal, so the equation isn't exact.

M y Nx
2xy + 4
= 2
is not a function of x only.
N
3x y 8x
2xy 4
1
Nx M y
=
= is a function of y only.
Second, we have
M
2xy2 4y
y
(1/y) dy
by the integrating factor I(y) = e
= y.

First, we have

Our new equation is therefore

Now we want to nd

Therefore we need to multiply

(2xy 3 4y 2 ) + (3x2 y 2 8xy)y 0 = 0.

Fx = 2xy 3 4y 2 and Fy = 3x2 y 2 8xy . Taking the anti-partial-derivative


F (x, y) = x2 y 3 4xy 2 + f (y) and checking in the second equation shows

with

of the rst equation gives

f 0 (y) = 0.

1.8

Therefore, our solutions are given implicitly by

x2 y 3 4xy 2 = C

First Order: General Procedure


We can combine all of the techniques for solving rst-order dierential equations into a handy list of steps. For
the purposes of this course, if the equation cannot be simplied via a substitution (an obvious substitution, or
if it is homogeneous or Bernoulli) then it is either exact, or can be made exact by multiplying by an integrating
factor. (If it's not one of those, then in this course we have no idea how to solve it.)

Note: It is not really necessary to check ahead of time whether the equation is separable or a rst-order
linear equation. Separable equations are exact, and rst-order linear equations can be made exact after
multiplying by an integrating factor, which will be detected using the

M y Nx
N

test. I check for these

two special types at the beginning only because it's faster to solve it using the usual methods.

Here is the general procedure to follow to solve rst-order equations:

Step 1: Write the equation in the two standard forms

y 0 = f (x, y)

and

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

and

check to see if it is rst-order linear or separable.

by the integrating factor

y 0 + P (x)y = Q(x)  then multiply

Step 1a: If the equation is rst-order


linear  namely, of the form

I(x) = e

P (x) dx

and then take the antiderivative of both sides.

Step 1b: If the equation is separable  namely, of the form

y 0 = f (x) g(y)

 then separate the

y -terms and x-terms on opposite sides of the equation and then take the antiderivative of both sides.

Step 2: Look for possible substitutions (generally, using the

y 0 = f (x, y)

form).

Step 2a: Check to see if there is any 'obvious' substitution that would simplify the equation.
Step 2b: Check to see if the equation is of Bernoulli type  namely, of the form

(1 n) y
and then make the
dv
+ (1 n)P (x) v = (1 n) Q(x).
dx

If so, multiply both sides by


rst-order linear equation

substitution

y 0 +P (x)y = Q(x)y n .
v = y 1n to obtain a

y
y0 = F
for some
x
y
dv
function F . If so, make the substitution v =
to obtain a separable equation x
= F (v) v .
x
dx
Step 3: If the equation is not of a special type, use the M (x, y) + N (x, y) y 0 = 0 form to nd the partial
derivatives My and Nx .

Step 2c: Check to see if the equation is homogeneous  namely, of the form

Step 4: If
factor

My = Nx ,

Step 3a:

I(x) = e

no integrating factor is needed. Otherwise, if

My 6= Nx ,

look for an integrating

to multiply both sides of the equation by.

Step 3b:

I(y) = e

Compute

P (x) dx

If it is a function

P (x)

only of

x,

then the integrating factor is

Nx My
.
M

If it is a function

Q(y)

only of

y,

then the integrating factor is

Compute

Q(y) dy

M y Nx
.
N

If neither of these methods works, you're out of luck unless you can nd an integrating factor some
other way.

Take antiderivatives to nd the function

Step 5:

solutions as

1.9

F (x, y)

with

Fx = M

and

Fy = N ,

and write the

F (x, y) = C .

First Order: General Problems and Solutions


Part of the diculty of seeing rst-order dierential equations outside of a homework set (e.g., on exams) is
that it is not always immediately obvious which method or methods will solve the problem. Thus, it is good
to practice problems without being told which method to use.

1.9.1 Problems

Solve the equation

xy 0 = y +

Solve the equation

y0 =

Solve the equation

y 2xy 2
.
3x2 y 2x

xy 0 = y + x.

Solve the equation

y 0 1 = y 2 + x3 + x3 y 2 .

Solve the equation

y0 =

Solve the equation

y 0 = xy 3 6xy .

Solve the equation

y0 =

xy .

4x3 y 2 + y
.
2x4 y + x

2xy + 2x
.
x2 + 1

1.9.2 Solutions

Solve the equation

xy 0 = y +

xy .

Step 1: The two standard forms are

y
y = +
x
0

y
x

(y

and

xy) + xy 0 = 0.

The equation is not

separable or rst-order linear.

Step 2: We go down the list and recognize that

Setting

This equation is separable: we have

Solving for

v = y/x

(with

gives

y = vx

and

y 0 = xv 0 + v )

y
y = +
x
0

yields

dv
1
=
dx
x
v

2
ln(x)
y=x
+C
.
2

y
is a
x

xv 0 = v .

hence

homogeneous equation.

2v 1/2 = ln(x) + C ,


so

v=

ln(x)
+C
2

2
.

Note: The equation is also of Bernoulli type, and could be solved that way too. Of course, it will give
the same answer.

Solve the equation

y0 =

y 2xy 2
.
3x2 y 2x

Step 1+2: The other standard form is

(2xy 2 y) + (3x2 y 2x) y 0 = 0.

The equation is not separable or

linear, nor is it homogeneous or Bernoulli.

Step 3: We have

M = 2xy 2 y

and

N = 3x2 y 2x

so

My = 4xy 1

and

Nx = 6xy 2.

Step 4: We need to look for an integrating factor, because

which is not a function of

My 6= Nx .

We have

2xy 1
1
Nx M y
=
= ,
2
M
2xy y
y

alone. Next we try

M y Nx
2xy + 1
= 2
,
N
3x y 2x

so the integrating factor is

1
dy
y
= y.
I(y) = e

with respect to

gives

x y xy 2 = C

Solve the equation

2 3

solutions are

(2xy 3 y 2 ) + (3x2 y 2 2xy) y 0 = 0. Taking the anti-partial of the new


F (x, y) = x2 y 3 xy 2 + f (y), and checking shows that f 0 (y) = 0. Hence the

Step 5: The new equation is

xy 0 = y +

x.
y0 =

Step 1: The two standard forms are

y
1
+
x
x

and

(y

x) + xy 0 = 0.

The equation is rst-order

linear.

Rewrite in the usual rst-order linear form

y 0 (x1 )y = x1/2 .
1

We have the integrating factor

Thus the new equation is

Taking the antiderivative on both sides yields

Solve the equation

I(x) = e

= e ln(x) = eln(x

dx

= x1 .

x1 y 0 x2 y = x3/2 .
1
x1 y = x1/2 + C ,
2

so

1
y = x1/2 + Cx
2

y 0 1 = y 2 + x3 + x3 y 2 .
y 0 = (y 2 + 1)(x3 + 1).

Step 1: Adding 1 and then factoring the right-hand side gives

This equation is

separable.

Separating it gives

Integrating yields

Solve the equation

y0
= x3 + 1 .
y2 + 1
3
x4 x2
dy
1
=
(x
+
1)
dx
, so tan
(y)
=
+ + C.
y2 + 1
4
2

y0 =


Then

y = tan

x4
x2
+
+C
4
2


.

(4x3 y 2 + y)
.
(2x4 y + x)

Step 1+2: The other standard form is

(4x3 y 2 + y) + (2x4 y + x) y 0 = 0.

The equation is not separable or

linear, nor is it homogeneous or Bernoulli.

N = 2x4 y + x

Step 3: We have

Step 4: No integrating factor is needed since

Step 5: Taking the anti-partial of


shows that

M = 4x3 y 2 + y

f (y) = 0.

Solve the equation

and

so

My = 8x3 y + 1

and

Nx = 8x3 y + 1.

M y = Nx .

with respect to

Hence the solutions are

gives

4 2

x y + xy = C

F (x, y) = x4 y + xy + f (y),

and checking

y 0 = xy 3 6xy .

Step 1: The equation is of Bernoulli type when written as

Multiply both sides by

Making the substitution

v = y 2

The integrating factor is

The new equation is

Taking the antiderivative on both sides yields

2y 3

to get

2y 3 y 0

with

(12/x) dx

y 0 + 6xy = xy 3 .

12 2
y = 2x.
x

v 0 = 2y 3 y 0

then yields the linear equation

v0

12
v = 2x.
x

= e12 ln(x) = x12 .

x12 v 0 12x13 v = 2x11 .


x12 v =

1 10
1
x +C , so v = x2 +Cx12 and y =
5
5

1 2
x + Cx12
5

1/2
.

y0 =

Solve the equation

2xy + 2x
.
x2 + 1

(method #1)

Step 1: The equation is separable, since after factoring we see that

Separating and integrating gives

Exponentiating yields

2x
dy
=
dx,
y+1
x2 + 1

y + 1 = e ln(x

+1)+C

C
,
x2 + 1

so that

y=

so

y0 =

2x
(y + 1).
+1

x2

ln(y + 1) = ln(x2 + 1) + C .

C
1
x2 + 1

(method #2)

Step 1: The other standard form is

Step 3: We have

M = 2xy + 2x

Step 4: We have

M y = Nx ,

Step 5: Taking the anti-partial of


shows that

f (y) = 1

so

(2xy + 2x) + (x2 + 1)y 0 = 0.

and

N = x2 + 1

so

My = 2x

and

Nx = 2x.

so the equation is exact.

f (y) = y .

with respect to

gives

Hence the solutions are

Note of course that we can solve for

F (x, y) = x2 y + x2 + f (y),

x y+x +y =C

and checking

explicitly, and we obtain exactly the same expression as in the

other solution.

1.10

Autonomous Equations, Equilibria, and Stability

dy
= f (y)
dt

An autonomous equation is a rst-order equation of the form

for some function

f.

An equation of this form is separable, and thus solvable in theory.


However, sometimes the function

f (y)

is suciently complicated that we cannot actually solve the

equation explicitly.

Nonetheless, would like to be able to say something about what the solutions look like, without actually
solving the equation. Happily, this is possible.

An equilibrium solution, also called a steady state solution or a critical point, is a solution of the form
for some constant

Clearly, if

c.

y(t)

y(t) = c,

(In other words, it is just a constant-valued solution.)

y 0 (t) is zero everywhere.


y = f (y), we just need to

is constant, then

to an autonomous equation

Thus, in order to nd the equilibrium solutions

solve

f (y) = 0.

(And this is not generally so

hard.)

For equilibrium solutions, we have some notions of stability:

y 0 = f (y) with the initial condition


y(0) = c +  for some small but positive , the solution y(t) moves toward c as t increases. This statement
is equivalent to f (c + ) < 0.

A solution

A solution

An equilibrium solution

y=c

y = c is stable from below if when we solve y 0 = f (y) with the initial condition y(0) = c  for
some small but positive , the solution y(t) moves toward c as t increases. This statement is equivalent
to f (c ) > 0.
y = c is unstable

for some small but positive


equivalent to

is stable from above if, when we solve

A solution

,

the solution

y(t)

moves

y 0 = f (y) with the initial condition y(0) = c + 


away from c as t increases. This statement is

f (c + ) > 0.

y = c is unstable

for some small but positive


equivalent to

from above if when we solve

f (c ) < 0.

from below if when we solve

,

the solution

y(t)

moves

y 0 = f (y) with the initial condition y(0) = c 


away from c as t increases. This statement is

We say a solution is stable if it is stable from above and from below.

We say it is unstable if it unstable

from above and from below. Otherwise (if it is stable from one side and unstable from the other) we say it is
semistable.

From the equivalent conditions about the sign of


equilibrium states of

f,

here are the steps to follow to nd and classify the

y 0 = f (y):

Step 1: Find all values of

Step 2: Mark all the equilibrium values on a number line, and then in each interval between two critical

for which

points, plug in a test value to

Step 3: On each interval where

f (c) = 0,

to nd the equilibrium states.

to determine whether

is positive or negative on that interval.

is positive, draw right-arrows, and on each interval where

is negative,

draw left-arrows.

Step 4: Using the arrows, classify each critical point: if the arrows point toward it from both sides, it
is stable. If the arrows point away, it is unstable. If the arrows both point left or both point right, it is
semistable.

Step 5 (optional): Draw some solution curves, either by solving the equation or by using the stability
information.

Example: Find the equilibrium states of

y0 = y

and determine stability.

Step 1: We have

Step 2: We draw the line and plug in 2 test points (or just think for a second) to see that the sign

f (y) = y ,

diagram looks like

which obviously is zero only when

y = 0.

| .
0

Step 3: Changing the diagram to arrows gives

| .
0

Step 4: So we can see from the diagram that the only equilibrium point

Step 5: We can of course solve the equation to see that the solutions are of the form
indeed, the equilibrium solution

y=0

Example: Find the equilibrium states of

Step 1: We have

y = 1,

and

is unstable .

y(t) = C et ,

and

is unstable:

y 0 = y 2 (y 1)(y 2)

f (y) = y 2 (y 1)(y 2),

and determine stability.

which conveniently is factored. We see it is zero when

y = 0,

y = 2.

Step 2: We draw the line and plug in 4 test points (or just think for a second) to see that the sign
diagram looks like

| | | .
0

Step 3: Changing the diagram to arrows gives

| | | .
0

Step 4: So we can see from the diagram that

Step 5: In this case, it is possible to obtain an implicit solution by integration; however, an explicit

is semistable ,

is stable , and

is unstable .

solution does not exist. However, we can graph some solution curves to see, indeed, our classication is
accurate:

1.11

Euler's Method
If we have exhausted all of our techniques trying to solve a rst-order initial value problem

y(a) = y0 , we
interval [a, b].

y 0 = f (x, y)

with

are sad. However, perhaps we would like to be able to nd an approximate solution on some

One method we can use to nd an approximate solution is Euler's Method, named after the Swiss mathematician Leonhard Euler (pronounced oiler).

The general idea behind Euler's Method, which should bring back memories of basic calculus, is to break
up the interval

[a, b]

into many small pieces, and then to use a linear approximation to the function

y(x)

on each interval to trace a rough solution to the equation.

Here is the method, more formally:

ba
be the width of the subintervals.
n
x0 = a, x1 = x0 + h, x2 = x1 + h, ... , xn = xn1 + h = b.

Step 1: Choose the number of subintervals

Step 2: Dene the

Step 3: Take y0 to be the given initial value. Then compute, iteratively, the values y1 = y0 + h f (x0 , y0 ),
y2 = y1 + h f (x1 , y1 ), ... , yn = yn1 + f (xn1 , yn1 ). It is easiest to organize this information in a

x-values

n,

and let

h=

table.

Step 4 (optional): Plot the points

(x0 , y0 ), (x1 , y1 ), . . . , (xn , yn )

and connect them with a smooth curve.

Example: Use Euler's Method to nd an approximate solution on the interval

y 0 = ln(x + y)

with

[1, 2] to the dierential equation

y(1) = 1.

Step 1: Let's take 10 subintervals. Then

h = 0.1.
x-values.
y -value and the

Steps 2+3: We organize our information in the table below. We ll out the rst row with the
Then we ll in the empty columns one at a time: to start the next column, we add the

h f (x, y)

value to get the next

y -value.

x
y
f (x, y)
h f (x, y)

1.1

1.2

1.3

1.4

1.5

1.6

1.7

1.8

1.9

2.0

1.0693

1.1467

1.2320

1.3249

1.4251

1.5324

1.6466

1.7674

1.8946

2.0280

0.693

0.774

0.853

0.929

1.002

1.073

1.1418

1.208

1.272

1.334

0.0693

0.0774

0.0853

0.0929

0.1002

0.1073

0.1142

0.1208

0.1272

0.1334

Step 4: Finally, we can plot the points, and (for comparison) the actual solution curve obtained using a
computer. As can be seen from the graph, the approximation is very good:

1.12

First Order: Some Applications

1.12.1 The Logistic Equation

Example: Solve the dierential equation

Step 1: Rewrite as

Step 2:

P 0 = kP (M P ),

where

and

are positive constants.

M dP
= kM dt.
P (M P )

partial fraction decomposition:

M
dP = kM dt. To evaluate the P -integral, use
P (M P )
M
1
1
=
+
. Evaluating the integrals therefore yields
P (M P )
P
M P

Integrate both sides to obtain

ln(P ) ln(M P ) = kM t + C .


CekM t .


P
= kM t + C ;
M P
M
P (t) =
.
1 + CekM t

Step 4: Combine the logarithms to obtain

Solving for

yields, nally,

Note: If we want to satisfy the initial condition

the solution can be rewritten in the form

ln

P (0) = P0 ,

P (t) =

now exponentiate to get

then plugging in shows

M P0
P0 + (M P0 )ekM t

Remark: Dierential equations of this form are called logistic equations.

C=

P
=
M P

M
1.
P0

Then

With the explicit solution given

here, or using the properties of stable and unstable equilibria, we can observe some properties of the solution
curves.

We can see that

Since

and

P =0

and

P =M

are the only equilibrium solutions.

are positive, the sign diagram is

| | .
0

So

is an unstable equilibrium and

is a

stable equilibrium.

Thus, as

t ,

as long as the starting population

carrying capacity of

M.

P0

is positive, the population

(We can also see this using the explicit solution.)

P (t)

tends toward the

k<0

Remark: If instead we had


(0 would be stable and
initial population

P0

it would tend toward

rather than

k > 0,

the stability of the two equilibrium solutions would ip

would be unstable). Then we would be in an extinction-explosion scenario: if the

were less than

M,

it would tend toward 0, and if the population were greater than

M,

1.12.2 The General Mixing Problem

Setup:

We have some reservoir (pool, lake, ocean, planet, room) of liquid (water, gas) which has some substance
(pollution, solute) dissolved in it.

The reservoir starts at an initial volume

We have some amount of liquid In(t) owing in with a given concentration

V0

and there is an initial amount of substance

k(t)

y0

in the reservoir.

of the substance, and

some other amount of liquid Out(t) owing out.

We assume that the substance is uniformly and perfectly mixed in the reservoir, and want to know the
amount

y(t)

of the substance that remains in the reservoir after time

t.

Note that this is the general setup. In more specic examples, the amount of liquid owing in or out may be
constants (i.e., not depending on time), and similarly the concentration of the liquid owing in could also be
a constant. The solution is the same, of course.

Solution:

Let

V (t)

be the total volume of the reservoir.

Then if

reservoir, the concentration of substance in the reservoir


moving in is

k In(t)

and the total amount of substance moving out is the concentration of substance

times the volume moving out, or

Thus we have

y(t) is the total amount of substance in the


y(t)
is
. Thus the total amount of substance
V (t)

V 0 (t) =

In(t)

y(t)
Out(t).
V (t)

Out(t),

and

y 0 (t) = k(t) In(t)

y(t)
Out(t).
V (t)

For clarity, refer to the

diagram:

Now to solve this system, we integrate to nd

Then we can rewrite the other equation as

V (t)

y0 +

explicitly.

Out(t)

V (t)

y = k(t) In(t),

which we can now solve because

it is rst-order linear.

Well, you're at the end of my handout. Hope it was helpful.


Copyright notice: This material is copyright Evan Dummit, 2012. You may not reproduce or distribute this material
without my express permission.

You might also like