Separation of Variables

Integration runs differentiation backward for a plain function. Separation of variables does the same job for a differential equation: given a relation between an unknown function and its own derivative, it recovers the function itself in closed form. It is the most basic technique for solving a first-order ordinary differential equation, as opposed to guessing a solution and checking it by substitution.

It does not work on every ODE — only on those with a particular shape. This page describes that shape, the procedure, and two worked examples drawn from population modeling.

What makes an ODE separable

A first-order ODE is separable if its right-hand side can be written as a product of two factors — one in which only the independent variable appears, and one in which only the unknown function appears:

dydx=g(x)h(y).\frac{dy}{dx} = g(x)\, h(y).

Each factor may be written using only its own variable: xx inside gg, yy inside hh.

This factoring is the whole condition the method needs: it is exactly what lets the xx-symbols and the yy-symbols be sorted onto opposite sides of the equation. A few quick tests:

  • dydx=xy\dfrac{dy}{dx} = x y is separable: g(x)=xg(x) = x, h(y)=yh(y) = y. Both variables appear, but they multiply, so they pull apart cleanly.
  • dydx=y\dfrac{dy}{dx} = y is separable: g(x)=1g(x) = 1 (the independent variable isn’t typed in at all) and h(y)=yh(y) = y.
  • dydx=x+y\dfrac{dy}{dx} = x + y is not separable: the right-hand side is a sum, and there is no way to rewrite x+yx + y as one xx-only factor times one yy-only factor.

The method

Once an equation is in separable form, the solution comes in three moves: separate, integrate, solve.

To solve a separable ODE dydx=g(x)h(y)\dfrac{dy}{dx} = g(x)\, h(y):

  1. Separate. Divide by h(y)h(y) and multiply by dxdx, collecting each variable on its own side:
1h(y)dy=g(x)dx.\frac{1}{h(y)}\, dy = g(x)\, dx.
  1. Integrate both sides, each against its own variable:
1h(y)dy=g(x)dx.\int \frac{1}{h(y)}\, dy = \int g(x)\, dx.

A single constant of integration CC on the right absorbs the constants from both integrals.

  1. Solve the resulting algebraic relation for yy, then fix CC using the initial condition.
Why splitting dydy and dxdx is legitimate

Treating dydy and dxdx as quantities to be shuffled across an equation is informal shorthand; the move is justified by the substitution rule for integrals (reversing the chain rule), reading yy as a function of xx throughout. Start from the separated equation with both sides still functions of xx, and integrate against xx:

1h(y)dydxdx=g(x)dx.\int \frac{1}{h(y)}\, \frac{dy}{dx}\, dx = \int g(x)\, dx.

The left-hand side is exactly the pattern the substitution rule collapses: with y=y(x)y = y(x), the factor dydxdx\frac{dy}{dx}\, dx becomes dydy, and the integral turns into 1h(y)dy\int \frac{1}{h(y)}\, dy. So the ”dydy on one side, dxdx on the other” picture is not an abuse of notation but a faithful record of a substitution.

The one division to watch. Step 1 divides by h(y)h(y), which is only valid where h(y)0h(y) \neq 0. Any value yy^\ast with h(y)=0h(y^\ast) = 0 gives a constant solution y(x)yy(x) \equiv y^\ast — the derivative is zero and the right-hand side is zero, so the equation holds — and dividing it away can drop it from the family the method produces. Check these equilibrium values separately. In the examples below each one is quietly recovered by the final formula, but that is luck worth verifying, not a rule.

Worked example: the Malthus equation

The Malthus model of population growth gives the cleanest possible case. Its population p(t)p(t) satisfies

p˙(t)=λp(t),\dot p(t) = \lambda\, p(t),

with growth rate λ\lambda and initial condition p(0)=p0p(0) = p_0.

Fitting it to the general shape. Line the equation up against dydx=g(x)h(y)\frac{dy}{dx} = g(x)\, h(y) and rename. The independent variable xx is the time tt. The unknown function yy is the population, which we call pp, not p(t)p(t): the letter pp names the function we are solving for, while p(t)p(t) is the single number that function returns at one instant. The slot yy fills in the general form is the whole function, so yy becomes pp. With both renamings the general shape reads

dpdt=g(t)h(p),\frac{dp}{dt} = g(t)\, h(p),

and our equation p˙=λp\dot p = \lambda p matches it with g(t)=λg(t) = \lambda and h(p)=ph(p) = p. The split is forced: the right-hand side λp\lambda p must break into a factor written with tt alone and a factor written with pp alone. The constant λ\lambda carries no tt and no pp, so it becomes the tt-factor g(t)=λg(t) = \lambda; the leftover pp is the pp-factor, already as simple as possible, so hh is just the rule “return what you are handed,” i.e. h(p)=ph(p) = p. That is why h(p)=ph(p) = p is enough: nothing further has to be done to pp.

