On this concept: Formula

Not sure which lesson to do first? Find your level and get a plan →

Math · Introduction to Calculus · Grade 9-12

Separation of Variables

Separation of variables solves a first-order DE of the form dydx=f(x)g(y) by rewriting it as dyg(y)=f(x) dx and integrating both sides in their own variable.

dydx=f(x)g(y)⇒∫dyg(y)=∫f(x) dx+C

Quick Answer

Separation of variables solves a first-order DE of the form dydx=f(x)g(y) by rewriting it as dyg(y)=f(x) dx and integrating both sides in their own variable. Use it when the rate of change is a product of an x-part and a y-part, as in growth, decay and cooling models. You integrate each side, add a single constant, solve for y, and use the starting value to fix the constant. The result is an exact formula for y, not just a sketch of its slopes.

Why This Matters

Many models only say how fast something changes: a population grows in proportion to its size, a hot drink cools in proportion to how much warmer it is than the room. Separation turns those rate statements into formulas you can evaluate, such as the temperature after 30 minutes or the age of a fossil. Without it you are left reading rough values off a slope field or stepping forward numerically.

Intuitive Explanation

Take dydx=xy. You can't simply integrate the right side with respect to x, because it contains y, and y is the unknown. The trick is to treat dy and dx as small changes that can be moved like factors: divide by y and multiply by dx to get dyy=x dx. Now the left side mentions only y and the right only x, so each can be integrated on its own: ln⁡∣y∣=x22+C.

Moving dx around is bookkeeping for a chain-rule fact. If y depends on x, then ddxln⁡∣y∣=1ydydx, and the equation says this equals x. So ln⁡∣y∣ and x22 have the same derivative and can differ only by a constant. That is also why one +C is enough, and why it must go in at the integration step, not after you solve for y.

The contrast is dydx=x+y. It looks just as simple, but it is a sum: whatever you divide by, an x stays stuck to a y. What decides it is whether the right side factors. x2y+y=y(x2+1) separates, and so does ex+y=exey, even though it contains a sum. x2+y does not, and needs a different method.

Think of it like this. Separating variables is like sorting a jar of mixed coins into two currencies before counting: once each pile holds one kind, you can total it by its own rules. Coins fused together, like the x+y in dydx=x+y, can't be sorted at all. Unlike coin counting, each total comes with an unknown constant that a starting value must fix.

Core idea. If dydx factors into an x-part times a y-part, separate them onto opposite sides and integrate each.


When to Use

Reach for separation when a first-order equation's right side is a product of an x-part and a y-part, including disguised ones such as ex+y=exey or xy+y=y(x+1). Stories where the rate is proportional to the amount, such as decay, cooling or unlimited growth, are separable. If the right side is a sum that won't factor, like x+y, use an integrating factor for a linear equation, or sketch a slope field when a picture is enough. If no y appears on the right, just integrate.

Tip. Ask: Can I rewrite the DE so one side has only y and dy, the other only x and dx?

How to Recognize It

Before moving dx and dy around, look at what the rate depends on, what kind of answer is wanted, and which values of y make the y-part zero.

  1. Does the right side contain y at all?

    If not, as in dydx=cos⁡x, there is nothing to separate: integrate directly, the plain antiderivative case. If y appears, separation is worth checking.

  2. Is the right side a sum of an x-term and a y-term that will not factor, like x2+y2?

    Then separation is impossible. A linear equation such as y′=x+y yields to the integrating factor method; others may need a slope field or Euler's method.

  3. Is there a value of y that makes the y-part zero, like y=0 in y′=2xy?

    Then y=0 is a constant solution that dividing by g(y) quietly throws away. Check it separately; in growth and cooling models it is often the equilibrium.

  4. Is a sketch or a long-run description enough for the question?

    Then a slope field may answer faster. Separation is worth the algebra when the question needs an exact formula or a value at a particular time, like the temperature after 10 minutes.

Separation of Variables compared with Slope fields, Integrating factor method, and Plain antiderivative

All four rows handle first-order differential equations, so the same equation can appear under each heading. Ask whether y appears on the right side, whether the equation is linear in y, and whether you need an exact formula or only a picture.

Separation of Variables

Meaning
Use this when a first-order DE's right side factors as a function of x times a function of y, so the variables can be moved to opposite sides.
Key test
Can I rewrite the DE so one side has only y and dy, the other only x and dx?
Formula
dydx=f(x)g(y)⇒∫dyg(y)=∫f(x) dx+C
Example
Solve dydx=xy with y(0)=2.

Slope fields

Meaning
A GRAPHICAL view of the same first-order DE; separation gives the exact formula.
Key test
Use slope fields when you only need qualitative behavior or can't separate.
Formula
segments of slope f(x,y)
Example
direction field of dydx=xy

Integrating factor method

Meaning
Solves LINEAR first-order DEs dydx+P(x)y=Q(x) that don't separate.
Key test
Use when the equation is linear but not a clean product.
Formula
μ=e∫P dx
Example
dydx+y=x

Plain antiderivative

Meaning
The special case dydx=f(x) where g(y)=1; just integrate the x-side.
Key test
Use when the rate depends on x only, no y on the right.
Formula
y=∫f(x) dx
Example
dydx=2x

Formula & Notation

dydx=f(x)g(y)⇒∫dyg(y)=∫f(x) dx+C
If dydx=f(x)⋅g(y) and g(y)≠0, then ∫1g(y) dy=∫f(x) dx+C. Let G(y)=∫1g(y) dy and F(x)=∫f(x) dx; then G(y)=F(x)+C defines y implicitly. Equilibrium solutions: g(y0)=0  ⟹  y=y0 is a constant solution.

How to read it: dyg(y)=f(x) dx — all y-terms on the left with dy, all x-terms on the right with dx. +C appears on one side only.

Worked Examples

Example 1 — Solve a separable DE

Easy

Solve dydx=xy with y(0)=2.
Show the steps and the answer
  1. Write the right side as a product: xy=f(x) g(y) with f(x)=x and g(y)=y.

    A product lets you divide the y-factor over to the left, which is all that separating needs.

  2. Divide by y and multiply by dx: dyy=x dx.

    Now the left side contains only y and the right only x. Dividing by y assumes y≠0, which is safe because y(0)=2.

  3. Integrate each side: ∫dyy=∫x dx gives ln⁡∣y∣=x22+C.

    Each side is an ordinary antiderivative in its own variable, and the two constants of integration merge into one C.

  4. Exponentiate both sides: ∣y∣=eCex2/2, so y=Aex2/2 where A=±eC.

    eln⁡∣y∣=∣y∣, and the plus-or-minus sign is absorbed into the new constant A.

  5. Use y(0)=2: 2=Ae0=A, so y=2ex2/2. Check: y′=2ex2/2⋅x=xy.

    The starting value picks one curve from the family, and differentiating confirms that the curve satisfies dydx=xy.

Answer: y=2ex2/2

Takeaway: Factor, separate, integrate with one constant, solve for y, then use the starting value. Differentiating your answer is a fast check.

Example 2 — Won't separate

Standard

Can you solve dydx=x+y by separation of variables?
Show the steps and the answer
  1. Test whether h(x,y)=x+y could be a product f(x)g(y). Any product satisfies h(0,0) h(1,1)=h(0,1) h(1,0), but here 0⋅2=0 while 1⋅1=1.

    If h=f(x)g(y), both sides equal f(0)f(1)g(0)g(1). The two values disagree, so no rearranging can split x+y into an x-part times a y-part.

  2. Rewrite the equation as dydx−y=x, which has the linear form dydx+P(x)y=Q(x) with P=−1 and Q=x.

    Linear first-order equations that don't separate are exactly the ones an integrating factor handles.

  3. Multiply by e∫−1 dx=e−x: the left side becomes (ye−x)′, so (ye−x)′=xe−x.

    The integrating factor turns the left side into a single product-rule derivative, which can be integrated directly.

  4. Integrate by parts: ye−x=−xe−x−e−x+C, so y=−x−1+Cex. Check: y′=−1+Cex and x+y=−1+Cex.

    The equation has a tidy solution after all; separation simply cannot reach it.

Answer: Not separable — use an integrating factor instead

Takeaway: Before separating, check that the right side factors. A sum such as x+y never does, while ex+y=exey does.

Example 3 — Find the mistake: the missing constant

Application

Solve dydx=3x2y with y(0)=5. Priya writes: "dyy=3x2 dx, so ln⁡y=x3, so y=ex3." Find the mistake and correct it.
Show the steps and the answer
  1. Test Priya's answer at the start: y(0)=e0=1, not 5.

    Her formula does satisfy the equation, since y′=3x2ex3=3x2y, but it is the wrong member of the family.

  2. Find the error: integrating dyy=3x2 dx gives ln⁡∣y∣=x3+C, and the +C was dropped.

    Every antiderivative carries a constant, and here the constant is the only thing that can hold the starting value 5.

  3. Solve for y: y=Aex3 with A=±eC, and y(0)=A=5.

    Exponentiating x3+C turns the added constant into a multiplying constant.

  4. Rule out the quick patch y=ex3+4: it has y′=3x2ex3, but 3x2y=3x2ex3+12x2.

    A constant tacked on after solving for y breaks the equation; it belongs at the integration step.

  5. Check y=5ex3: y′=15x2ex3=3x2y, and y(0)=5.

    Both the equation and the starting value hold, so this is the solution.

