Work Sheet 8 Solution
Work Sheet 8 Solution
1
Additional Exercise 1 Find the set of solutions to the following differential
equations :
1)y ′ − 4y = 3, (x ∈ R).
h π πi
2)y ′ − y tan x = sin x, (x ∈ − , ).
2 2
y
3)y ′ = + x, (x ∈ R∗+ ).
x
4)(x + 1)y ′ + xy = 0, (x ∈ R).
2
y ′′ − 2y ′ + y = 0.
Find the solution to this equation such that y(0) = 0 and y ′ (0) = −3.
2
Work sheet 8 Answers
Exercise 1
1) Consider the differential equation (E1 ) : y ′ + x ln(x) = 0.
This is a first-order linear ordinary differential equation (ODE), defined on R∗+ .
dy
Rewriting y ′ as dx , we have :
dy
(E1 ) ⇐⇒ = −x ln(x) ⇐⇒ dy = −x ln(x) dx
dx
Integrate both sides :
Z Z
dy = − x ln(x) dx (Ẽ1 ).
R
To solve x ln(x) dx, we use integration by parts. Let :
( (
u′ (x) = x, u(x) = 12 x2 ,
=⇒
v(x) = ln(x), v ′ (x) = x1 .
Applying integration by parts u′ v dx = uv − uv ′ dx :
R R
Z Z
1 2 1 2 1
x ln(x) dx = x ln(x) − x · dx
2 2 x
Z
1 1
= x2 ln(x) − x dx
2 2
1 1
= x2 ln(x) − x2 + C.
2 4
Substituting back into (Ẽ1 ) :
1 2 1 2
y=− x ln(x) − x + C,
2 4
1 1
y = − x2 ln(x) + x2 + C, C ∈ R.
2 4
Thus, the general solution to (E1 ) is :
1 1
y(x) = − x2 ln(x) + x2 + C.
2 4
2) Consider the differential equation (E2 ) : y ′ + 2y = x2
is a first-order linear ordinary differential equation (ODE), defined on R.
Homogeneous Solution
First, solve the homogeneous equation (EH ) : y ′ + 2y = 0. We have :
3
dy dy
(EH ) ⇐⇒ = −2y ⇐⇒ = −2 dx, (y ̸= 0)
dx y
Z Z
dy
⇐⇒ = −2 dx ⇐⇒ ln |y| = −2x + C,
y
⇐⇒ y = Ke−2x , (K = ±eC ∈ R).
Particular Solution
We look for a particular solution yp of the form yp = ax2 + bx + c. Then,
′
yp = 2ax + b. Substituting into (E2 ) :
2ax + b + 2(ax2 + bx + c) = x2 ,
We get
2ax2 + (2a + 2b)x + (b + 2c) = x2 .
Equating coefficients :
1
2a = 1,
a = 2 ,
2a + 2b = 0, =⇒ b = − 12 ,
b + 2c = 0, c = 14 .
4
We look for a particular solution yp of the form yp = λ sin x + µ cos x. Then,
yp′ = λ cos x − µ sin x. Substituting into (E3 ) :
yp = sin x + cos x.
4) Solution to y ′ − y = (x + 1)ex .
Homogeneous Solution
yH = Kex , K ∈ R,
5) Solution to y ′ + y = 3x − ex .
Homogeneous Solution
yH = Ke−x , K ∈ R.
Particular Solution In this case, yp = yp1 + yp2 , where yp1 is of the form
yp = ax + b, and yp2 is of the form yp = aex .
For yp1 , we have yp′ = a. Substituting into (E5 ), we get :
5
(
a = 3,
yp′ 1 + yp1 = 3x ⇒ ax + a + b = 3x ⇒
b = −a = −3,
Thus, yp1 = 3x − 3.
For yp2 , we have yp′ 2 = aex . Substituting into (E5 ), we get :
1
yp′ 2 + yp2 = −ex ⇒ 2a = −1 ⇒ a = − .
2
1 x
Therefore, yp2 = − 2 e . Hence, the particular solution is :
1
yp = 3x − 3 − ex .
2
General Solution of (E5 )
1
yG = Ke−x + 3x − 3 − ex , where K ∈ R.
2
Exercise 2 : Consider the Bernoulli equation :
(EBr ) : xy ′ + y = x2 y 2 .
6
Case 1 : x > 0
Here, zp = k(x)x and zp′ = k ′ (x)x + k(x). Substituting into (1) :
1
−zp′ + zp = x =⇒ k ′ (x) = −1 =⇒ k(x) = −x + α, α ∈ R.
x
Thus :
zp = k(x)x = x(−x + α) =⇒ zp = −x2 + αx.
Case 2 : x < 0
Here, zp = −k(x)x. Similarly, we find :
zp = −x2 + αx.
Therefore :
1 1
yp = = 2
, where x ̸= 0.
zp −x + αx
The general solution of (EBr ) is given by :
1 1
yG = yH + yp =⇒ yG = + 2
, where k, α ∈ R∗ .
k|x| −x + αx
2
y ′ y −2 + y −1 cos x = , (y ̸= 0).
x
Using the substitution z = y −1 , we have z ′ = −y ′ y −2 . Substituting into (EBr )
gives :
2
z ′ + z cos x = .
x
This is another first-order linear differential equation.
Homogeneous Solution zH
The homogeneous equation (EH ) is :
Z Z
′ dz
z + z cos x = 0 =⇒ = − cos x dx =⇒ ln |z| = − sin x + c, (c ∈ R).
z
Thus :
|z| = ec e− sin x =⇒ z = ke− sin x , k = ±ec ∈ R∗ .
This gives :
1
yH = .
ke− sin x
7
Particular Solution zp
Using the method of variation of constants, we seek a particular solution zp of the
form zp = k(x)e− sin x , where k is a function to be determined.
We consider the particular solution in the form zp = k(x)e− sin x , where k is a
function to be determined. Thus, we have :
8
Thus :
z = ke2x , k = ±ec ∈ R∗ .
This gives :
1
yH = x + 1 + e−2x .
k
Particular Solution zp
We observe that zp = − 12 is a particular solution of (ER). Therefore, the general
solution for z is :
1
z = zH + zp =⇒ z = − + ke2x .
2
1
Since yG = y1 + z , the final solution is :
1
yG = x + 1 + , k ∈ R∗ ,
− 12 + ke2x
x2 y ′ + xy + x2 y 2 = 1.
(ER) ⇔ x2 z ′ z −2 − xz −1 = x2 − 1 ⇔ x2 t′ + xt = −x2 − 1.
Homogeneous Solution tH
The homogeneous equation (EH) is :
Z Z
2 ′ dt dx 1
x t + xt = 0 ⇒ =− ⇒ ln |t| = − ln |cx| = ln , (c ∈ R∗+ ).
t x cx
9
Thus :
k 1
tH = , k = ± ∈ R∗ .
|x| c
Particular Solution tp
We consider the particular solution in the form tp = k(x)|x|
and distinguish two cases :
Case 1 : x > 0 ′
Here, tp = k(x)
x
and t′p = k (x)x−k(x)
x2
. Substituting into the equation :
1 1
x2 t′p + xtp = −x2 − 1 ⇔ k ′ (x) = −x − ⇔ k(x) = − x2 − ln x + α, α ∈ R.
x 2
Thus :
k(x) 1 1 α
tp = = − x − ln x + , α ∈ R.
x 2 x x
Case 2 : x < 0
Similarly, we obtain :
k(x) 1 1 α
tp = = − x − ln |x| + , α ∈ R.
|x| 2 x |x|
Since t = z1 , we have :
1
z= β 1
.
|x|
− 2
x − x1 ln |x|
Exercise 4.
1) Consider the differential equation xy ′ − y = 2x2 with initial condition y(1) = 5.
We begin by finding the general solution, then apply the initial conditions.
Homogeneous Solution yH
The homogeneous equation (EH ) is :
Z Z
′ dy dx
xy − y = 0 =⇒ = =⇒ ln |y| = ln |cx|, (c ∈ R∗+ ).
y x
10
Thus :
yH = kx, k = ±c ∈ R∗ .
Particular Solution yp
We assume a particular solution of the form yp = k(x)x. Then :
Therefore :
yp = (2x + α)x, α ∈ R.
The general solution is :
2(1)2 + λ(1) = 5 =⇒ λ = 3.
Homogeneous Solution yH
The homogeneous equation (EH ) is :
Z Z
′ dy dx 1
xy + y = 0 =⇒ =− =⇒ ln |y| = − ln |cx| = ln , (c ∈ R∗+ ).
y x cx
Thus :
k 1
yH = , k = ± ∈ R∗ .
x c
Particular Solution yp
k(x)
We assume a particular solution of the form yp = x
. Then :
k ′ (x)x − k(x)
yp′ = .
x2
Substituting into the original equation :
11
Therefore :
ex + α
yp = , α ∈ R.
x
The general solution is :
k ex + α ex + λ
y = yH + yp = + = , where λ = k + α ∈ R.
x x x
Applying the initial condition y(1) = 2 :
e1 + λ
= 2 =⇒ λ = 2 − e.
1
Thus, the solution is :
ex + (2 − e)
y= .
x
3) Consider the differential equation :
nπ o
y ′ + y tan x = cos2 x, y(0) = −1, on D = R \ + kπ | k ∈ Z .
2
Homogeneous Solution yH
The homogeneous equation (EH) is :
Z Z Z
′ dy sin x
y + y tan x = 0 =⇒ = − tan x dx = − dx.
y cos x
Let t = cos x, then dt = − sin x dx, so :
Z Z
dy dt
= =⇒ ln |y| = ln |ct| =⇒ y = k cos x.
y t
Thus :
yH = k cos x, k = ±c ∈ R∗ .
Particular Solution yp
Assume a particular solution of the form yp = k(x) cos x. Then :
Therefore :
yp = (sin x + α) cos x.
12
The general solution is :
1
y = yH + yp = λ cos x + sin x cos x = λ cos x + sin 2x, λ = k + α ∈ R.
2
Applying the initial condition y(0) = −1 :
1
λ cos 0 + sin 0 = −1 =⇒ λ = −1.
2
Thus, the solution is :
1
y = − cos x + sin 2x.
2
Exercise 5.
1) Solve the second-order linear homogeneous equation :
y ′′ − 5y ′ + 6y = 0. (2)
r2 − 5r + 6 = 0.
The discriminant is :
∆ = b2 − 4ac = 25 − 24 = 1 > 0.
y1 = e2x , y2 = e3x .
The Wronskian is :
e2x e3x
W (x) = = e5x ̸= 0 ∀x ∈ R.
2e2x 3e3x
yH = λe2x + µe3x , λ, µ ∈ R.
13
The characteristic equation is :
r2 − r = 0 =⇒ r = 0 ∨ r = 1.
yH = λ + µex , λ, µ ∈ R.
y ′′ − 2y ′ + 5y = 0. (4)
y ′′ − 6y ′ + 9y = 0. (5)
r2 − 6r + 9 = 0 with ∆ = 0.
yH = (λ + µx)e3x , λ, µ ∈ R.
Exercise 6.
y ′′ − 3y ′ + 2y = 4x2 (1)
yH = λex + µe2x , λ, µ ∈ R
14
We seek a particular solution of the form :
yp = ax2 + bx + c, a ̸= 0
Computing derivatives :
yp′ = 2ax + b
yp′′ = 2a
Substituting into (1) :
y ′′ + 2y ′ + y = 4xex (2)
r2 + 2r + 1 = 0
yH = (λ + µx)e−x , λ, µ ∈ R
yp = (ax + b)ex
Computing derivatives :
15
Substituting into (2) :
y = (λ + µx)e−x + (x − 1)ex , λ, µ ∈ R
y ′′ + y ′ − 2y = sin x (3)
r2 + r − 2 = 0
yH = λex + µe−2x , λ, µ ∈ R
yp = α cos x + β sin x, α, β ∈ R
Computing derivatives :
(−α cos x − β sin x) + (−α sin x + β cos x) − 2(α cos x + β sin x) = sin x
16
Thus, the general solution is :
1 3
y = λex + µe−2x − cos x − sin x, λ, µ ∈ R.
10 10
4) Solve the differential equation with initial conditions :
(
y ′′ − 3y ′ + 2y = 4x2 ,
y(0) = 1 and y ′ (0) = 2.
The solution is :
y = −8ex + 2e2x + 2x2 + 6x + 7.
5) Solve the equation :
y ′′ − 2y = cosh 2x.
The homogeneous solution is :
√ √
yH = λe 2x
+ µe− 2x
.
yp = α cosh 2x.
Computing derivatives :
yp′′ = 4α cosh 2x.
Substituting into the equation :
1
4α cosh 2x − 2α cosh 2x = cosh 2x ⇒ 2α = 1 ⇒ α = .
2
Thus, the general solution is :
√ √ 1
y = λe 2x
+ µe− 2x
+ cosh 2x, λ, µ ∈ R.
2
17
II) For the particular solution yp , we assume :
yp = α cos x + β sin x, α, β ∈ R
y ′ = cosh x + C1
y = sinh x + C1 x + C2 , C1 , C2 ∈ R
7)For y ′′ − 2y = cosh 2x :
Homogeneous solution :
√ √
yH = λe 2x
+ µe− 2x
1
⇒A=
2
General solution :
√ √ 1
y = λe 2x
+ µe− 2x
+ cosh 2x
2
2)Solve with initial conditions y(0) = 1 and y ′ (0) = 2 :
18
Verification :
y(0) = −8 + 2 + 7 = 1
y ′ (0) = −8 + 4 + 6 = 2
y
Additional Exercise 1 . 3)Solve y ′ = x
+ x for x ∈ R∗+ .
Homogeneous solution :
′ yH
yH − = 0 ⇒ yH = kx, k∈R
x
Particular solution using variation of parameters (yp = k(x)x) :
yp
yp′ = k ′ (x)x + k(x) = + x ⇒ k ′ (x) = 1 ⇒ k(x) = x + C
x
yp = x2 + Cx
General solution :
y = yH + yp = kx + x2 + Cx = x2 + λx, λ∈R
Separating variables :
dy dx
=√
y 1 − x2
ln |y| = arcsin x + C
y = kearcsin x , k = ±eC ∈ R
2) Solve the nonlinear equation :
y ′ = y(y − 1) cos x
19
For y ̸= 0 and y ̸= 1, separate variables :
Z Z
1 1
− dy = cos x dx
y−1 y
y−1
ln = sin x + C
y
y−1
= Kesin x , K = ±eC ∈ R
y
4) Solve by separation of variables (y ̸= 0) :
x+1
y′ =
y2
Z Z
2
y dy = (x + 1)dx
y3 x2
= +x+C
3 2
r
3 3 2
y= x + 3x + D, D = 3C
2
Additional Exercise 3
Solve the following differential equation : y ′′ + y ′ + y = 0.
The characteristic equation is given by r2 + r + 1 = 0.
√ √
−1 3 −1 3
∆ = −3, r1 = +i , r2 = −i
2 2 2 2
Thus, the general solution is :
√ ! √ !!
3 3 1
y = c1 cos x + c2 sin x e− 2 x , c1 , c2 ∈ R
2 2
Solve the following differential equation : y ′′ + y = ex .
The homogeneous equation is y ′′ + y = 0.
The characteristic equation is given by r2 + 1 = 0.
∆ = −4, r1 = i, r2 = −i.
The general solution to the homogeneous equation is :
yh = c1 cos x + c2 sin x, c1 , c2 ∈ R.
We look for a particular solution of the form yp = q(x)ex .
20
Since α = 1 is not a root of the characteristic equation, the degree of q(x) is 0.
Thus,
yp = Aex .
Substituting yp into the differential equation :
1
Aex + Aex = ex =⇒ 2Aex = ex =⇒ A = .
2
Therefore, the particular solution is :
1
yp = ex .
2
The general solution to the non-homogeneous equation is :
1
y = yh + yp = ex + c1 cos x + c2 sin x, c1 , c2 ∈ R.
2
Additional Exercise 4
Solve the following differential equation :
y ′′ − 2y ′ + y = 0 (∗)
The characteristic equation is given by r2 − 2r + 1 = 0.
∆ = 0, r = 1 (double root).
Thus, the general solution is :
y = (ax + b)ex , a, b ∈ R
Find the solution of (*) such that y(0) = 0 and y ′ (0) = −3.
First, compute the derivative of y :
0 = (a · 0 + b)e0 = b =⇒ b = 0.
2. y ′ (0) = −3 :
−3 = (a · 0 + 0 + a)e0 = a =⇒ a = −3.
Thus, the solution satisfying the initial conditions is :
y = −3xex .
21