You are on page 1of 24

2

1st-Order Differential Equations

2.1 – Introduction
Given a function F : D ⊆ R3 → R, a first-order ordinary differential equation in y
is an equation of the form
F (x, y(x), y 0 (x)) = 0, (1)
where y is any real-valued function of x that satisfies the equation.
Given a function f : D ⊆ R2 → R, an explicit first-order ordinary differential
equation in y is a first-order ordinary differential equation in y that can be written in the
form
y 0 = f (x, y). (2)
Throughout this chapter we will be developing techniques to solve many kinds of first-order
differential equations, both linear and nonlinear, that arise in applications.

2.2 – Separable Equations

Definition 2.1. An explicit 1st-order ODE y 0 = f (x, y) is separable if there exist functions
g(x) and p(y) such that f (x, y) = g(x)p(y) for all (x, y) ∈ Dom(f ).

If we define h(y) = 1/p(y), then a separable equation can just as well be written as

y 0 = g(x)/h(y),

which turns out to be convenient as we go forward.


Separable equations can be solved with relative ease by what’s known as the Method of
Separation of Variables. The theoretical underpinnings of the method are supplied by the
following theorem.

Theorem 2.2. Let c be an arbitrary constant. If functions g(x) and h(y) have antiderivatives
G(x) and H(y), respectively, and H(y) = G(x) + c implicitly defines y as a function of x, then
H(y) = G(x) + c is an implicit solution to the separable equation y 0 = g(x)/h(y).
2

Proof. Suppose G and H are antiderivatives of g and h, respectively, and also assume that
H(y) = G(x) + c implicitly defines a function ϕ(x) = y on some open interval I, so that

H(ϕ(x)) = G(x) + c (3)

is satisfied for all x ∈ I. Applying implicit differentiation to (3) gives

(H ◦ ϕ)0 (x) = G0 (x),

whereupon the Chain Rule leads to

H 0 (ϕ(x))ϕ0 (x) = G0 (x).

Next, since G0 = g and H 0 = h, we obtain h(ϕ(x))ϕ0 (x) = g(x) and hence


g(x)
ϕ0 (x) = (4)
h(ϕ(x))
for all x ∈ I. Observing that (4) is precisely the equation that results when ϕ(x) is substituted
for y in the ODE y 0 = g(x)/h(y), it follows that ϕ : I → R is an explicit solution to the ODE.
Therefore H(y) = G(x) + c is an implicit solution to the ODE, since it implicitly defines at
least one function that satisfies it on some interval. 

The Method of Separation of Variables is a streamlined procedure for obtaining the


implicit solution H(y) = G(x) + c to y 0 = g(x)/h(y). It flows as follows.

dy g(x)
• Write the equation as = .
dx h(y)
• “Multiply” by dx to obtain h(y) dy = g(x) dx.
ˆ ˆ
• Integrate both sides: h(y) dy = g(x) dx.

´ ´
Letting H(y) = h(y) dy and G(x) = g(x) dx, and inserting an arbitrary constant c,
immediately yields H(y) = G(x) + c as desired. It should be stressed that the “equation” in
the middle step is not really a proper mathematical equation, since the symbols dx and dy by
themselves have no meaning in this context. Some examples are in order.

Example 2.3. Solve the initial value problem


2x3 − x + 5
y0 = , y(0) = −2.
4−y

Solution. Here we have a first-order ordinary differential equation of the form y 0 = f (x, y),
and since f (x, y) = g(x)p(y) for
1
g(x) = 2x3 − x + 5 and p(y) = ,
4−y
3

it’s seen that the ODE is separable. Letting h(y) = 1/p(y) = 4 − y, we can write the ODE as
dy/dx = g(x)/h(y), from which we obtain h(y) dy = g(x) dx and finally
ˆ ˆ
(4 − y) dy = (2x3 − x + 5) dx.

Integrating both sides gives


1 1 1
4y − y 2 + c1 = x4 − x2 + 5x + c2 ,
2 2 2
where c2 and c2 are arbitrary constants produced by each indefinite integral. Subtracting c2
from both sides gives c1 − c2 on the right-hand side, which taken as a whole is still nothing
more than an arbitrary constant and so it is convenient to simply denote it by c to obtain
1 1 1
4y − y 2 = x4 − x2 + 5x + c. (5)
2 2 2
The Implicit Function Theorem could be used to verify that (5) implicitly defines y as a function
of x in at least one way, but we take this for granted. Hence (5) is an implicit solution to the
ODE, and if we multiply both sides by 2 it takes the form
8y − y 2 = x4 − x2 + 10x + c, (6)
where 2c is written simply as c since, in either case, the term represents any arbitrary real
number.
It is not necessary to solve (6) for y here. The initial condition y(0) = −2 can now be used
to determine c: substituting 0 for x and −2 for y in (6), we obtain
8(−2) − (−2)2 = 04 − 02 + 10(0) + c
and so c = −20. An implicit solution to the IVP is therefore
8y − y 2 = x4 − x2 + 10x − 20.
Can an explicit solution be found? The answer is yes: if we rewrite the implicit solution in
the form Ay 2 + By + C = 0,
y 2 − 8y + (x4 − x2 + 10x − 20) = 0,
we can use the quadratic formula to get

p
−(−8) ± (−8)2 − 4(1)(x4 − x2 + 10x − 20)
y= = 4 ± 36 − 10x + x2 − x4 .
2(1)

Now,√ putting x = 0 into the right-hand side yields y = 10 from 4 + · , and y = −2 from
4 − · . Since only y = −2 satisfies the initial condition we conclude that

