First order ordinary differential equations (ODEs) are fundamental in mathematical modeling of real-world phenomena. These equations describe relationships involving an unknown function and its first derivative. We’ll explore various techniques for solving these equations, with a particular focus on linear equations and integrating factors.
Motivating Problem: Population Growth
Consider a population P ( t ) P(t) P ( t ) that grows at a rate proportional to its current size:
d P d t = k P \frac{dP}{dt} = kP d t d P = k P where k k k is a positive constant. How does this population grow over time?
This famous equation leads to exponential growth. The solution is P ( t ) = P 0 e k t P(t) = P_0e^{kt} P ( t ) = P 0 e k t , where P 0 P_0 P 0 is the initial population at t = 0 t = 0 t = 0 . This simple ODE and its solution have widespread applications in biology, economics, and many other fields.
The equation d P d t = k P \frac{dP}{dt} = kP d t d P = k P is an example of a separable differential equation , one of the simplest types of first order ODEs that we’ll explore in this lecture.
Separable Differential Equation. A differential equation is separable if it can be written in the form:
d y d x = f ( x ) g ( y ) \frac{dy}{dx} = \frac{f(x)}{g(y)} d x d y = g ( y ) f ( x )
or equivalently:
g ( y ) d y d x = f ( x ) g(y)\frac{dy}{dx} = f(x) g ( y ) d x d y = f ( x )
Linear First Order ODE. A first order differential equation is linear if it can be written in the form:
d y d x + P ( x ) y = Q ( x ) \frac{dy}{dx} + P(x)y = Q(x) d x d y + P ( x ) y = Q ( x )
where P ( x ) P(x) P ( x ) and Q ( x ) Q(x) Q ( x ) are functions of x x x only.
How to Recognize a Linear ODE
A linear equation must have these properties:
The dependent variable y y y appears only to the first power (never as y 2 y^2 y 2 , y \sqrt{y} y , etc.)
The derivative d y d x \frac{dy}{dx} d x d y appears only to the first power
The coefficients P ( x ) P(x) P ( x ) and Q ( x ) Q(x) Q ( x ) depend only on x x x , not on y y y
Examples:
d y d x + 2 x y = sin x \frac{dy}{dx} + 2xy = \sin x d x d y + 2 x y = sin x — Linear: y y y appears only to first power
d y d x + y = x y 2 \frac{dy}{dx} + y = xy^2 d x d y + y = x y 2 — Not linear: y y y appears as y 2 y^2 y 2
y d y d x = x y\frac{dy}{dx} = x y d x d y = x — Not linear: d y d x \frac{dy}{dx} d x d y is multiplied by y y y
Why Do We Need an Integrating Factor?
When solving d y d x + P ( x ) y = Q ( x ) \frac{dy}{dx} + P(x)y = Q(x) d x d y + P ( x ) y = Q ( x ) , we face a challenge: the left side is not the derivative of a simple function.
Imagine if the left side were d d x [ y ] \frac{d}{dx}[y] d x d [ y ] , we could just integrate both sides. But it’s not that simple.
The integrating factor helps us transform the equation so that the left side becomes the derivative of a product, which we can then integrate directly.
Think of it as: Finding a special function that, when multiplied through the equation, turns the left side into a perfect derivative.
Integrating Factor Method: Step-by-Step
Goal: Solve d y d x + P ( x ) y = Q ( x ) \frac{dy}{dx} + P(x)y = Q(x) d x d y + P ( x ) y = Q ( x )
Step 1: Identify P ( x ) P(x) P ( x ) and Q ( x ) Q(x) Q ( x ) from your equation. Ensure equation is in standard form with d y d x \frac{dy}{dx} d x d y isolated.
Step 2: Calculate the integrating factor
μ ( x ) = e ∫ P ( x ) d x \mu(x) = e^{\int P(x)\,dx} μ ( x ) = e ∫ P ( x ) d x Find a basic antiderivative of P ( x ) P(x) P ( x ) (no +C needed). Take e e e to that power.
Step 3: Multiply every term in the equation by μ ( x ) \mu(x) μ ( x )
μ ( x ) d y d x + μ ( x ) P ( x ) y = μ ( x ) Q ( x ) \mu(x)\frac{dy}{dx} + \mu(x)P(x)y = \mu(x)Q(x) μ ( x ) d x d y + μ ( x ) P ( x ) y = μ ( x ) Q ( x ) Step 4: Recognize that the left side equals d d x [ μ ( x ) y ] \frac{d}{dx}[\mu(x)y] d x d [ μ ( x ) y ] .
This is the product rule in reverse!
d d x [ μ ( x ) y ] = μ ( x ) d y d x + d μ d x y = μ ( x ) d y d x + μ ( x ) P ( x ) y \frac{d}{dx}[\mu(x)y] = \mu(x)\frac{dy}{dx} + \frac{d\mu}{dx}y = \mu(x)\frac{dy}{dx} + \mu(x)P(x)y d x d [ μ ( x ) y ] = μ ( x ) d x d y + d x d μ y = μ ( x ) d x d y + μ ( x ) P ( x ) y Step 5: Rewrite equation with this derivative
d d x [ μ ( x ) y ] = μ ( x ) Q ( x ) \frac{d}{dx}[\mu(x)y] = \mu(x)Q(x) d x d [ μ ( x ) y ] = μ ( x ) Q ( x ) Step 6: Integrate both sides
μ ( x ) y = ∫ μ ( x ) Q ( x ) d x + C \mu(x)y = \int \mu(x)Q(x)\,dx + C μ ( x ) y = ∫ μ ( x ) Q ( x ) d x + C Step 7: Solve for y y y
y = 1 μ ( x ) [ ∫ μ ( x ) Q ( x ) d x + C ] y = \frac{1}{\mu(x)}\left[\int \mu(x)Q(x)\,dx + C\right] y = μ ( x ) 1 [ ∫ μ ( x ) Q ( x ) d x + C ]
The Magic of Integrating Factors Explained
The key insight behind the integrating factor is that:
d d x [ e ∫ P ( x ) d x ⋅ y ] = e ∫ P ( x ) d x ⋅ ( P ( x ) y + d y d x ) \frac{d}{dx}\left[e^{\int P(x)\,dx} \cdot y\right] = e^{\int P(x)\,dx} \cdot \left(P(x)y + \frac{dy}{dx}\right) d x d [ e ∫ P ( x ) d x ⋅ y ] = e ∫ P ( x ) d x ⋅ ( P ( x ) y + d x d y ) When we multiply our original equation d y d x + P ( x ) y = Q ( x ) \frac{dy}{dx} + P(x)y = Q(x) d x d y + P ( x ) y = Q ( x ) by the integrating factor μ ( x ) = e ∫ P ( x ) d x \mu(x) = e^{\int P(x)\,dx} μ ( x ) = e ∫ P ( x ) d x , the left side becomes exactly this derivative.
This transforms the equation from one that’s difficult to integrate directly into one that’s straightforward.
Solve d y d x + y = e x \frac{dy}{dx} + y = e^x d x d y + y = e x .
Solution:
Identify: P ( x ) = 1 P(x) = 1 P ( x ) = 1 and Q ( x ) = e x Q(x) = e^x Q ( x ) = e x
Find the integrating factor:
μ ( x ) = e ∫ 1 d x = e x \mu(x) = e^{\int 1\,dx} = e^x μ ( x ) = e ∫ 1 d x = e x
Multiply the equation by μ ( x ) \mu(x) μ ( x ) :
e x d y d x + e x ⋅ y = e x ⋅ e x = e 2 x e^x\frac{dy}{dx} + e^x \cdot y = e^x \cdot e^x = e^{2x} e x d x d y + e x ⋅ y = e x ⋅ e x = e 2 x
Left side is a derivative:
d d x [ e x y ] = e 2 x \frac{d}{dx}[e^x y] = e^{2x} d x d [ e x y ] = e 2 x
Integrate both sides:
e x y = ∫ e 2 x d x = 1 2 e 2 x + C e^x y = \int e^{2x}\,dx = \frac{1}{2}e^{2x} + C e x y = ∫ e 2 x d x = 2 1 e 2 x + C
Solve for y y y :
y = 1 e x [ 1 2 e 2 x + C ] = 1 2 e x + C e − x y = \frac{1}{e^x}\left[\frac{1}{2}e^{2x} + C\right] = \frac{1}{2}e^x + Ce^{-x} y = e x 1 [ 2 1 e 2 x + C ] = 2 1 e x + C e − x
Check: Verify by substituting back:
d y d x + y = ( 1 2 e x − C e − x ) + ( 1 2 e x + C e − x ) = e x ✓ \frac{dy}{dx} + y = \left(\frac{1}{2}e^x - Ce^{-x}\right) + \left(\frac{1}{2}e^x + Ce^{-x}\right) = e^x \quad \checkmark d x d y + y = ( 2 1 e x − C e − x ) + ( 2 1 e x + C e − x ) = e x ✓
Solve the initial value problem: d y d x − 1 x y = x 2 \frac{dy}{dx} - \frac{1}{x}y = x^2 d x d y − x 1 y = x 2 with y ( 1 ) = 2 y(1) = 2 y ( 1 ) = 2 for x > 0 x > 0 x > 0 .
Solution:
Identify: P ( x ) = − 1 x P(x) = -\frac{1}{x} P ( x ) = − x 1 and Q ( x ) = x 2 Q(x) = x^2 Q ( x ) = x 2
Find the integrating factor:
μ ( x ) = e ∫ − 1 x d x = e − ln ∣ x ∣ = 1 x for x > 0 \mu(x) = e^{\int -\frac{1}{x}\,dx} = e^{-\ln|x|} = \frac{1}{x} \quad \text{for } x > 0 μ ( x ) = e ∫ − x 1 d x = e − l n ∣ x ∣ = x 1 for x > 0
Multiply the equation by μ ( x ) \mu(x) μ ( x ) :
1 x d y d x − 1 x 2 y = x \frac{1}{x}\frac{dy}{dx} - \frac{1}{x^2}y = x x 1 d x d y − x 2 1 y = x
Recognize the left side as a derivative:
d d x [ y x ] = x \frac{d}{dx}\left[\frac{y}{x}\right] = x d x d [ x y ] = x
Integrate both sides:
y x = ∫ x d x = x 2 2 + C \frac{y}{x} = \int x\,dx = \frac{x^2}{2} + C x y = ∫ x d x = 2 x 2 + C
Solve for y y y :
y = x 3 2 + C x y = \frac{x^3}{2} + Cx y = 2 x 3 + C x
Apply the initial condition y ( 1 ) = 2 y(1) = 2 y ( 1 ) = 2 :
2 = 1 2 + C ⟹ C = 3 2 2 = \frac{1}{2} + C \implies C = \frac{3}{2} 2 = 2 1 + C ⟹ C = 2 3
Final solution:
y = x 3 2 + 3 x 2 y = \frac{x^3}{2} + \frac{3x}{2} y = 2 x 3 + 2 3 x
Note: The solution represents the family of curves y = x 3 2 + C x y = \frac{x^3}{2} + Cx y = 2 x 3 + C x . The initial condition y ( 1 ) = 2 y(1) = 2 y ( 1 ) = 2 selects the specific curve where C = 3 2 C = \frac{3}{2} C = 2 3 .
Common Integrating Factors
Here are some common patterns to recognize:
P ( x ) P(x) P ( x ) ∫ P ( x ) d x \int P(x)\,dx ∫ P ( x ) d x Integrating factor μ ( x ) \mu(x) μ ( x ) k k k (constant)k x kx k x e k x e^{kx} e k x 1 x \frac{1}{x} x 1 ln ∣ x ∣ \ln\lvert x\rvert ln ∣ x ∣ x x x − 1 x -\frac{1}{x} − x 1 − ln ∣ x ∣ -\ln\lvert x\rvert − ln ∣ x ∣ 1 x \frac{1}{x} x 1 n x \frac{n}{x} x n n ln ∣ x ∣ n\ln\lvert x\rvert n ln ∣ x ∣ x n x^n x n a x ax a x a x 2 2 \frac{ax^2}{2} 2 a x 2 e a x 2 2 e^{\frac{ax^2}{2}} e 2 a x 2 tan x \tan x tan x ln ∣ sec x ∣ \ln\lvert\sec x\rvert ln ∣ sec x ∣ sec x \sec x sec x
Memorizing these patterns can save you time in solving linear ODEs!
In-class Exercise
Solve the following linear differential equations:
(a) d y d x + 3 y = e − x \frac{dy}{dx} + 3y = e^{-x} d x d y + 3 y = e − x
(b) x d y d x + 2 y = 4 x 2 x\frac{dy}{dx} + 2y = 4x^2 x d x d y + 2 y = 4 x 2 for x > 0 x > 0 x > 0
(c) d y d x − y cot x = sin x \frac{dy}{dx} - y\cot x = \sin x d x d y − y cot x = sin x for 0 < x < π 0 < x < \pi 0 < x < π
Using Substitutions to Transform Differential Equations
Many differential equations that aren’t directly solvable can be transformed into simpler forms through substitution. The key approach is:
Apply a given substitution to transform the variables
Use the chain rule to express the derivative in terms of the new variable
Simplify the resulting equation
Solve using standard methods (separation of variables or integrating factors)
Substitute back to find the original solution
Substitutions can transform complicated-looking equations into familiar forms that are easier to handle.
a. Use the substitution u = y + 2 x u = y + 2x u = y + 2 x to transform the differential equation
d y d x = − ( 1 + 2 y + 4 x ) 1 + y + 2 x \frac{dy}{dx} = \frac{-(1 + 2y + 4x)}{1 + y + 2x} d x d y = 1 + y + 2 x − ( 1 + 2 y + 4 x )
into a differential equation in u u u and x x x .
b. By first solving this new equation, show that the general solution to the original equation may be written as 4 x 2 + 4 x y + y 2 + 2 y + 2 x = k 4x^2 + 4xy + y^2 + 2y + 2x = k 4 x 2 + 4 x y + y 2 + 2 y + 2 x = k , where k k k is a constant.
Solution:
Part (a):
Given the substitution u = y + 2 x u = y + 2x u = y + 2 x , we need to express d y d x \frac{dy}{dx} d x d y in terms of u u u and x x x .
Rearranging: y = u − 2 x y = u - 2x y = u − 2 x , so by the chain rule:
d y d x = d u d x − 2 \frac{dy}{dx} = \frac{du}{dx} - 2 d x d y = d x d u − 2
Substitute y = u − 2 x y = u - 2x y = u − 2 x into the right side:
− ( 1 + 2 ( u − 2 x ) + 4 x ) 1 + ( u − 2 x ) + 2 x = − ( 1 + 2 u ) 1 + u \frac{-(1 + 2(u - 2x) + 4x)}{1 + (u - 2x) + 2x} = \frac{-(1 + 2u)}{1 + u} 1 + ( u − 2 x ) + 2 x − ( 1 + 2 ( u − 2 x ) + 4 x ) = 1 + u − ( 1 + 2 u )
So the equation becomes:
d u d x − 2 = − ( 1 + 2 u ) 1 + u \frac{du}{dx} - 2 = \frac{-(1 + 2u)}{1 + u} d x d u − 2 = 1 + u − ( 1 + 2 u )
Rearranging:
d u d x = − ( 1 + 2 u ) + 2 ( 1 + u ) 1 + u = 1 1 + u \frac{du}{dx} = \frac{-(1 + 2u) + 2(1 + u)}{1 + u} = \frac{1}{1 + u} d x d u = 1 + u − ( 1 + 2 u ) + 2 ( 1 + u ) = 1 + u 1
Part (b):
Solve the transformed equation d u d x = 1 1 + u \frac{du}{dx} = \frac{1}{1 + u} d x d u = 1 + u 1 , which is separable:
( 1 + u ) d u = d x (1 + u)\,du = dx ( 1 + u ) d u = d x
Integrating both sides:
u + u 2 2 = x + C 1 u + \frac{u^2}{2} = x + C_1 u + 2 u 2 = x + C 1
Substitute back u = y + 2 x u = y + 2x u = y + 2 x :
( y + 2 x ) + ( y + 2 x ) 2 2 = x + C 1 (y + 2x) + \frac{(y + 2x)^2}{2} = x + C_1 ( y + 2 x ) + 2 ( y + 2 x ) 2 = x + C 1
Expanding and simplifying, setting k = 2 C 1 k = 2C_1 k = 2 C 1 :
4 x 2 + 4 x y + y 2 + 2 y + 2 x = k 4x^2 + 4xy + y^2 + 2y + 2x = k 4 x 2 + 4 x y + y 2 + 2 y + 2 x = k
a. Use the substitution z = y − 1 z = y^{-1} z = y − 1 to transform the differential equation
d y d x − 1 x y = ( x + 1 ) 3 x y 2 \frac{dy}{dx} - \frac{1}{x}y = \frac{(x + 1)^3}{x}y^2 d x d y − x 1 y = x ( x + 1 ) 3 y 2
into the differential equation
d z d x + 1 x z = − ( x + 1 ) 3 x \frac{dz}{dx} + \frac{1}{x}z = -\frac{(x + 1)^3}{x} d x d z + x 1 z = − x ( x + 1 ) 3
b. By first solving the transformed equation, find the general solution to the original equation, giving y y y in terms of x x x .
Solution:
Part (a):
Given z = y − 1 z = y^{-1} z = y − 1 , we have y = z − 1 y = z^{-1} y = z − 1 . Using the chain rule:
d y d x = − z − 2 d z d x = − 1 z 2 d z d x \frac{dy}{dx} = -z^{-2}\frac{dz}{dx} = -\frac{1}{z^2}\frac{dz}{dx} d x d y = − z − 2 d x d z = − z 2 1 d x d z
Substituting y = z − 1 y = z^{-1} y = z − 1 into the original equation:
− 1 z 2 d z d x − 1 x 1 z = ( x + 1 ) 3 x 1 z 2 -\frac{1}{z^2}\frac{dz}{dx} - \frac{1}{x}\frac{1}{z} = \frac{(x + 1)^3}{x}\frac{1}{z^2} − z 2 1 d x d z − x 1 z 1 = x ( x + 1 ) 3 z 2 1
Multiply both sides by − z 2 -z^2 − z 2 :
d z d x + 1 x z = − ( x + 1 ) 3 x ✓ \frac{dz}{dx} + \frac{1}{x}z = -\frac{(x + 1)^3}{x} \quad \checkmark d x d z + x 1 z = − x ( x + 1 ) 3 ✓
Part (b):
This is a linear first order ODE with P ( x ) = 1 x P(x) = \frac{1}{x} P ( x ) = x 1 and Q ( x ) = − ( x + 1 ) 3 x Q(x) = -\frac{(x + 1)^3}{x} Q ( x ) = − x ( x + 1 ) 3 .
Find the integrating factor:
μ ( x ) = e ∫ 1 x d x = e ln ∣ x ∣ = x ( for x > 0 ) \mu(x) = e^{\int \frac{1}{x}\,dx} = e^{\ln|x|} = x \quad (\text{for } x > 0) μ ( x ) = e ∫ x 1 d x = e l n ∣ x ∣ = x ( for x > 0 )
Multiply by μ ( x ) \mu(x) μ ( x ) :
d d x ( x z ) = − ( x + 1 ) 3 \frac{d}{dx}(xz) = -(x + 1)^3 d x d ( x z ) = − ( x + 1 ) 3
Integrate both sides:
x z = − ( x + 1 ) 4 4 + C xz = -\frac{(x+1)^4}{4} + C x z = − 4 ( x + 1 ) 4 + C
Since z = y − 1 z = y^{-1} z = y − 1 :
x y = − ( x + 1 ) 4 4 + C \frac{x}{y} = -\frac{(x+1)^4}{4} + C y x = − 4 ( x + 1 ) 4 + C
y = 4 x 4 C − ( x + 1 ) 4 y = \frac{4x}{4C - (x + 1)^4} y = 4 C − ( x + 1 ) 4 4 x
Key Strategies for Change of Variable
Remember the chain rule and the product rule:
If y = f ( v ) y = f(v) y = f ( v ) , then d y d x = f ′ ( v ) d v d x \frac{dy}{dx} = f'(v)\frac{dv}{dx} d x d y = f ′ ( v ) d x d v
If y = v x y = vx y = v x , then d y d x = v + x d v d x \frac{dy}{dx} = v + x\frac{dv}{dx} d x d y = v + x d x d v
Key Concepts
Separable Equations:
Form: g ( y ) y ′ = f ( x ) g(y)y' = f(x) g ( y ) y ′ = f ( x )
Technique: Separate variables and integrate
Linear Equations:
Form: y ′ + P ( x ) y = Q ( x ) y' + P(x)y = Q(x) y ′ + P ( x ) y = Q ( x )
Technique: Find integrating factor μ ( x ) = e ∫ P ( x ) d x \mu(x) = e^{\int P(x)\,dx} μ ( x ) = e ∫ P ( x ) d x and multiply both sides
Substitution:
If y = f ( v ) y = f(v) y = f ( v ) , then d y d x = f ′ ( v ) d v d x \frac{dy}{dx} = f'(v)\frac{dv}{dx} d x d y = f ′ ( v ) d x d v
If y = v x y = vx y = v x , then d y d x = v + x d v d x \frac{dy}{dx} = v + x\frac{dv}{dx} d x d y = v + x d x d v
Common Pitfalls
Forgetting to check if an equation is separable before trying more complex methods
Making errors when finding the integrating factor
Incorrectly identifying the P ( x ) P(x) P ( x ) and Q ( x ) Q(x) Q ( x ) functions in a linear equation
Not properly applying initial conditions
Solve the differential equation:
sin x d y d x − y cos x = sin 2 x sin x \sin x \frac{dy}{dx} - y\cos x = \sin 2x \sin x sin x d x d y − y cos x = sin 2 x sin x
Consider the differential equation:
d y d x − 4 y tan x = 2 y 1 2 \frac{dy}{dx} - 4y\tan x = 2y^{\frac{1}{2}} d x d y − 4 y tan x = 2 y 2 1
(a) Show that the substitution z = y 1 2 z = y^{\frac{1}{2}} z = y 2 1 transforms this equation into:
d z d x − 2 z tan x = 1 \frac{dz}{dx} - 2z\tan x = 1 d x d z − 2 z tan x = 1
(b) Solve the transformed equation to find z z z as a function of x x x .
(c) Hence obtain the general solution of the original equation.
(a) Find, in the form y = f ( x ) y = f(x) y = f ( x ) , the general solution of the equation:
d y d x + 2 y tan x = sin 2 x , 0 < x < π 2 \frac{dy}{dx} + 2y\tan x = \sin 2x, \quad 0 < x < \frac{\pi}{2} d x d y + 2 y tan x = sin 2 x , 0 < x < 2 π
given that y = 2 y = 2 y = 2 at x = π 3 x = \frac{\pi}{3} x = 3 π .
(b) Find the value of y y y at x = π 6 x = \frac{\pi}{6} x = 6 π , giving your answer in the form a + k ln b a + k\ln b a + k ln b , where a a a and b b b are integers and k k k is rational.
Consider the differential equation:
x d y d x + 2 y = 4 x 2 x\frac{dy}{dx} + 2y = 4x^2 x d x d y + 2 y = 4 x 2
(1) Find the general solution of this differential equation.
(2) Find the particular solution for which y = 5 y = 5 y = 5 at x = 1 x = 1 x = 1 , giving your answer in the form y = f ( x ) y = f(x) y = f ( x ) .
(3) For this particular solution:
(a) Find the exact values of the coordinates of the turning points of the curve.
(b) Sketch the curve, showing the coordinates of the turning points.