You are on page 1of 7

Math 334

Assignment 2 — Solutions

1. Discontinuous coefficients. There are times when the coefficient P (x) in a linear equation may
not be continuous, but may have a jump discontinuity. Fortunately, we may still obtain a reasonable
solution. Consider the initial value problem:
dy
+ p(x)y = x, y(0) = 1,
dx
where (
1, 0 6 x 6 2,
p(x) =
3, x > 2.

(a) Find the general solution for 0 6 x 6 2.


(b) Choose the constant in the solution of part (a) so that the initial condition is satisfied.
(c) Find the general solution for x > 2.
(d) Now choose the constant in the solution of part (c) so that the solution from part (b) and the
solution from part (c) agree at x = 2. By patching the two solutions together in this way we
obtain a continuous function that satisfies the differential equation except at x = 2, where its
derivative is undefined.
(e) Sketch a graph of the solution from x = 0 to x = 5.

Solution
(a) For 0 6 x 6 2 we have
dy
+y =x
dx
for which the solution is: y(x) = x − 1 + Ce−x.
(b) Applying the initial condition y(0) = 1 to the solution from part (a) yields: y(x) = x − 1 + 2e−x
(c) For x > 2 we have
dy
+ 3y = x,
dx
for which the solution is: y(x) = (3x − 1)/9 + Ce−3x .
(d) From parts (b) and (c) we have
(
x − 1 + 2e−x , 0 6 x 6 2,
y(x) = −3x
(3x − 1)/9 + Ce , x > 2.

We choose the constant C so that the solution is continuous at x = 2, which means that we
require
5
lim y(x) = lim y(x) i.e. + Ce−6 = 1 + 2e−2 .
x→2+ x→2− 9
4
This means that C = e6 + 2e4 and the solution is:
9

x − 1 + 2e−x , 0 6 x 6 2,
y(x) = 3x − 1 4 6−3x
 + e + 2e4−3x , x > 2.
9 9

1
Math 334 Assignment 2 — Solutions 2

(e) The graph of the solution looks like:

1.4
y
1.2

0.8

0.6

0.4

0.2

1 2 3 4 5 x

2. Consider the differential equation

(a1 x + b1 y + c1 )dx + (a2 x + b2 y + c2 )dy = 0.

If a1 b2 = a2 b1 , show that this equation reduces to the form y ′ = g(ax + by).

Solution
Rewrite the equation as:
dy a1 x + b1 y + c1
=− .
dx a2 x + b2 y + c2
a2 b2
The condition a1 b2 = a2 b1 implies = = λ. Substituting a2 = λa1 and b2 = λb1 into the equation
a1 b1
yields:
dy a1 x + b1 y + c1
=− = g(a1 x + b1 y),
dx λ(a1 x + b1 y) + c2
ξ + c1
where g(ξ) = − .
λξ + c2

3. Consider the Riccati equation


dy y
= x3 (y − x)2 + .
dx x
(a) Guess a solution to this equation.
(b) Use the particular solution from part (a) to reduce the equation to a Bernoulli equation.
(c) Solve the Bernoulli equation you obtained in part (b).
Solution

(a) By inspection a solution to the equation is given by y1 (x) = x.


(b) Make a transformation y(x) = y1 (x) + v(x) = x + v(x) to get a Bernoulli equation for v:

dv 1
− v = x3 v 2 .
dx x

(c) To solve this Bernoulli equation make the change of variables w = v −1 . The equation for w is:

dw 1
+ w = −x3 .
dx x
Math 334 Assignment 2 — Solutions 3

This linear equation is easily solved by means of an integrating factor as follows:


 
d dw 1
(xw) = x + w = x(−x3) = −x4 .
dx dx x

x4 c1
Integration yields w(x) = − + . The final solution is:
5 x

5x
y(x) = x + v(x) = x + 1/w(x) or y(x) = x + .
c − x5

4. Solve the following differential equations.


p
(a) xy ′ = x2 + y 2 ; (b) (1 + x2 )y ′ + 2xy = 4x3 .

Solution
p
(a) If we re–write the equation as y ′ = 1 + (y/x)2, we see that it is homogeneous. To solve,
we set√v = y/x. Then y(x) = xv(x) and y ′ = xv ′ + v. The differentiable equation becomes
xv ′ = 1 + v 2 − v, which is separable:
dv dx
√ = .
2
1+v −v x

Integration yields:
dv 1 p
Z Z p p
ln |x| = √ = ( 1 + v 2 + v) dv = [v 1 + v 2 + ln( 1 + v 2 + v) + v 2 ] + c1 .
1 + v2 − v 2

Substituting v = y/x gives:


p p
x2 y x2 + y 2 + x4 ln(y + x2 + y 2 ) + y 4 = 3x4 ln x + cx4 .

(b) The differential equation is linear, and so is solvable by a variety of methods. The easiest is
probably to recognize that the left hand side is the derivative of a product:
d
[(1 + x2 )y] = (1 + x2 )y ′ + 2xy = 4x3 .
dx
Therefore (1 + x2 )y = x4 + c which gives

x4 + c
y= .
1 + x2

5. Solve the following differential equations.

(a) cos(x + y) dx = x sin(x + y) dx + x sin(x + y) dy; (b) x2 y ′′ + xy ′ = 1.

Solution
Math 334 Assignment 2 — Solutions 4

(a) Re–write the differential equation in the form M dx + N dy = 0:

[x sin(x + y) − cos(x + y)] dx + x sin(x + y) dy = 0.


∂M ∂N
We see that = x cos(x + y) + sin(x + y) = , so the equation is exact. There exists a
∂y ∂x
function F for which df = M dx + N dy. Therefore
Z Z
F (x, y) = M (x, y) dx = [x sin(x + y) − cos(x + y)] dx = −x cos(x + y) + g(y).

Then
∂F
= N (x, y) =⇒ g′ (y) = 0 =⇒ g(y) = c.
∂y
Thus F (x, y) = −x cos(x + y) + c, and the solution is

x cos(x + y) = c.

(b) This is a second oeder ordinary differential equation with the dependent variable missing. We
may reduce this to a first order ordinary differential equation by letting v = y ′ . The equation
becomes
1
x2 v ′ + xv = 1 or, re–writing xv ′ + v = .
x
We then have
1 ln |x| + c1
(xv)′ = xv ′ + v = =⇒ xv = ln |x| + c1 =⇒ y ′ = .
x x
Therefore the solution is
1
y= (ln |x|)2 + c1 ln |x| + c2 .
2

6. Solve the following differential equations.

(a) (ex − 3x2 y 2 ) y ′ + yex = 2xy 3 ; (b) (6x + 4y + 3) dx + (3x + 2y + 2) dy = 0.

Solution
(a) Re–write the differential equation in the form M dx + N dy = 0:

(yex − 2xy 3 ) dx + (ex − 3x2 y 2 ) dy = 0.


∂M ∂N
We see that = ex − 6xy 2 = , so the equation is exact. There exists a function F for
∂y ∂x
which df = M dx + N dy. Therefore
Z Z
F (x, y) = M (x, y) dx = [yex − 2xy 3 ] dx = yex − x2 y 3 + g(y).

Then
∂F
= N (x, y) =⇒ g′ (y) = 0 =⇒ g(y) = c.
∂y
Thus F (x, y) = yex − x2 y 3 + c, and the solution is

yex − x2 y 3 = c.
Math 334 Assignment 2 — Solutions 5

(b) Re write the equation as


dy 6x + 4y + 3 2(3x + 2y) + 3
=− =− .
dx 3x + 2y + 2 3x + 2y + 2
We see that this differential equation is of the form y ′ = g(3x + 2y). Thus, let v = 3x + 2y. Then
dv dy 2v + 3 v
= 3+2 =3−2 =− .
dx dx v+2 v+2
This equation is separable, so we get
 
2
1+ dv = −dx =⇒ v + 2 ln |v| = −x + c.
v
Therefore the solution is
3x + 2y + ln(3x + 2y)2 + x = c.

7. Consider the following second order differential equations.


(a) y ′′ − 4y = 0; (b) y ′′ − 2y ′ + y = 0; (c) y ′′ − 2y ′ + 2y = 0.
For each equation do the following:
• reduce to a first order differential equation in v by means of the transformation v(y) = y ′ (x);
• solve this equation for v thereby obtaining a first order differential equation for y;
For the equation from part (a) solve the resulting first order differetial equation for y.

Solution
These are all second order ordinary differential equations, of the form y ′′ + ay ′ + by = 0 for various
values of a and b, with the independent variable missing. We may reduce this to a first order differential
equation by letting v(y) = y ′ (x). Then y ′′ = vv ′ and the equation becomes
y
vv ′ + av + by = 0 which can be re-written as v ′ = −a − b .
v
This equation is homogeneous. To solve, we set w = v/y. Then v ′ = yw′ + w and the differential
equation becomes
b w2 + aw + b
yw′ = −a − − w = − ,
w w
which is separable:
w dw dy
=− .
w2 + aw + b y
(a) For a = 0 and b = −4 we get
p
w dw dy 1 2 c2 + 4y 2
2
=− =⇒ ln |w − 4| = − ln |y| + c1 =⇒ w=± .
w −4 y 2 y
p
But w = v/y and v = y ′ so y ′ = ± c2 + 4y 2 . This equation is also separable:
dy
p = ±dx = εdx, where ε = ±1.
c2 + 4y 2
Integrate and solve for y:
1 p p
ln |2y + c2 + 4y 2 | = εx + c3 =⇒ 2y + c2 + 4y 2 = Ae2εx =⇒ y = αe2x + βe−2x .
2
Math 334 Assignment 2 — Solutions 6

(b) For a = −2 and b = 1 we get


Z  
w dw dy w dw dy 1 1
=− =⇒ = − =⇒ + dw = − ln |y| + c1
w2 − 2w + 1 y (w − 1)2 y w − 1 (w − 1)2
1
=⇒ ln |w − 1| − = − ln |y| + c1
w−1
y
=⇒ ln |v − y| − = c1 .
v−y

The differential equation for y is


y
ln |y ′ − y| − = c1 ,
y′ − y

which is difficult to solve.


(c) For a = −2 and b = 2 we get

w dw dy w dw dy
=− =⇒ =−
w2 − 2w + 2 y (w − 1)2 + 1 y
Z  
w−1 1
=⇒ + dw = − ln |y| + c1
(w − 1)2 + 1 (w − 1)2 + 1
1
=⇒ ln[(w − 1)2 + 1] + tan−1 (w − 1) = − ln |y| + c1 .
2
But w = v/y and v = y ′ so the differential equation for y is

ln[(y ′ − y)2 + y 2 ] + 2 tan−1 ((y ′ /y) − 1) = c.

which is difficult to solve.

8. Guerrilla Combat Model. In modelling a pair of guerrilla forces in combat, the following system of
differential equations arises:
dy
= −axy, (1)
dt
dx
= −bxy, (2)
dt
where x(t) and y(t) are the strengths of opposing forces at time t and a and b are positive constants.
The terms −axy and −bxy represent the combat loss rate for the troops y and x respectively. This
model assumes no reinforcements.

(a) Show that x and y satisfy the equation dy/dx = a/b.


(b) Let y(0) = y0 and x(0) = x0 . Solving the equation in part (a), derive the linear combat law
by − ax = c, where c = by0 − ax0 .
(c) Use the solution from part (b) to obtain the full solutions x(t) and y(t) of the original system of
equations.
(d) Under what conditions will the y troops win the guerrilla war (i.e. wipe out the x troops)? In
this case, how many y troops survive?

Solution
Math 334 Assignment 2 — Solutions 7

(a) Dividing the first equation by the second equation results in

dy dy/dt −axy a
= = = .
dx dx/dt −bxy b

(b) Solving the equation in part (a), we get by = ax + c. Using y(0) = y0 and x(0) = x0 implies that
c = by0 − ax0 .
dx
(c) Inserting the result from part (b) into Eq. (2) yields = −x(ax + c), which is a separable o.d.e.
dt
We get
 
dx 1 a
= −dt =⇒ − dx = −c dt =⇒ ln x − ln(ax + c) = −ct + c1 .
x(ax + c) x ax + c
x0
The initial condition x(0) = x0 implies that c1 = ln . Solving for x yields:
ax0 + c

cx0 e−ct
x(t) = .
by0 − ax0 e−ct
Plugging this expression for x into by = ax + c yields:
cy0
y(t) = .
by0 − ax0 e−ct

(d) The number of surviving troops for each side is given by:
(
cx0 e−ct 0 c>0
xs := lim x(t) = lim = ,
t→∞ t→∞ by0 − ax0 e−ct −c/a c < 0
(
cy0 c/b c > 0
ys := lim y(t) = lim = .
t→∞ t→∞ by0 − ax0 e−ct 0 c<0

Thus, the y troops win the guerrilla war if xs = 0, i.e. if c > 0.


Interpretation of results:
i. (a = b: armies of equal capabilities)
If a = b, then both armies lose troops in battle at the same rate. In this case c > 0 implies
y0 > x0 . In other words, given two armies of equal capabilities, the one that starts with more
troops wins.
ii. (x0 = y0 : armies of equal size)
If x0 = y0 , then both armies start with the same number of troops. In this case c > 0 implies
b > a. In other words, given two armies of equal size initially, the one that loses troops at
the lower rate, i.e. the army with the better soldiers, wins.

You might also like