Why the tt hidden inside p(t)p(t) is not a problem. Writing h(p)=ph(p) = p can look as if it forgets that pp secretly depends on tt. It does not. hh is a rule applied to a number: hand it any value and it gives that value straight back. While the equation runs, the value handed in is the current population p(t)p(t), so applying the rule gives h(p(t))=p(t)h\big(p(t)\big) = p(t). Spelled out in full, the equation is

p˙(t)=g(t)h(p(t))=λp(t),\dot p(t) = g(t)\, h\big(p(t)\big) = \lambda\, p(t),

which is just p˙=λp\dot p = \lambda p written out. So dpdt=g(t)h(p)\dfrac{dp}{dt} = g(t)\, h(p) and dp(t)dt=g(t)h(p(t))\dfrac{dp(t)}{dt} = g(t)\, h\big(p(t)\big) are the same equation: the short form defines the rule hh, the long form applies it at time tt. (This is the same one-letter-for-both convention introduced with the ordinary differential equation, where pp does double duty for the function and for its value.) The tt buried inside p(t)p(t) is no obstacle, because hh never inspects where its input came from — it only uses the input’s value. Separability asks only that the rule gg mention no pp and the rule hh mention no tt, and both hold here.

With the pieces named, run the three steps.

Separate, assuming p0p \neq 0:

1pdp=λdt.\frac{1}{p}\, dp = \lambda\, dt.

Integrate both sides. The left is the logarithm; the right is linear in tt:

lnp=λt+C.\ln|p| = \lambda t + C.

Solve for pp. Exponentiating both sides,

p=eλt+C=eCeλt,|p| = e^{\lambda t + C} = e^{C}\, e^{\lambda t},

so p(t)=Aeλtp(t) = A\, e^{\lambda t}, where A=±eCA = \pm e^{C} is an arbitrary nonzero constant rolling the sign and the eCe^{C} together. The initial condition pins it down: at t=0t = 0,

p0=Ae0=A,p_0 = A\, e^{0} = A,

so A=p0A = p_0, and the solution is the exponential

p(t)=p0eλt.p(t) = p_0\, e^{\lambda t}.

The division by pp assumed p0p \neq 0, which set aside the constant solution p(t)0p(t) \equiv 0 — the extinct population, the lone zero of h(p)=ph(p) = p. That solution is not lost after all: it is the p0=0p_0 = 0 case of the formula, which gives A=0A = 0 and p(t)0p(t) \equiv 0. So p(t)=p0eλtp(t) = p_0\, e^{\lambda t} holds for every starting population.

Worked example: the saturation equation

The Verhulst saturation model is barely harder. Its population satisfies

p˙(t)=m(p(t)K),\dot p(t) = -m\,\big(p(t) - K\big),

with response rate m>0m > 0, carrying capacity KK, and initial condition p(0)=p0p(0) = p_0. It is separable with g(t)=mg(t) = -m and h(p)=pKh(p) = p - K.

Separate, assuming pKp \neq K:

1pKdp=mdt.\frac{1}{p - K}\, dp = -m\, dt.

Integrate. The left-hand side is again a logarithm, since ddplnpK=1pK\frac{d}{dp}\ln|p - K| = \frac{1}{p - K}:

lnpK=mt+C.\ln|p - K| = -m t + C.

Solve for pp. Exponentiating gives pK=Aemtp - K = A\, e^{-m t} with A=±eCA = \pm e^{C}, so

p(t)=K+Aemt.p(t) = K + A\, e^{-m t}.

The initial condition at t=0t = 0 reads p0=K+Ap_0 = K + A, hence A=p0KA = p_0 - K, and the solution is

p(t)=K+(p0K)emt.p(t) = K + (p_0 - K)\, e^{-m t}.

The dropped value this time is pKp \equiv K, the population sitting exactly at carrying capacity. It returns as the p0=Kp_0 = K case, where A=0A = 0 and p(t)Kp(t) \equiv K holds for all time.

The saturation model can also be solved without separation, by the change of variable u(t)=p(t)Ku(t) = p(t) - K that turns it into the Malthus equation for the gap uu. Separation reaches the same closed form directly, without the substitution — two routes to one answer.

When separation isn’t enough

Separation handles a first-order ODE only when the right-hand side factors as g(x)h(y)g(x)\, h(y), and even then only when both resulting integrals can be carried out. Two limits show up immediately in population modeling.

The logistic growth model, with p˙=apbp2=(abp)p\dot p = a\, p - b\, p^2 = (a - b\, p)\, p, is separable: the right-hand side is a product g(t)=1g(t) = 1 times h(p)=(abp)ph(p) = (a - b\, p)\, p. But the integral 1(abp)pdp\int \frac{1}{(a - b\, p)\, p}\, dp is not one of the standard antiderivatives. Evaluating it needs partial-fraction decomposition — splitting the single fraction into 1p\frac{1}{p} and 1abp\frac{1}{a - b\, p} pieces, each a logarithm — which is a separate technique layered on top of separation.

Systems of coupled ODEs, such as the two-species predator–prey models, are a harder break: there the rate of each population depends on both populations at once, so no single equation can be separated into one-variable pieces. Such systems are studied through their equilibria and stability rather than solved in closed form.