Answer: y=5ex3

Takeaway: Add +C the moment you integrate, before solving for y. In growth and decay problems it becomes the multiplier set by the starting value.

Where You'll See It

  • Cooling a cup of coffee

    Newton's law of cooling says dTdt=−k(T−20) in a 20°C room. Separating gives dTT−20=−k dt, so T=20+Ae−kt. Coffee poured at 90°C has A=70. If it is 55°C after 10 minutes, the gap to room temperature halves every 10 minutes, so after 20 minutes the coffee is 20+17.5=37.5°C.

  • Radiocarbon dating a bone

    Carbon-14 decays at a rate proportional to the amount present: dNdt=−kN. Separating gives N=N0e−kt, and a half-life of 5730 years means k=ln⁡25730≈0.000121 per year. A bone with 25% of its original carbon-14 has been through two half-lives, so it is about 11,460 years old.

  • Draining a water tank

    Water leaves a hole faster when the tank is fuller, roughly dhdt=−kh. Separating gives dhh=−k dt, so 2h=−kt+C. With h=4 m at the start and k=0.2 (time in minutes), h=2−0.1t, and the tank is empty at t=20 minutes. Unlike exponential decay, the level reaches zero in a finite time.

Common Mistakes

  1. The slip: Trying to separate a non-product right side

    Instead: dydx=x+y won't separate; check it factors as f(x)g(y) first.

  2. The slip: Forgetting the constant of integration

    Instead: add +C after integrating (on one side), then use any initial condition to find it.

  3. The slip: Mishandling the dy/dx

    Instead: move dx to the right and divide by g(y) properly; don't drop the differentials.


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. Solve dydx=2y with y(0)=5.

    Hint: Divide by y, multiply by dx, and integrate both sides.

  2. Solve dydx=xy with y(0)=3.

    Hint: Move y to the left side: y dy=x dx.

  3. Solve dydx=xy2 with y(0)=1.

    Hint: Separate as y−2 dy=x dx. The antiderivative of y−2 is −1y.

  4. A town of 1000 people grows according to dPdt=0.04P, with t in years. Find P(t) and the population after 10 years.

    Hint: Separate to get dPP=0.04 dt, then use P(0)=1000.

  5. Which equation can be solved by separation of variables: dydx=ex+y or dydx=x2+y?

    Hint: Try to write each right side as a function of x times a function of y.

  6. Solving dydx=2xy with y(0)=3, a student writes "ln⁡∣y∣=x2, so y=ex2." Correct the work.

    Hint: Check the student's answer at x=0. Something was dropped after integrating.

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

Is it legal to treat dydx like a fraction and multiply by dx?

It is shorthand for a valid step. Dividing dydx=f(x)g(y)\frac{dy}{dx}=f(x)g(y) by g(y)g(y) gives 1g(y)dydx=f(x)\frac{1}{g(y)}\frac{dy}{dx}=f(x). Integrating both sides with respect to xx, and using the chain rule in reverse as a substitution, turns the left side into ∫1g(y) dy\int\frac{1}{g(y)}\,dy. The fraction notation reaches the same result in one move, which is why Leibniz's notation is so convenient.

Why do I add +C on only one side?

Integrating both sides does give two constants, C1C_1 and C2C_2, but moving one across leaves only their difference, which is just one unknown number. Watch what happens after exponentiating, too: ln⁡∣y∣=kt+C\ln|y|=kt+C becomes ∣y∣=eCekt|y|=e^Ce^{kt}, and the new constant A=±eCA=\pm e^C can be any nonzero number. Allowing A=0A=0 as well brings back the solution y=0y=0, so answers are written y=Aekty=Ae^{kt}.

Can separation of variables give a solution that blows up?

Yes. Solving dydx=y2\frac{dy}{dx}=y^2 with y(0)=1y(0)=1 gives −1y=x−1-\frac1y=x-1, so y=11−xy=\frac{1}{1-x}, which shoots to infinity as x→1x\to1. Nothing in the equation looks dangerous, yet the solution exists only for x<1x<1. When the rate grows with the square of the amount, growth outpaces any exponential and reaches infinity in a finite time.

Learning Path

Separation of Variables

You are here

Next →

Nothing after this yet
You need Introduction to Differential Equations (what a solution and an initial condition are) and Integral (antiderivatives such as ∫dyy=ln⁡∣y∣). Separation adds a way to get exact formulas from rate equations. With it you can solve exponential growth and decay, Newton's law of cooling and the logistic model, and then move on to integrating factors for linear equations that don't separate.

See Also