First-Order Differential Equations
National Chiao Tung University Chun-Jen Tsai 9/16/2019
Solution Curves without Solving DE
Sometimes, just by looking at the differential equation, we can learn useful information about its solutions:
The solution curve y = y(x) of a first order DE
dy/dx = f (x, y) on its interval of definition I must possess a tangent line at each point (x, y(x)), and must have no breaks.
The slope of the tangent line at (x, y(x)) on a solution curve is the value of the first derivative dy/dx at this point.
A (very small) line segment at (x, y(x)) that has the slope f (x, y) is called lineal element of the solution curve.
Example of Lineal Element
Consider dy/dx = f (x, y) = 0.2xy, the slope of the lineal element of the solution curve at (2, 3) is f (2, 3) = 1.2.
x y
Lineal element is tangent to solution curve passes (2,3)
(2, 3) solution curve
tangent
x y
Lineal element at (2, 3) (2, 3) slope = 1.2
Direction Field
The collection of the lineal elements on a rectangular grid on the xy-plane is called a direction field or a slope field of the DE dy/dx = f (x, y).
A single solution curve on the x–y plane will follow the flow pattern of the slope field.
y 4
2
- 2
x 4
2
- 2
y
x
Increasing/Decreasing of a Solution
If dy/dx > 0 for all x on the interval of definition I, then the differentiable function y(x) is increasing on I.
If dy/dx < 0 for all x on the interval of definition I, then the differentiable function y(x) is decreasing on I.
Example: Approximating a Solution
We can use a slope field to approximate the IVP, dy/dx = sin y, y(0) =-3/2:
1) Define the direction field around y = 0
2) Constraint 1: the solution must pass (0, –3/2)
3) Constraint 2: the slope of the solution curve must be 0 when y
= 0 and y = –
the solution curve can be
approximated as in the figure.
4 2
-2
y
x
Autonomous First-Order DEs
A DE in which the independent variable does not appear explicitly is said to be autonomous.
If x is the independent variable, an autonomous DE can be written as F(y, y') = 0, or dy/dx = f (y).
Example: If y(t) is a function of time, then the following DE is autonomous and time-independent:
1 y2
dt
dy
Critical Points
In dy/dx = f (y), if f(c) = 0, then c is called the critical point of the autonomous DE. A critical point is also refer to as an equilibrium point or a stationary point.
If c is a critical point of dy/dx = f (y), then y(x) = c is a constant solution of the autonomous equation. This is also called an equilibrium solution.
Example: Autonomous DE
The DE, dP/dt = (a-bP)P, a > 0, b > 0, is autonomous.
Let (a-bP)P = 0, we have two critical points: 0 and a/b.
The sign of f(P) = P(a-bP) can be shown in a phase portrait
a/b
0
P-axis
Interval Sign of f(P) P(t) Arrow
(–, 0) minus decreasing down
(0, a/b) plus Increasing Up
(a/b, ) minus decreasing down
Solution Curve Properties
The solution space can be divided into several regions by equilibrium solutions:
y(x) is bounded
f(y) > 0 or f(y) < 0 for all x in a sub region
y(x) is strictly monotonic
If y(x) is bounded above or below by a critical point, y(x) approaches this point either as x or as x –.
R3
I
(x0, y0) y
R2 y(x) = c2
y(x) = c1
Example: dP/dt = P(a - bP) Revisited
P
a b
0
decreasing
increasing
decreasing
phase line tP-plane
P0 P0 P0 P
R3
R2
R1 t
Example: dy/dx = (y – 1)
21
y y
(0, 2)
y = 1 y
y = 1
(0, –1)
x x
increasing
increasing
x = − x = 1
Attractors and Repellers
The solution curve of a first order DE near a critical point c exhibits one of the following three behaviors:
Solution curves approach c from either sides. c is called asymptotically stable or an attractor.
All solution curves starts near c move away from c. c is called unstable critical point or a repeller.
Solution curves approach c from one side and move away from c from the other side. c is called semistable.
Solution by Integration
If the DE can be expressed in normal form, f(x, y) = g(x), the equation can be solved by integration.
Since,
Integrating both sides, we have:
where G(x) is the indefinite integral of g(x).
xdx g dy
x dx G
x cg
y
Example: Solution by Integration
Solving the initial value problem
By integrating both sides, we have . 3
) 3 2
( )
(x x dx x2 x c
y
. 2 )
1 ( ,
3
2
x y
dx dy
-6 -5 -4 -3 -2 -1 0 1 2 3 4
-10 -8 -6 -4 -2 0 2 4
C = 2
C = 0 C = –2
C = –6 C = –4
Solution that passes through the initial condition (1, 2) is the curve with C = –2
Family of solution curves
2
nd-Order Solution by Integration
If we have a second-order DE of the special form:
we have
where G is an anti-derivative of g and C1 is an arbitrary constant. Therefore,
where C2 is a second arbitrary constant.
),
2 (
2
x dx g
y
d
, )
( )
( )
(x dx g x dx G x C1
y
( )
( ) ,) ( )
(x y x dx G x C1 dx G x dx C1x C2
y
y
Separable Equations (1/2)
A first order DE of the form
is said to be separable or to have separable variables.
Divide both side by h(y), the DE becomes
Integrating both sides w.r.t. x, we have
x h y g x f y , where f (y) 1/ h(y)dx g
dy
g
xdx y dy
f
( )
dx g
x dx C.dx x dy y
f
Separable Equations (2/2)
Cancelling the differential term dx, we have
If the two anti-derivatives
can be found, we have the family of equations F(y(x)) = G(x) + C
that conforms to the differential equation.
y dy g
x dx C.f
f y dy G x g x dx y
F( ) and ( )
Example: dy/dx = –6xy, y(0) = 7
Rearranging the equation, we have dy/y = –6xdx, therefore,
Thus |y| = e–3x2 eC1 or y = ±eC1 e–3x2. We have, y = C2e–3x2, C2 = ±eC1 R.
However, y = 0 is also a solution.
Note that as C2 0, y 0.
Since y(0) = 7, the particular solution is y = 7e–3x2. .
3 ln
6 /
1
2 C
x y
xdx y
dy
Example: dy/dx = –x/y, y(4) = –3
Since
ydy=
–
xdx, we have y2/2 = –x2/2 + c1. The solution must pass (4, –3), thus, c1 = 25/2. the solution is the lower half-circle of radius 5 centered at (0, 0).
x y
family of solutions:
x2+ y2= C
Losing a Solution
Some care should be exercised when separating
variables, since the variable divisors could be zero in some cases.
If r is a zero of h(y), then y = r is a constant solution of the DE. However, y = r may not show up in the family of solutions. Recall that this is called a singular
solution.
Example: dy/dx = y
2- 4
Since y2-4 is separable
y2dy 4
dx
y1/42 y1/ 42dy
dx2 1
4 ln 2 1
4 ln
1 y y x c
, 2
2 or 2
, 2 4
ln 2 2 ce4x c ec
y c y
y x
y
x x
ce
y ce4
4
1 21
Example: (e
2y– y)cos x = e
ysin 2x, y(0) = 0
Solve the IVP by dividing both sides by ey cos x, then multiply both sides by dx, we have
x dx dy x
e y e
y y
cos 2
2 sin
ey yey dy 2
sin x dx0 )
0 ( , cos
2
ye e x c y
ey y y
c = 4
Linear First Order DE
A first-order differential equation of the form:
(1) is said to be a linear equation. When g(x) = 0, the
linear equation is said to be homogeneous, otherwise it is non-homogeneous.
Dividing both side of (1) by the leading coefficient a1(x), we have the standard form:
) ( )
( )
( 0
1 a x y g x
dx x dy
a
) ( )
(x y f x dy P
Solving the 1
st-Order Standard Form
The solution of dy/dx + P(x)y = f(x) can be derived by multiplying both sides of the equation by a special function
(x). We want the function
(x) to satisfy the property:Thus d
/dx =
P(x)
= eP(x)dx.The function
(x) is called the integrating factor.
( )
P(x)y f (x).dx y dy
dx d dx
y dy dx x
d
Solution by Integrating Factors
We can solve the DE by multiplying both sides of the standard form by eP(x)dx, thus:
P x dx P x e P x dx y f x e P x dx dx
e ( ) dy ( ) ( ) ( ) ( )
ye P x dx f x e P x dx dx
d ( ) ( )
) (
c dx e
x f
yeP(x)dx
( ) P(x)dx Dropping Integrating Factor Constant
Note that you do not need to keep the constant when computing the anti-derivative of the integrating factor.
Assume that G(x) is the anti-derivative of P(x), since eP(x)dx = eG(x) + c = c1eG(x),
The constant c1 = ec will simply be cancelled out on both side of the differential equation.
Example: Solve dy/dx – 3y = 6
Solution:
dx x
e e(3) 3
e x y e xdx
d 3 3
6
x x
x e y e
dx
e3 dy 3 3 6 3
c e
y
e3x 2 3x
ce x
y 2 3x,
General Solution on I
If P(x) and f(x) in the standard form are continuous on an open interval I, then
is a general solution of dy/dx + P(x)y = f(x).
That is, every solutions on I has the form. In other words, there is no singular solution for the linear 1st order differential equation on I.
ce e e f x dx
y P(x)dx P(x)dx P(x)dx ( )
Particular Solution on I
Given an initial condition y(x0) = y0 to the linear first order DE dy/dx + P(x)y = Q(x) on I where P(x) and Q(x) are continuous, the particular solution of the DE has the form:
Note that it is easy to verify that y(x0) = y0.
xxdu u P dt
t
P y e Q t dt
e x
y
t x x
x
0 0
0 ( )
)
( ( ) 0 ( )
Example: (x
2–9)dy/dx + xy = 0
Solution:
P(x) is continuous on (–, –3), (–3, 3), and (3, ).
Thus, the integrating factor is:
Therefore,
) 9 ) (
( ,
9 0 2
2
x x x
P x y
x dx
dy
. 3 , 3 ,
2 9
9 ln 2 / ) 1
9
( 2 2
x x
e
e x dx x
x
. 0
2 9
x y dx
d
. 3 , 3 ,
2 9 y c x x
Example: IVP y' + y = x, y(0) = 4
Since P(x) = 1 and Q(x) = x are continuous on (–, ), we have integrating factor edx = ex:
ex y xexdx
d
x ce x
y ( 1) x,
4 2 0 - 2
x y
c > 0
c < 0 0
transient term
Example: Discontinuous f(x)
Find a continuous function satisfying
and y(0) = 0.
Solution:
find c2 so that
0, 1
1 0
, ) 1
( ),
( x
x x f x f dx y
dy
1 ,
1 0
, 1
2e x
c
x
y e x
x
) 1 ( )
(
limx1 y x y
f(x)
x
y
1 x
Non-elementary Functions
Some simple function do not possess antiderivatives that are elementary functions, and integrals of this kind of functions are called non-elementary.
The integrations of non-elementary functions can only be solved by numerical methods.
Example:
dx e x
2
sin x2dxLevel Curves and Family of Solutions
In multivariate calculus, for a function of two variables, z = G(x, y), the curves defined by G(x, y) = c (c is a
constant) are called level curves of the function.
Level curves of ey+ye–y+e–y+2cos = c Solutions of IVPs
x y
2
1
-1
-2
-2 -1 1 2
-1
-2
x y
2
1
-2 -1 1 2
c = 2 c = 4
(0, 0)
( /2, 0)
Differentials of Two-Variable Functions
If z = f (x, y) is a function of two variables with
continuous first partial derivatives in a region R of the xy-plane, then its total differential is:
If f (x, y) = c, we have:
Given a one-parameter family of curves f (x, y) = c, .
y dy dx f
x dz f
.
0
dy
y dx f
x f
Example:
If x2 – 5xy + y3 = c, then taking the differential gives (2x – 5y) dx + (–5x + 3y2) dy = 0.
Question: can we think reversely?
Exact Equations
A differential expression M(x, y) dx + N(x, y) dy is an exact differential in a region R of the xy-plane if it is the total differential of some function f(x, y).
A first-order differential equation of the form M(x, y) dx + N(x, y) dy = 0
is said to be an exact equation if the expression on the left-hand side is an exact differential.
Criterion for an Exact Differential
Theorem: Let M(x, y) and N(x, y) be continuous and
have continuous first partial derivatives in a rectangular region R defined by a < x < b, c < y < d.
Then a necessary and sufficient condition that M(x, y) dx + N(x, y) dy be an exact differential is
x . N y
M
Proof of the Necessity
If M(x, y) dx + N(x, y) dy is exact, there exists some function f such that for all x in R,
Therefore, M(x, y) = f/x, and N(x, y) = f/y, and .
) , ( )
,
( dy
y dx f
x dy f
y x N dx
y x
M
.
2
x N y
f x
x y
f x
f y
y M
#
Proof of the Sufficiency (1/2)
Note that we have
where g(y), shall be a function of y. Since we want
therefore,
If we can prove that g'(y) is a function of y alone, integrating g'(y) w.r.t. y, gives us the solution.
), ( )
, ( )
, ( )
,
(x y f x y M x y dx g y x M
f
), ( )
, ( )
, ( )
,
( M x y dx g y
y y x N y
x y N
f
M x y dx
y y x N y
g ( ) ( , ) ( , )
Proof of the Sufficiency (2/2)
Since
and M/y = N/x, we have /x[g'(y)] = 0.
Thus, g'(y) is a function of y alone.
In this case, the solution is
y M x
dx N y x y M
y x
x N
( , )
( , ). )
, ( )
, ( )
, ( )
,
(x y
M x y dx
N x y y
M x y dxdyf
#
Observations
The solution to an exact eq. M(x, y) dx + N(x, y) dy = 0 is
where c is a constant parameter.
The method of solution can start from f/ y = N(x, y) as well. Then, we have
( , ) ( )
) ,
(x y N x y dy h x f
N x y dy
y x x M x
h ( ) ( , ) ( , )
, )
, ( )
, ( )
, ( )
,
( M x y dx dy c
y y x N dx
y x M y
x
f
Example: 2xy dx+(x
2– 1)dy = 0
Solution:
Since M(x, y) = 2xy, N(x, y) = x2 – 1, we have
M/y = 2x = N/x so the equation is exact, and there exists f(x, y) such that f/x = 2xy and
f/y = x2 – 1.
Integrating the first equation f(x, y) = x2y + g(y)
Take the partial derivative of y, equate it with N(x, y), we have x2 + g(y) = x2 – 1. Therefore, g(y) = –1, and f (x, y) = x2y – y. The implicit solution is x2y – y = c.
Example: An IVP of Exact Equation
Solve
Solution:
. 2 ) 0 ( ) ,
1 (
sin cos
2
2
y
x y
x x
xy dx
dy
x xdx
x x
h( ) (cos )(sin ) 12cos2
x xy N
y M
2
2 2 h (x) cosxsin x xy x xy
f
) ( ) 1
2 ( ) , ( ), 1
( 2
2
2 y x h x
y x f x
y y
f
Example: An IVP (cont.)
The implicit solution is y2(1 – x2) – cos2x = c.
Substitute the initial condition y(0) = 2 into the implicit solution, we have c = 3.
y
x
Integrating Factors for Exactness
Can we multiply a non-exact equation by an integrating factors
(x, y) to make it exact? That is, can we make
(x, y)M(x, y) dx +
(x, y)N(x, y) dy = 0an exact differential equation? To achieve this goal,
(x, y) must satisfyM
y– N
x + (My – Nx)
= 0. In practice, a proper
(x, y) is not easy to find unless it happens to be a function of x or y alone. If
(x, y) =
(x),
N N M
dx
d y x
Separable equation if (My – Nx)/N contains x alone.
Solution by Substitutions
We can substitute dy/dx = f (x, y) with y = g(x, u), where u is a function of x, to solve for the solution.
By chain rule:
then
We can then solve for du/dx = F(x, u).
If u =
(x) is the solution, then y = g(x,
(x))., )
, ( )
,
( dx
u du x g u
x dx g
dy
u
x
. )
, ( )
, ( ))
, ( ,
( dx
u du x g u
x g u
x g x
f x u
Homogeneous Equations (1/2)
If f(tx, ty) = tf(x, y) for some real number
, then f is said to be a homogeneous equation of degree
.Example: f (x, y) = x3+y3 is a homogeneous equation of degree 3.
Similarly, a first-order DE in differential form M(x, y)dx+N(x, y)dy = 0
is said to be homogeneous if both M and N are homogeneous function of the same degree.
Homogeneous Equations (2/2)
The meaning of “homogeneous” here is different from the “homogeneous” in Sec. 2.3.
If M and N are homogeneous functions of degree
, we have:M(x, y) = xM(1, u) and N(x, y) = xN(1, u), u = y/x and
M(x, y) = yM(v, 1) and N(x, y) = yN(v, 1), v = x/y
We can turn a homogeneous equation into a separable first order DE using substitution with either y = ux or x = vy.
Example: (x
2+y
2)dx +(x
2-xy)dy = 0
Solution:
M and N are 2nd-order homogeneous equation.
Let y = ux, then dy = u dx+x du.
After substitution, we have
(x2+u2x2)dx+(x2-ux2)[u dx+x du] = 0
x2 (1+u)dx+x3 (1-u) du = 0 Therefore
1 0 1 2 1 0
1
x du dx
u x
du dx u u
c x
u
u 2ln1 ln ln
Bernoulli’s Equation
The DE
where n is any real number, is called Bernoulli’s
equation. Note that for n = 0 and n = 1, it is linear. For any other n, the substitution u = y1–n reduces any
equation of this form to a linear equation.
yn
x f y
x dx P
dy ( ) ( )
Example: x dy/dx + y = x
2y
2 Solution:
,
substitute with y = u–1 and dy/dx = –u–2du/dx.
, the integrating factor on (0, ) is e–dx/x = x–1, we have
x–1u = –x + c y = 1/(– x2 + cx).
1 2
xy x y
dx
dy
x x u
dx
du
1
x1u 1dx d
Another Reduction to Separation
A DE of the form
can always be reduced to an equation with separable variables by means of the substitution
u = Ax+By+C, B ≠ 0.
) (Ax By C dx f
dy
Example: dy/dx = (–2x + y)
2– 7, y(0) = 0
Solution:
Let u =-2x+y, then du/dx =-2+dy/dx.
The DE can be reduced to du/dx = u2-9.
dx u du
dx u u
u
du
3 1 3
1 6
1 )
3 )(
3 (
6 1
6
1 ,
3 3 3
ln 3 6
1 x c
e c
u ce c u
u x
u
x x
ce x ce
y 6
6
1
) 1
( 2 3
. 1 ,
0 )
0
(
y c x
y
Numerical Methods
The solution of a DE can be approximated using a tangent line:
Euler’s Method
One can solve the IVP: y’ = f(x, y), y(x0) = y0, numerically using the following procedure:
1. Linearization of y(x) at x = x0: L(x) = f(x0, y0)(x – x0) + y0
2. Replace x in the above equation with x1 = x0 + h, we have L(x1) = f (x0, y0)(x0 + h – x0) + y0 or y1 = y0 + hf (x0, y0),
where y1 = L(x1)
3. If h 0 then y1 ~ y(x1)
4. Use (x1, y1) as a new starting point, we have x2 = x1 + h = x0 + 2h, and y(x2) = y1 + hf(x1, y1)
5. Recursively, we have yn+1 = yn + hf(xn, yn), where xn = x0 + nh, n = 0, 1, 2, …
Error Accumulations
Numerical solutions are approximations to the exact solution of a DE approximation errors may become large when x is far away from the initial condition.
exact solution
y
Euler’s method Runge-Kutta
method