# Solving Differential Equations: The Variable Separation Technique

In this post, we look at the technique of separating variables to solve first-order differential equations of single variable functions - very common in standard Mathematics courses of Pre-U curriculums. The technique requires us to separate the so-called differentials along with each of its variables to their own side of the equation.

## A Case of Not Walking The Talk

Let's look at a sample problem for which we'll employ this technique.

Solve the following differential equation and state $$y$$ in terms of $$x$$.

$\frac{\mathrm{d}y}{\mathrm{d}x} = 2xy$

The solution:

Separating the differentials $$\mathrm{d}y$$, $$\mathrm{d}x$$ and the variables, we have:

$\frac{1}{y} \:\mathrm{d}y = 2x \: \mathrm{d}x$

Integrating both sides of the equation:

\begin{aligned} \int \; \frac{1}{y} \:\mathrm{d}y &= \int \; 2x \: \mathrm{d}x \\ \ln y &= x^2 + \mathrm{c} \\ y &= e^{x^2 + \mathrm{c}} \\ y &= e^{\mathrm{c}} e^{x^2} \\ y &= \mathrm{k} e^{x^2} \quad \blacksquare \end{aligned}

$$\dagger$$ where $$\mathrm{c, k }$$ are constants

Whilst the above solution is completely accepted in your standard school/public examinations, I have always been uncomfortable with the separation of the differentials - $$\mathrm{d}y$$ and $$\mathrm{d}x$$. Allow me to explain why.

The derivative $$\frac{\mathrm{d}y}{\mathrm{d}x}$$ is not a quotient or a fraction. It is not the same kind of thing as $$\frac{\Delta y}{\Delta x}$$ or $$\frac{\delta y}{\delta x}$$, for the terms $$\frac{\Delta y}{\Delta x}$$ and $$\frac{\delta y}{\delta x}$$ are actual quotients; $$\Delta y, \Delta x, \delta y$$ and $$\delta x$$ are each numerical values. On the other hand, $$\frac{\mathrm{d}y}{\mathrm{d}x}$$ is not decomposable since $$\mathrm{d}y$$ and $$\mathrm{d}x$$ are not numbers standing as a numerator and a denominator, respectively; we say the derivative $$\frac{\mathrm{d}y}{\mathrm{d}x}$$ is atomic - that which cannot be broken up further$$\ddagger$$. So, you can see why moving the differentials $$\mathrm{d}y$$ and $$\mathrm{d}x$$ around as if they're numbers, might be going against the grain to some folks.

$$\ddagger$$ Although these days we've already managed to even split the proton and neutron

No worries, for we will explore another train of thought that's coherent with the notion of what the derivative $$\frac{\mathrm{d}y}{\mathrm{d}x}$$ actually is.

## Another way of thinking

Suppose we have a function $$z = y^2$$ and with that, $$y$$ is dependent on $$x$$ - meaning $$y$$ is some function of $$x$$.

Using the Chain Rule for differentiation, we find $$\frac{\mathrm{d}z}{\mathrm{d}x}$$:

\begin{aligned} z &= y^2 \\ \tag{1} \frac{\mathrm{d}z}{\mathrm{d}x} &= \frac{\mathrm{d}z}{\mathrm{d}y} \cdot \frac{\mathrm{d}y}{\mathrm{d}x} \\ \frac{\mathrm{d}z}{\mathrm{d}x} &= 2y \frac{\mathrm{d}y}{\mathrm{d}x} \end{aligned}

We started with $$z$$ and ended up with $$\frac{\mathrm{d}z}{\mathrm{d}x}$$. So, should we wish to "get back" $$z$$, all we need to do is integrate $$\frac{\mathrm{d}z}{\mathrm{d}x}$$ with respect to $$x$$ because that's the way we "undo" the differention we performed. Integrating both sides of the last equation with respect to $$x$$:

\begin{aligned} \frac{\mathrm{d}z}{\mathrm{d}x} &= 2y \cdot \frac{\mathrm{d}y}{\mathrm{d}x} \\ {\color{blue}\int\: \bigg(}\frac{\mathrm{d}z}{\mathrm{d}x}{\color{blue}\bigg)\: dx} &= {\color{blue}\int \: \bigg(}2y \frac{\mathrm{d}y}{\mathrm{d}x} {\color{blue}\bigg) \: dx} \\ z &= y^2 {\color{gray} + \rm{c}} \end{aligned}

$$\dagger$$ The constant $$\rm{c}$$ has to be included in the result since we integrated

Observe that $$\int\big(2y \frac{\mathrm{d}y}{\mathrm{d}x}\big) \: dx$$ had to give us $$y^2 {\color{gray} + \rm{c}}$$ because we just undid the differentiation.

The expression $$\int\big(2y \frac{\mathrm{d}y}{\mathrm{d}x}\big) \: dx$$ gave us $$y^2 {\color{gray} + \rm{c}}$$. Without any deeper thought, we obtained the expression $$y^2 + c$$ purely by viewing the integration process as an undoing of the differentiation.

