Differential Equations

Separation of Variables

Move y to one side, x to the other, integrate — the first ODE technique

For a first-order ODE of the form dy/dx = f(x) g(y), separation of variables rewrites it as dy/g(y) = f(x) dx and integrates both sides. It is the original solution technique, used by Leibniz in 1691 and still the first tool you reach for. The same idea generalises to partial differential equations under the ansatz u(x, t) = X(x) T(t) — reducing a PDE to a pair of ODEs and producing Fourier series.

  • Formdy/dx = f(x) g(y)
  • Separation stepdy/g(y) = f(x) dx
  • Integrate both sides∫ dy/g(y) = ∫ f(x) dx + C
  • Works iffF(x, y) factors as a product
  • PDE ansatzu(x, t) = X(x) T(t) → two ODEs in λ
  • Used inExponential growth, heat equation, Schrödinger, RC circuits

Watch the 60-second explainer

A condensed visual walkthrough — narrated, captioned, under a minute.

The recipe

Start with a first-order ODE

dy/dx = f(x) · g(y)

where the right-hand side factors into a function of x times a function of y. The factorisation is the entire pre-condition for the method — if F(x, y) cannot be written as a product, separation does not apply.

Step 1. Divide by g(y) (assuming g(y) ≠ 0) and multiply by dx:

dy / g(y) = f(x) dx

Step 2. Integrate both sides — left with respect to y, right with respect to x:

∫ dy / g(y) = ∫ f(x) dx + C

Step 3. Solve the resulting implicit equation for y, if you can. Sometimes you stop at the implicit form because no closed-form solution exists.

Step 4 (always). Check the roots of g(y) = 0. Each one gives a constant solution y = c that step 1's division silently dropped. Add them to the family.

Worked example — dy/dx = xy

The right side factors as x · y, so the equation is separable.

Step 1. Divide by y (assuming y ≠ 0) and multiply by dx:

dy / y = x dx

Step 2. Integrate:

ln |y| = x²/2 + C

Step 3. Solve for y. Exponentiate both sides:

|y| = e^C · e^{x²/2}

Absorbing the sign and the eC factor into a single arbitrary constant C (now allowed to be any real number),

y = C · ex²/2.

Step 4. y = 0 was excluded when we divided. Substitute y = 0 into the original ODE: dy/dx = x · 0 = 0, and the constant y = 0 satisfies it. That solution corresponds to C = 0 in the family, so the formula already covers it. ✓

An initial condition y(0) = 1 determines C = 1, giving y = ex²/2. The solution grows much faster than the exponential ex — at x = 3, y is roughly e4.5 ≈ 90.

Worked example — exponential growth, dy/dx = ky

The canonical separable ODE. The right side factors as k · y. Separate: dy/y = k dx. Integrate: ln|y| = kx + C. Exponentiate: y = Cekx. Every doubling-time, half-life, RC-decay calculation reduces to this single template.

PDE separation: u(x, t) = X(x) T(t)

Consider the heat equation on a rod of length L with zero-temperature boundaries:

u_t = α² u_{xx},   u(0, t) = u(L, t) = 0

Ansatz. Look for solutions of the form u(x, t) = X(x) · T(t). Substituting:

X(x) T'(t) = α² X''(x) T(t)

Divide both sides by α² X(x) T(t):

T'(t) / (α² T(t)) = X''(x) / X(x)

The left side depends only on t, the right only on x. The only way two functions of independent variables can be equal everywhere is if both equal the same constant — call it −λ. We now have two ODEs:

T'(t) = −λ α² T(t), X''(x) = −λ X(x)

The X equation with boundary conditions X(0) = X(L) = 0 is an eigenvalue problem; its non-trivial solutions are Xn(x) = sin(nπx/L) with eigenvalues λn = (nπ/L)². The matching Tn(t) = exp(−α² λn t). Superposing:

u(x, t) = Σ b_n sin(nπx/L) exp(−α² (nπ/L)² t)

The coefficients bn are determined by the initial profile u(x, 0) via Fourier sine series. This is exactly how Joseph Fourier solved the heat equation in 1822 — separation of variables was the technique, the Fourier series was the by-product.

