You are on page 1of 9

and Scientific Research

Ministry of Higher Education


Al-Iraqia University
College of Engineering – Electrical Depatrment
Second Stage (A)

Separable equations & Linear equations


This Report is submitted to fulfill the
requirements of the Numerical Analysis

Prepared By
Tareq Omar Mursi

Supervised By
Dr Farqad Talib Najim

1
Separable equations

A first-order ode is separable if it can be written in the form


dy
g(y) = f (x), y(x0 ) = y0 , (2.2)
dx
where the function g(y) is independent of x and f (x) is independent of y.
Integra- tion from x0 to x results in
x x
Z g(y(x))y′(x)dx = Z f (x)dx.
x0 x0
The integral on the left can be transformed by substituting u = y(x), du = y′
(x)dx, and changing the lower and upper limits of integration to y(x0) = y0 and
y(x) = y.
Therefore,
y x
Z g(u)du = Z f (x)dx,
y0 x0
and since u is a dummy variable of integration, we can write this in the
equivalent form
y x
Z g(y)dy = Z f (x)dx. (2.3)
A simpler procedure that alsoy0 yields (2.3)x0is to treat dy/dx in (2.2) like a fraction.
Multiplying (2.2) by dx results in
g(y)dy = f (x)dx,
which is a separated equation with all the dependent variables on the left-
side, and all the independent variables on the right-side. Equation (2.3) then
results directly upon integration.

2
Example: Solve dy + 1 y = 3 , with y(0) = 2.
dx 2 2
We first manipulate the differential equation to the form
dy 1
= (3 − y), (2.4)
dx 2
and then treat dy/dx as if it was a fraction to separate variables:
dy 1
= dx.
3−y 2
We integrate the right-side from the initial condition x = 0 to x and the left-
side from the initial condition y(0) = 2 to y. Accordingly,
y dy 1 x
Z = Z dx. (2.5)
2 3 − y 2 0
The integrals in (2.5) need to be done. Note that y(x) < 3 for finite x or the
integral on the left-side diverges. Therefore, 3 − y > 0 and integration
yields
y 1 x
− ln (3 − y) 2 = x
2
1
0 , ln (3 − y) =2−
x,
1
3 − y = e−2 x ,
21
y = 3 − e− x .
Since this is our first nontrivial analytical solution, it is prudent to check our
result. We do this by differentiating our solution:
dy 1 −2 1 x
dx = 2 e
1
= (3 − y);
2
and checking the initial conditions, y(0) =− 3 e0 = 2. Therefore, our
solution satisfies both the original ode and the initial condition.
Example: Solve dy + 1 y = 3 , with y(0) = 4.
dx 2 2
This is the identical differential equation as before, but with different initial
condi- tions. We will jump directly to the integration step:
Zy Z
dy 1 x
= dx.
4 3 − y 2 0

Now y(x) > 3, so that y − 3 > 0 and integration


y 1 xyields
− ln (y − 3) 4 = x
2
1
0 , ln (y − 3) = 2

x,
1
y − 3 = e− 2 x ,
12 x
y = 3 + e− .
dy/dx + y/2 = 3/2
6

3
y

0
0 1 2 3 4 5 6 7
x
Figure 2.2: Solution of the following ode: dy + 1 y = 3 .
dx 2 2

The solution curves for a range of initial conditions is presented in Fig. 2.2.
All solutions have a horizontal asymptote at y = 3 at which dy/dx = 0. For
y(0) = y0, the general solution can be shown to be y(x) = 3 + (y0 − 3)
exp(−x/2).

Example: Solved dy = 2 3+2


cos 2x
, with y(0) = −1. (i) For what values of x > 0 does
x
the solution exist? (ii) For what value of x > 0 is y(x) maximum?
Notice that the derivative of y diverges when y−= 3/2, and that this may
cause some problems with a solution.
We solve the ode by separating variables and integrating from initial conditions:
(3 + 2y)dy = 2 cos 2x dx
y x
Z (3 + 2y)dy = 2 Z cos 2x dx
1
− 3y y2 y 0
−1 = sin 2x x
0
+
y2 + 3y + 2 − sin 2x = 0
1 √
y± = [−3 ± 1 + 4 sin 2x].
2
Solving the quadratic equation for y has introduced a spurious solution that
does not satisfy the initial conditions. We test:
1 -1;
y±(0) = 2 [−3 ± 1] = -2.
Only the + root satisfies the initial condition, so that the unique solution to the ode
and initial condition is √
1
y = [ 3 + 1 + 4 sin 2x]. (2.6)
2−
To determine (i) the values of x > 0 for which the solution exists, we require
1 + 4 sin 2x ≥ 0,
or
1
sin 2x ≥ −4 . (2.7)
Notice that at x = 0, we have sin 2x = 0; at x = π/4, we have sin 2x =
1; at x = π/2, we have sin 2x = 0; and at x = 3π/4, we have sin 2x = 1 We
therefore need to determine the value of x such that sin 2x =− 1/4, with x
in the range π/2 < x < 3π/4. The solution to the ode− will then exist for all x
between zero and
this value.
To solve sin 2x = 1/4 for x in the interval π/2 < x < 3π/4, one needs to
recall the definition−of arcsin, or sin−1, as found on a typical scientific
calculator.
The inverse of the function
f (x) = sin x, −π/2 ≤ x ≤ π/2
is denoted by arcsin. The first solution with x > 0 of the equation sin −2x =
1/4 places 2x in the interval (π, 3π/2), so to invert this equation using the
arcsine we need to apply the identity sin (π x) = sin x, and rewrite sin 2x
= 1/4 as sin (π 2x) = 1/4. The − solution of this equation may then be

