Lesson 25: Differential Equations (HL) HL ONLY
🎧 Audio narration for this lesson is coming soon.
A differential equation relates a function to its derivatives; solving it means recovering the function itself (AA Topic 5, HL). Where earlier lessons differentiate known functions, this one runs the film backwards from a *law of change*: cooling, growth, mixing, motion with resistance. The HL toolkit: separable equations, linear equations via an integrating factor, slope fields for qualitative behaviour, and Euler's method for numerical answers when no closed form exists. Every solution technique ends with the same free check: differentiate your answer and confirm it satisfies the equation.
Separable equations: divide and integrate
If dy/dx = f(x)·g(y), then (formally) separate: dy/g(y) = f(x) dx, integrate both sides, and reunite. Two disciplines matter: the constant of integration merges into one C; and any value where g(y) = 0 is a constant solution the separation may have divided away — check for it separately.
Worked Example 1 — separation with an initial condition. Solve dy/dx = 2xy² with y(0) = 1, and state the domain of the solution.
Solution. Separate: y⁻² dy = 2x dx. Integrate: −1/y = x² + C. Apply y(0) = 1: −1 = C. So −1/y = x² − 1, giving y = 1/(1 − x²). Verify: dy/dx = 2x/(1 − x²)² = 2x·y² ✓. Domain: the solution exists for −1 < x < 1 (the formula blows up at x = ±1, and the initial point x = 0 selects this branch) — IB awards a mark for noticing that a "solution" is a function *on an interval*, not just a formula. (The constant solution check: y ≡ 0 satisfies the equation but not the condition — noted, excluded.)
Linear equations and the integrating factor
For dy/dx + P(x)·y = Q(x), multiply through by the integrating factor I(x) = e^(∫P(x) dx). The left side collapses into a product derivative: d/dx [I(x)·y] = I(x)Q(x). Integrate, divide by I(x), apply conditions.
Worked Example 2 — integrating factor (past-paper style). Solve dy/dx + 2y = e^(−x) with y(0) = 3.
Solution. P(x) = 2, so I(x) = e^(2x). Multiply: e^(2x) dy/dx + 2e^(2x) y = e^(x); the left side is d/dx [y e^(2x)]. Integrate: y e^(2x) = e^x + C. Apply y(0) = 3: 3 = 1 + C → C = 2. Solution: y = e^(−x) + 2e^(−2x). Verify by substitution into the original equation (derivative: −e^(−x) − 4e^(−2x); then dy/dx + 2y = −e^(−x) − 4e^(−2x) + 2e^(−x) + 4e^(−2x) = e^(−x) ✓). The collapse of the left side is the method's entire trick — if your multiplied equation does not collapse, the integrating factor was computed wrongly.
Slope fields: reading behaviour without solving
A slope field plots the gradient dy/dx = f(x, y) as short segments across a grid. Solutions are curves that flow along the segments. Equilibrium solutions (horizontal lines where f = 0) and their stability (do nearby solutions approach or flee?) are readable at a glance. On paper, sketch by computing slopes at the grid points the question names; in modelling, slope fields answer "what happens eventually?" before any formula exists.
Reading example. For dy/dx = y(1 − y) (logistic growth), the slope is 0 at y = 0 and y = 1, positive between, negative above 1: solutions starting in (0, 1) climb sigmoidally towards the carrying capacity y = 1; y = 1 is stable, y = 0 unstable. That one picture is the logistic story — Lesson 17's rumour-spread IA runs on it.
Euler's method: numerical solutions
When separation fails, step numerically: y_{n+1} = y_n + h·f(x_n, y_n) with step size h. Smaller h, better accuracy; error accumulates, and for convex solutions Euler systematically under/over-shoots (it follows tangents, which lag curves).
Worked Example 3 — Euler versus exact. Approximate y(1) for dy/dx = y, y(0) = 1, using h = 0.5, and compare with the exact value.
Solution. Step 1: y₁ = 1 + 0.5 × 1 = 1.5 (at x = 0.5). Step 2: y₂ = 1.5 + 0.5 × 1.5 = 2.25 (at x = 1). Exact: y = e^x, y(1) = e ≈ 2.718. Euler underestimates (2.25) because the true curve bends away above its tangents — with h = 0.25 the estimate improves to ≈ 2.44, the expected convergence pattern. GDC/spreadsheet Euler tables are Paper 3 furniture: set up x, y, slope, next-y columns and let the machine march.
Real-world modelling: Newton cooling and mixing
Newton's law of cooling: dT/dt = −k(T − T_env) — separable after the shift u = T − T_env (Lesson 4's model made rigorous). A tank with inflow/outflow of brine gives a linear equation for the salt mass — the integrating factor's home ground. Population with a ceiling gives the logistic equation (separable via partial fractions, Lesson 23 — the topics interlock).
Cooling, quantified. A drink at 90 °C sits in a 20 °C room; after 10 minutes it is 60 °C. Model: T − 20 = 70e^(−kt); 40 = 70e^(−10k) → k = ln(7/4)/10 ≈ 0.0560 per minute. At t = 25: T = 20 + 70e^(−1.40) ≈ 20 + 70 × 0.2466 ≈ 37.3 °C. Every step is a course technique: separation, logs, evaluation, interpretation.
Common mistakes
- Dividing by y (or g(y)) without recording the constant solution it may destroy.
- Two constants of integration left standing (one per side) — merge them into a single C immediately.
- Integrating factor built from ∫Q instead of ∫P, or the multiplied equation not recognised as a product derivative.
- Applying the initial condition before solving fully — conditions fix C at the *end* of the general solution (except in separation, where early substitution is legitimate but riskier).
- Euler steps with the slope evaluated at the new point, or x and y columns drifting out of sync.
- No verification: differentiating your final y and substituting back takes one minute and catches most slips — examiners note its absence.
IB Exam Experience
Question 1 [2 marks]. Find the general solution of dy/dx = 3x²y. *Marking notes:* M1 for separation and integration: ln|y| = x³ + C; A1: y = Ae^(x³) (any equivalent form; the constant repackaged as a multiplicative A earns the mark, as does noting y ≡ 0 is included when A = 0).
Question 2 [3 marks]. Solve dy/dx − y = x, given y(0) = 2, using an integrating factor. *Marking notes:* M1: I(x) = e^(−x) (P = −1 — sign care); M1: d/dx [y e^(−x)] = x e^(−x), integrate by parts (Lesson 23): y e^(−x) = −(x + 1)e^(−x) + C; A1: y = −(x + 1) + Ce^x with C = 3 from y(0) = 2: y = 3e^x − x − 1. Verify quickly: dy/dx = 3e^x − 1; dy/dx − y = 3e^x − 1 − 3e^x + x + 1 = x ✓.
Question 3 [4 marks]. For dy/dx = x − y: (a) sketch slope segments at (0, 0), (0, 1), (1, 0), (1, 1) [2]; (b) describe the behaviour of the solution through (0, 1) as x increases. [2] *Marking notes:* (a) slopes: at (0, 0): 0; (0, 1): −1; (1, 0): 1; (1, 1): 0 — A1 per correct pair. (b) A1: from (0, 1) the curve initially decreases (slope −1); A1: it approaches the line y = x − 1 (along that line the field slope is x − (x − 1) = 1, exactly the line's own slope, so the line is itself a solution and acts as an asymptote the curve settles towards). Equilibrium-style reasoning about a non-constant attractor line is the Paper 3 flavour here.
Extended problem (Paper 2 style) [10 marks]. A 100-litre tank initially contains pure water. Brine at 0.4 kg/L flows in at 5 L/min and the mixture flows out at 5 L/min. Let S(t) kg be the salt mass at time t. (a) Show that dS/dt = 2 − S/20. [3] (b) Solve for S(t). [4] (c) Find the salt mass after 30 minutes and the limiting mass as t → ∞, interpreting the limit. [3] *Marking notes:* (a) M1: inflow of salt = 5 × 0.4 = 2 kg/min; M1: outflow concentration = S/100 kg/L × 5 L/min = S/20 kg/min; A1: rate of change = in − out: dS/dt = 2 − S/20 ✓ (volume constant since flows balance — state it). (b) M1: linear (or separable in (2 − S/20)): rewrite as dS/dt = −(1/20)(S − 40); M1: solution form S = 40 + Ae^(−t/20); A1: S(0) = 0 (pure water) gives A = −40; A1: S(t) = 40(1 − e^(−t/20)). (c) A1: S(30) = 40(1 − e^(−1.5)) ≈ 40 × 0.7769 ≈ 31.1 kg; A1: limit 40 kg; A1: interpretation — the tank approaches the equilibrium where inflow concentration equals tank concentration (0.4 kg/L × 100 L = 40 kg): the system forgets its pure start. Equilibrium-first thinking (set dS/dt = 0 → S = 40 before solving) is the Paper 3 habit this problem rewards.
Exploration (IA) idea: your Lesson 17 rumour/logistic model made rigorous — fit a logistic or cooling model to data you collect (a drink cooling with a thermometer is a one-evening dataset), solve the ODE, and evaluate parameters against a second dataset. Differential equations are the HL IA's highest-yield engine.
Going further: one more separable, and equilibrium-first thinking
A separable equation with a trigonometric driver: solve dy/dx = y²cos x with y(0) = 1. Separate: y⁻² dy = cos x dx → −1/y = sin x + C; y(0) = 1 gives C = −1, so y = 1/(1 − sin x). Verify: dy/dx = cos x/(1 − sin x)² = y² cos x ✓. Note the behaviour the formula confesses: the solution blows up where sin x = 1 — differential-equation solutions live on intervals, and stating the interval (here the maximal interval containing 0 is (−3π/2, π/2), bounded by the nearest points where sin x = 1) is worth marks. Cultivate equilibrium-first thinking for any autonomous equation dy/dx = f(y): the constant solutions sit where f(y) = 0, and the sign of f between them sketches the whole flow without solving anything — for dy/dx = (y − 1)(y − 3): where y < 1 both factors are negative, so f > 0 and solutions increase towards 1; between 1 and 3, f < 0 and solutions decrease towards 1; above 3, f > 0 and solutions increase away from 3 — so y = 1 is stable (approached from both sides) and y = 3 is unstable. Thirty seconds of sign analysis buys the qualitative answer to any "describe the long-term behaviour" part before the analytic work begins.
Extra exam practice [4 marks]. Solve dy/dx = (x + 1)/y with y(0) = 2. *Marking notes:* M1 for separation: y dy = (x + 1) dx → y²/2 = x²/2 + x + C; M1 for the condition: 2 = C (from y²(0)/2 = 2); A1: y² = x² + 2x + 4; A1: y = √(x² + 2x + 4), positive branch chosen because y(0) = 2 > 0 (the negative branch is the classic dropped mark).
📊 Interactive: Differential Equations
Interactive — hover or explore the chart above.
🎬 Watch & Learn
Free YouTube video lessons on “Differential Equations (HL)” — pick a result below: