By the end of this chapter, you will be able to:
Mastering these skills will help you analyze and predict real-world engineering systems with confidence and accuracy.
Industrial Control and Installation professionals frequently encounter systems whose behaviour changes over time. Understanding and solving ordinary differential equations is essential for modelling electrical circuits, control systems, and fluid flows in Kenyan industries. This chapter equips you with the skills to solve first order differential equations, enabling you to analyse and predict system responses in real-world installations.
First order differential equations describe quantities where the rate of change depends on the current value or other variables. These equations are fundamental in modelling processes such as temperature change in industrial ovens, voltage drop across resistors, or liquid flow in tanks.
A linear first order differential equation has the form \( \frac{dy}{dx} + P(x)y = Q(x) \), where \( P(x) \) and \( Q(x) \) are functions of \( x \) only. Solving such equations often involves finding an integrating factor.
Example 1:
A heating element in a water tank is controlled so that the temperature \( y \) changes with time \( x \) as \( \frac{dy}{dx} + 2y = 10 \), where \( y \) is in °C and \( x \) in minutes. Find the general solution.
Given: \( P(x) = 2 \), \( Q(x) = 10 \)
$$ \frac{dy}{dx} + 2y = 10 $$
Integrating factor:
$$ IF = e^{\int 2 dx} = e^{2x} $$
Multiply both sides by integrating factor:
$$ e^{2x} \frac{dy}{dx} + 2e^{2x} y = 10e^{2x} $$
Left side is derivative of \( e^{2x}y \):
$$ \frac{d}{dx}(e^{2x}y) = 10e^{2x} $$
Integrate both sides:
$$ \int \frac{d}{dx}(e^{2x}y) dx = \int 10e^{2x} dx $$
$$ e^{2x}y = 5e^{2x} + C $$
Divide both sides by \( e^{2x} \):
$$ y = 5 + Ce^{-2x} $$
Answer: \( y = 5 + Ce^{-2x} \) °C
Example 2:
A voltage \( y \) across a resistor changes according to \( \frac{dy}{dx} + 4y = 20 \), where \( x \) is time in seconds. Find the particular solution if \( y = 0 \) when \( x = 0 \).
Given: \( P(x) = 4 \), \( Q(x) = 20 \), \( y(0) = 0 \)
$$ IF = e^{\int 4 dx} = e^{4x} $$
Multiply:
$$ e^{4x} \frac{dy}{dx} + 4e^{4x}y = 20e^{4x} $$
$$ \frac{d}{dx}(e^{4x}y) = 20e^{4x} $$
Integrate:
$$ e^{4x}y = 5e^{4x} + C $$
So,
$$ y = 5 + Ce^{-4x} $$
Substitute \( x = 0, y = 0 \):
$$ 0 = 5 + C \Rightarrow C = -5 $$
$$ y = 5 - 5e^{-4x} $$
Answer: \( y = 5 - 5e^{-4x} \) V
Example 3:
A chemical concentration \( y \) is described by \( \frac{dy}{dx} + 3y = 6 \), \( y(0) = 2 \). Find \( y \) after \( x = 1 \) hour.
Given: \( P(x) = 3 \), \( Q(x) = 6 \), \( y(0) = 2 \)
$$ IF = e^{3x} $$
Multiply:
$$ e^{3x} \frac{dy}{dx} + 3e^{3x} y = 6e^{3x} $$
$$ \frac{d}{dx}(e^{3x}y) = 6e^{3x} $$
Integrate:
$$ e^{3x}y = 2e^{3x} + C $$
So,
$$ y = 2 + Ce^{-3x} $$
At \( x = 0, y = 2 \):
$$ 2 = 2 + C \Rightarrow C = 0 $$
At \( x = 1 \):
$$ y = 2 + 0 = 2 $$
Answer: \( y = 2 \) units (constant concentration)
Example 4:
A pressure \( y \) in an industrial pipe follows \( \frac{dy}{dx} + y = 5 \), \( y(0) = 2 \). Find \( y \) when \( x = 2 \).
Given: \( P(x) = 1 \), \( Q(x) = 5 \), \( y(0) = 2 \)
$$ IF = e^{x} $$
Multiply:
$$ e^{x} \frac{dy}{dx} + e^{x} y = 5e^{x} $$
$$ \frac{d}{dx}(e^{x}y) = 5e^{x} $$
Integrate:
$$ e^{x}y = 5e^{x} + C $$
$$ y = 5 + Ce^{-x} $$
At \( x = 0, y = 2 \):
$$ 2 = 5 + C \Rightarrow C = -3 $$
At \( x = 2 \):
$$ y = 5 - 3e^{-2} $$
Calculate \( e^{-2} \approx 0.1353 \):
$$ y = 5 - 3 \times 0.1353 = 5 - 0.4059 = 4.5941 $$
Answer: \( y \approx 4.59 \) units
Example 5:
A humidity sensor records \( \frac{dy}{dx} + 0.5y = 8 \), \( y(0) = 0 \). Find \( y \) after \( x = 3 \) hours.
Given: \( P(x) = 0.5 \), \( Q(x) = 8 \), \( y(0) = 0 \)
$$ IF = e^{0.5x} $$
Multiply:
$$ e^{0.5x} \frac{dy}{dx} + 0.5e^{0.5x} y = 8e^{0.5x} $$
$$ \frac{d}{dx}(e^{0.5x}y) = 8e^{0.5x} $$
Integrate:
$$ e^{0.5x}y = 16e^{0.5x} + C $$
$$ y = 16 + Ce^{-0.5x} $$
At \( x = 0, y = 0 \):
$$ 0 = 16 + C \Rightarrow C = -16 $$
At \( x = 3 \):
$$ y = 16 - 16e^{-1.5} $$
Calculate \( e^{-1.5} \approx 0.2231 \):
$$ y = 16 - 16 \times 0.2231 = 16 - 3.5696 = 12.4304 $$
Answer: \( y \approx 12.43 \) units
A first order homogeneous differential equation has the form \( \frac{dy}{dx} = f(\frac{y}{x}) \), where \( f \) is a function of the ratio \( \frac{y}{x} \). These equations are solved by the substitution \( y = vx \).
Example 1:
A control system’s voltage \( y \) and time \( x \) relate as \( \frac{dy}{dx} = \frac{y}{x} \). Find the general solution.
Let \( y = vx \), so \( \frac{dy}{dx} = v + x\frac{dv}{dx} \):
$$ v + x\frac{dv}{dx} = \frac{y}{x} = v $$
Subtract \( v \):
$$ x\frac{dv}{dx} = 0 $$
$$ \frac{dv}{dx} = 0 $$
Integrate:
$$ v = C $$
Recall \( y = vx \):
$$ y = Cx $$
Answer: \( y = Cx \)
Example 2:
Given \( \frac{dy}{dx} = \frac{x + y}{x} \), solve for \( y \).
Rewrite:
$$ \frac{dy}{dx} = 1 + \frac{y}{x} $$
Let \( y = vx \), \( \frac{dy}{dx} = v + x\frac{dv}{dx} \):
$$ v + x\frac{dv}{dx} = 1 + v $$
Subtract \( v \):
$$ x\frac{dv}{dx} = 1 $$
$$ \frac{dv}{dx} = \frac{1}{x} $$
Integrate:
$$ v = \ln x + C $$
Recall \( y = vx \):
$$ y = x(\ln x + C) $$
Answer: \( y = x(\ln x + C) \)
Example 3:
Solve \( \frac{dy}{dx} = \frac{y^2}{x^2} \).
Let \( y = vx \), \( \frac{dy}{dx} = v + x\frac{dv}{dx} \):
$$ v + x\frac{dv}{dx} = v^2 $$
$$ x\frac{dv}{dx} = v^2 - v $$
$$ \frac{dv}{dx} = \frac{v^2 - v}{x} $$
Separate variables:
$$ \frac{1}{v^2 - v} dv = \frac{1}{x} dx $$
Factor denominator:
$$ \frac{1}{v(v-1)} dv = \frac{1}{x} dx $$
Partial fractions:
$$ \frac{1}{v(v-1)} = \frac{1}{v} - \frac{1}{v-1} $$
Integrate:
$$ \int ( \frac{1}{v} - \frac{1}{v-1} ) dv = \int \frac{1}{x} dx $$
$$ \ln|v| - \ln|v-1| = \ln|x| + C $$
$$ \ln| \frac{v}{v-1} | = \ln|x| + C $$
Recall \( v = \frac{y}{x} \):
$$ \ln| \frac{y/x}{y/x-1} | = \ln|x| + C $$
Simplify:
$$ \ln| \frac{y}{y, x} | = \ln|x| + C $$
Or:
$$ \frac{y}{y, x} = Kx $$
Answer: \( \frac{y}{y, x} = Kx \), where \( K = e^C \)
Example 4:
Solve \( \frac{dy}{dx} = \frac{3y + x}{x} \).
Rewrite:
$$ \frac{dy}{dx} = 3\frac{y}{x} + 1 $$
Let \( y = vx \):
$$ v + x\frac{dv}{dx} = 3v + 1 $$
$$ x\frac{dv}{dx} = 2v + 1 $$
$$ \frac{dv}{dx} = \frac{2v + 1}{x} $$
Separate variables:
$$ \frac{1}{2v + 1} dv = \frac{1}{x} dx $$
Integrate:
$$ \frac{1}{2} \ln|2v + 1| = \ln|x| + C $$
$$ \ln|2v + 1| = 2\ln|x| + 2C $$
$$ |2v + 1| = Kx^2 $$
Recall \( v = \frac{y}{x} \):
$$ 2\frac{y}{x} + 1 = Kx^2 $$
$$ 2y + x = Kx^3 $$
Answer: \( 2y + x = Kx^3 \)
Example 5:
Solve \( \frac{dy}{dx} = \frac{y, x}{y + x} \).
Let \( y = vx \), \( \frac{dy}{dx} = v + x\frac{dv}{dx} \):
$$ v + x\frac{dv}{dx} = \frac{vx, x}{vx + x} = \frac{x(v - 1)}{x(v + 1)} = \frac{v - 1}{v + 1} $$
$$ x\frac{dv}{dx} = \frac{v - 1}{v + 1} - v $$
$$ x\frac{dv}{dx} = \frac{v - 1 - v(v + 1)}{v + 1} $$
$$ x\frac{dv}{dx} = \frac{v - 1 - v^2 - v}{v + 1} = \frac{-1 - v^2}{v + 1} $$
$$ \frac{dv}{dx} = \frac{-1 - v^2}{x(v + 1)} $$
Separate variables:
$$ \frac{v + 1}{1 + v^2} dv = -\frac{1}{x} dx $$
Expand numerator:
$$ \frac{v}{1 + v^2} + \frac{1}{1 + v^2} $$
Integrate:
$$ \int \frac{v}{1 + v^2} dv + \int \frac{1}{1 + v^2} dv = -\int \frac{1}{x} dx $$
First term: \( \int \frac{v}{1 + v^2} dv = \frac{1}{2} \ln(1 + v^2) \)
Second term: \( \int \frac{1}{1 + v^2} dv = \arctan v \)
So:
$$ \frac{1}{2} \ln(1 + v^2) + \arctan v = -\ln|x| + C $$
Recall \( v = \frac{y}{x} \):
Answer: \( \frac{1}{2} \ln(1 + (\frac{y}{x})^2) + \arctan(\frac{y}{x}) = -\ln|x| + C \)
An exact equation has the form \( M(x, y)dx + N(x, y)dy = 0 \), where there exists a function \( F(x, y) \) such that \( \frac{\partial F}{\partial x} = M \) and \( \frac{\partial F}{\partial y} = N \). The solution is \( F(x, y) = C \).
Example 1:
Solve \( (2x + 3y)dx + (3x + 4y)dy = 0 \).
Check exactness:
\( \frac{\partial M}{\partial y} = 3 \), \( \frac{\partial N}{\partial x} = 3 \), equation is exact.
Integrate \( M \) with respect to \( x \):
$$ \int (2x + 3y) dx = x^2 + 3y x + f(y) $$
Differentiate with respect to \( y \):
$$ \frac{\partial}{\partial y}(x^2 + 3yx + f(y)) = 3x + f'(y) $$
Set equal to \( N \):
$$ 3x + f'(y) = 3x + 4y \Rightarrow f'(y) = 4y $$
Integrate \( f'(y) \):
$$ f(y) = 2y^2 $$
Thus, solution:
$$ x^2 + 3yx + 2y^2 = C $$
Answer: \( x^2 + 3yx + 2y^2 = C \)
Example 2:
Solve \( (y + x)dx + xdy = 0 \).
Check exactness:
\( M = y + x \), \( N = x \)
\( \frac{\partial M}{\partial y} = 1 \), \( \frac{\partial N}{\partial x} = 1 \), exact.
Integrate \( M \):
$$ \int (y + x) dx = yx + \frac{1}{2}x^2 + f(y) $$
Differentiate with respect to \( y \):
$$ \frac{\partial}{\partial y}(yx + \frac{1}{2}x^2 + f(y)) = x + f'(y) $$
Set equal to \( N \):
$$ x + f'(y) = x \Rightarrow f'(y) = 0 $$
So \( f(y) = C \).
Solution:
$$ yx + \frac{1}{2}x^2 = C $$
Answer: \( yx + \frac{1}{2}x^2 = C \)
Example 3:
Solve \( (2x, y)dx + (x - 2y)dy = 0 \).
Check exactness:
\( \frac{\partial M}{\partial y} = -1 \), \( \frac{\partial N}{\partial x} = 1 \), not exact, can’t solve as exact.
Example 4:
Solve \( (x + 2y)dx + (2x + y)dy = 0 \).
Check exactness:
\( M = x + 2y \), \( N = 2x + y \)
\( \frac{\partial M}{\partial y} = 2 \), \( \frac{\partial N}{\partial x} = 2 \), exact.
Integrate \( M \):
$$ \int (x + 2y) dx = \frac{1}{2}x^2 + 2y x + f(y) $$
Differentiate with respect to \( y \):
$$ \frac{\partial}{\partial y}(\frac{1}{2}x^2 + 2yx + f(y)) = 2x + f'(y) $$
Set equal to \( N \):
$$ 2x + f'(y) = 2x + y \Rightarrow f'(y) = y $$
Integrate:
$$ f(y) = \frac{1}{2}y^2 $$
Solution:
$$ \frac{1}{2}x^2 + 2yx + \frac{1}{2}y^2 = C $$
Answer: \( \frac{1}{2}x^2 + 2yx + \frac{1}{2}y^2 = C \)
Example 5:
Solve \( (3x + 2y)dx + (2x + 3y)dy = 0 \).
Check exactness:
\( \frac{\partial M}{\partial y} = 2 \), \( \frac{\partial N}{\partial x} = 2 \), exact.
Integrate \( M \):
$$ \int (3x + 2y) dx = \frac{3}{2}x^2 + 2y x + f(y) $$
Differentiate with respect to \( y \):
$$ \frac{\partial}{\partial y}(\frac{3}{2}x^2 + 2y x + f(y)) = 2x + f'(y) $$
Set equal to \( N \):
$$ 2x + f'(y) = 2x + 3y \Rightarrow f'(y) = 3y $$
Integrate:
$$ f(y) = \frac{3}{2}y^2 $$
Solution:
$$ \frac{3}{2}x^2 + 2y x + \frac{3}{2}y^2 = C $$
Answer: \( \frac{3}{2}x^2 + 2y x + \frac{3}{2}y^2 = C \)
A separable equation can be written as \( \frac{dy}{dx} = f(x)g(y) \), allowing variables to be separated and integrated individually.
Example 1:
Solve \( \frac{dy}{dx} = 2x y \).
Separate variables:
$$ \frac{dy}{y} = 2x dx $$
Integrate both sides:
$$ \int \frac{dy}{y} = \int 2x dx $$
$$ \ln|y| = x^2 + C $$
$$ y = Ae^{x^2} $$
Answer: \( y = Ae^{x^2} \)
Example 2:
Solve \( \frac{dy}{dx} = x(y - 1) \).
Separate variables:
$$ \frac{dy}{y - 1} = x dx $$
Integrate:
$$ \int \frac{dy}{y - 1} = \int x dx $$
$$ \ln|y - 1| = \frac{1}{2}x^2 + C $$
$$ y - 1 = Ae^{\frac{1}{2}x^2} $$
Answer: \( y = 1 + Ae^{\frac{1}{2}x^2} \)
Example 3:
Solve \( \frac{dy}{dx} = \frac{x}{y} \).
Separate variables:
$$ y dy = x dx $$
Integrate:
$$ \int y dy = \int x dx $$
$$ \frac{1}{2}y^2 = \frac{1}{2}x^2 + C $$
$$ y^2 - x^2 = K $$
Answer: \( y^2 - x^2 = K \)
Example 4:
Solve \( \frac{dy}{dx} = 3y \).
Separate variables:
$$ \frac{dy}{y} = 3 dx $$
Integrate:
$$ \int \frac{dy}{y} = \int 3 dx $$
$$ \ln|y| = 3x + C $$
$$ y = Ae^{3x} $$
Answer: \( y = Ae^{3x} \)
Example 5:
Solve \( \frac{dy}{dx} = x^2 y \).
Separate variables:
$$ \frac{dy}{y} = x^2 dx $$
Integrate:
$$ \int \frac{dy}{y} = \int x^2 dx $$
$$ \ln|y| = \frac{1}{3}x^3 + C $$
$$ y = Ae^{\frac{1}{3}x^3} $$
Answer: \( y = Ae^{\frac{1}{3}x^3} \)
The integrating factor is used to solve linear first order differential equations of the form \( \frac{dy}{dx} + P(x)y = Q(x) \). The integrating factor is \( IF = e^{\int P(x)dx} \).
Example 1:
Solve \( \frac{dy}{dx} + y = x \).
Find integrating factor:
$$ IF = e^{\int 1 dx} = e^{x} $$
Multiply by integrating factor:
$$ e^{x} \frac{dy}{dx} + e^{x} y = x e^{x} $$
Left side is \( \frac{d}{dx}(e^{x}y) \):
$$ \frac{d}{dx}(e^{x}y) = x e^{x} $$
Integrate:
$$ \int \frac{d}{dx}(e^{x}y) dx = \int x e^{x} dx $$
Integrate \( x e^{x} \) by parts:
Let \( u = x \), \( dv = e^{x} dx \), \( du = dx \), \( v = e^{x} \):
$$ \int x e^{x} dx = x e^{x} - \int e^{x} dx = x e^{x} - e^{x} $$
So,
$$ e^{x}y = x e^{x} - e^{x} + C $$
$$ y = x - 1 + C e^{-x} $$
Answer: \( y = x - 1 + C e^{-x} \)
Example 2:
Solve \( \frac{dy}{dx} + 2y = x \).
Integrating factor:
$$ IF = e^{2x} $$
Multiply:
$$ e^{2x} \frac{dy}{dx} + 2 e^{2x} y = x e^{2x} $$
Left side is \( \frac{d}{dx}(e^{2x}y) \):
$$ \frac{d}{dx}(e^{2x}y) = x e^{2x} $$
Integrate \( x e^{2x} \):
Let \( u = x \), \( dv = e^{2x} dx \), \( du = dx \), \( v = \frac{1}{2}e^{2x} \):
$$ \int x e^{2x} dx = x \frac{1}{2}e^{2x} - \int \frac{1}{2}e^{2x} dx = \frac{x}{2}e^{2x} - \frac{1}{4}e^{2x} $$
So,
$$ e^{2x}y = \frac{x}{2}e^{2x} - \frac{1}{4}e^{2x} + C $$
$$ y = \frac{x}{2} - \frac{1}{4} + C e^{-2x} $$
Answer: \( y = \frac{x}{2} - \frac{1}{4} + C e^{-2x} \)
Example 3:
Solve \( \frac{dy}{dx} + 3y = 6x \).
Integrating factor:
$$ IF = e^{3x} $$
Multiply:
$$ e^{3x} \frac{dy}{dx} + 3 e^{3x} y = 6x e^{3x} $$
Left side is \( \frac{d}{dx}(e^{3x}y) \):
$$ \frac{d}{dx}(e^{3x}y) = 6x e^{3x} $$
Integrate \( 6x e^{3x} \):
Let \( u = x \), \( dv = e^{3x} dx \), \( du = dx \), \( v = \frac{1}{3}e^{3x} \):
$$ \int 6x e^{3x} dx = 6 ( x \frac{1}{3}e^{3x} - \int \frac{1}{3}e^{3x} dx ) = 2x e^{3x} - 2 \int e^{3x} dx = 2x e^{3x} - 2 \frac{1}{3}e^{3x} = 2x e^{3x} - \frac{2}{3}e^{3x} $$
So,
$$ e^{3x}y = 2x e^{3x} - \frac{2}{3}e^{3x} + C $$
$$ y = 2x - \frac{2}{3} + C e^{-3x} $$
Answer: \( y = 2x - \frac{2}{3} + C e^{-3x} \)
Example 4:
Solve \( \frac{dy}{dx} + 2y = 4x \).
Integrating factor:
$$ IF = e^{2x} $$
Multiply:
$$ e^{2x} \frac{dy}{dx} + 2 e^{2x} y = 4x e^{2x} $$
Left side is \( \frac{d}{dx}(e^{2x}y) \):
$$ \frac{d}{dx}(e^{2x}y) = 4x e^{2x} $$
Integrate \( 4x e^{2x} \):
Let \( u = x \), \( dv = e^{2x} dx \), \( du = dx \), \( v = \frac{1}{2}e^{2x} \):
$$ \int 4x e^{2x} dx = 4 ( x \frac{1}{2}e^{2x} - \int \frac{1}{2}e^{2x} dx ) = 2x e^{2x} - 2 \int e^{2x} dx = 2x e^{2x} - 2 \frac{1}{2}e^{2x} = 2x e^{2x} - e^{2x} $$
So,
$$ e^{2x}y = 2x e^{2x} - e^{2x} + C $$
$$ y = 2x - 1 + C e^{-2x} $$
Answer: \( y = 2x - 1 + C e^{-2x} \)
Example 5:
Solve \( \frac{dy}{dx} + y = 5x \).
Integrating factor:
$$ IF = e^{x} $$
Multiply:
$$ e^{x} \frac{dy}{dx} + e^{x} y = 5x e^{x} $$
Left side is \( \frac{d}{dx}(e^{x}y) \):
$$ \frac{d}{dx}(e^{x}y) = 5x e^{x} $$
Integrate \( 5x e^{x} \):
Let \( u = x \), \( dv = e^{x} dx \), \( du = dx \), \( v = e^{x} \):
$$ \int 5x e^{x} dx = 5(x e^{x} - e^{x}) = 5x e^{x} - 5e^{x} $$
So,
$$ e^{x}y = 5x e^{x} - 5e^{x} + C $$
$$ y = 5x - 5 + C e^{-x} $$
Answer: \( y = 5x - 5 + C e^{-x} \)
Create a free account to open more of this chapter.
Free: practical guides, quick cards, workplace scenarios and more.
Create a free accountThis chapter explored the fundamentals and solution techniques for ordinary differential equations relevant to civil engineering contexts. It began with a review of the main types of first order differential equations, including linear, homogeneous, exact, and separable equations, as well as the use of integrating factors. The process of forming first order differential equations from physical systems was discussed, followed by detailed methods for solving these equations. Applications of first order differential equations in real-world engineering scenarios were illustrated to reinforce their practical value. The chapter then progressed to the formation of second order differential equations for various engineering systems, highlighting how these equations arise in structural and mechanical analyses. Techniques for solving second order differential equations were thoroughly covered, with stepwise calculations. Finally, practical applications of second order differential equations were examined, demonstrating their importance in modeling and solving complex engineering problems.
Solve the linear differential equation \( \frac{dy}{dx} + 2y = 6 \), given that \( y = 2 \) when \( x = 0 \). (5 marks)
Find the general solution to the homogeneous equation \( \frac{dy}{dx} = \frac{y}{x} \), given that \( y = 5 \) when \( x = 1 \). (5 marks)
A technician at a Nairobi-based manufacturing plant observes that the temperature \( T \) (in °C) of a control panel cools according to the differential equation \( \frac{dT}{dt} + 0.2T = 25 \), where \( t \) is time in minutes. If the initial temperature is \( 80^\circ \)C, solve for \( T \) as a function of \( t \). (4 marks)
Determine whether the differential equation \( (2xy + y^2)dx + (x^2 + 2xy)dy = 0 \) is exact. If not, state why. (4 marks)
At the start of this chapter we promised you would be able to:
Tick each one you can genuinely do.
So, are you there yet?
You're competent when you can confidently do 50% or more of what this chapter promised.
Sign in to record how you're doing.