Calculus — Alpha School

Lesson 11: Differential Equations — Separation of Variables

🎧 Listen to this lesson

A differential equation is an equation involving a derivative — a description of how a quantity changes, rather than what it is. Solving one means recovering the function from its rate law, which makes this lesson the integral's most important application. The workhorse method, separation of variables, handles any equation that can be rearranged into "all the y's on one side, all the x's on the other." Behind the method stands a serious idea: many laws of nature are stated as rates (Newton's cooling law, radioactive decay, population growth), so this is where calculus meets the world most directly.

Slope fields: seeing the equation

Before solving anything, look. The equation dy/dx = x/y says: at each point (x, y), the solution curve passing through has slope x/y. Sketching short segments of those slopes gives a slope field, and solution curves are the paths that everywhere follow the segments. Already the picture teaches: near the x-axis slopes explode (division by small y), on the y-axis slopes are 0. Qualitative reasoning — equilibria, stability, long-term behaviour — often matters more than formulas, and slope fields are how you get it.

Separation of variables, step by step

dy/dx = x/y
1. Separate:   y dy = x dx              (treat dy/dx as separable parts — the chain rule justifies this)
2. Integrate:  y^2/2 = x^2/2 + C
3. Simplify:   y^2 − x^2 = C1            (absorb the 1/2s into a new constant)
4. Particular: y(0) = 2 gives C1 = 4, and taking the branch through (0, 2): y = sqrt(x^2 + 4)

Worked Example 1 (exponential growth). dy/dt = 0.03y with y(0) = 500. Separating: dy/y = 0.03 dt → ln|y| = 0.03t + C → y = 500 e^(0.03t). The doubling time solves e^(0.03t) = 2: t = ln 2/0.03 ≈ 23.1 time units — independent of the starting amount, the signature of exponential growth. Rule of thumb worth memorising: doubling time ≈ 70/(percentage rate) = 70/3 ≈ 23.3. Worked Example 2. dy/dx = 2x(y − 1), y(0) = 3. Separate: dy/(y − 1) = 2x dx → ln|y − 1| = x^2 + C → y = 1 + A e^(x^2). The initial condition gives A = 2: y = 1 + 2 e^(x^2). Note also the equilibrium solution y = 1 (constant, derivative 0 = RHS 0), which separation loses when dividing by (y − 1) — always ask what was divided away.

Newton's law of cooling

Objects cool at a rate proportional to their temperature excess over the surroundings: dT/dt = −k(T − T_room). Separating (or pattern-matching on Worked Example 2) gives T(t) = T_room + (T_0 − T_room) e^(−kt) — exponential decay toward room temperature. Worked Example 3. Coffee at 90°C in a 20°C room with k = 0.1 per minute: after 10 minutes, T = 20 + 70 e^(−1) ≈ 20 + 25.7 ≈ 45.7°C. The model predicts the coffee never quite reaches 20°C — it approaches asymptotically, like the horizontal asymptotes of Lesson 2. Real coffee also loses heat by evaporation, which is why measured cooling is faster at first; models are honest about their assumptions, and so should you be.

Application: dating with radiocarbon

Carbon-14 decays with half-life 5730 years, so its decay constant is k = ln 2/5730 ≈ 1.21 × 10^(−4) per year. A sample retaining 60% of its original carbon-14 satisfies e^(−kt) = 0.6, giving t = −ln(0.6)/k ≈ 0.5108/0.000121 ≈ 4220 years. The entire method — archaeology's clock — is one separation of variables plus a logarithm. Its accuracy limits (the atmospheric carbon-14 level has varied over history) are a modelling caveat, not a calculus error: the equation is solved exactly; the world only approximately obeys it.

Logistic flavour: equilibria and stability

For dy/dt = y(1 − y) (population in units of carrying capacity), the equilibria are y = 0 and y = 1. Solutions starting between them increase toward y = 1; the equilibrium y = 1 is stable (nearby solutions approach it) and y = 0 is unstable. You can read all of this off the sign of dy/dt on each interval without solving anything — and for many real equations, which cannot be solved in closed form at all, this qualitative analysis is the whole game.

Common mistakes

  • Dividing away a solution. Separating dy/dt = y(1 − y) by dividing by y(1 − y) silently discards the equilibria y = 0 and y = 1. Right: note them separately before separating — they are often the most important solutions (extinction and carrying capacity!).
  • Forgetting the ± when removing the absolute value. ln|y| = x + C gives y = A e^x where A can be any nonzero constant of either sign, plus y = 0 from A = 0. Compressing this to "y = e^(x + C)" loses negative solutions.
  • Stopping at the implicit answer when a particular solution is asked. y^2 − x^2 = C is a family; with y(0) = 2 the deliverable is y = sqrt(x^2 + 4), branch chosen by the initial condition.
  • Treating + C as decoration. In rate problems the constant is where the initial condition enters; dropping it makes every answer the same wrong one.
