What am I doing when I separate the variables of a differential equation?

The basic justification is that integration by substitution works, which in turn is justified by the chain rule and the fundamental theorem of calculus.

More specifically, suppose you have: $$\frac{dy}{dx} = g(x) h(y)$$ Rewrite as: $$\frac{1}{h(y)} \frac{dy}{dx} = g(x)$$ Add the implicit dependency of $y$ on $x$ to obtain $$\frac{1}{h(y(x))} \frac{dy}{dx} = g(x)$$

Now, integrate both sides with respect to $x$: $$\int \frac{1}{h(y(x))} \frac{dy}{dx} \, dx = \int g(x) \, dx$$ If we do a variable substitution of $y$ for $x$ on the left-hand side (i.e., use the integration by substitution technique), we replace $\frac{dy}{dx} dx$ with $dy$. Thus we have $$\int \frac{1}{h(y)}\, dy = \int g(x) \, dx,$$ which is the separation of variables formula.

So if you believe integration by substitution, then separation of variables is valid.


"Separation of variables" in ODE (which has nothing to do with separation of variables in PDE) is a kind of magic that is easy to perform but difficult to justify.

Assume that in the given differential equation the quantities $x$ and $y$ are functions of a hidden variable $t$ (time). Then the equation $y\>y'=e^x$ is equivalent to $y(t){\dot y(t)\over \dot x(t)}\equiv e^{x(t)}$, resp. $$y(t)\dot y(t)\equiv e^{x(t)}\dot x(t).$$ Integrating this from $t=0$ to $t=T$ one gets $${1\over2}(y^2(T)-y_0^2)=e^{x(T)}-e^{x_0},$$ where $(x_0,y_0)$ is the initial condition and $T$ is arbitrary. This means: At any given time the quantities $x$ and $y$ are related by the equation $${1\over2}(y^2-y_0^2)=e^x-e^{x_0}.$$ Looking back, one can see that the relation between $x$ and $y$ obtained in this way is exactly the equation obtained by following the recipe given in the books.