2 ODEs—Integrating Factors and Homogeneous Equations

advertisement
2
ODEs—Integrating Factors and Homogeneous Equations
We begin with a slightly different type of equation:
2.1
Exact Equations
These are ODEs whose general solution can be obtained by simply integrating both sides of the equation.
Examples Find the general solutions of the following ODEs.
a)
dy
dx
b)
d
2
dx (yx )
= 2 sin x,
= 4x3
Z
a) This is completely standard—we can rewrite as the integral equation
Z
dy =
2 sin(x)dx. Then
integrating both sides, we obtain
y = −2 cos x + c
b) Here we do the same: Integrating both sides, we obtain
Z
2
d(yx )
Z
=
4x3 dx
and hence
yx2 = x4 + c.
We can now divide through by x2 to obtain the general solution
y = x2 +
c
.
x2
Key Point
The solution of the equation
d
f (x)y = g(x)
dx
is
Z
f (x)y =
g(x) dx
or
y=
Terminology: In the differential equation b)
1
f (x)
Z
g(x) dx
c
d
(yx2 ) = 4x3 , the solution has two parts, since y = x2 + 2 .
dx
x
1
The part x2 is called the definite part. The part
c
(containing the arbitrary constant of integration) is
x2
called the indefinite part.
If we take the definite part of the solution, i.e. yd = x2 then
d
d
d
(yd · x2 ) =
(x2 · x2 ) =
(x4 ) = 4x3 .
dx
dx
dx
Hence yd = x2 is a solution of the original differential equation (b).
Now consider the indefinite part of the solution, i.e. yi =
c
x2 ,
then
d
d
d c
2
=
·
x
(yi · x2 ) =
(c) = 0.
2
dx
dx x
dx
This works generally:
2.1.1
Useful fact:
In solving an exact equation
d
f (x)y = g(x), the solution y has two parts: y = yd (x) + yi (x) where:
dx
1. The definite part yd (x) which is a solution of the differential equation.
2. The indefinite part yi (x) which satisfies a simpler version of the differential equation in which the
right-hand side is zero.
Exercise: Solve the equation
d
(y sin x) = sinx
dx
and verify that the indefinite part of the solution satisfies the equation
d
dx (y sin
Solution: Integrate both sides of the equation,
y sin x =
y
=
− cos x + C
− cot x + Ccosec x.
Hence yd (x) = − cot x and yi (x) = C cosec x.
Now
d
d
d
(yi (x) sin x) =
(cosec x sin x) =
(C) = 0.
dx
dx
dx
2
x) = 0.
2.1.2
Recognising exact equations
d
(yx2 ) = x2 is exact but if we expand the left-hand side of this equation using the
dx
product rule, we have that
The equation b)
d
(yx2 )
dx
=
=
dy
d
+ y (x2 )
dx
dx
dy
x2
+ y(2x)
dx
x2
and so,
x2
dy
+ 2xy = x2 .
dx
(2.1)
Hence the equation (2.1) is exact but it is not in standard form.
2.1.3
Key point
The equation f (x)
dy
+ yf 0 (x) = g(x) is exact. It can be rewritten as:
dx
d
(yf (x)) = g(x)
dx
Z
so that yf (x) =
1
g(x) dx and y =
f (x)
Z
g(x) dx.
Example. Solve the equation
e2x
dy
+ 2e2x y = x2 .
dx
d 2x
e = 2e2x . Therefore this is just the exact equation
dx
x3
gives e2x y =
+ c. Thus
3
x3 −2x
y=
e
+ ce−2x
3
Note that
is the general solution.
3
d
2x
dx (e y)
= x2 . Integrating both sides
2.2
Integrating Factors
Integrating factors can be used to transform certain ODEs which are not exact into exact ODEs. As an
illustration, consider
x3
dy
+ 4x2 y = x.
dx
As you may wish to check, this is not exact. However, if we multiply through by x, we get
x4
dy
+ 4x3 y = x2
dx
which can be rewritten as the exact equation
d
(yx4 ) = x2 .
dx
Thus we can solve this as before to get
yx4 =
Z
d
(yx4 )dx =
dx
Z
x2 dx =
x3
+c
3
or
y=
1
c
+ 4.
3x x
The function by which we multiply a given ODE in order to make it exact is called the integrating factor.
In the above example x is the integrating factor. This works rather generally:
2.2.1
Fundamental Algorithm
dy
+ b(x)y + c(x) = 0 can be transformed into an exact equation and
dx
then (hopefully!) solved. This requires the following steps:
Any linear ODE of the form a(x)
Step I: Divide by a(x) to get an equation of the form
dy
+ f (x)y = g(x)
dx
Step II: Compute the integrating factor
Z
I.F. = exp
f (x) dx
Note that we do not need constants of integration—here the IF is any function of the form eF (x) where
f (x) = F 0 (x).
Step III: Multiply through by the IF to get
eF (x)
dy
+ f (x)eF (x) y = eF (x) g(x).
dx
d F (x)
(e
y) and so we can solve:
dx
Z
Z
d F (x)
F (x)
(e
y) = eF (x) g(x).
e
y=
dx
Step IV: The LHS of this equation is simply
4
Example: Consider the example
dy
+ 4x2 y = x
dx
dy
4
from before. This can be rewritten as
+ y = x−2 . Thus the integrating factor (I.F.) is
dx x
Z
4x−1 dx = exp(4 log x) = exp(log x4 ) = x4 .
exp
x3
Therefore, we multiply through by x4 , giving the exact ODE
dy
+ 4x3 y = x2 ;
x4 dx
equivalently
d
dy
(yx4 ) = x4
+ 4x3 y = x2
dx
dx
as before.
Example: Solve the ODE y 0 + 2y = sin x.
Step 1 is already done!
Step 2. Calculate the I.F.
Z
I.F. = exp
2 dx
= e2x .
Step 3. Multiply through by the I.F. and write the equation in exact form.
e2x
dy
+ 2e2x y = e2x sin x.
dx
Thus
d 2x e y = e2x sin x.
dx
Step 4. Integrate both sides of the equation and find the general solution. This is a standard integration
by parts, and I will let you check that
2x
Z
Z
2x
e y=
e ydx =
1
2
e2x sin x = · · · = − e2x cos x + e2x sin x + C.
5
5
dy
+ (sin x)y = cos2 x.
dx
dy
Step 1. Rewrite the differential equation as
+ tan(x)y = cos x.
dx
Example: Solve the ODE
cos x
Step 2. Calculate the I.F.
Z
I.F. = exp
tan(x) dx = exp(− ln(cos x)) = exp(ln(sec x)) = sec(x).
5
Step 3. Multiply through by the I.F. and write the equation in exact form.
sec x
dy
+ y sec x tan x = sec(x) cos x = 1
dx
equivalently,
d
sec(x)y = 1
dx
Step 4. Integrate both sides of the equation and find the general solution:
Z
d sec(x)y =
Z
dx
which has solution
sec(x)y = x + c
or
y = (x + c) cos(x).
An electrical example:
Suppose we are given an electrical circuit with a resistor and an inductance coil and a battery.
R
L
+
E
-
A basic fact from physics is that, if we close the circuit we get a current i flowing clockwise around the
di
circuit, with voltage drop across the resistor of iR and across the coil of L . Thus,
dt
E = iR + L
di
.
dt
[Note: These are not formulae you need to remember for this course.]
Let’s put in some numbers; say E = 10, R = 8 and L = 2; with initial conditions of i = 0 at t = 0. Thus
di
10 = 8i + 2 , or
dt
di
+ 4i = 5.
dt
6
This can be solved either with an IF (which equals e4t ) or by separating variables and using (1.3.1) from
page 6 of the Separation of Variables notes. Either way you find that i = 5/4 + Ce−4t . The initial
conditions give 0 = 5/4 + C and so C = −5/4 and
i=
5 5 −4t
− e .
4 4
This has the graph with asymptote at i = 5/4 like those on page 7 of the Separation of Variables section.
Now suppose the battery goes flat and we use the mains in place, say with voltage 2 cos(t). This means
that we have to solve the equation
2
di
+ 8i = 2 cos(t)
dt
di
+ 4i = cos(t).
dt
or
R
This does now need an IF = exp( 4dt) = e4t . Thus
d 4t di
e i = e4t + 4e4t i = e4t cos(t).
dt
dt
Z
1
4 4t
e cos(t) + e4t sin(t) + C, where the integral on the RHS was
17
17
solved by integration by parts (twice). Solving for i we get
4t
Therefore, e i =
e4t cos(t) =
i =
4
1
cos(t) +
sin(t) + Ce−4t .
17
17
4
Finally, solving for C from i(0) = 0 gives C = − 17
and so, finally,
i =
4
1
4
cos(t) +
sin(t) − e−4t .
17
17
17
Example: Even quite innocent-looking equations can lead to impossible integrals. For example the
R
2
equation y 0 + xy = 1 leads to the IF = exp( xdx) = ex /2 and hence to the equation
ex
2
/2
Z
y=
ex
2
/2
dx,
which has no closed form. (In fact, you can always solve this sort of equation by writing ex
series in x, but that is another story—and another course.)
7
2
/2
as a power
3
Homogenous Equations
These are differential equations of the form:
dy
= f (x, y)
dx
where the function f (·, ·) satisfies f (λx, λy) = f (x, y), for any λ.
Remark: Be careful about looking up homogeneous equations in the literature since this has more than
one meaning.
Examples of homogeneous equations:
a) f (x, y) = 1 +
y
x
since f (tx, ty) = 1 +
x
tx
ty
tx
y
x
=1+
= f (x, y).
x
b) f (x, y) = e y since f (tx, ty) = e ty = e y = f (x, y).
c) f (x, y) =
3.1
x
y
+
y
x
since f (tx, ty) =
tx
ty
+
ty
tx
=
x
y
+
y
x
= f (x, y).
Basic Technique for Solving Homogeneous Equations.
To solve homogeneous equations, we do a substitution:
z=
y
(or y = zx)
x
and use the rule
dy
d
dz
=
(zx) = x
+ z.
dx
dx
dx
We illustrate how this is done with an example.
Example: Solve the ODE
x
dy
= x + y.
dx
Step 1. Divide through by x to get a homogenous equation:
Step 2. Substitute y = zx to get
d
dx (xz)
dy
dx
= 1 + xy .
= 1 + z.
The Key Step 3. Expand the LHS of the equation using the product rule,
x
dz
d
+ z (x) = 1 + z
dx
dx
8
or
x
dz
+ z = 1 + z.
dx
Step 4. Hopefully (!) this can now be solved by one of the earlier techniques. In this case we can cancel
dz
the “z’s” to get x
= 1. This can then be solved by separating variables:
dx
Z
Z
dz
1
dx
=
and so
dz =
.
dx
x
x
This has solution z = ln x + C.
Step 5. Finally substitute back z = y/x; thus
y
= ln(x) + C
x
or
y = x ln(x) + Cx.
Lets do this with some more examples.
Example. Solve the ODE
x
dy
= y + xey/x
dx
Solution: Divide by x to get
y = 1 at x = 1.
y
dy
= + ey/x .
dx
x
This is homogeneous, so we set z =
y
x
x
Cancel the z to get x
subject to
or y = zx to get
dz
d(zx)
+z =
= z + ez .
dx
dx
dz
= ez . This can now be solved by separating variables:
dx
Z
Z
−z
e dz = x−1 dx,
with solution −e−z = ln|x| + C. Substituting back z = y/x we get
−ey/x = ln |x| + C.
Plugging in y = 1 at x = 1 gives −e−1 = 0 + C and so C = −e−1 . Thus, finally,
−ey/x = ln |x| − e−1 .
If you like you can solve for y by taking logs, but the answer is still not very elegant.
9
Example. Solve the ODE
dy
(y + x)y
=−
−2
dx
x(x − y)
Solution: This is not obviously homogeneous, but we make it so by dividing the top and bottom of the
fraction on RHS by x2 :
dy
=−
dx
y
x
+ 1 xy
−2
1 − xy
Substitute in y = zx
x
dz
+z
dx
x
dz
dx
(z + 1)z
−2
(1 − z)
2
z +z
= −
−z−2
1−z
= −
We can now simplify the RHS:
x
dz
−z 2 − z − z(1 − z) − 2(1 − z)
−z 2 − z − z + z 2 − 2 + 2z
2
2
=
=
= −
=
.
dx
1−z
1−z
1−z
z−1
Thus we can separate variables:
z−1
2
dz =
1
dx
x
or
z
1
−
2 2
dz =
1
dx
x
Integrate both sides of the equation to get
z2
z
− = ln x + c
4
2
Finally we substitute back z =
y
x
to get
y2
y
−
= ln x + c.
2
4x
2x
With a bit of an effort you can write this as y = g(x) for some function g(x) but I really do not think it
is worth the bother.
10
Download