Odes PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Civil Engineering 2 Mathematics Autumn 2011

M. Ottobre

First and Second Order ODEs


Warning: all the handouts that I will provide during the course are in no way
exhaustive, they are just short recaps.
Notation used in this handout: y(x), f (x), a1 (x), a2 (x), a(x), b(x) are scalar func-
tions and x ∈ R. We will often write just y instead of y(x) and y 0 is the derivative
of y with respect to x.

• Classification. Consider the following differential equations

y 0 + a(x)y = b(x) (1)

and
y 00 + a1 (x)y 0 + a2 (x)y = f (x) (2)
in the unknown y(x).
Equation (1) is first order because the highest derivative that appears in it
is a first order derivative. In the same way, equation (2) is second order as
also y 00 appears.
They are both linear, because y, y 0 and y 00 are not squared or cubed etc and
their product does not appear. In other words we do not have terms like (y 0 )2 ,
(y 00 )5 or yy 0 .
If f (x) (b(x), respectively) is zero, then (2) ((1), respectively) is homogeneous,
otherwise it is non homogeneous.
If a1 (x) and a2 (x) are constant, then (2) has constant coefficients.
Example 0.1.
y 00 + 5y = x
is second order, linear, non homogeneous and with constant coefficients.

y 0 + x2 y = e x

is first order, linear, non homogeneous.

yy 00 + y 0 = 0

is non linear, second order, homogeneous.

Important Remark: The general solution to a first order ODE has one
constant, to be determined through an initial condition y(x0 ) = y0 e.g y(0) = 3.
The general solution to a second order ODE contains two constants, to be de-
termined through two initial conditions which can be for example of the form
y(x0 ) = y0 , y 0 (x0 ) = y00 , e.g. y(1) = 2, y 0 (1) = 6.

1
We will in general focus on linear equations. The only non linear ones that
we will stumble across are Separable Equations:
  Z Z
dy dy
= y 0 = g(x)h(y) ⇒ = g(x)dx
dx h(y)

(if h(y) is non linear then the equation is non linear).


Now let’s go back to the main object of our study.

• How do we solve equations of type (1)?


You might be in a very simple case:
Z
0
y = b(x) ⇒ y(x) = b(x)

However, in general we will use the INTEGRATING R FACTOR METHOD:


Step 1: Calculate the indefinite integral A(x) = a(x)dx.
Step 2: Multiply both sides of (1) by the integrating factor eA(x) . Hence
you get
eA(x) (y 0 + a(x)y) = eA(x) b(x). (3)
Now notice that the LHS of (3) can be rewritten as (eA(x) y)0 , in fact by the rule
for the derivative of the product of functions and the chain rule we have

(eA(x) y)0 = eA(x) a(x)y + eA(x) y 0 .

Step 3: Equation (3) can be rewritten as

(eA(x) y)0 = eA(x) b(x).

Integrate both sides Z


A(x)
e y= eA(x) b(x)dx + C

and obtain Z
y = e−A(x) eA(x) b(x)dx + e−A(x) C. (4)

The above formula (4) is the general solution. C is a generic constant and it
can be calculated by using the initial conditions.

• How do we solve equations of type (2)?


Recap of available methods.
Case 1: If the equation is homogeneous with constant coefficients, i.e. if
it is of the form
y 00 + by 0 + cy = 0, b, c ∈ R (5)
then we write the associated auxiliary polynomial

λ2 + bλ + c = 0, Δ = b2 − 4c.

2
If Δ > 0 the polynomial has two distinct real roots, λ1 , λ2 ∈ R and the solution
to (5) is
y(x) = Aeλ1 x + Beλ2 x , A, B ∈ R.
If Δ = 0 the polynomial has only one root, λ = − 2b , and the solution to (5) is

y(x) = Aeλx + Bxeλx A, B ∈ R.

If Δ < 0 (b2 < 4c) the polynomial has two complex conjugate roots, λ1 , λ2 ∈ C,
namely r
b b 4c − b2
λ1 = − + iω, λ2 = − − iω, ω=
2 2 4
and the solution to (5) is
b
y(x) = e− 2 x (A cos(ωx) + B sin(ωx)) A, B ∈ R.

Case 2: If the equation is homogeneous with NON constant coefficients,


i.e. if it is of the form

y 00 + a1 (x)y 0 + a2 (x)y = 0. (6)