Recall the steps of differentiation which led us to an expression in terms of $$y$$ (i.e. $$2y$$) multiplied with the term $$\frac{\mathrm{d}y}{\mathrm{d}x}$$. Because the term $$\frac{\mathrm{d}y}{\mathrm{d}x}$$ is present immediately as a multiplier after a function of $$y$$ due to the use of the chain-rule differentiating with respect to $$x$$, we are justified to think the term $$\frac{\mathrm{d}y}{\mathrm{d}x}$$ simply "rolls back in to its hole and vanishes" when we integrate with respect to $$x$$; further inspection reveals only the term $$2y$$ was integrated, and that too with respect to $$y$$, to yield $$y^2 +\mathrm{c}$$. No manipulation was done on the term $$\frac{\mathrm{d}y}{\mathrm{d}x}$$.

We are therefore permitted to think the actual integration in the above was done only on the function of $$y$$ with reference to $$y$$ alone. We can summarise the above reasoning mathematically:

\begin{aligned} \int \: 2y\frac{\mathrm{d}y}{\mathrm{d}x}\:\mathrm{d}x &= y^2 + \rm{c} \\ \int \: 2y\:\mathrm{d}y &= y^2 + \rm{c} \\ \therefore \quad \int \: 2y\frac{\mathrm{d}y}{\mathrm{d}x}\:\mathrm{d}x &= \int \: 2y\:\mathrm{d}y \end{aligned}

Generalizing our foregoing reasoning, we could replace $$2y$$ in the expression $$2y\frac{\mathrm{d}y}{\mathrm{d}x}$$, with any expression/function of $$y$$ as with $$f(y)$$ in $$f(y)\frac{\mathrm{d}y}{\mathrm{d}x}$$. It should be sensible, that even with any general expression of the form $$f(y) \frac{\mathrm{d}y}{\mathrm{d}x}$$, the following is true:

$\boxed{ \int \: f(y)\frac{\mathrm{d}y}{\mathrm{d}x}\:\mathrm{d}x = \int \: f(y)\:\mathrm{d}y } \tag{2}$

## Reworded Solution

Let's use our newly discovered knowledge to rework the solution of our sample problem:

\begin{aligned} \frac{\mathrm{d}y}{\mathrm{d}x} &= 2xy \\ \end{aligned} We separate only the variables: \begin{aligned} \frac{1}{y} \:\frac{\mathrm{d}y}{\mathrm{d}x} &= 2x \\ \end{aligned} Integrating both sides with respect to $$x$$: \begin{aligned} \int \bigg(\frac{1}{y} \frac{\mathrm{d}y}{\mathrm{d}x}\bigg)\; \mathrm{d}x&= \int (2x) \; \mathrm{d}x \\ \end{aligned} Exploiting the result in (2): \begin{aligned} \int \frac{1}{y}\;\mathrm{d}y &= \int 2x \; \mathrm{d}x \\ \ln y &= x^2 + c \\ y &= e^{x^2 + c} \\ y &= e^ce^{x^2} \\ y &= \mathrm{k} e^{x^2} \quad \blacksquare \end{aligned}

And there you have it - a solution reasoned out without separating $$\mathrm{d}y$$ and $$\mathrm{d}x$$.

## Going Formal

Here we look at a formal derivation of our previous result.

Consider a variable $$z$$, such that $$z = f(y)$$. According to the Chain-Rule:

$\frac{\mathrm{d}}{\mathrm{d}x} [{\color{blue}z}]= \frac{\mathrm{d}}{\mathrm{d}y} [{\color{blue}z}]\cdot \frac{\mathrm{d}y}{\mathrm{d}x} \\$

If we let $${\color{blue}z} = {\color{blue}\int f(y) \mathrm{d}y}$$:

\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}x} \bigg[{\color{blue} \int f(y) \: \mathrm{d}y}\bigg] &= \frac{\mathrm{d}}{\mathrm{d}y} \bigg[{\color{blue}\int f(y) \: \mathrm{d}y}\bigg] \cdot \frac{\mathrm{d}y}{\mathrm{d}x} \\ {\color{green}\frac{\mathrm{d}}{\mathrm{d}x} \bigg[\int f(y) \: \mathrm{d}y\bigg]} &= {\color{green}f(y) \cdot \frac{\mathrm{d}y}{\mathrm{d}x}} \\ \end{aligned}

Integrating both sides with respect to $$x$$:

\begin{aligned} {\color{red}\int}\;{\color{green}\frac{\mathrm{d}}{\mathrm{d}x} \bigg[\int f(y) \: \mathrm{d}y\bigg]} \;{\color{red}\mathrm{d}x} &= {\color{red}\int}\; {\color{green}f(y) \cdot \frac{\mathrm{d}y}{\mathrm{d}x}} \:{\color{red}\mathrm{d}x} \\ \int f(y) \: \mathrm{d}y &= \int f(y) \frac{\mathrm{d}y}{\mathrm{d}x} \: \mathrm{d}x \end{aligned}

$\therefore \quad \boxed{\int f(y) \frac{\mathrm{d}y}{\mathrm{d}x} \: \mathrm{d}x = \int f(y) \: \mathrm{d}y}$