Separable Equations
A separable equation is a first-order differential equation whose right-hand side factors into a function of times a function of . Moving every to one side and every to the other turns the equation into two ordinary integrals. This lesson justifies the method, shows where it silently loses solutions, and applies it to mixing tanks and orthogonal trajectories.
For a gentler first pass, see Separable Equations in the survey course.
Definition and the method
An equation is separable when . Where :
The middle line treats and like numbers, which looks suspicious. Here is why it is correct. Let be an antiderivative of and one of . If solves the equation, the chain rule gives
so has zero derivative on an interval and is constant: . That implicit solution is exactly what the integration step produces. Running the argument backwards shows every differentiable satisfying (with ) is a solution.
Lost solutions and non-uniqueness
Dividing by assumed . Every root of gives a constant solution (an equilibrium), and the formula often misses it. For the constant solutions and are not in the family obtained with partial fractions for any finite .
Uniqueness can also fail. The Picard–Lindelöf theorem guarantees one solution through when and are continuous near that point. For , blows up at , and both and pass through the origin.
import sympy as sp
x = sp.symbols("x", real=True)
y = sp.Function("y")
sol = sp.dsolve(sp.Eq(y(x).diff(x), x * y(x)**2), y(x), ics={y(0): 1})
print(sol)
print("blows up where the denominator is 0:", sp.solve(sp.denom(sol.rhs), x))
# two different solutions of y' = 3 y^(2/3) through (0, 0)
for cand in (sp.Integer(0), x**3):
residual = sp.simplify(cand.diff(x) - 3 * sp.cbrt(cand**2))
print(f"y = {cand}: residual {residual} (check at x=2: {residual.subs(x, 2)})")Eq(y(x), -2/(x**2 - 2))
blows up where the denominator is 0: [-sqrt(2), sqrt(2)]
y = 0: residual 0 (check at x=2: 0)
y = x**3: residual 0 (check at x=2: 0)
SymPy prints , which is . Declaring real lets SymPy simplify to , so both residuals vanish. The first solution exists only on : a perfectly smooth equation can drive its solution to infinity in finite . Solutions of nonlinear equations live on intervals you have to find, not on all of .
Mixing problems
A tank holds 200 L of brine with 30 kg of dissolved salt. Brine with 0.05 kg/L flows in at 4 L/min, and the well-stirred mixture flows out at the same rate. If is the salt in kg:
The salt decays toward the equilibrium 10 kg, the amount a tank full of inflow brine holds. A numerical solver agrees:
import math
from scipy.integrate import solve_ivp
sol = solve_ivp(lambda t, S: [0.2 - S[0] / 50], (0, 120), [30.0],
t_eval=[0, 30, 60, 120], rtol=1e-10, atol=1e-12)
for t, S in zip(sol.t, sol.y[0]):
exact = 10 + 20 * math.exp(-t / 50)
print(f"t = {t:5.0f} min numeric {S:.6f} exact {exact:.6f}")t = 0 min numeric 30.000000 exact 30.000000
t = 30 min numeric 20.976233 exact 20.976233
t = 60 min numeric 16.023884 exact 16.023884
t = 120 min numeric 11.814359 exact 11.814359
Orthogonal trajectories
Curves that meet every member of a family at right angles are its orthogonal trajectories. For the parabolas , eliminate : . Orthogonal slopes are negative reciprocals, so the trajectories solve , which is separable:
a family of ellipses. Electric field lines and equipotentials, or heat flow lines and isotherms, are pairs like this.
import numpy as np
import matplotlib.pyplot as plt
xs = np.linspace(-2, 2, 400)
plt.figure(figsize=(5, 5))
for k in (-2, -1, -0.5, 0.5, 1, 2):
plt.plot(xs, k * xs**2, color="tab:blue", lw=1)
t = np.linspace(0, 2 * np.pi, 400)
for C in (0.25, 0.75, 1.5, 2.5):
plt.plot(np.sqrt(2 * C) * np.cos(t), np.sqrt(C) * np.sin(t), color="tab:orange", lw=1)
plt.xlim(-2, 2); plt.ylim(-2, 2); plt.gca().set_aspect("equal")
plt.title("y = kx² (blue) and y² + x²/2 = C (orange)")
plt.show()
print("plotted 6 parabolas and 4 orthogonal ellipses")plotted 6 parabolas and 4 orthogonal ellipses
In software
- Closed forms as test oracles: when you write an ODE integrator (see Integrators), separable equations with known solutions such as are the cheapest unit tests for its accuracy.
- Blow-up detection: shows why numerical solvers need step-size control and overflow checks; solve_ivp reports failure instead of returning garbage when a solution escapes to infinity.
- Cooling and decay: thermal models of CPUs, cache-entry decay scores and "half-life" ranking formulas (e.g. hot-post scores) are all solutions of .
Exercises
Exercise 1: A trigonometric factor
Solve with .
Answer
Solution
( is the equilibrium that the division by set aside; it does not meet the initial condition.)
Exercise 2: Choosing the branch
Solve with .
Answer
, valid for all .
Solution
Both satisfy the implicit equation; the initial value is negative, so the solution is the negative branch.
Exercise 3: Newton's law of cooling
Coffee at 90 °C sits in a 20 °C room and is 70 °C after 5 minutes. With , find and the time at which the coffee reaches 40 °C.
Answer
per minute; 40 °C after about minutes.
Solution
import math
k = math.log(7 / 5) / 5
t = math.log(3.5) / k
print(f"k = {k:.5f}, t = {t:.2f} min")k = 0.06729, t = 18.62 min
Exercise 4: Where does it blow up?
Solve with , find the largest interval around 0 on which the solution exists, and confirm with SymPy.
Answer
, which exists on .
Solution
The denominator vanishes at , and the solution through cannot cross those points.
import sympy as sp
x = sp.symbols("x")
y = sp.Function("y")
sol = sp.dsolve(sp.Eq(y(x).diff(x), x * y(x)**2), y(x), ics={y(0): 2})
print(sp.simplify(sol.rhs), sp.solve(sp.denom(sp.together(sol.rhs)), x))-2/(x**2 - 1) [-1, 1]
Test yourself
Which equation is separable?
Separating by dividing by can lose which solutions?
- None
- Only
- and
- All solutions with
Why can have two solutions through ?
- Because is not continuous at , so the uniqueness theorem does not apply
- Because the equation is not separable
- Because sympy rounds
- Because the solution blows up