Assignment 2 Solutions
Assignment 2 Solutions
Assignment 2 Solutions
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.
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
1.4
y
1.2
0.8
0.6
0.4
0.2
1 2 3 4 5 x
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
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
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
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
(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
Solution
Math 334 Assignment 2 — Solutions 4
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
Solution
(a) Re–write the differential equation in the form M dx + N dy = 0:
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
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
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
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.
Solution
Math 334 Assignment 2 — Solutions 7
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