Separable Equations
Picture salt dissolving into a stirred tank of water, or a skydiver's speed as air resistance
builds against gravity: in each you know the rule for how fast something changes, but
not yet a formula for the quantity itself. Recovering that formula means solving a differential
equation — and the ones you can crack most directly, by pulling the variables apart and
integrating each on its own, are the separable equations of this page.
Most differential equations are stubborn: the x's and
y's are tangled together and no amount of algebra pries them apart. But
every so often you get lucky, and a first-order ODE comes apart cleanly — the right-hand side
factors into a part depending only on x and a part depending only on
y:
\frac{dy}{dx} = g(x)\,h(y).
An equation of this shape is called separable. When it happens we can shepherd all
the y's to one side and all the x's to the
other, then
integrate
each side on its own — turning a differential equation into two ordinary integrals you already know
how to do. It is the most direct solution method in the whole subject, which is exactly why it
should be the first thing you check for when a new ODE lands on your desk: before reaching
for a more powerful (and more painful) technique, ask "does this separate?"
Treating \tfrac{dy}{dx} as a ratio of differentials — a manoeuvre
justified by the chain rule, as the theorem notes — the recipe is
\frac{dy}{h(y)} = g(x)\,dx \quad\Longrightarrow\quad \int \frac{dy}{h(y)} = \int g(x)\,dx.
The centrepiece: solving y' = ky
One separable equation governs an astonishing share of the natural world — populations,
radioactive decay, compound interest, cooling coffee. It is
\frac{dy}{dx} = ky,
"the rate of change is proportional to the amount present." Let us solve it from scratch, line by
line. Here g(x) = k (a constant) and h(y) = y.
Step 1 — separate the variables. Divide both sides by
y and multiply by dx, collecting each letter
on its own side:
\frac{dy}{y} = k\,dx.
Step 2 — integrate both sides. The left integral is a standard logarithm; the
right is the integral of a constant:
\int \frac{dy}{y} = \int k\,dx \quad\Longrightarrow\quad \ln|y| = kx + C_1.
Step 3 — exponentiate to free y. Apply
e^{(\cdot)} to both sides, and split the exponential of a sum:
|y| = e^{kx + C_1} = e^{C_1}\,e^{kx}.
Step 4 — absorb the constants. The factor
e^{C_1} is just some positive constant; dropping the absolute value lets
it carry a sign, and the case y \equiv 0 (lost when we divided by
y) is recovered by allowing the constant to be zero. Write the single
constant as C = \pm e^{C_1}:
\boxed{\,y = C\,e^{kx}\,.}
Step 5 — read off the meaning. Setting x = 0 gives
y(0) = C, so C is the initial amount. With
k > 0 this is exponential growth; with
k < 0, exponential decay. The proportional-rate law and
the exponential function are two faces of the same fact.
A second example, with an initial condition
Separable equations need not be linear. Solve the IVP
\frac{dy}{dx} = \frac{x}{y}, \qquad y(0) = 2.
Step 1 — separate. Here g(x) = x and
1/h(y) = 1/(1/y) = y, so bring the y across:
y\,dy = x\,dx.
Step 2 — integrate both sides.
\int y\,dy = \int x\,dx \quad\Longrightarrow\quad \frac{y^2}{2} = \frac{x^2}{2} + C_1.
Step 3 — tidy into an implicit relation. Multiply by 2 and rename the constant
C = 2C_1:
y^2 = x^2 + C.
Step 4 — apply the initial condition
y(0) = 2. Substitute x = 0, y = 2:
4 = 0 + C, so C = 4. Notice this step only
makes sense after both sides have already been integrated — the constant you're pinning
down is the one that appeared in Step 2, not some earlier placeholder.
Step 5 — solve for y. Take the root, choosing the
positive branch because y(0) = 2 > 0:
y = \sqrt{x^2 + 4}.
A quick check: y' = x/\sqrt{x^2+4} = x/y, and
y(0) = 2. Both the equation and the initial condition hold. ✓
If a first-order ODE has the form
\dfrac{dy}{dx} = g(x)\,h(y) with h(y) \ne 0,
then it is solved by separating and integrating:
\int \frac{dy}{h(y)} = \int g(x)\,dx + C.
This is legitimate because, by the chain rule, if H' = 1/h and
G' = g then \tfrac{d}{dx}H(y(x)) = \tfrac{1}{h(y)}y' = g(x)
= G'(x), so H(y) = G(x) + C. Two riders:
-
the special case \tfrac{dy}{dx} = ky has solution
y = Ce^{kx} — exponential growth (k>0) or
decay (k<0), with C = y(0);
-
any constant y \equiv y_* with h(y_*) = 0
is an equilibrium solution, lost in the division by
h(y) and must be reinstated.
Pure exponential growth y' = ky is a fantasy of unlimited resources —
left alone, the population reaches the moon. Reality imposes a ceiling, the
carrying capacity M, and the fix is the
logistic equation, still separable:
\frac{dy}{dx} = k\,y\left(1 - \frac{y}{M}\right).
When y is small the bracket is near 1 and
growth is nearly exponential; as y \to M the bracket
\to 0 and growth stalls. Separating and integrating (the
y-integral needs
partial fractions,
worked out in full below for the case M = 1) gives the S-shaped curve
y = \frac{M}{1 + A\,e^{-kx}}, \qquad A = \frac{M - y_0}{y_0}.
It rises exponentially, bends at the inflection point y = M/2, then
levels off at M — the model behind epidemics, technology adoption, and
bounded population growth alike. The constant solutions y \equiv 0 and
y \equiv M are the equilibria the theorem warned us to keep.
A third example: when separating leaves you with partial fractions
Separating is always the easy part; the integral it leaves behind is sometimes the hard part. Solve
\frac{dy}{dx} = y(1 - y), \qquad y(0) = \tfrac14,
the logistic equation with k = 1 and carrying capacity
M = 1.
Step 1 — separate. Here g(x) = 1 and
h(y) = y(1-y):
\frac{dy}{y(1-y)} = dx.
Step 2 — split the left side with partial fractions. Before integrating, rewrite
the awkward fraction as two simple ones:
\frac{1}{y(1-y)} = \frac{1}{y} + \frac{1}{1-y}.
(Check it: put the right side over the common denominator
y(1-y) and the numerator is
(1-y) + y = 1 — exactly the left side.)
Step 3 — integrate both sides. Each piece on the left is now a standard logarithm
(mind the sign on the second one, from the chain rule on 1-y):
\int\!\left(\frac{1}{y} + \frac{1}{1-y}\right) dy = \int dx \;\Longrightarrow\; \ln|y| - \ln|1-y| = x + C_1.
Step 4 — combine the logarithms and exponentiate.
\ln\left|\frac{y}{1-y}\right| = x + C_1 \;\Longrightarrow\; \frac{y}{1-y} = Ce^{x}.
Step 5 — solve for y. Cross-multiply and collect
y:
y = Ce^x(1-y) \;\Longrightarrow\; y(1 + Ce^x) = Ce^x \;\Longrightarrow\; y = \frac{Ce^x}{1+Ce^x}.
Step 6 — apply the initial condition y(0) = \tfrac14.
Substitute x = 0:
\frac14 = \frac{C}{1+C} \;\Longrightarrow\; 1 + C = 4C \;\Longrightarrow\; C = \tfrac13.
Step 7 — write the particular solution. Substituting
C = \tfrac13 and tidying (multiply top and bottom by 3):
y = \frac{e^x}{3 + e^x}.
This is exactly the S-shaped logistic curve promised earlier: it starts at
y(0) = \tfrac14, climbs, and creeps toward the ceiling
y \to 1 as x \to \infty — while the two
equilibrium solutions y \equiv 0 and y \equiv 1
sit patiently at the floor and ceiling, exactly where the theorem said the lost solutions would be.
Three habits separate a clean separable-equation solve from a broken one.
-
You only need one constant, not one per side. Integrating the left side produces
a constant and integrating the right side produces another, but they immediately combine into a
single unknown — write +C once, on whichever side is more convenient,
not +C_1 on the left and +C_2 on
the right.
-
Dividing by h(y) can silently delete solutions.
Whenever you separate dy/dx = g(x)h(y) by dividing through by
h(y), you are implicitly assuming h(y) \ne 0.
Every constant value y \equiv y_* with h(y_*) = 0
is a perfectly good solution that vanishes from the formula — always check for these
equilibrium solutions separately and list them alongside the general solution.
-
An initial condition can only pin down the constant after you integrate, not
before. There is no C to substitute into until both
\int dy/h(y) and \int g(x)\,dx have actually
been carried out — trying to apply y(x_0)=y_0 to the unintegrated
equation is a category error, like trying to cash a cheque before it's been signed.
The family y = Ce^{kx}, live
Below is the solution curve of y' = ky for sliders
k (the growth rate) and C = y(0) (the starting
amount). Push k positive for runaway growth, negative for decay toward the
axis; the faint reference curve is the unit exponential e^{x}. Each setting
is one member of the infinite family the general solution describes.
Pull the plug on a bathtub and the water rushes out fast at first, then dawdles at the very end —
the last inch seems to take forever. That's Torricelli's law: water escaping
through a hole at the bottom of a tank leaves at a speed proportional to
\sqrt{h}, the square root of the remaining height, which makes the
height itself obey the separable ODE
\frac{dh}{dt} = -k\sqrt{h}.
Separating gives dh/\sqrt{h} = -k\,dt, and integrating
(\int h^{-1/2}\,dh = 2\sqrt{h}) leads to
2\sqrt{h} = -kt + C, so
h(t) = \left(\sqrt{h_0} - \frac{k}{2}t\right)^{2}, \qquad 0 \le t \le \frac{2\sqrt{h_0}}{k}.
Because the height is squared, it doesn't fall in a straight line or a clean exponential —
it decelerates, tracing a downward-curving parabola in time until it politely touches zero and
stays there (the formula is only valid up to that moment; the tank doesn't go negative). Galileo
himself experimented with draining vessels centuries before calculus existed to explain why.
See it explained