y(x) = 4 − 36 − 10x + x2 − x4
is the explicit solution to the IVP. 

Example 2.4. Solve the initial value problem


y 0 = 2x cos2 y, y(0) = π/3.
4

Solution. The differential equation is of the form y 0 = g(x)p(y), with g(x) = 2x and p(y) =
cos2 y, and so the Method of Separation of Variables is applicable. From dy/dx = 2x cos2 y we
write
1
dy = 2x dx,
cos2 y
which leads to the equation ˆ ˆ
2
sec y dy = 2x dx.
Integrating gives tan y = x2 + c, which is an implicit solution to the ODE. Using the given√
initial condition, we substitute x = 0 and y = π/3 to obtain tan(π/3) = 02 + c, so that c = 3
and we find that √
tan y = x2 + 3 (7)
is an implicit solution to the IVP.
To obtain an explicit solution first recall from trigonometry that the domain of the tangent
function is [ π π 
Dom(tan) = − + kπ, + kπ ,
k∈Z
2 2
and recall from calculus that√the tangent function is continuous on its domain. Consider
√ again
the initial condition y(0) = 3, which in particular is a point in R2 where y is 3. √ The only
interval (−π/2 + kπ, π/2 + kπ) in the domain of the tangent function that contains 3 is the
one for which k = 0, which is to say the interval (−π/2, π/2). Thus the implicit solution (7)
to the IVP must generate a curve that is entirely contained within a narrow band in R2 where
−π/2 < y < π/2. It’s known that tan y is one-to-one on (−π/2, π/2) and hence has an inverse
tan−1 . Thus the explicit solution to the IVP is
 √ 
y(x) = tan−1 x2 + 3 ,
where it’s understood that the range of the function y is (−π/2, π/2), which is the customary
range of the function tan−1 . 
5

2.3 – Linear Equations


Recall that a first-order linear differential equation has the form
a1 (x)y 0 + a0 (x)y = b(x), (8)
where a1 , a0 , and b are known functions of x, and a1 in particular is not the zero function. If
a0 happens to be the zero function then the equation becomes a1 (x)y 0 = b(x), which is in fact
is a separable equation and so can be solved using the Method of Separation of Variables. But
what if a0 (x) is not the zero function?
Dividing (8) by a1 (x) and defining P (x) = a0 (x)/a1 (x) and Q(x) = b(x)/a1 (x), we obtain
y 0 + P (x)y = Q(x), (9)
which is the standard form for a first-order linear ODE. What we would like to do is find a
function µ(x), called an integrating factor, for which
µ(x)y 0 (x) + µ(x)P (x)y(x) = [µ(x)y(x)]0 (10)
The Product Rule of Differentiation tells us that (µy)0 = µ0 y + µy 0 , so that (10) becomes
µ(x)y 0 (x) + µ(x)P (x)y(x) = µ0 (x)y(x) + µ(x)y 0 (x),
which implies that
µ(x)P (x)y(x) = µ0 (x)y(x)
and hence µ must be such that µ0 (x) = µ(x)P (x). One function that satisfies this equation is
ˆ  ´
µ(x) = exp P (x) dx = e P (x) dx , (11)
´
where of course P (x) dx is taken to represent any antiderivative of the function P (x).
Now let us see what this choice for µ does for us. If we multiply both sides of (9) by µ as
given by (11), we obtain
µ(x)y 0 + µ(x)P (x)y = µ(x)Q(x),
which by (10) becomes
[µ(x)y]0 = µ(x)Q(x).
Integrating both sides with respect to x then yields
ˆ
µ(x)y = µ(x)Q(x) dx + c,

where c is an arbitrary constant. Finally we can isolate y and obtain an explicit solution to (9),
ˆ 
1
y(x) = µ(x)Q(x) dx + c , (12)
µ(x)
which in light of (11) may be written as
´
ˆ ´

− P (x) dx P (x) dx
y(x) = e Q(x)e dx + c .
6

The preceding manipulations suggests a general procedure that may be followed to solve
linear first-order differential equations.

Procedure. To solve: the linear equation a1 (x)y 0 + a0 (x)y = b(x).


1. Divide by a1 (x) to obtain the standard form y 0 + P (x)y = Q(x).
´
2. Determine P (x) dx, which can be any convenient antiderivative for P (x).
´ 
3. Set µ(x) = exp P (x) dx
ˆ 
1
The general explicit solution is y(x) = µ(x)Q(x) dx + c . 
µ(x)

Example 2.5. Solve xy 0 + 3y + 2x2 = x3 + 4x.

Solution. If we write the equation as


xy 0 + 3y = x3 − 2x2 + 4x

it can be seen that it is indeed a first-order linear ODE. Dividing by x gives


3
y 0 + y = x2 − 2x + 4, (13)
x
which is standard form with P (x) = 3/x and Q(x) = x2 − 2x + 4. Now,
ˆ
3
dx = 3 ln |x| + c
x
for arbitrary constant c, and so an integrating factor µ(x) is formulated as follows:
´ 3 +c 3
µ(x) = e 3/x dx
= e3 ln |x|+c = eln |x| = e|x| = |x|3 = x3 ,

where along the way we choose c = 0 and cast off the absolute value bars in the end. The
removal of absolute value bars is justified since it results in an expression for µ(x), namely x3 ,
that places no restriction on the independent variable x, and so it will not hinder the derivation
of the best general solution to the ODE.
At this juncture we may use (12) to obtain the general solution to the ODE, or we may
multiply (13) by x3 and use simple calculus to arrive at the solution. We’ll employ the latter
strategy since it is more instructive and does not require memorizing a rather cumbersome
formula. Multiplying (13) by x3 gives

x3 y 0 + 3x2 y = x5 − 2x4 + 4x3 ,


which becomes
0
x3 y = x5 − 2x4 + 4x3
and hence, after integrating both sides,
ˆ
3 1 2
x5 − 2x4 + 4x3 dx = x6 − x5 + x4 + c.

xy=
6 5
7

Finally, multiplying by x−3 yields


1 2
y(x) = x3 − x2 + x + cx−3
6 5
as the general solution to the ODE. 

Example 2.6. Solve y 0 = y/x + 2x + 1.

Solution. Writing the equation in standard form, we have


1
y 0 − y = 2x + 1,
x
so P (x) = −1/x and Q(x) = 2x + 1. Now,
´ −1 +c
µ(x) = e (−1/x)dx
= e− ln |x|+c = eln |x| = |x|−1 + c = x−1 ,
where for the last equality we choose c = 0 and remove absolute value bars. The removal of
absolute value bars is justified since the result is an expression for µ(x) that does not put any
new restrictions on x that did not exist beforehand. Next, using (12) we obtain
ˆ  ˆ  
1 −1 1
y(x) = −1 x (2x + 1) dx + c = x 2+ dx + cx
x x
= x (2x + ln |x|) + cx.
Therefore
y(x) = 2x2 + x ln |x| + cx
is the general solution to the ODE. 
8

2.4 – Exact Equations


We now consider differential equations of the form
M (x, y) + N (x, y)y 0 = 0, (14)

which oftentimes are written as M (x, y)dx + N (x, y)dy = 0 in other texts, but this will not be
used here.1

Definition 2.7. An ODE of the form M (x, y) + N (x, y)y 0 = 0 is exact on an open set
U ⊆ Dom(M ) ∩ Dom(N ) if there exists a function F : U → R such that
Fx (x, y) = M (x, y) and Fy (x, y) = N (x, y)
for all (x, y) ∈ U .

In practice explicit mention of an open set U is typically omitted and one simply says that
an ODE is exact.
Fortunately there is an easy test that can be applied to determine whether an ODE of the
form (14) is exact. In order to prove the test, however, we will need the following proposition,
which is proven in §5.5 of the Calculus Notes as a direct consequence of the Fundamental
Theorem of Calculus.

Proposition 2.8. If f is continuous on (a, b) and x0 ∈ (a, b), then the function Φ : (a, b) → R
given by
ˆ x
Φ(x) = f (t) dt, a < x < b
x0
0
is differentiable on (a, b), with Φ (x) = f (x) for each x ∈ (a, b).

And now for the theorem that furnishes a test for determining whether (14) is exact, often
called the Test for Exactness.

Theorem 2.9 (Test for Exactness). Suppose that M (x, y) and N (x, y) have continuous first
partial derivatives on an open rectangle R. Then M (x, y) + N (x, y)y 0 = 0 is exact on R if and
only if My (x, y) = Nx (x, y) for all (x, y) ∈ R.

Proof. Suppose that M (x, y) + N (x, y)y 0 = 0 is exact on R = (a, b) × (c, d). Then there exists
some function F : R → R such that Fx = M and Fy = N on R. The continuity of the first
partial derivatives of M and N then implies the continuity of all second partial derivatives
of F . Thus by Clairaut’s Theorem (see Section 1.0) we find that Fxy = Fyx on R. Now,
Fxy = (Fx )y = My and Fyx = (Fy )x = Nx , so that My = Nx on R.
1This is because the expression M (x, y)dx + N (x, y)dy has no real meaning here, at least in light of devel-
opments thus far. It is what is called a differential form, the precise definition of which is quite technical and
beyond the scope of this course. Therefore use of the expression is a terrific waste of time and a fine opportunity
for confusion and misunderstanding to arise.
9

For the converse, suppose that My = Nx on R. The approach will be to construct a function
F : R → R for which Fx = M and Fy = N on R. Fix x0 ∈ (a, b) and let
ˆ x
F (x, y) = M (t, y) dt + g(y) (15)
x0

for (x, y) ∈ R, where g : (c, d) → R is an arbitrary function of y.2 Observe that, for any fixed
y0 ∈ (c, d), the function M ( · , y0 ) is continuous on (a, b), and if we define Φ : (a, b) → R by
Φ(x) = F (x, y0 ), then Proposition 2.8 implies Φ is differentiable on (a, b) with
ˆ x
0 d d
Φ (x) = M (t, y0 ) dt + [g(y0 )] = M (x, y0 )
dx x0 dx
for all a < x < b. Since Fx (x, y0 ) = Φ0 (x) and c < y0 < d is arbitrary, we conclude that
Fx (x, y) = M (x, y) for all (x, y) ∈ R.
What must be shown is that it is always possible to choose g(y) such that the condition
Fy = N holds on R. Differentiating F (x, y) with respect to y gives
ˆ x 
Fy (x, y) = Dy M (t, y) dt + g 0 (y),
x0

where of course Dy [g(y)] = g 0 (y), and so in order to have Fy = N we must have


ˆ x 
0
g (y) = N (x, y) − Dy M (t, y) dt . (16)
x0

This would seem to deliver the solution, but there is a question: is the right-hand side of (16)
actually independent of x, and so solely a function of y alone as required?
Fix some x1 ∈ (a, b) such that x1 ≥ x0 , and define
ˆ x1
Ψ(y) = M (t, y) dt.
x0

Now, given any y ∈ (c, d) there exists some  > 0 such that y ∈ [c + , d − ], and since M and
My are continuous on the rectangle [x0 , x1 ] × [c + , d − ] ⊆ R, it follows by Leibniz’s Integral
Rule (see Section 1.0) that
ˆ x1
0
Ψ (y) = My (t, y) dy.
x0

The outcome is the same if x1 < x0 , and so for any constant x ∈ (a, b) we find that
ˆ x ˆ x
d
M (t, y) dt = My (t, y) dy.
dy x0 x0

From this we conclude that


ˆ x  ˆ x
Dy M (t, y) dt = My (t, y) dy
x0 x0

2
´ x The continuity of M ( · , y) on the closed interval with endpoints x0 and x ensures the existence of
x0
M (t, y) dt.
10

since, whenever computing Dy , we do indeed consider x to be constant. Recalling (16) and our
hypothesis that My = Nx on R, we next obtain
ˆ x ˆ x
0
g (y) = N (x, y) − My (t, y) dt = N (x, y) − Nx (t, y) dt. (17)
x0 x0
0
If we define H(t) = N (t, y), then H (t) = Nx (t, y) so that
ˆ x ˆ x
Nx (t, y) dt = H 0 (t) dt = H(x) − H(x0 ) = N (x, y) − N (x0 , y)
x0 x0

by the Fundamental Theorem of Calculus, and then (17) gives

g 0 (y) = N (x, y) − [N (x, y) − N (x0 , y)] = N (x0 , y).

Thus g 0 as defined by (16), or alternatively (17), is indeed a function of y alone, and so if we


choose ˆ y ˆ x 
g(y) = N (x, s) − Ms (t, s) dt ds (18)
y0 x0
0
as an antiderivative of g , where y0 ∈ (c, d), then F as given by (15) will be such that Fx = M
and Fy = N .
Therefore M (x, y) + N (x, y)y 0 = 0 is exact on R. 

It’s worth mentioning that another way to demonstrate that the right-hand side of (16) is
independent of x would be to differentiate the middle expression in (17) with respect to x and
show that the result is 0.
The choice for x0 and y0 in (15) and (18) is not important, only that an antiderivative for
F with respect to x and an antiderivative for g 0 with respect to y are found. We may therefore
write (15) as simply
ˆ
F (x, y) = M (x, y) dx + g(y),

and (18) as simply


ˆ  ˆ 
g(y) = N (x, y) − My (x, y) dx dy.

Combining these results gives


ˆ ˆ  ˆ 
F (x, y) = M (x, y) dx + N (x, y) − My (x, y) dx dy,

which is scarcely worth memorizing since it is in practice easier to simply follow the procedure
given after the following theorem.

Theorem 2.10. If M (x, y) + N (x, y)y 0 = 0 is exact on R = (a, b) × (c, d), so that there is a
function F such that Fx = M and Fy = N on R, then F (x, y) = c is an implicit solution for
any constant c.
11

Proof. Let c ∈ R be arbitrary and set F (x, y) = c. We take the relation F (x, y) = c to
implicitly define y as a function ϕ of x on some open interval I, so that
F (x, ϕ(x)) = c (19)
for all x ∈ I. Differentiating both sides of (19) with respect to x and employing Chain Rule 1
(see Section 1.0) on the left-hand side, we obtain
Fx (x, ϕ(x)) + Fy (x, ϕ(x))ϕ0 (x) = 0
for all x ∈ I. Recalling that Fx = M and Fy = N , we now obtain
M (x, ϕ(x)) + N (x, ϕ(x))ϕ0 (x) = 0
for all x ∈ I.
Since ϕ : I → R satisfies M (x, y)+N (x, y)y 0 = 0 we conclude that F (x, y) = c is an implicit
solution to the ODE. 

The proof of Theorem 2.9 outlines the way in which the function F may be determined.
The procedure is as follows.

Procedure. To solve: the exact equation M (x, y) + N (x, y)y 0 = 0. Given: Fx = M , Fy = N .


´
1. Integrate Fx (x, y) = M (x, y) with respect to x to get F (x, y) = M (x, y) dx + g(y).
´
2. Differentiate F (x, y) = M (x, y) dx + g(y) with respect to y , substitute N for Fy , and
solve for g 0 (y).
3. Integrate g 0 (y) to determine an expression for g(y) up to an arbitrary constant.
´
4. Put the expression for g(y) into F (x, y) = M (x, y) dx + g(y)
The general implicit solution is F (x, y) = c. 

Example 2.11. Solve


0 3x2 − ex sin y
y = x .
e cos y + y −2/3 /3

Solution. Rewriting the equation as


 
2 x x 1 −2/3 0
− 3x + e sin y + e cos y + y y = 0,
3
we have M (x, y) = ex sin y − 3x2 and N (x, y) = ex cos y + y −2/3 /3, and since
My (x, y) = ex cos y = Nx (x, y)
we conclude by Theorem 2.9 that the equation is exact. Thus it is appropriate to employ the
procedure given above to find a function F that will determine implicit solutions to the ODE.
From Fx = M we obtain, for any fixed y,
ˆ ˆ
F (x, y) = M (x, y) dx + g(y) = (ex sin y − 3x2 ) dx + g(y) = ex sin y − x3 + g(y), (20)
12

where g(y) is an arbitrary function of y. (Notice that the partial derivative of the right-hand
side of (20) with respect to x is indeed M (x, y).)
Taking the partial derivative of F with respect to y gives
Fy (x, y) = Dy ex sin y − x3 + g(y) = ex cos y + g 0 (y),
 

and since Fy = N we obtain


1
ex cos y + y −2/3 = ex cos y + g 0 (y)
3
and thus
1
g 0 (y) = y −2/3 .
3
Now we integrate to get ˆ
1
g(y) = y −2/3 dy = y 1/3 + c1
3
for arbitrary constant c1 . Substituting this result into (20) yields
F (x, y) = ex sin y − x3 + y 1/3 + c1 .
Therefore implicit solutions to the ODE are given by
ex sin y − x3 + y 1/3 + c1 = c2 ,
but this can be written simply as
ex sin y − x3 + y 1/3 = c,
where c is the arbitrary constant that results when we consolidate the arbitrary constants c1
and c2 . 

Example 2.12. Solve the initial value problem


1
+ 2xy 2 + 2x2 y − cos y y 0 = 0,

y(1) = π.
x

Solution. Here we have  


1 2
My (x, y) = Dy + 2xy = 4xy
x
and
Nx (x, y) = Dx 2x2 y − cos y = 4xy,
 

so My = Nx on at least some rectangle R in R2 and it follows that the ODE is exact. Thus
there exists a function F such that Fx = M and Fy = N . From the former we obtain
ˆ ˆ  
1
F (x, y) = M (x, y) dx + g(y) = + 2xy dx = ln |x| + x2 y 2 + g(y).
2
(21)
x
From this comes
Fy (x, y) = 2x2 y + g 0 (y),
13

and since Fy = N this leads to


2x2 y − cos y = 2x2 y + g 0 (y).
Thus g 0 (y) = − cos y, which gives us g(y) = − sin y as a suitable antiderivative of g. Substituting
this into (21) gives
F (x, y) = ln |x| + x2 y 2 − sin y,
and therefore
ln |x| + x2 y 2 − sin y = c (22)
are the implicit solutions to the ODE.
Now we make use of the initial condition y(1) = π. Substituting 1 for x and π for y we find
that
c = ln |1| + (1)2 (π)2 + sin(π) = π 2 ,
and so
ln x + x2 y 2 + sin y = π 2
is the implicit solution to the IVP. Notice that, since x > 0 at the initial point (1, π), we can
take |x| = x in the solution. 
14

2.5 – Integrating Factors


If an equation of the form
M (x, y) + N (x, y)y 0 = 0, (23)
is not exact on any open set U ⊆ R2 , we may be able to find some function µ(x, y) such that
µ(x, y)M (x, y) + µ(x, y)N (x, y)y 0 = 0
is exact. That is, if we define
M̂ (x, y) = µ(x, y)M (x, y) and N̂ (x, y) = µ(x, y)N (x, y),
then for the equation
M̂ (x, y) + N̂ (x, y)y 0 = 0 (24)
there exists some open set U and function F : U → R such that Fx = M̂ and Fy = N̂ on U . In
this case the function µ(x, y) is called an integrating factor.
By Theorem 2.9, in order for (24) to be exact we must have M̂y (x, y) = N̂x (x, y) on some
open set U , which can be expressed as
Dy [µ(x, y)M (x, y)] = Dx [µ(x, y)N (x, y)] .
By the product rule of differentiation we obtain
µ(x, y)My (x, y) + M (x, y)µy (x, y) = µ(x, y)Nx (x, y) + N (x, y)µx (x, y),
which is a partial differential equation that generally would be no trivial matter to solve for
µ. However, if µ were a function of x alone, we could replace µ(x, y) with µ(x), µx (x, y) with
µ0 (x), and µy (x, y) with 0, to arrive at the marginally less hideous equation
µ(x)My (x, y) = µ(x)Nx (x, y) + N (x, y)µ0 (x).
This we rewrite as
µ0 My (x, y) − Nx (x, y)
= . (25)
µ N (x, y)
Now, if the right-hand side of this equation is independent of y, which is to say that it is a
function of x alone, then the equation is in fact a first-order linear ODE in µ. Indeed we can
then let
My (x, y) − Nx (x, y)
g(x) =
N (x, y)
0
and h(µ) = µ, and write (25) as µ = g(x)h(µ) to see that the ODE actually separable! By the
Method of Separation of Variables we obtain
ˆ ˆ
1
dµ = g(x) dx,
h(µ)
for all x on some open interval I where g is continuous, which implies that
ˆ ˆ
1 My (x, y) − Nx (x, y)
dµ = dx,
µ N (x, y)
15

and thus ˆ
My − Nx
ln |µ| = dx + c
N
for an arbitrary constant c. Hence an integrating factor of the form µ(x) is given by
ˆ 
My − Nx
µ(x) = exp dx . (26)
N
A similar analysis based on the assumption that µ and (Nx − My )/M are functions of y
alone (i.e. independent of x) leads to another formula:
ˆ 
Nx − My
µ(y) = exp dy . (27)
M
In the special case when we are given a first-order linear ODE in standard form,

y 0 + P (x)y = Q(x),
we can write
[P (x)y − Q(x)] + y 0 = 0

to obtain the form (23) with

M (x, y) = P (x)y − Q(x) and N (x, y) = 1,


´
which
´ generally is not exact. However multiplying by µ(x) = exp( P (x) dx), where here
P (x) dx represents any particular antiderivative of P (x), yields
´ ´
e P (x) dx
[P (x)y − Q(x)] + e P (x) dx y 0 = 0, (28)
| {z } | {z }
M̂ (x,y) N̂ (x,y)

and since
´
P (x) dx
M̂y (x, y) = P (x)e = N̂x (x, y),
it follows from Theorem 2.9 that (28) is exact´and therefore µ(x) is an integrating factor as the
term is defined in this section. Of course exp( P (x) dx) was encountered before in Section 2.3,
where it was also defined to be an integrating factor, and so we see that the integrating factor
of that section is just a special instance of the more inclusive notion of an integrating factor
under consideration here.

Example 2.13. Solve 2xy + (y 2 + 3x2 )y 0 = 0.

Solution. Here we have an ODE of the form M + N y 0 = 0 with

M (x, y) = 2xy and N (x, y) = y 2 + 3x2 .


Since
My (x, y) = 2x 6= 6x = Nx (x, y),
16

the equation is not exact. We will attempt to make it exact by finding an integrating factor of
some kind. In order to obtain an integrating factor that depends only on x we need (My −Nx )/N
to be independent of y, but this is not the case due to a y 2 term that cannot be expunged:
My (x, y) − Nx (x, y) 2x − 6x 4x
= 2 = − .
N (x, y) y + 3x2 y 2 + 3x2
To obtain an integrating factor that depends only on y we need (Nx − My )/M to be
independent of x, and here we have more luck:
Nx (x, y) − My (x, y) 6x − 2x 2
= = ,
M (x, y) 2xy y
where no x is to be seen in the final expression. To determine µ(y) we use the formula (27):
ˆ  ´
Nx (x, y) − My (x, y) 2
µ(y) = exp dy = e 2/y dy = e2 ln |y| = eln y = y 2
M (x, y)
Multiplying the ODE by y 2 gives
2xy 3 + (y 4 + 3x2 y 2 )y 0 = 0,

which is of the form M̂ + N̂ y 0 = 0 with


M̂ (x, y) = 2xy 3 and N̂ (x, y) = y 4 + 3x2 y 2 .

Since M̂y (x, y) = 6xy 2 = N̂x (x, y) the equation is exact (exact on R2 , in fact), and so there
exists some function F (x, y) such that Fx = M̂ and Fy = N̂ . From the latter equation3 we
obtain ˆ ˆ
1
F (x, y) = N̂ (x, y) dy = (y 4 + 3x2 y 2 ) dy = y 5 + x2 y 3 + h(x),
5
where h(x) is an arbitrary function of x. Differentiating with respect to x then yields
Fx (x, y) = 2xy 3 + h0 (x),

and since Fx = M̂ we have 2xy 3 + h0 (x) = 2xy 3 and thus h0 (x) = 0. We conclude that h(x) = c1
for any arbitrary constant c1 , so that
1
F (x, y) = y 5 + x2 y 3 + c1 .
5
The general implicit solution is therefore
1 5
y + x 2 y 3 + c1 = c2 ,
5
where c2 is arbitrary. Naturally we may combine c1 and c2 by letting c = c2 − c1 , and write
y 5 + 5x2 y 3 = c
as the general solution. 

It is within our capability to determine an integrating factor that depends on both x and
y in certain instances, as the next example illustrates.
3It does not, of course, matter which equation we start with.
17

Example 2.14. Find an integrating factor of the form xm y n that will make the equation
(2y 2 − 6xy) + (3xy − 4x2 )y 0 = 0 exact, then solve the equation.

Solution. Multiply the ODE by xm y n to obtain


(2xm y n+2 − 6xm+1 y n+1 ) + (3xm+1 y n+1 − 4xm+2 y n )y 0 = 0, (29)
so that
M (x, y) = 2xm y n+2 − 6xm+1 y n+1 and N (x, y) = 3xm+1 y n+1 − 4xm+2 y n .
For the ODE to be exact we must choose m and n such that
My (x, y) = 2(n + 2)xm y n+1 − 6(n + 1)xm+1 y n
equals
Nx (x, y) = 3(m + 1)xm y n+1 − 4(m + 2)xm+1 y n ,
which is to say that
(2n + 4)xm y n+1 + (−6n − 6)xm+1 y n = (3m + 3)xm y n+1 + (−4m − 8)xm+1 y n .

In order for this equation to be satisfied for all (x, y) in some open set U ⊆ R2 , the coefficients
of like terms will have to be equal; that is, the coefficients of the xm y n+1 terms will need to
match, giving 2n + 4 = 3m + 3, and the coefficients of the xm+1 y n terms will need to match,
giving −6n − 6 = −4m − 8. Thus we have a system of equations

3m − 2n = 1
4m − 6n = −2

The solution to this system is m = 1 and n = 1, giving us an integrating factor µ(x, y) = xy


and turning (29) into the exact equation
(2xy 3 − 6x2 y 2 ) + (3x2 y 2 − 4x3 y)y 0 = 0.

We now set about finding the general solution to the ODE. There is a function F (x, y) such
that
Fx (x, y) = 2xy 3 − 6x2 y 2 (30)
and
Fy (x, y) = 3x2 y 2 − 4x3 y. (31)
From (30) we obtain
ˆ
F (x, y) = (2xy 3 − 6x2 y 2 ) dx = x2 y 3 − 2x3 y 2 + g(y).

Differentiating this equation with respect to y then gives


Fy (x, y) = 3x2 y 2 − 4x3 y + g 0 (y),

which together with (31) implies that


3x2 y 2 − 4x3 y + g 0 (y) = 3x2 y 2 − 4x3 y,
18

and hence g 0 (y) = 0. So g(y) = c1 for any constant c1 , whence we get


F (x, y) = x2 y 3 − 2x3 y 2 + c1 .
The general implicit solution is F (x, y) = c2 for any constant c2 . We may write this as
x2 y 3 − 2x3 y 2 = c.
by letting c = c2 − c1 . 
19

2.6 – Substitutions and Transformations


If an explicit 1st-order ODE y 0 = f (x, y) is not separable, linear, exact, or amenable to being
made exact with an integrating factor, there is yet another technique that may be employed
in order to solve it. Just as an integral, whether definite or indefinite, can oftentimes be made
more tractable by effecting a substitution of variables, so too can a substitution sometimes be
made in a differential equation so as to render it easier to work with.

Definition 2.15. An explicit 1st-order ODE y 0 = f (x, y) is homogeneous if there exists a


function g and open set U ⊆ R2 such that f (x, y) = g(y/x) for all (x, y) ∈ U .

It turns out that homogeneous equations lend themselves well to a substitution of variables.
Given y 0 = g(y/x) let v = y/x, so that y = xv and by the product rule of differentiation we
obtain y 0 = v + xv 0 . This turns the ODE into the form
v + xv 0 = g(v), (32)

where now v is the dependent variable (thought of as a function of x), but x retains its role as
the independent variable. But notice that (32) is a separable equation: we can write it as
g(v) − v
v0 = ,
x
which has the form v 0 = G(v)H(x) with G(v) = g(v) − v and H(x) = 1/x. By the Method of
Separation of Variables we obtain
ˆ ˆ
1 1
dv = dx, (33)
g(v) − v x
from which it should be possible to find v(x) up to an arbitrary constant. Then from
y(x) = xv(x) we determine a general explicit solution to the original ODE.

Example 2.16. Solve


(x2 + y 2 ) + 2xyy 0 = 0.

Solution. This equation is actually exact, but we will solve it a different way to illustrate the
substitution technique. First we isolate y 0 ,
x2 + y 2
y0 = − .
2xy
Next,
x2 + y 2 1/x2 1 + (y/x)2
y0 = − · = − ,
2xy 1/x2 2(y/x)
so the right-hand side of the ODE can be cast as a function of y/x and therefore it is homoge-
neous. Letting v = y/x, the equation becomes
1 + v2
v + xv 0 = − ,
2v
20

which is separable and so leads to


ˆ ˆ
1 1
dv = dx
−(1 + v 2 )/(2v) − v x
as in (33), where of course g(v) = −(1 + v 2 )/(2v). A little algebra then gives
ˆ ˆ
2v 1
− 2
dv = dx.
3v + 1 x
Making the substitution w = 3v 2 + 1, the integral on the left-hand side transforms to give
ˆ ˆ
1/3 1
− dw = dx,
w x
and hence
1
− ln |w| = ln |x| + c1
3
for any constant c1 . From w = 3v 2 + 1 = 3y 2 /x2 + 1 comes the general implicit solution
 2 
3y
ln + 1 = −3 ln |x| + c1 ,
x2
which can be rearranged to give
 2   2 
3y 3 3y
+ 1 = ln 3|x|y 2 + |x|x2 = c1 .

3 ln |x| + ln 2
+ 1 = ln |x | + ln 2
x x
To get the general solution in a nicer form, we can exponentiate the last equality to get
|x|(3y 2 + x2 ) = c2 ,

where c2 = exp(c1 ) > 0 is arbitrary. From this comes x(3y 2 + x2 ) = ±c2 , and so we may as well
replace ±c2 with the arbitrary constant c 6= 0 and write
x3 + 3xy 2 = c,

which could in fact be solved for y if desired. 

Example 2.17. Solve


xy 0 = y(ln y − ln x + 1).

Solution. The equation is not separable, linear, or exact. However, dividing by x we obtain
0 y(ln y − ln x + 1) y y y
y = = ln + ,
x x x x
where the right-hand side can be seen to be a function of y/x. The equation is therefore
homogeneous, and so we let v = y/x and get
v + xv 0 = v ln v + v,
and thus
xv 0 = v ln v.
21

The Method of Separation of Variables now gives


ˆ ˆ
1 1
dv = dx,
v ln v x
whereupon the substitution w = ln v for the integral on the right gives
ˆ ˆ
1 1
dw = dx.
w x
Hence ln |w| = ln |x| + c1 for any constant c1 , and observing that w = ln v = ln(y/x), we obtain
a general implicit solution to the ODE:
ln |ln(y/x)| = ln |x| + c1 .
An alternate form of this general solution can be realized by exponentiating both sides of the
equation:
|ln (y/x)| = eln |x|+c1 = ec1 |x| = c2 |x|,
where c2 = exp(c1 ) > 0 is arbitrary. Pressing on, we get
ln (y/x) = ±c2 |x| = c|x|, (34)
where now c 6= 0 is arbitrary. As in the past we recognize that since c can now be either positive
or negative, there is no need for absolute value bars around the x on the right-hand side of
(34), and so we write simply ln(y/x) = cx, or equivalently y = xecx .
The question now arises: might c = 0 also yield a valid solution to the ODE? Putting c = 0
into y = xecx leads to y = x. If we substitute the function ϕ(x) = x for y in the ODE, we
obtain
xϕ0 (x) = ϕ(x)[ln(ϕ(x)) − ln x + 1],
which implies that x · 1 = x(ln x − ln x + 1) and finally x = x. So c = 0 indeed reaps another
solution to the ODE, and therefore the general implicit solution may be given as
y = xecx
for c any arbitrary constant. 
We now move on to Bernoulli equations, which are another kind of first-order ODE that
lends itself well to a substitution.

Definition 2.18. A Bernoulli equation is a first-order ODE of the form


y 0 + P (x)y = Q(x)y n (35)
for some n ∈ R, where P (x) and Q(x) are continuous on an open interval I.

The substitution to make here is v = y 1−n , which can also be expressed as y n = y/v.
Differentiating with respect to x gives
v 0 = (1 − n)y −n y 0 ,
so that
yn 0 y/v 0 yv 0
y0 = v = v =
1−n 1−n (1 − n)v
22

and (35) becomes


yv 0 y
+ P (x)y = Q(x) .
(1 − n)v v
Dividing both sides of this equation by y, we get
v0 1
+ P (x) = Q(x) ,
(1 − n)v v
and finally a linear equation in standard form is obtained with one more manipulation:
v 0 + (1 − n)P (x)v = (1 − n)Q(x). (36)
Indeed if we let
P̂ (x) = (1 − n)P (x) and Q̂(x) = (1 − n)Q(x),
then (36) can be written as v 0 + P̂ (x)v = Q̂(x).
It should be noted that the zero function y ≡ 0 is a solution to any Bernoulli equation with
n 6= 0, and so in the examples that follow no mention of it will be made.

Example 2.19. Solve √


y 0 + (x − 2)−1 y − 5(x − 2) y = 0.

Solution. First rewrite the equation as


1
y0 + y = 5(x − 2)y 1/2 ,
x−2
which can be seen to be a Bernoulli equation with n = 1/2,
1
P (x) = , and Q(x) = 5(x − 2).
x−2
Making the substitution v = y 1−1/2 = y 1/2 the equation becomes, by (36),
1 5(x − 2)
v0 + v= .
2(x − 2) 2
An integrating factor for this first-order linear ODE is given by
ˆ   
1 1 p
µ(x) = exp dx = exp ln |x − 2| = |x − 2|,
2(x − 2) 2
where here we cannot casually wave away the absolute value bars in the final expression since
that would commit us to having x > 2 in order to avoid square roots of negative numbers.4
(Note that x 6= 2 in any case since division by 0 would result in the original ODE.) By equation
(12) we obtain ˆ 
1 5 p
v(x) = p (x − 2) |x − 2| dx + c .
|x − 2| 2
Assuming that x > 2 yields
 ˆ


1 5 1
(x − 2)5/2 + c ,
 
v(x) = √ (x − 2) x − 2 dx + c = √
x−2 2 x−2
4Recall from Section 2.3 that absolute value bars may only be cast off in situations in which doing so results
in a final expression for µ(x) that does not unduly restrict the freedom of the independent variable x.
23

and assuming that x < 2 yields


 ˆ


1 5 1
(2 − x)5/2 + c ,
 
v(x) = √ (x − 2) 2 − x dx + c = √
2−x 2 2−x
Combining these results, we conclude that
p 1
|x − 2|5/2 + c = (x − 2)2 + c|x − 2|−1/2 ,
 
y(x) = v(x) = p
|x − 2|
and therefore 2
y(x) = (x − 2)2 + c|x − 2|−1/2


is the general explicit solution. 

Given an equation y 0 = f (x, y), suppose there can be found constants a and b, and a
function G, such that
f (x, y) = G(ax + by)
for all (x, y) in some open set U ⊆ R2 . Then the ODE may be written as y 0 = G(ax + by),
and it becomes possible to transform it into a separable equation by making the substitution
z = ax + by. Differentiating with respect to x, we have z 0 = a + by 0 and thus
z0 − a
y0 = ,
b
which enables us to write y 0 = G(ax + by) as
z0 − a
= G(z)
b
and finally z 0 = a + bG(z). By the Method of Separation of Variables this leads to the equation
ˆ ˆ
1
dz = dx,
a + bG(z)
and we’re on our way toward glorious victory.

Example 2.20. Solve the initial value problem y 0 = sin(x − y), y(0) = π/4.

Solution. Here f (x, y) = sin(x − y), and so if we define G(z) = sin(z) we can see that
f (x, y) = sin(x − y) = G(x − y)

for all (x, y) ∈ R2 . Thus, we may make the substitution z = x − y for y 0 = sin(x − y) and
expect a separable equation to result. From z = x − y we get z 0 = 1 − y 0 , so that y 0 = 1 − z 0
and the ODE becomes 1 − z 0 = sin(z). By the Method of Separation of Variables this leads to
ˆ ˆ
1
dz = dx. (37)
1 − sin(z)
Now, since
1 1 1 + sin(z) 1 + sin(z)
= · = 2
= sec2 (z) + tan(z) sec(z),
1 − sin(z) 1 − sin(z) 1 + sin(z) cos (z)
24

equation (37) becomes


ˆ ˆ
2
sec (z) dz + tan(z) sec(z) dz = x + c,

where c is an arbitrary constant. This immediately yields


tan(z) + sec(z) = x + c,
and thus
tan(x − y) + sec(x − y) = x + c
is the general solution to the ODE.
Now we make use of the initial condition. Setting x = 0 and y = π/4 in the general solution
gives
tan(−π/4) + sec(−π/4) = c,

so that c = 2 − 1 and we obtain

tan(x − y) + sec(x − y) = x + 2 − 1
as the solution to the IVP. 

You might also like