C2 PDF
C2 PDF
Note: This module is prepared from Chapter 2 of the text book (G.F. Simmons, Differential
Equations with Applications and Historical Notes, TMH, 2nd ed., 1991) just to help the students.
The study material is expected to be useful but not exhaustive. For detailed study, the students
are advised to attend the lecture/tutorial classes regularly, and consult the text book.
1
Contents
2
2.1 First Order Differential Equations
In general, any first order DE is of the form
g(x, y, y 0 ) = 0. (2.1)
Sometimes, it is possible to write the first order DE (2.1) in the canonical form
y 0 = f (x, y) (2.2)
y 0 = F (x)G(y), (2.3)
where F (x) is function of x, and G(y) is function of y. Equation (2.3) can be rewritten as
dy
= F (x)dx,
G(y)
3
DE of the form y 0 = f (ax + by + c)
Here a, b and c are constants. Such DE can be reduced to variable separable by using the trans-
formation
ax + by + c = t.
For, we have a + by 0 = t0 , which transforms the DE y 0 = f (ax + by + c) into the variable separable
DE
t0 = bf (t) + a
Homogeneous DE
A function h(x, y) is said to be homogeneous function of degree n if h(tx, ty) = tn h(x, y). A DE
of the form M (x, y)dx + N (x, y)dy = 0 is said to be homogeneous if M (x, y) and N (x, y) are
homogeneous functions of same degree. The DE M (x, y)dx + N (x, y)dy = 0 can be rewritten
as y 0 = −M (x, y)/N (x, y) = f (x, y) (say). Therefore, a DE expressed in the form y 0 = f (x, y)
is homogeneous if f (tx, ty) = f (x, y) = f (1, y/x). To solve the homogeneous DE, we use the
transformation y = vx, where v is a function of x. This gives y 0 = v + xv 0 . So the DE y 0 = f (x, y)
transforms to
v + xv 0 = f (1, v),
4
DE of the form y 0 = (ax + by + c)/(px + qy + r)
Here a, b, c, p, q and r are constants. In case, ap = qb = m (say), we have ax + by = m(px + qy).
Then the transformation px + qy = t transforms the given DE into variable separable form. Now,
consider that ap 6= qb . In this case, we use the transformations x = X + h and y = Y + k, where
h and k are constants to be determined from the equations ah + bk + c = 0 and ph + qk + r = 0.
The equation y 0 = (ax + by + c)/(px + qy + r), then, transforms to
dY aX + bY
= ,
dX pX + qY
which is a homogeneous DE in X and Y .
x+y+4
Ex. 2.2.4. Solve y 0 = x−y−6
.
y+5
p
Solution 2.2.4. tan−1
x−1
= log (x − 1)2 + (y + 5)2 + c.
2.3 Exact DE
dy
The first order DE dx = f (x, y) can be written in the canonical form M (x, y)dx + N (x, y)dy = 0
where f (x, y) = −M (x, y)/N (x, y). It is said to be an exact DE if M dx + N dy is an exact differ-
ential of some function say F (x, y), that is, M dx + N dy = dF .
The following theorem provides the necessary and sufficient condition for a DE to be exact.
Necessary and sufficient condition for exact DE: If M (x, y) and N (x, y) possess continuous
first order partial derivatives, then the DE M (x, y)dx + N (x, y)dy = 0 is exact if and only if
∂M
∂y
= ∂N
∂x
.
Proof. First assume that the DE M (x, y)dx + N (x, y)dy = 0 is exact. Then by definition, there
exists some function F (x, y) such that
M dx + N dy = dF. (2.4)
Also F (x, y) is a function of x and y. So from the theory of partial differentiation, we have
∂F ∂F
dx + dy = dF. (2.5)
∂x ∂y
∂F ∂F
M= , N= . (2.6)
∂x ∂y
∂M ∂ 2F ∂N ∂ 2F
=⇒ = , = . (2.7)
∂y ∂y∂x ∂x ∂x∂y
5
Given that M (x, y) and N (x, y) possess continuous first order partial derivatives. Therefore,
∂2F ∂2F ∂2F ∂2F
∂y∂x
and ∂x∂y are continuous functions, which in turn implies that ∂y∂x = ∂x∂y . Hence, (2.7) gives
∂M ∂N
= . (2.8)
∂y ∂x
Conversely assume that the condition (2.8) is satisfied. We shall prove that there exists a
function F (x, y) such that equation (2.4) and hence (2.6) are satisfied. Integrating first of the
equations in (2.6) w.r.t. x, we get
Z
F = M dx + g(y). (2.9)
Z
∂F ∂
=⇒ = M dx + g 0 (y).
∂y ∂y
Z
∂
=⇒ N= M dx + g 0 (y).
∂y
Z Z
∂
=⇒ g(y) = N− M dx dy. (2.10)
∂y
Z
∂
=⇒ The integrand N − M dx is a function of y only.
∂y
Z
∂ ∂
=⇒ N− M dx = 0.
∂x ∂y
∂2
Z
∂N
=⇒ − M dx = 0.
∂x ∂x∂y
Z
∂N ∂ ∂
=⇒ − M dx = 0.
∂x ∂y ∂x
∂N ∂M
=⇒ − = 0,
∂x ∂y
which is true in view of (2.8). This completes the proof.
Note. If the DE M dx + N dy = 0 is exact, then in view of (2.9) and (2.10) the solution F (x, y) = c
reads as
Z Z Z
∂
M dx + N− M dx dy = c.
∂y
6
Ex. Test the equation ey dx + (xey + 2y)dy = 0 for exactness and solve it if it is exact.
Sol. Comparing the given equation with M dx + N dy = 0, we get
M = ey , N = xey + 2y.
∂M ∂N
=⇒ = ey = .
∂y ∂x
This shows that the given DE is exact, and therefore its solution is given by
Z Z Z
∂
M dx + N− M dx dy = c.
∂y
Z Z Z
y y ∂ y
=⇒ e dx + xe + 2y − e dx dy = c.
∂y
Z
y y ∂ y
=⇒ xe + xe + 2y − (xe ) dy = c.
∂y
Z
y
=⇒ xe + (xey + 2y − xey ) dy = c.
=⇒ xey + y 2 = c.
7
Next, assume that µ is IF and f (x, y) = c be general solution of the DE M dx + N dy = 0. Let
F be any function of f , then µF (f ) is also an IF of M dx + N dy = 0. For
Z
µF (f )(M dx + N dy) = F (f )df = d F (f )df .
∂M ∂µ ∂N ∂µ
=⇒ µ +M =µ +N .
∂y ∂y ∂x ∂x
1 ∂µ ∂µ ∂M ∂N
=⇒ N −M = − . (2.11)
µ ∂x ∂y ∂y ∂x
We can not determine µ in general from (2.11). If µ happens to be a function of x only, then
(2.11) reduces to
1 dµ 1 ∂M ∂N
= − = h(x) (say).
µ dx N ∂y ∂x
dµ
=⇒ = h(x)dx.
µ
R
h(x)dx
=⇒ µ=e .
R
1 ∂M ∂N
Thus, if N ∂y
− ∂x
= h(x) is a function of x only, then the IF µ = e h(x)dx .
R
1 ∂N
Similarly, if M ∂x
− ∂M
∂y
= h(y) is a function of y only, then the IF µ = e h(y)dy
.
(p(x)y − q(x))dx + dy = 0.
8
with M dx + N dy = 0 gives M = p(x)y − q(x) and N R= 1. Here, we find that
Itscomparison
1 ∂M ∂N
N ∂y
− ∂x = p(x) is a function of x only. Therefore, the IF is µ = e p(x)dx . Now multiplying
both sides of (2.12) by the IF, we obtain
R R R
y0e p(x)dx
+ p(x)ye p(x)dx
= q(x)e p(x)dx
.
d R p(x)dx R
=⇒ ye = q(x)e p(x)dx .
dx
R
Z R
p(x)dx p(x)dx
=⇒ ye = q(x)e dx + c
2.4.3 Bernoulli’s DE
A non-linear DE of the form y 0 + p(x)y = q(x)y n (n 6= 1) is called Bernoulli’s DE, which can be
reduced to LDE by dividing it by y n and then substituting y 1−n = z.
Ex. Solve y 0 + xy = x3 y 3 .
2
Sol. y −2 = 1 + x2 + cex .
2.4.4 IF of homogeneous DE
If M (x, y)dx+N (x, y)dy = 0 is a homogeneous DE, then its IF is 1/(M x+N y) provided M x+N y 6=
0. In case, M x + N y = 0, the IF is 1/x2 or 1/y 2 or 1/(xy).
2.5 Clairaut’s DE
A Clairaut’s DE is of the form
y = xy 0 + f (y 0 ), (2.13)
y f (p)
x= − , (p = y 0 ). (2.14)
p p
Differentiating with respect to y, we get
1 1 y dp f (p) dp f 0 (p) dp
= − 2 + 2 − . (2.15)
p p p dy p dy p dy
9
or
dp
[y − f (p) + pf 0 (p)] = 0. (2.16)
dy
dp
It suggests that either dy = 0 or y = f (p) − pf 0 (p).
dp
If = 0, then p = c (a constant) and we get the general solution of (2.13) given by
dy
y = cx + f (c).
So the parametric equations x = −f 0 (t) and y = f (t) − tf 0 (t) define another solution of (2.13).
It is called singular solution of (2.13).
It should be noted that the straight lines given by the general solution y = cx + f (c) are
tangential to the curve given by the singular solution x = −f 0 (t) and y = f (t) − tf 0 (t). Hence, the
singular solution is an envelope of the family of straight lines of general solution as illustrated in
the following example.
Note: In general, a given DE need not to possess a solution. For example, |y0 | + |y| + 1 = 0 has
no solution. The DE |y 0 | + |y| = 0 has only one solution y = 0.
10
∂f
Picard’s Theorem: Let f (x, y) and ∂y
be continuous in a closed rectangular region R. If
(x0 , y0 ) is any point in R, then there exists some constant h > 0 such that the IVP y 0 = f (x, y),
y(x0 ) = y0 has a unique solution in the interval [x0 − h, x0 + h].
11
2.7 Analytical and Numerical Solutions of a First Order
LDE in Python
A LDE can be solved symbolically using sympy package in python. Let us solve the LDE y 0 −y = 0
with the initial conditions y(0) = 1.
Copy and paste the following program in a Jupyter Notebook cell of python in your system.
Alternatively, you can do it on the online Jupyter Notebook available at https://jupyter.org/try.
Try Classic Notebook at this link, insert a new cell there, and copy-paste the program given below.
%matplotlib inline
import sympy as sy
sy.init_printing() # for LaTeX formatted output
from IPython.display import display
x = sy.symbols(’x’); y = sy.symbols(’y’, cls=sy.Function)
#Enter the differential equation (DE): y-y=0
a1=1;a0=-1;r=0
DE = sy.Eq(a1*y(x).diff(x) + a0*y(x), r)
# Print the DE
display(DE)
# Solve the DE
sol = sy.dsolve(DE,y(x))
# Print the solution
display(sol)
# Solving C1 from the intial conditions y(0)=1
constants = sy.solve([sol.rhs.subs(x,0) - 1])
display(constants)
# Final solution
C1 = sy.symbols(’C1’)
fsol = sol.subs(constants)
display(fsol)
Retype the inverted commas over x, y and C1. Then run the program. It displays the following
output:
d
−y(x) + y(x) = 0
dx
y(x) = C1 ex
{C1 : 1}
y(x) = ex
This is great! Now you can solve the DE: a1y 0 + a0y = r. Just you need to supply the coef-
ficients a1, a0 and the right hand side function r in the above program. Also, supply the initial
condition, if a particular solution is required from the general solution.
12
Now let us do the numerical solution of the above differential equation for which the python
program is as follows:
%matplotlib inline
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
def dydx(y, x):
# Consider the DE y’=- (a0/a1)*y + r/a1
a1=1;a0=-1;r=0
return -(a0/a1)*y + r/a1
x = np.linspace(0, 2, 200)
w = odeint(dydx, [1], x) # Here [1] stands for the IC [y(0)]=[1]
y = w[:,0] # y’ = w[:,0]
# plot results
plt.plot(x,y,’b--’,label=’Numerical’)
plt.plot(x,np.exp(x),’g’,label=’Exact’)
plt.legend(loc="best")
plt.xlabel(’$x$’)
plt.ylabel(’$y(x)$’)
plt.show()
Take care of the inverted commas at different places after copy-pasting the above program
in Jupyter Notebook. Then run the program. The numerical solution as well as the analytical
solution are shown for the range x ∈ [0, 2] in the following figure, which is the output of the above
program. We see that both the solution curves overlap each other, as expected. We look for
numerical solution of the DE where the exact or analytical solution is not available.
Numerical
7 Exact
6
5
y(x)
4
3
2
1
0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00
x
13