Mathematics 263
Written Assignment 1 Math-263 Written Assignment 1 Model Solutions
Q1) To solve y separate variables giving
Z
dy + cos x − x = 0, dx
ydy =
Z
(− cos x + x)dx
and hence y 2 /2 = − sin x + x2 /2 + C.
√ The initial condition, y(0) = − 2 gives C = 1, so
y 2/2 = − sin x + x2 /2 + 1, is an implicit solution of the IVP. However, this can be rearranged to obtain an explicit solution since y 2 = −2 sin x + x2 + 2, implies that
√ y = − 2 − 2 sin x + x2 ,
where it √ is important to note that we take the negative square root since the initial condition, y(0) = − 2, requires y to be negative when x = 0.
For the interval of validity, note that for y to be real we require − sin x+(x2 /2+1) ≥ 0, or equivalently, x2 /2 + (1 − sin x) ≥ 0. But this holds for all x ∈ (−∞, ∞). Moreover we notice form the ODE that for y ′(x) to be finite for all x we require y(x) 6= 0, but this also holds since − sin x + (x2 /2 + 1) > 0 for all x ∈ (−∞, ∞) and hence the interval of validity is the whole real line x ∈ (−∞, ∞). Q2) To solve the ODE xy ′ + y = x2 − x + 1, rewrite as y′ +
y 1 = x−1+ . x x
This is linear. The integrating factor is R
µ=e
1 dx x
= elnx = x
and multiplying by µ(x) returns us to the original equation xy ′ + y = x2 − x + 1. And finally we notice that (the more observant of you may skip straight to this point) that d (xy) = xy ′ + y = x2 − x + 1, dx
Mathematics 263
Written Assignment 1
hence
Z
1 1 (x2 − x + 1)dx = x3 − x2 + x + C. 3 2 The initial condition y(1) = 1 implies that 1 = 1/3 − 1/2 + 1 + C and hence C = 1/6. So xy =
1 1 1 y(x) = x2 − x + 1 + . 3 2 6x This solution has a discontinuity at x = 0 but is continuously differentiable for all x > 0 and so is valid as a solution of the initial value problem for x ∈ (0, +∞) (recalling that the interval of validity must contain x = 1 since initial condition is specified at x = 1). Q3) To solve the Bernoulli equation let u = y −2 then u′ = (−2/y 3)y ′ . Thus xu′ = −
xy ′ + 2y − y 3 = 0,
2 ′ 2 xy = − 3 (y 3 − 2y) = −2(1 − 2y −2) = −2(1 − 2u) = 2(2u − 1), 3 y y
or equivalently,
du dx = . 2(2u − 1) x
Then ln |x| =
Z
dx 1 = x 2
Z
giving the implicit solution
du 1 = 2u − 1 4
ln |x| =
Z
2du 1 = ln |2u − 1| + C, 2u − 1 4
1 ln |2y −2 − 1| + C, 4
which can be rearranged as ln |2y −2 − 1| = −4C + ln x4
and hence |2y −2 −1| = x4 e−4C so 2y −2 −1 = ±x4 e−4C . Thus letting k = ±e−4C we have 2y −2 = 1+kx4 and r 2 2 2 y = or y=± . 4 1 + kx 1 + kx4 The y 2 form of the answer is acceptable, since without an initial condition we don’t know which square root to take. Several other related possible forms of the final answer are possible depending on how you treat the constant term (most involving e−4C or e4C , the second arising if the original constant of integration is placed on the left hand side instead of the right hand side). Q4) To solve x2 ′ 2x 3 + (y − 2 )y = 1, y y transform the equation into x2 2x ( − 1) dx + (y 3 − 2 ) dy = 0. y y | {z } | {z } P
Q
We have Py = Qx = −2x/y 2 , i.e., the equation is exact. Thus the solution can be written in the form F (x, y) = c, where -2-
Mathematics 263
Written Assignment 1
R P (x, y)dx = ( 2x − 1)dx = x2 /y − x + c1 (y). R R y3 x2 F = Q(x, y)dy = (y − y2 )dy = 41 y 4 + x2 /y + c2 (x). from which we see that F = x2 /y − x + 14 y 4 satisfies both equations, or,
(a) F =
R
(b) using Rthe formula from R y Karzhemanov’s R x lectures: Ry 3 x F := 0 P (x, y)dx + 0 Q(0, y)dy = 0 ( 2x − 1)dx + y = x2 /y − x + y 4/4. y 0
Now the implicit solution is F = C that is
x2 1 − x + y 4 = C. y 4 Q5) (a) The equation (x2 + y 2 )dy + (3x2 y + 2x(y + 3) + y 3)dx = 0 is of the form Qdy + P dx = 0 with Q = x2 + y 2,
P = 3x2 y + 2x(y + 3) + y 3.
We have Py = 3x2 + 2x + 3y 2 6= Qx = 2x. So the equation is not exact. (b) To solve lets look for an integrating factor. Since Py − Qx 3x2 + 3y 2 = 2 = 3, Q x + y2 doesn’t depend on y we can find an integrating factor µ = µ(x) which depends on x only with R
µ(x) = e
Py −Qx dx Q
R
=e
3dx
= e3x .
Then we have (e3x P )y = (e3x Q)x , i.e., the equation e3x Qdy + e3x P dx = 0 is exact. So solution is F = C where we can now proceed in two ways. Either i. F =
Z
3x
e Q(x, y)dy =
Z
1 e3x (x2 + y 2 )dy = x2 ye3x + y 3 e3x + c1 (x), 3
where c1 (x) is a function of x. But also Z Z 3x F = e P (x, y)dx = e3x (3x2 y + 2x(y + 3) + y 3)dx Z Z 3x = 6xe dx + e3x (3x2 y + 2xy + y 3)dx = J1 + J2 . Now integrating by parts, or inspection, we see that Z 2 J1 = 6xe3x dx = 2xe3x − e3x . 3 -3-
Mathematics 263
Written Assignment 1
The computation of J2 looks harder at first sight until we realise that it should give the same mixed terms involving x and y as seen in the first integral, and indeed d 2 3x 1 3 3x (x ye + y e ) = 2xye3x + 3x2 ye3x + y 3e3x dx 3 so J2 =
Z
1 e3x (3x2 y + 2xy + y 3 )dx = x2 ye3x + y 3 e3x , 3
and
1 2 F = J1 + J2 = 2xe3x − e3x + x2 ye3x + y 3 e3x , 3 3 which agrees with the first expression for F with c1 (x) = J1 . ii. Alternatively, using ‘the’ formula Z x Z y Z x Z 3x 3x 2 3 F = e P (x, y)dx+ Q(0, y)dy = e (3x y + 2x(y + 3) + y )dx+ 0
0
0
where I1 =
Z
y
y 2dy = I1 + I2
0
y
0
1 y 2dy = y 3 , 3
and I2 =
Z
x 3x
2
3
e (3x y + 2x(y + 3) + y )dx = 3y
0
Z
|0
x
with I ′′′ = 31 (e3x − 1), and integrating by parts
Z
x
I′
3x
I ′′
3
Z
x
e3x dx, e xdx +y e x dx +2(y + 3) {z } | 0 {z } | 0 {z } 3x 2
I ′′′
1 1 1 1 1 I ′′ = xe3x − I ′′′ = xe3x − e3x + , 3 3 3 9 9 1 2 1 2 2 2 I ′ = x2 e3x − I ′′ = x2 e3x − xe3x + e3x − 3 3 3 9 27 27 Thus 1 F = I1 + I2 = y 3 + 3yI ′ + 2(y + 3)I ′′ + y 3I ′′′ 3 1 3 1 3x 1 3x 1 1 1 2 3x 2 3x 2 3x 2 = y + 3y + 2(y + 3) + y 3 (e3x − 1) x e − xe + e − xe − e + 3 3 9 27 27 3 9 9 3 1 3x 1 3x 1 1 2 2 2 + 2(y + 3) + y 3e3x xe − e + = y x2 e3x − xe3x + e3x − 3 9 9 3 9 9 3 2 2 1 = x2 ye3x + 2xe3x − e3x + + y 3 e3x . 3 3 3 Both methods give the same answer for F . Actually they differ by a constant, but this doesn’t matter because the implicit solution of the ODE is F = C or 1 2 2xe3x − e3x + x2 ye3x + y 3e3x = C. 3 3 -4-
Mathematics 263
Written Assignment 1
Q6) To solve the homogeneous ODE (x2 − y 2)dx − x2 dy = 0,
either rewrite the equation in the form 1 − (y/x)2 − y ′ = 0 then let y = ux for some function u. Thus y ′ = xu′ + u, so the equation becomes 1 − u2 − u − xu′ = 0.
(6.1)
Alternatively note that y = ux implies dy = udx + xdu and substitute into original form of equation above to obtain (x2 − x2 u2 )dx − x2 (udx + xdu) = 0,
and hence, on dividing by x2 and collecting terms
(1 − u − u2 )dx − xdu = 0.
(6.2)
But (6.1) and (6.2) are the same ODE and separating variables Z Z du dx = . 2 1−u−u x Letting z = u + 1/2 we have
Z
Further, Z
dz 1 =√ 2 5/4 − z 5
Z
du = 1 − u − u2 dz √ + 5/2 − z
Z
Z
(6.3)
dz 5/4 − z 2
dz √ 5/2 + z
z + √5/2 1 √ = √ ln . 5 z − 5/2
Now (6.3) gives the implicit solution z + √5/2 u + (1 + √5)/2 y/x + (1 + √5)/2 1 1 1 √ √ √ ln |x| + C = √ ln = √ ln = √ ln . 5 z − 5/2 5 u − ( 5 − 1)/2 5 y/x − ( 5 − 1)/2
A slightly neater implicit solution is obtained by taking exponentials of each side after multiplying √ by 5: y + x(1 + √5)/2 y/x + (1 + √5)/2 √ √ √ 5 ˜ √ √ , = = e 5C |x| 5 = C|x| y − x( 5 − 1)/2 y/x − ( 5 − 1)/2 √
(where the constant C˜ = e
5C
). To obtain an explicit solution notice that √ √ y + x(1 + 5)/2 5 ˜ √ , = ±C|x| y − x( 5 − 1)/2
so letting k = ±C˜ we have y + x(1 +
√
√ √ 5)/2 = k|x| 5 (y − x( 5 − 1)/2),
and finally √ √ √ √ √ √ k|x| 5 ( 5 − 1)/2 + (1 + 5)/2 k|x| 5 ( 5 − 1) + (1 + 5) √ √ y= x= x. k|x| 5 − 1 2(k|x| 5 − 1)
-5-
Mathematics 263
Written Assignment 1
Q7) To solve y ′ = (x + 4y + 1)2 , using a substitution of the form u = Ax + By + C, let u = x + 4y + 1. Then u′ = 1 + 4y ′ = 1 + 4(x + 4y + 1)2 = 1 + 4u2, which we can solve by separation of variables. Z Z du = dx, 1 + 4u2 implies x+C =
Z
1 du = 2 1 + 4u 4
Z
du 1 1 = 2 arctan(2u) = arctan(2(x + 4y + 1)). 2 1/4 + u 4 2
Taking tan of both sides, we get ˜ = 2(x + 4y + 1), tan(2x + C) where C˜ = 2C, and hence y=
1 ˜ − 1 (x + 1). tan(2x + C) 8 4
Q8) (a) The direction field for y′ =
x2 , y(1 + x3 )
is y’=f(x,y)=x2/y(1+x3) 3
2.5
2
1.5
y
1
0.5
0
−0.5
−1
−1.5
−2 −2
−1
0
1 x
2
3
4
This was drawn using matlab, and the matlab code is made available for those of you that use matlab. In a hand drawn sketch I wouldn’t expect nearly as much detail. The only essentials are to identify where dy/dx = 0 (horizontal arrows) dy/dx = ±∞ (vertical arrows) and to have the slopes vary continuously in the regions between with arrows of positive slope where dy/dx > 0 and negative slope when dy/dx < 0. -6-
Mathematics 263
Written Assignment 1
(b) To solve the ODE y′ =
x2 , y(1 + x3 )
rewrite the equation as ydy =
x2 dx 1 + x3
and integrate both sides. We get 1 2 y +C = 2
Z
1 x2 dx = 1 + x3 3
Now the initial condition y(0) = 1 implies
1 2
Z
3x2 dx 1 = ln |1 + x3 |. 1 + x3 3
+ C = 0, so C = −1/2 and
2 ln |1 + x3 |, 3 or taking the positive root since we require y = 1 > 0 when x = 0, by the initial condition; r 2 y = + 1 + ln |1 + x3 |, 3 y2 = 1 +
(c) Here we draw several integral curves. The initial condition and the integral curve passing through it are drawn in black. y’=f(x,y)=x2/y(1+x3) 3
2.5
2
1.5
y
1
0.5
0
−0.5
−1
−1.5
−2 −2
−1
0
1 x
2
3
4
In the graph I only drew the part of the integral curve corresponding to the solution to the IVP, but it would also be correct to draw the whole curve (including the y < 0 part, which is a reflection in the x-axis of the y > 0 part). (d) To determine the interval of validity, the solution in (b) is only finite if (1 + x3 ) 6= 0, that is x 6= −1. But since initial condition is specified at x = 0 we require x > −1 for solution of the initial value problem. But for the solution in (b) to be real we also require 23 ln |1 + x3 | + 1 ≥ 0, i.e., |1 + x3√ | ≥ e−3/2 . But since x > −1 this condition becomes 1 + x3 ≥ e−3/2 , or 3 equivalently x ≥ − 1 − e−3/2 . Strictly speaking the endpoint of this interval is not included in the interval of validity since there y = 0 and so dy/dx = ∞. The interval of validity is then √ 3 −3/2 , ∞). x ∈ (− 1 − e -7-