A tutorial on how to solve first order differential equations. Examples with detailed solutions are included.
The general form of the first order linear differential equation is as follows
Example 1: Solve the differential equation
Solution to Example 1
Comparing the given differential equation with the general first order differential equation, we have
P(x) = -2 x and Q(x) = x
Let us now find the integrating factor u(x)
u(x) = eò P(x) dx
= eò -2 x dx
= e - x2
We now substitute u(x)= e - x2 and Q(x) = x in the equation u(x) y = ò
u(x) Q(x) dx to obtain
e - x2 y = ò x e - x2dx
Integrate the right hand term to obtain
e - x2 y = -(1/2) e-x2 + C , C is a constant of integration.
Solve the above for y to obtain
y = C ex2 - 1/2
As a practice, find dy / dx and substitute y and dy / dx in the given equation to check that the solution found is correct.
Example 2: Solve the differential equation
Solution to Example 2
We first find P(x) and Q(x)
P(x) = 1 / x and Q(x) = - 2
The integrating factor u(x) is given by
u(x) = eò P(x) dx
= eò (1 / x) dx
= eln |x| = | x | = x since x > 0.
We now substitute u(x)= x and Q(x) = - 2 in the equation u(x) y = ò
u(x) Q(x) dx to obtain
x y = ò -2 x dx
Integrate the right hand term to obtain
x y = -x2 + C , C is a constant of integration.
Solve the above for y to obtain
y = C / x - x
As an exercise find dy / dx and substitute y and dy / dx in the given equation to check that the solution found is correct.
Example 3: Solve the differential equation
Solution to Example 3
We first divide all terms of the equation by x to obtain
dy / dx + y / x = - x2
We now find P(x) and Q(x)
P(x) = 1 / x and Q(x) = - x2
The integrating factor u(x) is given by
u(x) = eò P(x) dx
= eò (1 / x) dx
= eln |x| = | x | = x since x > 0.
We now substitute u(x)= x and Q(x) = - x2
in the equation u(x) y = ò
u(x) Q(x) dx to obtain
x y = ò - x3
dx
Integration of the right hand term yields
x y = -x4 / 4 + C , C is a constant of integration.
Solve the above for y to obtain
y = C / x - x3 / 4
As an exercise find dy / dx and substitute y and dy / dx in the given equation to check that the solution found is correct.
NOTE: If you can "see" that the right hand side of the given equation
x dy / dx + y = - x3
can be written as d(x y) / dx, the solution can be found easily as follows
d(x y) / dx = - x3
Integrate both sides to obtain
x y = - x4 / 4 + C.
Then solve for y to obtain
y = - x3 / 4 + C / x
More references on
Differential Equations
Differential Equations - Runge Kutta Method