Key idea. Separation of variables: rearrange, integrate both sides, combine constants, apply the initial condition, and account for any equilibrium solutions you divided away.
Try it. Solve: (a) dy/dx = 3x^2/y with y(0) = 2 (answer: y = sqrt(2x^3 + 4)). (b) dy/dt = −0.2y with y(0) = 80 — find the half-life of this decay (answer: ln 2/0.2 ≈ 3.47). (c) dP/dt = 0.05P with P(0) = 1200: when does the population reach 5000? (Solve 5000 = 1200 e^(0.05t).) Then sketch the slope field of dy/dx = y − x at the points (0, 0), (0, 1), (1, 0), (2, 2) and describe, qualitatively, the solution through (0, 1).

Exam Experience

1. The solution of dy/dx = 2xy with y(0) = 3 is

  • (A) y = 3e^(x^2)
  • (B) y = e^(x^2) + 2
  • (C) y = 3e^(2x)
  • (D) y = 3x^2 + 3

Answer: (A). Separating: dy/y = 2x dx, so ln|y| = x^2 + C and y = A e^(x^2); y(0) = 3 fixes A = 3.

2. A quantity decays so that dy/dt = −0.25y. Its half-life is

  • (A) 4
  • (B) ln 2/0.25 ≈ 2.77
  • (C) 0.25 ln 2 ≈ 0.17
  • (D) 1/0.25 = 4, in different units than (A) suggests — both wrong

Answer: (B). y = y_0 e^(−0.25t); halving needs e^(−0.25t) = 1/2, so t = ln 2/0.25 ≈ 2.77. Choice (A) is the time constant 1/k, a related but different quantity (the time to fall to 1/e, not 1/2).

3. For the equation dy/dt = (y − 2)(y + 1), the stable equilibrium is

  • (A) y = 2
  • (B) y = −1
  • (C) Both are stable
  • (D) Neither is stable

Answer: (B). Sign analysis on both sides of each equilibrium. Near y = −1: just above −1, (y − 2) < 0 and (y + 1) > 0 give dy/dt < 0, pushing y down toward −1; just below −1, both factors are negative, dy/dt > 0, pushing y up toward −1. Solutions approach −1 from both sides — stable. Near y = 2: above 2, dy/dt > 0 (y increases away); below 2, dy/dt < 0 (y decreases away) — unstable. The standing warning: run the sign test on both sides of every equilibrium before declaring stability; guessing from the "nicer" number is how this question catches people.

Free-response question. Water at 100°C is placed in a room at 20°C. After 10 minutes it has cooled to 60°C. Assume Newton's law of cooling. (a) Write T(t) in terms of t, determining the constant k from the data. (b) Find the temperature after 25 minutes. (c) Find the time at which the water reaches 30°C.

Scoring guideline.

  • (a) 2 points. 1 point for the model form T(t) = 20 + 80 e^(−kt) (from T_0 = 100, room 20). 1 point for using T(10) = 60: 60 = 20 + 80 e^(−10k) gives e^(−10k) = 1/2, so k = ln 2/10 ≈ 0.0693 per minute.
  • (b) 1 point. T(25) = 20 + 80 e^(−25 ln 2/10) = 20 + 80·2^(−2.5) ≈ 20 + 80(0.1768) ≈ 34.1°C.
  • (c) 1 point. 30 = 20 + 80 e^(−kt) gives e^(−kt) = 1/8 = 2^(−3); with k = ln 2/10, t = 3 ln 2/(ln 2/10) = 30 minutes exactly. The elegant exactness (three half-lives of the excess: 80 → 40 → 20 → 10) is the intended insight; answers within rounding of 30 earn the point.

Going deeper: blow-up, and a mixing tank

Not every solution lives forever. Solve dy/dx = y^2 with y(0) = 1: separating gives −1/y = x + C, and the initial condition fixes C = −1, so y = 1/(1 − x). As x → 1 from below, y explodes to infinity — the solution exists only on (−∞, 1) and then stops. Nothing in the equation warned us; the rate law y^2 feeds on itself so aggressively that the quantity reaches infinity in finite time. (Contrast y' = y, whose solutions grow fast but live for all time.) Differential equations carry domains with them, and reporting a solution without its interval is an incomplete answer — a modelling fact with teeth in engineering, where blow-up is a design limit, not a curiosity. Mixing problems are the friendlier face of the same lesson. A 100-litre tank of pure water receives brine (0.2 kg of salt per litre) at 5 L/min, and the well-stirred mixture leaves at 5 L/min, keeping the volume constant. Salt S(t) changes by (rate in) − (rate out) = 5(0.2) − 5·(S/100) = 1 − S/20. The equilibrium is S = 20 kg (where the rates balance), and separating — after rewriting as dS/dt = (20 − S)/20 — gives S(t) = 20(1 − e^(−t/20)) from S(0) = 0. After 20 minutes: S ≈ 20(1 − e^(−1)) ≈ 12.6 kg, about 63% of the way to equilibrium — the same 1 − 1/e signature as charging capacitors and cooling coffee. One exponential template, many costumes: whenever a rate is proportional to the remaining gap, the gap decays exponentially.

Keep reading to complete this lesson