Separable Differential Equation Calculator: How to Solve by Separation of Variables
About the Author

A separable differential equation calculator turns dy/dx = g(x)h(y) into an answer in three moves: divide by h(y), integrate both sides, solve for y. That’s the entire method. The interesting part isn’t the recipe — it’s the two things the recipe quietly destroys on the way past, and almost every lost mark on this topic traces back to one of them. What follows runs the mechanics once, fast, then spends the rest of its time on what the mechanics hide: the constant solutions that division deletes, and the interval where your formula is genuinely a solution rather than just an expression.
The Three Moves, Run Once Without Commentary
Take dy/dx = 6x²y with y(0) = 5. Everything with x already sits on one side of the product and everything with y on the other, which is exactly what “separable” means.
dy/y = 6x² dx
∫ dy/y = ∫ 6x² dx
ln|y| = 2x³ + C
y = A e^(2x³), where A = ±e^C
y(0) = 5 → A = 5 → y = 5e^(2x³)
Check it: differentiate 5e^(2x³) and you get 5e^(2x³)·6x², which is 6x²y. Four lines, done. Two details in there matter more than they look. The constant appeared on the right side only — putting C₁ on the left and C₂ on the right just means subtracting them later, so skip it. And C moved inside the exponential and became a multiplier A rather than staying an addend. That transformation is where the constant most often gets dropped entirely.
The calculator above runs these same steps and prints all five lines for whatever g and h you pick. It also does something a hand solution can’t be bothered to: it re-integrates your original equation numerically with fourth-order Runge–Kutta and compares the two answers. Agreement to eight digits means the antiderivatives are right. Disagreement means something in the algebra isn’t. It’s substitution-back-in, automated.
Why C Has to Go In Before You Solve for y
Here’s the most expensive habit in this topic: integrate both sides, solve for y, and then tack on + C at the end. Watch what it costs on dy/dx = 2xy.
| Step | Correct: C early | Wrong: C late |
|---|---|---|
| Integrate | ln|y| = x² + C | ln|y| = x² |
| Exponentiate | y = e^(x²)·e^C | y = e^(x²) |
| Bring in the constant | y = A e^(x²) | y = e^(x²) + C |
| Does it satisfy y′ = 2xy? | Yes, for every A | Only when C = 0 |
The late-C version gives y′ = 2x e^(x²) while 2xy = 2x e^(x²) + 2xC. Those agree only if C = 0, so a one-parameter family of solutions has collapsed into a single curve — and the initial condition y(0) = 7 now has no solution at all in your “general” form. The rule that prevents this is purely mechanical: write + C the instant you finish integrating, before any exponentiating, squaring, or reciprocating, then let the algebra carry it wherever it goes. It becomes a multiplier under an exponential, it lands inside a square root, it ends up in the denominator of a logistic fraction. All of those are fine. Bolting it on at the end is not.
The Solutions That Vanish the Moment You Divide
Move one of the method divides by h(y). Division by zero is illegal, so every root of h(y) is excluded from the general solution — and every root of h(y) is itself a perfectly good solution, because if h(y₀) = 0 then dy/dx = 0 and y never moves again.
Logistic growth makes the stakes obvious. For dP/dt = 0.8P(1 − P/1000), separation gives P = 1000/(1 + Ae^(−0.8t)). No value of A produces P = 0, and none produces P = 1000. Yet both are solutions: an empty habitat stays empty, and a population sitting exactly at carrying capacity stays there. Those two equilibria are the entire qualitative story of the model — the floor everything grows away from, the ceiling everything approaches — and the standard formula contains neither one. Run the “Logistic to 1000” preset above and the calculator lists both in its lost-solutions panel; enter y₀ = 1000 and it tells you outright that you’re sitting on the constant branch.
The fix is cheap. Before dividing, set h(y) = 0, solve, and write those y-values down as additional solutions. Ten seconds of work, frequently a mark of its own on an exam, and in applied work it’s the difference between a model that has a steady state and one that appears not to. If you’d rather see the equilibrium structure without solving anything, stepping forward from several starting values in a Euler’s method calculator shows the curves flattening out at precisely those y-values.
Your Formula Is Only a Solution on One Interval
Solve dy/dx = y² with y(0) = 1. Separating gives −1/y = x + C, so C = −1 and y = 1/(1 − x). Nothing about y′ = y² hints at trouble — the right side is a polynomial, smooth everywhere, defined for every real y. But the solution blows up at x = 1. It exists on (−∞, 1) and nowhere beyond, and the branch of 1/(1 − x) living to the right of x = 1 is a different function that never connects back to your initial condition.
This is finite-time blow-up, and it’s a nonlinear phenomenon that linear equations simply don’t exhibit. Four equations, all starting at y(0) = 1:
| Equation | Solution | Interval of existence |
|---|---|---|
| y′ = y | e^x | All real x |
| y′ = y² | 1/(1 − x) | (−∞, 1) |
| y′ = y³ | 1/√(1 − 2x) | (−∞, 0.5) |
| y′ = 1 + y² | tan(x + π/4) | (−3π/4, π/4) |
The pattern is clean: the faster h(y) grows, the sooner the curve escapes. Squaring buys you until x = 1; cubing halves that to x = 0.5. Three rules fix the interval in general. It must contain x₀. It must be a single interval, not a union of pieces. And the solution has to stay finite and stay inside the domain of h across all of it. The calculator finds the edges numerically, by walking outward from x₀ until the closed form stops returning a finite value, and it refuses to quote y at a target x outside that range rather than printing a confident wrong number. If you want to see the antiderivatives on their own, the integral calculator handles either side, and a general differential equation calculator is the place to start when you’re not yet sure which method the equation wants.
Separable or Not? A Thirty-Second Test
Separable means dy/dx factors into a function of x alone times a function of y alone. The test is blunt: try to write the right-hand side as a product with no mixed terms. If a sum survives that refuses to factor, it isn’t separable and you need a different method.
| Equation | Separable? | Why |
|---|---|---|
| y′ = xy + x | Yes | Factors as x(y + 1) |
| y′ = x + y | No | A sum that won’t factor — use an integrating factor |
| y′ = e^(x+y) | Yes | e^x·e^y — exponent rules do the factoring |
| y′ = (x + y)² | No | The cross term 2xy blocks it — substitute u = x + y |
| y′ = y sin(x)/(1 + y) | Yes | sin(x)·[y/(1 + y)] — ugly h(y), still a product |
The e^(x+y) row is the one people miss. A sum inside an exponential looks unseparable, but e^(x+y) = e^x·e^y and the equation separates fine. Whenever you see a sum in an exponent, or terms sharing a common factor, spend a moment factoring before reaching for something heavier. Equations that are linear but not separable, like y′ = x + y, belong to a first-order differential equation calculator using an integrating factor instead.
When You Can’t Solve for y — and Shouldn’t Try
Separation always lands you at Φ(y) = G(x) + C. Getting from there to y = something requires inverting Φ, and plenty of ordinary-looking Φ have no elementary inverse. Take dy/dx = x/(y + e^y). Separating gives y²/2 + e^y = x²/2 + C, and no amount of algebra isolates y — not because the problem is hard, but because the inverse function doesn’t exist in closed form. That implicit relation is the answer, and it’s complete.
Implicit form stays fully usable. Differentiate it implicitly and you recover the original equation, which verifies it. Plug in the initial condition and you get C exactly. Solve numerically and you get y at any specific x you care about. The one thing you can’t do is write y = …, and inventing a formula to scratch that itch is how wrong answers get produced. When a problem says “find the general solution” without demanding explicit form, an implicit relation earns full marks. When it does say “solve for y” and you can’t, suspect an algebra slip earlier — a mistake in h(y) often turns an invertible Φ into a non-invertible one.
One more wrinkle: even when you can solve for y, you often get ±. From y²/2 = x²/2 + C comes y = ±√(x² + 2C), and the initial condition picks the branch. If y(0) = 3 you take the positive root and keep it for every x, because a solution cannot jump branches — it would have to pass through y = 0, where dy/dx is undefined for this equation. The calculator handles that by carrying the sign of y₀ through every evaluation instead of defaulting to the principal root, which is why the “y′ = x/y” preset with a negative y₀ returns the lower branch rather than silently flipping to the upper one.
Four Models You’ll Solve Again and Again With a Separable Differential Equation Calculator
Most separable equations that turn up outside a textbook are one of a small handful of shapes. Recognising the shape tells you the answer before you integrate anything.
| Model | Equation | Solution | Behaviour |
|---|---|---|---|
| Exponential growth or decay | y′ = ky | y₀e^(kt) | Unbounded, or decays toward 0 |
| Newton’s cooling | y′ = k(M − y) | M − (M − y₀)e^(−kt) | Approaches M, never reaches it |
| Logistic growth | y′ = ky(1 − y/M) | M/(1 + Ae^(−kt)) | S-curve, inflection at y = M/2 |
| Torricelli draining | y′ = −k√y | (√y₀ − kt/2)² | Hits zero in finite time |
The draining tank is the sneaky one. A tank holding y₀ = 4 m of water with k = 0.5 empties at t = 2√y₀/k = 8 time units — and the formula (2 − 0.25t)² happily keeps producing positive numbers after t = 8, which is physical nonsense. Tanks don’t refill themselves.
That’s the interval-of-existence idea again in applied clothing: the model holds until the water runs out, after which the real solution is y = 0 — the equilibrium separation deleted back in step one. Splicing a solution branch onto its equilibrium at the right moment is standard modelling practice, and it’s only possible if you bothered to write that equilibrium down. For the theory behind why √y in particular allows two different solutions through the same point, the Lipschitz condition in the Picard–Lindelöf existence and uniqueness theorem is where to look: √y isn’t Lipschitz at y = 0, so uniqueness fails at exactly that point and nowhere else. When your equation turns out not to separate at all, the broader ODE calculator covers the methods that take over from here.