FACT: If y1 (x) and y2 (x) are two (distinct) solutions of (6) then the general
solution of (6) is

y(x) = Ay1 (x) + By2 (x), A, B ∈ R.

So our aim is finding y1 and y2 . Let’s see what we can do.

METHOD OF ORDER REDUCTION. This method is based on hav-


ing a certain amount of luck. What do I mean? Well, if for some reason a
solution y1 rains on you, then this method allows you to find y2 which is the
general solution. But you are still left with the problem of finding y1 ...However,
assume we have a solution y1 of (6). To find y2
Step 1: Find u(x) solution to
 0 
2y1
u0 + + a1 u = 0 (7)
y1

(using the integrating factor method, see (4)).


Step 2: The general solution y2 is
Z
y2 (x) = y1 (x) u(x)dx.

This is it. But, why is that? We need to show that y2 solves (6).
Z
0 0
y2 = y1 u + y1 u,

3
Z
y200 = y100 u + 2y10 u + y1 u0 .

Putting everything together

y200 + a1 y20 + a2 y2
Z
= (y1 + a1 y1 + a2 y1 ) u + y1 u0 + (2y10 + a1 y1 ) u = 0
00 0
| {z } | {z }
k k
0 0
where the first addend vanishes because y1 is a solution and the terms in the
second brace vanish because u solves (7).

Case 3: If the equation is NON homogeneous with NON constant coef-


ficients, i.e. if it is of the form

y 00 + a1 (x)y 0 + a2 (x)y = f (x). (8)

FACT: Let y1 (x) and y2 (x) be two (distinct) solutions of the homogeneous
equation associated to (8), that is (6). Let yˉ be a particular integral of (8),
then the general solution of (8) is

y(x) = Ay1 (x) + By2 (x) + yˉ(x), A, B ∈ R. (9)

In other words, the general solution to (8) is

y(x) = general solution of homog. eqn. + particular int. of (8).

Because the method of order reduction worked so well before, let’s see if we can
employ it again. So, suppose you are given a solution y1 of the homogenous
equation (6). Let us again look for a solution of (8) in the form
Z
y = y1 v

and try and determine the equation that v has to satisfy in order for y to be a
solution of (8). As before Z
0 0
y = y1 v + y1 v,
Z
y 00 = y100 v + 2y10 v + y1 v 0 .

Now
y 00 + a1 y 0 + a2 y = f (x) ⇔ y1 v 0 + (2y10 + a1 y1 ) v = f (x)
hence v has to solve the equation
 0 
0 2y1 f (x)
v + + a1 v = .
y1 y1

4
R
v will then
R be of the form v(x) = g1 (x) + Cg2 (x) (see (4)) so that v is of
the form v = G1 (x) + CG2 (x) + D. Hence y(x) is of the form (9) and it is
therefore the general solution we were seeking.

Conservative Case: When a2 = a01 . In this case equation (8) reads


y 00 + a1 y 0 + a01 y = f (x),
which can be rewritten as
(y 0 + a1 y)0 = f (x)
R
so that integrating both sides and naming F (x) = f (x) leads to
0
y + a1 (x)y = F (x).
This equation is in the form (1) and we know how to solve it. Notice that the
above works also in case f ≡ 0.
Example 0.2. Solve
y 0 = −ex y, y(0) = 1.
First solution: separable variables
Z y Z x
dy x
=− ex dx ⇒ log(y) = −ex + 1 ⇒ y = e ∙ e−e .
1 y 0
Second solution: Integrating factor method. The integrating factor is
Z
A(x) = ex dx = ex .
x
Multiply both sides of the equation by ee and obtain
 x 0 x x
ee y = 0 ⇒ ee y = C ⇒ y = e−e C.

Imposing y(0) = 1 gives C = e.


Example 0.3. Given that y1 = x is a solution of
x(x + 2) 0 x + 2
y 00 − y + y = 0,
x2 x2
find the general solution of
x(x + 2) 0 x + 2
y 00 − y + y = x.
x2 x2
R
Sketch of solution: let y = x v. In order for y to be a solution of the inho-
mogeneous equation, v has to solve v 0 − v = 1 (during the exam you need to
show all the steps that lead to the equation for v). We solve the equation for v
by the integrating factor method and we get
Z
v = −1 + Cex ⇒ v = −x + Cex + D

⇒ y = −x2 + Cxex + Dx, C, D ∈ R


and y is the general solution we were seeking.

You might also like