Mathwords logoMathwords

Separation of Variables — Definition, Formula & Examples

Separation of variables is a technique for solving a differential equation by rearranging it so that each variable and its differential appear on opposite sides of the equation, then integrating both sides independently.

Given a first-order ODE of the form dydx=f(x)g(y)\frac{dy}{dx} = f(x)\,g(y), separation of variables rewrites the equation as 1g(y)dy=f(x)dx\frac{1}{g(y)}\,dy = f(x)\,dx, provided g(y)0g(y) \neq 0. Integrating both sides yields an implicit (or explicit) solution relating xx and yy.

Key Formula

dydx=f(x)g(y)    1g(y)dy=f(x)dx+C\frac{dy}{dx} = f(x)\,g(y) \;\Longrightarrow\; \int \frac{1}{g(y)}\,dy = \int f(x)\,dx + C
Where:
  • f(x)f(x) = A function of x only
  • g(y)g(y) = A function of y only (assumed nonzero)
  • CC = Constant of integration

How It Works

First, check that the ODE can be written as a product of a function of xx alone and a function of yy alone. Move all yy-terms (including dydy) to one side and all xx-terms (including dxdx) to the other. Integrate both sides separately, remembering to include a constant of integration. Finally, solve for yy explicitly if possible, and apply any initial condition to determine the constant.

Worked Example

Problem: Solve the initial value problem: dy/dx = 2x·y, with y(0) = 3.
Separate: Divide both sides by y and multiply both sides by dx to isolate each variable.
1ydy=2xdx\frac{1}{y}\,dy = 2x\,dx
Integrate: Integrate the left side with respect to y and the right side with respect to x.
1ydy=2xdx    lny=x2+C\int \frac{1}{y}\,dy = \int 2x\,dx \;\Longrightarrow\; \ln|y| = x^2 + C
Solve and apply initial condition: Exponentiate both sides to solve for y, then use y(0) = 3 to find the constant.
y=Aex2,A=eC.y(0)=A=3    y=3ex2y = Ae^{x^2}, \quad A = e^{C}. \quad y(0) = A = 3 \;\Longrightarrow\; y = 3e^{x^2}
Answer: y=3ex2y = 3e^{x^2}

Why It Matters

Separation of variables is typically the first solution technique taught in a differential equations course, and it applies directly to modeling exponential growth, radioactive decay, Newton's law of cooling, and other processes where the rate of change factors into independent parts. In partial differential equations, extended versions of this method are used to solve the heat equation, wave equation, and Laplace's equation.

Common Mistakes

Mistake: Forgetting to check that g(y) ≠ 0, which can cause division by zero and lost solutions.
Correction: Before dividing by g(y), note any values where g(y) = 0. These constant solutions (equilibrium solutions) must be stated separately — for example, y = 0 is a solution to dy/dx = 2xy that the general solution y = Ae^{x²} only captures when A = 0.