Step 24: Separable Differential Equations and Slope Fields
- A differential equation is an equation for an unknown function that involves its derivative. “The rate of change of \( y \) is proportional to \( y \)” becomes \( \dfrac{dy}{dt} = ky \).
- To check a solution, substitute it into both sides. A general solution carries a constant \( C \); an initial condition such as \( y(0) = 2 \) fixes \( C \) and gives the particular solution.
- A slope field draws a short segment of gradient \( \dfrac{dy}{dx} \) at each grid point, so you can see the shape of every solution before solving anything. It is an AP topic; Cambridge 9709 does not include slope fields.
- Exam point: to solve a separable equation, separate, integrate both sides with \( + C \) at once, use the initial condition, then rearrange to \( y = \ldots \) and state the domain if asked.
Turning words into a differential equation
Most laws of change are really statements about rates. A balance grows at a rate proportional to its size. A rumour spreads at a rate proportional to the number of people who have not yet heard it. A cup of tea cools faster when it is much hotter than the room. Each of these is a differential equation: an equation whose unknown is a whole function, and which involves that function’s derivative.
Writing one is translation, a phrase at a time. “The rate of change of \( N \)” is \( \dfrac{dN}{dt} \). “The gradient of the curve” is \( \dfrac{dy}{dx} \). “Is proportional to” is “\( = k \times \)”, with a constant \( k \) that you must name. And a quantity that is falling needs a minus sign or a negative \( k \).
| Words | Symbols |
|---|---|
| \( V \) decreases at a rate proportional to \( V \) | \( \dfrac{dV}{dt} = -kV \), \( k > 0 \) |
| the rate of increase of \( A \) is inversely proportional to \( A \) | \( \dfrac{dA}{dt} = \dfrac{k}{A} \), \( k > 0 \) |
| the gradient at \( (x, y) \) is the sum of the coordinates | \( \dfrac{dy}{dx} = x + y \) |
A town has 5000 people. The number \( N \) who have heard a rumour grows at a rate proportional to the number who have not yet heard it. At the start 100 people know, and at that moment the rumour is spreading at 49 people per hour. Write a differential equation for \( N \) and find the constant.
Sense check: as \( N \) approaches 5000 the right-hand side shrinks towards 0, so the spread slows down as the town runs out of people to tell.
Checking a solution: general and particular
To check that a function solves a differential equation, you do not need to know how it was found. Work out each side separately and see whether they agree for every \( x \).
Show that \( y = Ce^{2x}-\tfrac{1}{2}x-\tfrac{1}{4} \) is a solution of \( \dfrac{dy}{dx} = 2y + x \) for every constant \( C \). Then find the solution with \( y(0) = 1 \).
The particular solution is \( y = \tfrac{5}{4}e^{2x}-\tfrac{1}{2}x-\tfrac{1}{4} \).
A first-order equation needs one condition to fix its one constant. AP questions in this area often hand you a candidate function and ask you to verify it, or give you a family such as \( y = Ce^{kx} \) and ask which \( k \) works. Substitution answers both.
Slope fields: seeing solutions before solving
The equation \( \dfrac{dy}{dx} = f(x, y) \) tells you the gradient of the solution curve through every point. Draw a short segment with that gradient at each point of a grid and you have a slope field (also called a direction field). Solution curves are the paths that flow along the segments, like iron filings round a magnet.
Figure 1 is the slope field of \( \dfrac{dy}{dx} = y-x \). Three features are worth spotting. Along the line \( y = x \) the gradient is 0, so the segments are horizontal there. The line \( y = x + 1 \) has gradient 1, and on it \( y-x = 1 \), so this straight line is itself a solution. Solutions above that line bend upwards and run away from it; solutions below it bend downwards. You can confirm this: the general solution is \( y = x + 1 + Ce^{x} \), and the gap \( Ce^{x} \) grows as \( x \) increases.
For \( \dfrac{dy}{dx} = y-x \): (a) find the gradient of the solution curves through \( (2, 1) \) and \( (-1, 2) \); (b) find \( \dfrac{d^2y}{dx^2} \) and say where solution curves are concave up; (c) classify the points where solutions have horizontal tangents.
The teal curve in Figure 1, \( y = x + 1-e^{x} \), has its maximum at \( (0, 0) \), exactly where it meets the line \( y = x \).
When the right-hand side depends on \( y \) only, every horizontal row of segments is identical, and constant solutions show up as rows of flat segments. Figure 2 shows \( \dfrac{dy}{dx} = (y-1)(3-y) \). The equilibrium solutions are \( y = 1 \) and \( y = 3 \). Between them the gradient is positive, so a solution starting at \( y = 2 \) rises towards 3. Above 3 the gradient is negative, so a solution starting at \( y = 4 \) falls towards 3. Below 1 the gradient is negative, so solutions fall away from 1. The line \( y = 3 \) attracts nearby solutions; the line \( y = 1 \) repels them.
Solving by separating the variables
A slope field shows the shape of the solutions; for many important equations we can also find them as formulas. The key type is the separable equation, where the right-hand side factorises into a function of \( x \) times a function of \( y \):
Why is this allowed? You are not really “multiplying by \( dx \)”. If \( y(x) \) is a solution, then \( \dfrac{1}{h(y)}\dfrac{dy}{dx} = g(x) \) for every \( x \). Integrate both sides with respect to \( x \). By the chain rule, the left side is exactly \( \displaystyle\int \frac{1}{h(y)}\,dy \): separation is integration by substitution (Step 22) written compactly. One constant is enough, because constants on both sides combine into one.
Solve \( \dfrac{dy}{dx} = y\cos x \), given that \( y(0) = 3 \).
The solution is \( y = 3e^{\sin x} \), valid for all real \( x \). It oscillates between \( 3e^{-1} \approx 1.10 \) and \( 3e \approx 8.15 \).
When the solution involves a square root, the initial condition also tells you which sign to take.
Solve \( \dfrac{dy}{dx} = \dfrac{x}{y} \) with \( y(0) = -2 \), giving \( y \) explicitly in terms of \( x \).
The positive root \( y = \sqrt{x^2 + 4} \) also satisfies the equation, but not the initial condition. The domain is all real \( x \). In general, the domain is the largest open interval containing the starting \( x \) on which the formula is defined and differentiable: for \( \dfrac{dy}{dx} = y^2 \), \( y(0) = \tfrac{1}{2} \), the solution \( y = \dfrac{1}{2-x} \) is valid only for \( x < 2 \).
An economics example: constant elasticity of demand. The price elasticity of demand is \( \dfrac{P}{Q}\dfrac{dQ}{dP} \). Suppose market research says it is \( -2 \) at every price. That is a differential equation: \( \dfrac{dQ}{dP} = -\dfrac{2Q}{P} \). Separate: \( \displaystyle\int \frac{1}{Q}\,dQ = \int -\frac{2}{P}\,dP \), so \( \ln Q = -2\ln P + C \) and \( Q = AP^{-2} \). If 400 units sell at a price of $5, then \( A = 400 \times 25 = 10\,000 \) and \( Q = \dfrac{10\,000}{P^2} \). So a constant elasticity forces a power-law demand curve. At $10, demand falls to 100 units: doubling the price cuts quantity to a quarter, exactly what an elasticity of \( -2 \) means.
Practise: 6 questions
Try each one on paper first, then check the worked answer.
EasyQ1. Water drains from a tank so that the depth \( h \) falls at a rate proportional to the square root of the depth. Write a differential equation for \( h \). Show worked answer
It is proportional to \( \sqrt{h} \) and the depth is falling, so it is negative.
\( \dfrac{dh}{dt} = -k\sqrt{h} \), where \( k > 0 \) is a constant.
EasyQ2. Show that \( y = 4e^{-3x} + 2 \) satisfies \( \dfrac{dy}{dx} = 6-3y \) and the condition \( y(0) = 6 \). Show worked answer
Right side: \( 6-3(4e^{-3x} + 2) = 6-12e^{-3x}-6 = -12e^{-3x} \).
The sides agree for every \( x \), so the function is a solution.
\( y(0) = 4 + 2 = 6 \), as required.
MediumQ3. For \( \dfrac{dy}{dx} = x^2-y \): (a) find the gradient of the solution curves through \( (2, 1) \) and \( (-1, 1) \); (b) describe where the slope-field segments are horizontal; (c) find \( \dfrac{d^2y}{dx^2} \) in terms of \( x \) and \( y \). Show worked answer
(b) Horizontal where \( x^2-y = 0 \), that is along the parabola \( y = x^2 \).
(c) \( \dfrac{d^2y}{dx^2} = 2x-\dfrac{dy}{dx} = 2x-(x^2-y) = 2x-x^2 + y \).
MediumQ4. Solve \( \dfrac{dy}{dx} = \dfrac{3x^2}{2y} \), given \( y(1) = 3 \). Give \( y \) in terms of \( x \) and state the domain of the solution. Show worked answer
\( y^2 = x^3 + C \).
At \( (1, 3) \): \( 9 = 1 + C \), so \( C = 8 \) and \( y^2 = x^3 + 8 \).
\( y > 0 \) at the start, so take the positive root: \( y = \sqrt{x^3 + 8} \).
The derivative \( \dfrac{3x^2}{2y} \) needs \( y \neq 0 \), so we need \( x^3 + 8 > 0 \): the domain is \( x > -2 \).
MediumQ5. Solve \( \dfrac{dy}{dx} = e^{x-y} \), given \( y(0) = \ln 2 \). Show worked answer
\( e^{y} = e^{x} + C \).
At \( x = 0 \): \( e^{\ln 2} = 1 + C \), so \( 2 = 1 + C \) and \( C = 1 \).
\( e^{y} = e^{x} + 1 \), so \( y = \ln(e^{x} + 1) \), valid for all real \( x \).
ExamQ6. Consider the differential equation \( \dfrac{dy}{dx} = 2x(1-y) \). (a) Find \( \dfrac{d^2y}{dx^2} \) in terms of \( x \) and \( y \). [2] (b) Is the solution curve through \( (0, 3) \) concave up or concave down at that point? Give a reason. [1] (c) Find the particular solution \( y = f(x) \) with \( f(0) = 3 \). [5] (d) Find \( \displaystyle\lim_{x \to \infty} f(x) \). [1] Show worked answer
\( = 2(1-y)-4x^2(1-y) = 2(1-y)(1-2x^2) \). [A1]
(b) At \( (0, 3) \): \( 2(-2)(1) = -4 < 0 \), so the curve is concave down. [B1]
(c) Separate: \( \displaystyle\int \frac{1}{1-y}\,dy = \int 2x\,dx \). [M1]
\( -\ln|1-y| = x^2 + C \). [A1 A1, one for each side]
At \( (0, 3) \): \( -\ln 2 = C \). [M1]
So \( \ln|1-y| = \ln 2-x^2 \), \( |1-y| = 2e^{-x^2} \). Since \( y > 1 \) at the start, \( y-1 = 2e^{-x^2} \), giving \( f(x) = 1 + 2e^{-x^2} \). [A1]
(d) \( e^{-x^2} \to 0 \), so \( f(x) \to 1 \). [B1]
Total: 9 marks.
Check yourself
1. Which is the general solution of \( \dfrac{dy}{dx} = 3y \)?
2. In a slope field, the segments along every horizontal line are parallel to each other. Which equation could it be?
3. Which of these is an equilibrium solution of \( \dfrac{dy}{dx} = (y-2)(y + 1) \)?
Your score: 0 out of 3
The short version
- A differential equation is an equation for an unknown function involving its derivative. Translate words phrase by phrase, and name the constant of proportionality and its sign.
- Verify a solution by substituting it into both sides. The general solution has a constant \( C \); an initial condition gives the particular solution.
- A slope field shows the gradient \( f(x, y) \) at grid points. Solutions follow the segments and never cross an equilibrium line \( y = c \). (AP only: not in 9709 or IB AA.)
- Separable equations \( \dfrac{dy}{dx} = g(x)h(y) \): \( \displaystyle\int \frac{1}{h(y)}\,dy = \int g(x)\,dx + C \). Put in \( C \) as you integrate, use the initial condition, then write \( y = \ldots \).
- The initial condition also picks the sign of a square root and the interval on which the solution is valid.
- The full chapter in Mathematics Made Simple has many more worked examples and a full set of practice questions with a complete answer key.
Further reading on EconTutorials
Related in-depth articles from our blog:
