Learning Objectives
By the end of this section you will be able to:
- Recognize when a first-order DE is separable, i.e., can be written as .
- Execute the four-step procedure — separate, integrate, combine constants, apply the initial condition — to obtain a particular solution.
- Explain why moving the differentials and across the equality is legitimate (the chain-rule justification, not just \"multiply both sides\").
- Detect singular and lost solutions that the routine division by can quietly throw away.
- Verify a separable-equation solution by independent numerical integration (RK4) and by symbolic computation (SymPy / PyTorch autograd).
The Big Picture
We met direction fields in the previous section: a forest of tiny tangent segments that hint at every solution at once. Beautiful, but qualitative. Now we want actual closed-form solutions — formulas like that you can evaluate at any with a calculator. The first technique that achieves this is also the simplest, the oldest, and by far the most common in physics and engineering: separation of variables.
The idea is embarrassingly clean: if every appearance of and can be herded onto one side, and every appearance of and onto the other, then both sides are now ordinary single-variable integrals. Calculus we already know solves the rest.
One-line summary: Separation of variables turns the differential equation into the integral equation . After that, it's just antiderivatives.
Where the Trick Comes From
The technique is essentially as old as calculus itself. Leibniz, who invented the notation , deliberately designed it so the symbols on top and bottom behave as if they were ordinary numbers in many contexts. He used separation in 1691 to solve the catenary problem (the shape of a hanging chain). Johann Bernoulli, his student, used it to solve the brachistochrone problem in 1696 (the curve of fastest descent). Both problems reduce to a separable ODE after a clever substitution.
For about two centuries afterward, "solve the differential equation" mostly meant "try to massage it into a separable form." Even today, when you see an exponential, a Gaussian, a logistic curve, or Newton's law of cooling, you are looking at the output of a separation of variables that someone, somewhere, did once and recorded.
What Does "Separable" Mean?
A first-order ODE is separable if its right-hand side factors as a product of a function of alone and a function of alone:
The factorisation is the whole game. Look at three quick examples:
| Equation | f(x) | g(y) | Separable? |
|---|---|---|---|
| dy/dx = x·y | x | y | Yes |
| dy/dx = sin(x)/y | sin(x) | 1/y | Yes |
| dy/dx = y² − x² | — | — | No (subtraction, not product) |
| dy/dx = e^{x+y} | e^x | e^y | Yes (because e^{x+y}=e^x·e^y) |
| dy/dx = x + y | — | — | No (sum of two terms, neither factoring) |
The Separation Procedure
Once the equation is in the form , you carry out exactly four moves.
Step 1 — Separate
Divide both sides by , multiply both sides by :
Step 2 — Integrate both sides
The left side is a -integral; the right is an -integral. Crucially they are now independent:
Step 3 — Combine the constants
Each integral introduces its own constant; merge them into a single . After integration you have an implicit equation of the form
where is an antiderivative of and is an antiderivative of . Sometimes this implicit form is the end of the road (e.g., when has no elementary expression). Often, though, you can finish:
Step 4 — Solve for y, then apply the initial condition
Algebraically invert to get . Then substitute the initial value and solve for the single unknown . The result is the unique solution that passes through the prescribed point.
Why Moving Differentials Like Symbols Is Allowed
At step 1 you wrote by treating as a quotient of differentials. Is that rigorous, or just a happy notation? Let's check it cleanly.
Suppose is a solution. Define , so that . Then by the chain rule:
So has derivative with respect to , which means it is an antiderivative of . That is exactly the conclusion you get from . The Leibniz manipulation is a shortcut for this chain-rule argument — never a sleight of hand.
Interactive Lab: Direction Fields and Solutions
Pick a separable DE from the panel, drag the parameter slider, and click anywhere on the plane to plant an initial condition. The thin coloured segments are the slope field (tangents to every solution); the thick coloured curve is the actual solution computed by a black-box RK4 integrator. The bracketed steps on the right show the symbolic separation evolving in real time.
Interactive: Watch a Separation Step by Step
Below, each press of the play button advances the symbolic manipulation by exactly one move. Use the per-step pills above to jump around, or step manually with the arrow buttons.
Worked Example: Newton's Cooling by Hand
A barista pulls an espresso shot at into a room at . Newton's law of cooling models the drink as
Find and the time at which the coffee reaches a drinkable .
Show full hand-computation (try it yourself first, then peek)
Step 1 — substitute . Since is constant, , and the equation becomes
Step 2 — separate. Divide by , multiply by :
Step 3 — integrate both sides.
Step 4 — exponentiate and absorb signs into :
Step 5 — apply the initial condition. At , . So .
Step 6 — when does T = 30 °C?
Compute it numerically: .
Sanity table:
| t (min) | T(t) (°C) | Plain English |
|---|---|---|
| 0 | 95.00 | Just poured |
| 10 | 65.49 | Still scalding |
| 30 | 36.73 | Comfortable sip |
| 40.30 | 30.00 | Target reached |
| 60 | 23.73 | Lukewarm |
| 120 | 20.19 | Essentially room temperature |
Run the Python block below: every row in this table reproduces to four decimal places.
A Subtler Example: Logistic Growth
Some separable equations require partial fractions before they can be integrated. The classic example is the logistic equation, which models any population whose growth slows as it approaches a carrying capacity :
Show the full derivation (we'll use it in the visualizer above)
Step 1 — separate.
Step 2 — partial fractions. Write and solve: , . So
Step 3 — integrate.
Step 4 — exponentiate. With :
Step 5 — solve for y. Cross-multiply, expand, and collect :
Let . Then .
Step 6 — initial condition. At : .
With and , and the population takes about units to reach the inflection point .
| x | y(x) | Behaviour |
|---|---|---|
| 0 | 10.00 | Initial seed |
| 1 | 26.72 | Still slow |
| 3 | 168.66 | Take-off |
| 5 | 599.86 | Past the inflection |
| 7 | 917.20 | Saturating |
| 10 | 995.53 | Practically at K |
A Catalog of Common Separable DEs
These five appear in almost every applied-mathematics course. Pattern-recognise them and you save a lot of derivation time.
| Equation | Separated form | Closed-form solution | Where it appears |
|---|---|---|---|
| dy/dx = ky | dy/y = k dx | y = y₀ e^{k(x-x₀)} | Exponential growth/decay, RC circuits, half-lives |
| dT/dt = -k(T - Tenv) | du/u = -k dt (u = T-Tenv) | T = Tenv + (T₀ - Tenv)e^{-kt} | Newton's cooling, heat-exchangers |
| dy/dx = y(1 - y/K) | K dy/[y(K-y)] = dx | y = K / (1 + ((K-y₀)/y₀)e^{-x}) | Population dynamics, learning curves, S-shaped adoption |
| dy/dx = -x/y | y dy = -x dx | x² + y² = R² | Circular orbits, perpendicular trajectories |
| dy/dx = ky(1 - y)·... etc. | (partial fractions) | various | Chemical kinetics, epidemic SIR |
Real-World Applications
- Radioactive decay. gives ; the half-life is .
- RC circuit discharge. separates the same way; the time constant is .
- Chemical kinetics. First-order reactions . Second-order reactions like also separate, giving .
- Mixing problems. Concentration in a stirred tank with inflow and outflow: separates after substituting .
- Logistic populations & epidemics. The SI model and the Verhulst growth model are both separable after partial fractions.
Connection to Machine Learning
Separable equations sneak into machine learning more often than people realise:
- Exponential learning-rate schedules. The schedule gives , which is the continuous-time analogue of multiplying by a fixed factor each epoch.
- Diffusion models. The forward process is governed by an SDE whose deterministic skeleton is separable in ; the closed-form marginals come from this separation.
- Population-style RL. Replicator dynamics in evolutionary algorithms look like — separable, with logistic-style solutions.
- Continuous-time normalising flows. Whenever the ODE is , separation gives — the basis of time-conditional Gaussian flows.
Python: Solving a Separable DE Numerically
Code is the second proof. Below, plain Python implements the same Newton's- cooling problem two independent ways: directly from the closed-form solution , and via a hand-written RK4 integrator that knows nothing about the closed form. We then compute the maximum disagreement. If the separation algebra is correct, the gap is tiny round-off.
PyTorch: Symbolic vs. Autograd Verification
SymPy can carry out separation of variables symbolically, and PyTorch's autograd can independently differentiate the closed-form expression to confirm it satisfies the DE. The two together are about as airtight as a one-page proof.
Common Pitfalls
Summary
- A first-order DE is separable iff its right-hand side factors as — a product, never a sum.
- The four-step recipe — separate, integrate, combine constants, apply IC — turns the DE into two ordinary integrals.
- The Leibniz move "multiply both sides by " is rigorously justified by the chain rule, not by ambiguity of notation.
- Watch for lost equilibrium solutions when , and for domain restrictions when inverting an implicit solution.
- Numerical verification with RK4 and symbolic verification with SymPy / PyTorch autograd give you an independent, automatic sanity check that any candidate solution truly satisfies the original equation.
Looking ahead: Separation is the workhorse but it only handles first-order equations whose right-hand side factors. The next section introduces Euler's method: a numerical scheme that handles arbitrary first-order DEs — even non-separable ones — by following the direction field one tiny step at a time.