Variants and extensions

  • Implicit separable. Some equations require a substitution first. dy/dx = y/x is separable in v = y/x but not in (x, y).
  • Bernoulli equation. y' + p(x) y = q(x) yn becomes linear under u = y1−n. The logistic dy/dt = ry(1 − y/K) is the famous instance — also separable directly, via partial fractions.
  • Homogeneous of degree 0. dy/dx = F(y/x) becomes separable in v = y/x.
  • Separation in cylindrical / spherical coordinates. Laplace's equation Δu = 0 separates in 11 coordinate systems (proved by Eisenhart in 1934), each producing a different family of special functions.
  • Hamilton–Jacobi separability. Classical-mechanics separation of variables yields conserved quantities; this is the basis of action-angle variables and integrable systems.

Separable vs other first-order techniques

TypeFormRecipeNotes
Separabley' = f(x) g(y)dy/g(y) = f(x) dx, integrate both sidesWorks iff right side factors
Lineary' + p(x) y = q(x)Multiply by μ = e∫p dxAlways solvable in closed-form modulo integrals
ExactM dx + N dy = 0 with My = NxFind potential F with Fx = M, Fy = NNeeds the exactness test first
Bernoulliy' + py = qynSubstitute u = y1−n; reduces to linearn ≠ 0, 1
Homogeneous (degree 0)y' = F(y/x)v = y/x; reduces to separableThe substitution always works
Riccatiy' = p + qy + ry²If y₁ known, y = y₁ + 1/u → linearGenerally no closed form

Common pitfalls

  • Forgetting absolute values when integrating dy/y. ∫ dy/y = ln|y|, not ln(y). The absolute value matters whenever y can be negative.
  • Dropping equilibrium solutions. Dividing by g(y) assumes g(y) ≠ 0. Each root g(c) = 0 gives a constant solution y = c that you must add to the family — sometimes those are the only solutions on certain initial conditions.
  • Skipping the factorisation check. dy/dx = x + y is not separable. Attempting to separate gives nonsense. Always verify the right-hand side factors before applying the recipe.
  • Treating dy/dx as a true ratio. It isn't a fraction; it is a derivative notation. The heuristic dy/g(y) = f(x) dx is justified by the chain rule (substitution u = y(x)), not by dividing differentials.
  • Forgetting the constant of integration. ∫ dy/g(y) = ∫ f(x) dx + C. Drop the +C and you lose a one-parameter family of solutions.
  • Misreading PDE separation as universally applicable. The ansatz u(x, t) = X(x)T(t) succeeds only for certain linear PDEs in certain coordinate systems. Nonlinear PDEs (Navier–Stokes, Burgers) almost never separate.

Frequently asked questions

When can I use separation of variables?

On a first-order ODE dy/dx = F(x, y), exactly when F factors as f(x) · g(y). Without that product structure, separation fails.

Why is dy/dx = xy separable?

The right side already factors as x · y. Move y to one side, x to the other: dy/y = x dx. Integrate: ln|y| = x²/2 + C. Exponentiate: y = C ex²/2.

Is the dy/dx fraction manipulation rigorous?

Yes — the chain rule supplies the rigour. From dy/dx = f(x) g(y), divide by g(y), integrate with respect to x, and substitute u = y(x) on the left. The result is ∫ du/g(u) = ∫ f(x) dx + C — which the heuristic notation encodes.

Can separation lose solutions?

Yes. Dividing by g(y) assumes g(y) ≠ 0. Each root y = c with g(c) = 0 is an equilibrium solution that you must check separately.

How does separation work for PDEs?

Assume u(x, t) = X(x) T(t). Substitute, rearrange so one side depends only on x and the other only on t. Both sides must equal the same constant −λ. You get two ODEs and an eigenvalue problem.

What is the connection to Fourier series?

Separation of variables on the heat equation produces the eigenvalue problem X'' = −λX with X(0) = X(L) = 0. The eigenfunctions are sin(nπx/L); superposing them with appropriate coefficients is exactly the Fourier sine series.

Are all PDEs solvable by separation?

No. Separation succeeds for certain linear PDEs in certain coordinate systems (Cartesian, polar, spherical, cylindrical). Nonlinear PDEs like Navier–Stokes typically do not separate.