# Is it mathematically valid to separate variables in a differential equation? [duplicate]

I read the following statement in a book on Calculus, as part of my mathematics course:

Technically this separation of $\frac{dy}{dx}$ is not mathematically valid. However, the resulting integration leads to correct answer.

The book also contains the following:

To solve a differential equation by separation of variables:

• get all the $x$ values on one side and all the $y$ values on the other side by multiplication and division.
• separate $\frac{dy}{dx}$ as if it were a fraction.
• integrate both sides.

Note: This box doesn't refer to a particular problem. It refers to a class of problems of differential equations which can be solved using the Method of Separation of Variables.

My high school mathematics teacher told me that this is the most fundamental way to solve differential equations but the textbook says it is not mathematically valid. I am not able to understand why are certain methods being followed without having a mathematical proof. Or am I wrong?

## marked as duplicate by Hans Lundmark, Claude Leibovici calculus StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Feb 14 '17 at 9:30

• This post does not contain enough information. – Jas Ter Apr 26 '15 at 9:32
• @NemisL. What information can provide you further context? Name of the book? – Devarsh Ruparelia Apr 26 '15 at 9:33
• Quote what the book is referring to by the word "this". – John Bentin Apr 26 '15 at 9:36
• It is not clear what kind of technique is referred to: "this separation" -- what separation? The quoted statement is without context. – Jas Ter Apr 26 '15 at 9:36
• @NemisL. I think the question contains more then enough information if you are familiar with how calculus is taught in the US. If you are used to a rigorous approach to mathematical analysis it might make less sense. – DRF Apr 26 '15 at 10:00

The problem with this form of separation of variables (I say "this form" because "separation of variables" can refer to multiple things) is that treating the derivative $dy/dx$ as a ratio is a purely formal algebraic manipulation. There is a way to arrive at the same results in a rigorous fashion, but textbooks often don't address this.

To elaborate, separation of variables in ODEs most commonly refers to a method of solving the ODE $$\frac{dy}{dx} = g(x)h(y)$$ for the unknown function $y(x)$. Introductory textbooks often tell you to split the "fraction" $dy/dx"$ and unite common variables, like so: $$\frac{dy}{h(y)} = g(x)dx$$ and then integrate both sides, as long as $h(y)\neq 0$, to obtain $$H(y(x)) = \int g(x)~dx + C,$$ where $H(y)$ is an antiderivative of $\frac{1}{h(y)}$.

Unfortunately "$dy$" and "$dx$" have no actual mathematical meaning in this context, so all we've done is pull a little algebraic trick without understanding why it works. To resolve this, we rearrange: $$\frac{1}{h(y)}\frac{dy}{dx} = g(x).$$ Integrating in $x$, $$\int \frac{1}{h(y(x))}\frac{dy}{dx}(x)~dx = \int g(x)~dx + C.$$ Now if $H(y)$ is an antiderivative of $1/h(y)$, then by the chain rule $$\frac{d}{dx}H(y(x)) = \frac{1}{h(y(x))}\frac{dy}{dx}(x)$$ so the left-hand integral is $$\int \frac{1}{h(y(x))}\frac{dy}{dx}(x)~dx = \int \frac{d}{dx}H(y(x))~dx = H(y(x))$$ leading us to our desired conclusion, $$H(y(x)) = \int g(x)~dx + C.$$

Doing it this way gives a rigorous justification of the result, but frankly the abuse of notation with the symbolic approach is much easier for most to memorize, so it is often the way it is taught to students. However, I think not explaining why the abuse of notation works confuses many students, both about the method and about their already flimsy understanding of the derivative.

