Learning Objectives
By the end of this section, you will be able to:
- Recognize when a first-order ODE can be tamed by a change of variable, even though it is neither linear nor exact.
- Apply the homogeneous substitution to any ODE of the form .
- Linearize a Bernoulli equation via .
- Handle equations of the form with the linear shift .
- Verify the algebra numerically using Python and PyTorch's autograd.
- Connect these substitutions to real-world models: population growth, fluid drag, mixing, and beyond.
The Big Idea: Why Substitute?
"We do not solve hard problems. We trade them for easy ones."
In Sections 21.1 and 21.2 you mastered two structurally easy equations: linear and exact. The integrating factor handled the first, the potential function the second. But the wild ODE you meet in a physics lab rarely walks in already wearing one of those costumes. Consider three real specimens:
Each of these resists every technique you know. And yet — with the right change of variable, all three collapse into separable or linear equations you can solve in your sleep.
The substitution mindset
Substitution is the universal escape hatch. Whenever a first-order ODE doesn't fit any standard mould, ask: is there a single quantity inside this equation that, if I gave it its own name, everything would simplify around? That quantity is your (or ), and naming it is half the battle.
The three patterns below come up so often that they have dedicated names. In every case the recipe is the same four-step dance:
- Diagnose the structure on the right side.
- Introduce a new variable that captures that structure.
- Rewrite the ODE in the new variable — it will be separable or linear.
- Solve and undo the substitution to get back.
Diagnosing the Right Substitution
Pattern matching the right side of tells you which substitution to reach for:
| Right side depends on… | Call it | Substitution | Equation becomes |
|---|---|---|---|
| only the ratio y/x | Homogeneous | v = y/x | separable in v, x |
| y^n with a linear y elsewhere | Bernoulli | u = y^(1−n) | linear in u |
| only ax + by + c | Linear shift | v = ax + by + c | separable in v, x |
Spotting homogeneity at a glance
A right side is homogeneous of degree zero exactly when for every . Try : you get , a function of alone.
Homogeneous Equations: v = y/x
A first-order ODE is homogeneous of degree zero when its right side depends only on the ratio :
Set , so . Differentiating with the product rule gives . Substituting:
The right side is a product of a function of and a function of — it is separable:
What is the geometric meaning?
Slopes of a homogeneous ODE are constant along rays from the origin. Walk out along the ray and the slope never changes. Move the slider in the demo below to feel this.
The Three-Line Recipe
- Write the ODE so its right side is a function of alone, call it .
- Replace with and rearrange to .
- Integrate both sides, then back-substitute .
Worked Example — Homogeneous
Solve .
Click to expand step-by-step solution (try it yourself first!)
Step 1 — Confirm homogeneity. Divide numerator and denominator by :
Step 2 — Substitute. Let , so :
Step 3 — Separate variables.
Step 4 — Integrate. Split the left integral into two pieces:
Step 5 — Back-substitute :
Step 6 — Apply the initial condition : the left side becomes , and the right side is , so . The implicit solution is:
Step 7 — Sanity check. Differentiate implicitly and simplify — the slope at should equal , and indeed it does. Plot the curve in the demo above to see it threads through .
Bernoulli Equations: u = y^(1−n)
A Bernoulli equation is anything of the form
It is one tiny step removed from a linear equation — only that troublesome on the right makes it non-linear. The magic substitution is .
Why this exponent?
We want a quantity whose derivative absorbs the . Differentiate :
Now multiply the original ODE by :
The first term is exactly , and . So:
A linear first-order ODE in ! Solve it with the integrating factor method from Section 21.1, then convert back via .
The famous case n = 2 — the logistic equation
With the substitution becomes , and the equation rewritten as turns into the linear equation . Play with , , and below to see how the S-curve emerges.
Worked Example — Bernoulli (Logistic)
Solve the logistic ODE with .
Click to expand step-by-step solution
Step 1 — Rewrite in Bernoulli standard form.
Here .
Step 2 — Substitute :
Step 3 — Multiply the ODE by :
The left side is exactly , giving the linear equation:
Step 4 — Integrating factor :
Step 5 — Integrate both sides:
Step 6 — Apply :
Step 7 — Convert back to and clean up:
Step 8 — Read the physics off the formula.
- x → 0: the exponential is 1, so denominator = K/y₀, giving y(0) = y₀. ✓
- x → ∞: exponential → 0, so y → K (the carrying capacity).
- Inflection point: y = K/2 — the population grows fastest when half of capacity is filled. This is why S-curves show up in advertising spend, virus spread, and tech adoption.
Linear-Shift Substitution: v = ax + by + c
If the entire right side depends on a single linear combination,
the right substitution is to give that combination a name. Set . Differentiating:
The new equation is separable: . Integrate, then undo the substitution.
Worked micro-example
For , set . Then , separable to . Undoing: , so .
Python: Hand-rolled Substitution Solver
Let's see the homogeneous substitution work end-to-end on a computer. We'll start from the original ODE, apply the substitution by hand to derive the simplified equation, then ask SciPy to solve that simplified equation — and finally un-substitute to recover . As a last step we will plug the answer back into the original ODE and measure the residual — if our algebra was right, the residual should be tiny.
PyTorch: Verifying with Autograd
Once we hand-derive a closed-form solution from a substitution, how do we know we didn't flip a sign or forget a chain-rule factor? PyTorch's autograd engine gives us a one-line answer: differentiate the candidate solution and compare with the right side of the original ODE. If they match at every point, the derivation is correct.
Real-World Applications
🌱 Population Biology (Bernoulli)
The logistic ODE is the workhorse of ecology — every bounded population, from yeast in a flask to wolves in Yellowstone, settles onto an S-curve toward its carrying capacity .
💨 Fluid Drag (Bernoulli, n = 2)
Newtonian drag gives . Dividing by and substituting turns terminal-velocity problems into linear ODEs.
🔬 Reaction Kinetics (Homogeneous)
Self-catalytic reactions obey . In dimensionless form (concentrations scaled by the total) the rate law is homogeneous of degree zero, solvable by .
🧠 Machine Learning (Bernoulli)
The replicator equation for evolutionary game theory, , is a multi-species Bernoulli system and underlies modern reinforcement-learning dynamics.
Common Pitfalls
Forgetting the product rule
When you substitute , the derivative is , not just . Missing the term is the single most common mistake in homogeneous substitutions.
Bernoulli with n = 0 or n = 1
The substitution is degenerate when (gives ) or trivial when . But in those cases the original equation is already linear — solve it directly with the integrating factor method.
Don't forget to back-substitute
After integrating the simplified equation in or , you MUST express the answer back in terms of the original variables and . A solution "in v" is not yet a solution to the original problem.
Signs in the linear-shift case
For with , the substitution degenerates — the right side is then a function of alone and the ODE is already directly integrable.
Test Your Understanding
Summary
Substitution is the most strategic tool in the first-order ODE toolbox. With three patterns you can crack equations that look forbidding at first glance:
| Pattern | Substitution | Becomes | Hallmark |
|---|---|---|---|
| dy/dx = F(y/x) | v = y/x | separable in v, x | right side depends only on the ratio y/x |
| y' + Py = Qy^n | u = y^(1−n) | linear in u | rogue y^n term ruins linearity |
| dy/dx = f(ax+by+c) | v = ax+by+c | separable in v, x | right side groups x and y as a single block |
Key Takeaways
- Substitution trades a difficult ODE for an easier one in a new variable — the rest of the work is back-substitution.
- Homogeneous: slopes are constant along rays from the origin → always works.
- Bernoulli: a single spoils linearity → kill it with .
- Linear shift: when appears as a unit, name it .
- Numerical verification with SciPy and analytic verification with PyTorch autograd are cheap insurance against algebra mistakes — use them.
- Real-world S-curves, drag, and reaction kinetics are all logistic / Bernoulli equations in disguise.
Coming Next: Section 21.4 turns these tools toward their most famous applications — exponential growth and decay. We'll meet radioactive isotopes, compound interest, and the half-life formula as one unified story.