found by taking the arcsine, and is
π − 2x = arcsin (−1/4),
or
1 1
x =2 π + arcsin 4 .

Therefore the solution exists for


≤ 0 x (π + arcsin (1/4)) /2 = 1.6971 . . . ,
where we have used a calculator value (computing in radians) to find
arcsin(0.25) = 0.2527 . . . . At the value (x, y) = (1.6971 . . . , 3/2), the

solution curve ends and dy/dx becomes infinite.
To determine (ii) the value of x at which y = y(x) is maximum, we
examine (2.6) directly. The value of y will be maximum when sin 2x takes
its maximum value over the interval where the solution exists. This will be
when 2x = π/2, or x = π/4 = 0.7854 . . . .
The graph of y = y(x) is shown in Fig. 2.3.

Linear equations
The linear first-order differential equation (linear in y and its derivative) can
be written in the form
dy
+ p(x)y = g(x), (2.8)
dx
with the initial condition y(x0) = y0. Linear first-order equations can be
integrated using an integrating factor µ(x). We multiply (2.8) by µ(x),
dy
µ(x) d + p(x)y = µ(x)g(x),
x

(2.9) and try to determine µ(x) so that


dy d
µ(x) d + p(x)y =d [µ(x)y]. (2.10)
x x
(3+2y) dy/dx = 2 cos 2x, y(0) = −1
0
−0.2
−0.4
−0.6
−0.8
y

−1
−1.2
−1.4
−1.6
0 0.5 1 1.5
x
Figure 2.3: Solution of the following ode: (3 + 2y)y′ = 2 cos 2x, y(0) = −1.

Equation (2.9) then


becomes
d
[µ(x)y] = µ(x)g(x). (2.11)
dx
Equation (2.11) is easily integrated using µ(x0) = µ0 and y(x0) = y0:

µ(x)y − µ0y0 Z
x
or =
µ(x)g(x)dx,
x0
1 x
y= µ0 0y + Z µ(x)g(x)dx . (2.12)
µ(x) x0

It remains to determine µ(x) from (2.10). Differentiating and expanding


(2.10) yields
dy dµ dy
µ + pµy = y + µ ;
and upon dx dx dx
simplifying, dµ
= pµ. (2.13)
dx
Equation (2.13) is separable and can be integrated:
µ dµ x
Z
µ
= Z p(x)dx,
µ0 x0
Z
µ x
ln µ0 = p(x)dx,
x0
µ(x) = µ0 x
exp Z p(x)dx .
x0

Notice that since µ0 cancels out of (2.12), it is customary to assign µ0 = 1.


The solution to (2.8) satisfying the initial condition y(x0) = y0 is then
commonly written
as
1 Zx
y= y0 +
µ(x)g(x)dx ,
with µ(x) x0
x
µ(x) = exp Z p(x)dx
x0
the integrating factor. This important result finds frequent use in applied
mathe- matics.

Example: Solved dy + 2y = e−x , with y(0) = 3/4.


x
Note that this equation is not separable. With p(x) = 2 and g(x) = e−x , we have
x
µ(x) = exp Z 2dx
0
2x
=e ,
and x
3
y = e−2x + Z e2xe−xdx
4 0x
3
= e−2x + Z exdx
4 0
−2x 3 x
=e +4 (e − 1)
1
= e−2x ex − 4
1
= e−x 1 − 4e −x .

Example: Solved dy − 2xy = x, with y(0) = 0.


This equation isx separable, and we solve it in two ways. First, using an
integrating factor with p(x) = −2x and g(x) = x:
x
µ(x) = exp −2 Z xdx
0
−x2
=e ,
and
2Z x −x2
y = ex xe dx.
0
The integral can be done by substitution with u = x2, du = 2xdx:
Zx 2 1 Z x2
−u
0 xe dx = 2 10 e x2du
−x

= − e−u0
2
1 2
= 1 − e−x .
2
Therefor
e,
1 2 2
y = 2 ex 1 − e−x
1 2
= 2 ex − 1 .
Second, we integrate by separating variables:
dy
− 2xy = x,
dx
dy
= x(1 + 2y),
dx
y dy x
Z = Z xdx,
10 1 + 0 1
ln (1 + 2y) = x2,
2 2
x2
1 + 2y = e ,
1 2
y = 2 ex − 1 .
The results from the two different solution methods are the same, and the
choice of method is a personal preference.

You might also like