• This is really nice explanation. – Devarsh Ruparelia Apr 26 '15 at 9:58
• +1 Thank you alot for sharing this simple explanation. Up until your post I only saw pages of explanations which were hard to follow :D. – MrYouMath Sep 29 '16 at 12:05
• So this proves that the "trick" of moving around the $dy$ and $dx$ works for the equation $\frac{dy}{dx}=g(x)h(y)$. I wonder though: does moving around $dy$ and $dx$ give you the right answer in general? or only in that particular equation. E.g. do we get the right answers if we apply something similar to complicated PDE's? – user56834 Sep 29 '16 at 14:24
• @Programmer2134 Separation of variables is definitely the standard approach to solving some PDEs (particularly the Laplace and Heat equations), particularly in physics. My introduction to PDE class in the math department has also used this technique though. In PDE, if for instance we want to solve for $u(x,y)$ given a PDE in $u$, we attempt to write $u(x,y)=f(x)g(y)$ and solve the PDE using this form (this often allows you to convert the pde into a system of ODEs). I unfortunately do not recall when this is a reasonable assumption (might have to do with linearity). – helloworld112358 May 17 '17 at 18:40

You are misunderstanding what they mean by not mathematically valid in this situation. It has little to do with whether or not there is a proof and more to do with some formalism.

When we write $\frac{dy}{dx}$ I'm sure you've heard already that this is not a fraction. In particular this is really saying to apply the differential operator $\frac{d}{dx}$ to the function $y$.

So when you perform separation of variables by transitioning from $\frac{dy}{dx}=g(x)h(y)$ to $\frac{dy}{h(y)}=g(x)dx$ we have done something that seems to be fundamentally incorrect we took the operator $\frac{d}{dx}$ and split it as if it was a fraction. This obviously makes no sense if we really think of $\frac{d}{dx}$ as an operator and moreover the $dx$ and $dy$ we end up with make no sense either as we don't even know what they should mean.

On the other hand the resulting integrals $\int\frac{1}{h(y)}dy=\int g(x)dx$ actually have a reasonable mathematical meaning and moreover assuming $g(x)$ and $h(y)$ aren't very awful you get the correct result.

Now the fact that the resulting integral equation gives you the correct result is absolutely provable, we just shouldn't have gotten to it the way we did. Instead the following approach is appropriate:

$$\frac{dy}{dx}=g(x)h(y)$$ then assuming $h(y)$ is not $0$. $$\frac{1}{h(y)}\frac{dy}{dx}=g(x)$$ Further assuming both sides are integrable we get $$\int\frac{1}{h(y)}\frac{dy}{dx}dx=\int g(x)dx$$ Now performing a substitution in the integral on the left we get $$\int\frac{1}{h(y)}dy=\int g(x)dx$$

Now even in this explanation I've cheated in a few places slightly but it's a reasonable first approximation to explaining why separation of variables is a correct method for solving differential equations.

Edit You can actually build mathematics in such a way that $dy$ and $dx$ do have a reasonable meaning on their own and that you can pretty much treat $\frac{dy}{dx}$ as a fraction. This is usually called non-standard mathematics and makes use of something called infinitesimals. It's not particularly easy to do though and you still end up having some issues.

• How did you perform the last substitution $\int\frac{1}{h(y)}dy=\int g(x)dx$ ? – Dor Apr 26 '15 at 9:47
• Makes sense but not completely. – Devarsh Ruparelia Apr 26 '15 at 9:50
• @dor that is just the standard substitution rule for integrals except with a tiny bit of abuse of notation. You have $\int f(g(x))g^\prime(x)dx=\int f(y)dy$ for $y=g(x)$. So really I should have said $u=y$ and $\int \frac{1}{h(y)}\frac{dy}{dx}dx=\int \frac{1}{h(u)}du$. – DRF Apr 26 '15 at 10:06
• What issues arise when dealing with infinitesimals? – bjb568 Apr 26 '15 at 16:29
• @bjb568 I must admit that my knowledge of the topic is cursory at best. Adding infinitesimals loses you a number of properties of the reals, like being archimedean and complete. In my mind though the biggest issues is that actually properly formalizing infinitesimals always seemed extremely hard and it seemed to me that while some things end up being easier for students they end up completely confused in the end because they miss a lot of the nuances of the theory they work in. That might just be my own problem since my understanding isn't good enough. – DRF Apr 26 '15 at 16:42