Differential equations of first order - part 2
Dr Alina Gleska
Institute of Mathematics,
Faculty of Control, Robotics and Electrical Engineering,
Poznań University of Technology, Poland
Dr Alina Gleska Differential equations of first order - part 2
Definition
A first order differential equation is said to be linear if it can be
written as
y 0 + p(x)y = f (x). (1)
A first order differential equation that can’t be written like this is
nonlinear. We say that (1) is homogeneous if f ≡ 0; otherwise
it’s nonhomogeneous. Since y ≡ 0 is obviously a solution of the
homogeneous equation
y 0 + p(x)y = 0,
we call it the trivial solution. Any other solution is nontrivial.
Dr Alina Gleska Differential equations of first order - part 2
If p and f are continuous on some open interval (a, b) then
there’s a unique formula y = y (x, c) that involves x and a
parameter c and has these properties:
I For each fixed value of c, the resulting function of x is a
solution of (1) on (a, b).
I If y is a solution of (1) on (a, b), then y can be obtained
from the formula by choosing c appropriately.
We’ll call y = y (x, c) the general solution of (1).
Dr Alina Gleska Differential equations of first order - part 2
Homogeneous Linear First Order Equations
Theorem
If p is continuous on (a, b), then the general solution of the
homogeneous equation
y 0 + p(x)y = 0 (2)
on (a, b) is
y = ce−P(x) ,
R
where P(x) = p(x)dx is any antiderivative of p on (a, b); that
is P 0 (x) = p(x) for a < x < b.
Dr Alina Gleska Differential equations of first order - part 2
Linear Nonhomogeneous First Order Equations
We’ll now solve the nonhomogeneous equation (1):
y 0 + p(x)y = f (x).
When considering this equation we call
y 0 + p(x)y = 0
the complementary equation. We’ll find solutions of (1) in the
form y = uy1 , where y1 is a nontrivial solution of the
complementary equation and u is to be determined. This
method of using a solution of the complementary equation to
obtain solutions of a nonhomogeneous equation is a special
case of a method called variation of parameters.
Dr Alina Gleska Differential equations of first order - part 2
If y = uy1 , then y 0 = u 0 y1 + uy10 . Substituting these expressions
for y and y 0 into (1) yields
u 0 y1 + u(y10 + p(x)y1 ) = f (x)
which reduces to
u 0 y1 = f (x) (3)
since y1 is a solution of the complementary equation; that is,
y10 + p(x)y1 = 0.
Let us observe that y1 has no zeros on an interval where p is
continuous. Therefore we can divide (3) through by y1 to obtain
u 0 = f (x)/y1 (x).
We can integrate this (introducing a constant of integration),
and multiply the result by y1 to get the general solution of (1).
Dr Alina Gleska Differential equations of first order - part 2
Example
Find the general solution of
3
y 0 − y = x.
x
Solution. At first we find the nontrivial solution of the
complementary equation:
3
y 0 − y = 0.
x
We have
3y dy 3y dy 3dx dy 3dx
Z Z
0
y = ⇔ = ⇔ = ⇒ = ⇒
x dx x y x y x
⇒ ln |y | = 3 ln |x| + ln |C| ⇔ ln |y | = ln |Cx 3 | ⇒ y = Cx 3 .
Dr Alina Gleska Differential equations of first order - part 2
Now we take
y (x) = C(x)x 3 .
Then
y 0 (x) = C 0 (x)x 3 + C(x)3x 2 .
Substituting y and y 0 into the main nonhomogeneous equation
we obtain
3
C 0 (x)x 3 + 3x 2 C(x) − C(x)x 3 = x ⇔ C 0 (x)x 3 = x ⇔
x
1 1 1
Z
⇒ C 0 (x) = 2
⇒ C(x) = 2
dx = − + K .
x x x
So the general solution is y (x) = − x1 + K x 3 = Kx 3 − x 2 .
Dr Alina Gleska Differential equations of first order - part 2
Example
Find the general solution of
y 0 + 2y = e3x .
Solution. At first we find the nontrivial solution of the
complementary equation:
y 0 + 2y = 0.
We have
dy dy dy
Z Z
y 0 = −2y ⇔ = −2y ⇔ = −2dx ⇒ = −2dx ⇒
dx y y
⇒ ln |y | = −2x + C1 ⇔ y = e−2x+C1 ⇒ y = Ce−2x
where C = eC1 .
Dr Alina Gleska Differential equations of first order - part 2
Now we take
y (x) = C(x)e−2x .
Then
y 0 (x) = C 0 (x)e−2x − 2C(x)e−2x .
Substituting y and y 0 into the main nonhomogeneous equation
we obtain
C 0 (x)e−2x −2C(x)e−2x +2C(x)e−2x = e3x ⇔ C 0 (x)e−2x = e3x ⇔
1
Z
0 5x
⇒ C (x) = e ⇒ C(x) = e5x dx = e5x + K .
5
So the general
solution
is
1 5x
y (x) = 5 e + K e −2x = 51 e3x + Ke−2x .
Dr Alina Gleska Differential equations of first order - part 2
Example
Find the general solution of
y 0 cos(x) − y sin(x) = 1.
Solution. At first we find the nontrivial solution of the
complementary equation:
y 0 cos(x) − y sin(x) = 0.
We have
dy sin(x) dy sin(x)
y 0 cos(x) = y sin(x) ⇔ =y ⇔ = dx ⇒
dx cos(x) y cos(x)
dy sin(x)
Z Z
⇒ = dx ⇒
y cos(x)
C C
⇒ ln |y | = − ln | cos(x)|+ln |C| ⇔ ln |y | = ln ⇒y = .
cos(x) cos(x)
Dr Alina Gleska Differential equations of first order - part 2
Now we take
C(x)
y (x) = .
cos(x)
Then
C 0 (x) cos(x) + C(x) sin(x) C 0 (x) C(x) sin(x)
y 0 (x) = 2
= + .
cos (x) cos(x) cos2 (x)
Substituting y and y 0 into the main nonhomogeneous equation
we obtain
C 0 (x) C(x) sin(x) C(x)
+ 2
cos(x)− sin(x) = 1 ⇔ C 0 (x) = 1 ⇔
cos(x) cos (x) cos(x)
Z
⇒ C(x) = 1dx = x + K .
x+K
So the general solution is y (x) = cos(x) .
Dr Alina Gleska Differential equations of first order - part 2
Example
Find the general solution of
xy 0 + x 2 + xy = y .
Solution. At first we have to reformulate the equation
xy 0 + x 2 + xy = y ⇔ xy 0 + (x − 1)y = −x 2 .
Now we find the nontrivial solution of the complementary
equation:
xy 0 + (x − 1)y = 0.
We have
dy 1−x dy 1
xy 0 = (1 − x)y ⇔ =y ⇔ = − 1dx ⇒
dx x y x
dy 1
Z Z
⇒ = −1dx ⇒ ln |y | = ln |x|−x +C1 ⇔ y = eln |x|−x+C1 ⇔
y x
Dr Alina Gleska Differential equations of first order - part 2
⇔ y = Cxe−x
for x > 0.
Now we take
y (x) = C(x)xe−x .
Then
y 0 (x) = C 0 (x)xe−x + C(x)(e−x − xe−x ) =
= C 0 (x)xe−x + C(x)e−x − C(x)xe−x .
Substituting y and y 0 into the main nonhomogeneous equation
we obtain
x C 0 (x)xe−x +C(x)e−x −C(x)xe−x +(x −1)C(x)xe−x = −x 2 ⇔
Z
0 −x
C (x)e = −1 ⇔ C(x) = −ex dx = −ex + K .
So the general solution is
y (x) = (−ex + K )xe−x = −x + Kxe−x = x(Ke−x − 1).
Dr Alina Gleska Differential equations of first order - part 2
An Existence and Uniqueness Theorem
Theorem
Suppose p and f are continuous on an open interval (a, b) and
let y1 be any nontrivial solution of the complementary equation
y 0 + p(x)y = 0
on (a, b). Then
I The general solution of the nonhomogeneous equation
y 0 + p(x)y = f (x)
on (a, b) is
Z
y = y1 x + f (x)/y1 (x) dx.
Dr Alina Gleska Differential equations of first order - part 2
I If x0 is an arbitrary point in (a, b) and y0 is an arbitrary real
number, then the initial value problem
y 0 + p(x)y = f (x), y (x0 ) = y0
has the unique solution
y Z x
0 f (t)
y = y1 (x) + dt
y1 (x0 ) x0 y1 (t)
on (a, b).
Dr Alina Gleska Differential equations of first order - part 2
Undetermined Coefficients
In this section we will take a look at the first method that can be
used to find a particular solution to a nonhomogeneous
differential equation:
y 0 + p(x)y = q(x). (4)
One of the main advantages of this method is that it reduces
the problem down to an algebra problem. The algebra can get
messy on occasion, but for most of the problems it will not be
terribly difficult. Another nice thing about this method is that the
complementary solution will not be explicitly required, although
as we will see knowledge of the complementary solution will be
needed in some cases and so we’ll generally find that as well.
Dr Alina Gleska Differential equations of first order - part 2
Suppose that yp (x) is a known particular solution of the
equation (4). Then
yp0 + p(x)yp = q(x) (5)
on some open interval (a, b). Subtracting equation (4) and (5)
we get
y 0 − yp0 + p(x)(y − yp ) = 0. (6)
Let’s denote z = y − yp . Then z 0 = y 0 − yp0 and (6) becomes
z 0 + p(x)z = 0. (7)
We have obtained the equation with separable variables. It’s
general solution is equal to:
R
z = Ce− p(x)dx
,
and the general solution of (4) is y = yp + z.
Dr Alina Gleska Differential equations of first order - part 2
There are two disadvantages of this method:
I First, it will only work for a fairly small class of q(x)’s. The
class of q(x)’s for which the method works, does include
some of the more common functions, however, there are
many functions out there for which undetermined
coefficients simply won’t work.
I Second, it is generally only useful for constant coefficient
differential equations.
Dr Alina Gleska Differential equations of first order - part 2
The method is quite simple. All that we need to do is look at
q(x) and make a guess as to the form of yp (x) leaving the
coefficient(s) undetermined (and hence the name of the
method). Plug the guess into the differential equation and see if
we can determine values of the coefficients. If we can
determine values for the coefficients then we guessed correctly,
if we can’t find values for the coefficients then we guessed
incorrectly.
Dr Alina Gleska Differential equations of first order - part 2
Now that we’ve gone over the three basic kinds of functions
that we can use undetermined coefficients on let’s summarize.
q(x) yp (x) guess
βx
ae Aeβ x
a cos(β x) A cos(β x) + B sin(β x)
b sin(β x) A cos(β x) + B sin(β x)
a cos(β x) + b sin(β x) A cos(β x) + B sin(β x)
nth degree polynomial An xn + An−1 xn−1 + . . . + A1 x + A0
Notice that there are really only three kinds of functions given
above. It’s usually easier to see this method in action rather
than to try and describe it, so let’s jump into some examples.
Dr Alina Gleska Differential equations of first order - part 2
Example
Find the general solution of
y 0 + 4y = x 2 − 1.
The first thing that we’re going to do is find the complementary
solution to this differential equation. We have:
dz
Z Z
0
z + 4z = 0 ⇒ = −4dx ⇒ ln |z| = −4x + C1 ⇒ z = Ce−4x .
z
Now, let’s proceed with finding a particular solution. We predict
that yp = ax 2 + bx + c. Then yp0 = 2ax + b. We plug them into
the main differential equation:
2ax + b + 4(ax 2 + bx + c) = x 2 − 1.
Dr Alina Gleska Differential equations of first order - part 2
This symplify to
4ax 2 + (2a + 4b)x + b + 4c = x 2 − 1.
We compare the coefficients:
1
4a = 1 ⇒ a = ,
4
1
2a + 4b = 0 ⇒ b = − ,
8
7
b + 4c = −1 ⇒ c = − .
32
Finally we have the general solution y = Ce−4x + 14 x 2 − 18 x − 32
7
.
Dr Alina Gleska Differential equations of first order - part 2
Example
Find the general solution of
y 0 + 2y = cos(3x).
The first thing that we’re going to do is find the complementary
solution to this differential equation. We have:
dz
Z Z
z 0 + 2z = 0 ⇒ = −2dx ⇒ ln |z| = −2x + C1 ⇒ z = Ce−2x .
z
Now, let’s proceed with finding a particular solution. We predict
that yp = A sin(3x) + B cos(3x). Then
yp0 = 3A cos(3x) − 3B sin(3x). We plug them into the main
differential equation:
3A cos(3x) − 3B sin(3x) + 2(A sin(3x) + B cos(3x)) = cos(3x).
Dr Alina Gleska Differential equations of first order - part 2
This symplify to
(2A − 3B) sin(3x) + (3A + 2B) cos(3x) = cos(3x).
We compare the coefficients:
2A − 3B = 0 4A − 6B = 0 3 2
⇔ ⇒A= ,B = .
3A + 2B = 1 9A + 6B = 3 13 13
Finally we have the general solution
3 2
y = Ce−2x + sin(3x) + cos(3x).
13 13
Dr Alina Gleska Differential equations of first order - part 2
Example
Find the general solution of
y 0 − 3y = 4x 2 e−x .
The first thing that we’re going to do is find the complementary
solution to this differential equation. We have:
dz
Z Z
z 0 − 3z = 0 ⇒ = 3dx ⇒ ln |z| = 3x + C1 ⇒ z = Ce3x .
z
Now, let’s proceed with finding a particular solution. We predict
that yp = (ax 2 + bx + c)(e−x ). Then
yp0 = (2ax +b)e−x −(ax 2 +bx +c)e−x = e−x (−ax 2 +(2a−b)x +b −c).
We plug them into the main differential equation:
e−x (−ax 2 + (2a − b)x + b − c) − 3(ax 2 + bx + c)(e−x ) = 4x 2 e−x .
Dr Alina Gleska Differential equations of first order - part 2
This symplify to
−4ax 2 + (2a − 4b)x + b − 4c = 4x 2 .
We compare the coefficients:
−4a = 4 ⇒ a = −1,
1
2a − 4b = 0 ⇒ b = −
2,
1
b − 4c = 0 ⇒ − .
8
Finally we have the general solution
1 1 −x
y = Ce3x − x 2 + x + e .
2 8
Dr Alina Gleska Differential equations of first order - part 2
Example
Find the general solution of
y 0 − y = xex .
The first thing that we’re going to do is find the complementary
solution to this differential equation. We have:
dz
Z Z
z0 − z = 0 ⇒ = dx ⇒ ln |z| = x + C1 ⇒ z = Cex .
z
Now, let’s proceed with finding a particular solution. We predict
that yp1 = (ax + b)(ex ). Then
0
yp1 = aex + (ax + b)ex = ex (ax + a + b).
We plug them into the main differential equation:
ex (ax + a + b) − (ax + b)(ex ) = xex ⇔ aex = xee .
Dr Alina Gleska Differential equations of first order - part 2
It is a contradiction since a is a constant and x is a variable. So
we try again - we predict yp2 = (ax 2 + bx + c)(ex ). Then
0
yp2 = (2ax +b)ex +(ax 2 +bx +c)ex = ex (ax 2 +(2a+b)x +b +c).
We plug them into the main differential equation:
ex (ax 2 + (2a + b)x + b + c) − (ax 2 + bx + c)(ex ) = xex ⇔
⇔ ex (2ax + b) = xex ⇔ 2ax + b = x.
We compare the coefficients:
1
2a = 1 ⇒ a = ,
2
b = 0, c − any constant.
Finally we have the general solution
1 1
y = Cex + x 2 + c ex = ex x 2 + D ,
2 2
where D = C + c.
Dr Alina Gleska Differential equations of first order - part 2