IB Diploma Mathematics AI · Calculus
Differential equations and slope fields (HL)
1What a differential equation says
A differential equation links a function with its derivatives. It describes how something changes, and solving it tells you the quantity itself.
- $\dfrac{dN}{dt} = kN$: the growth rate is proportional to the size (population, compound interest).
- $\dfrac{dT}{dt} = -k(T - T_{\text{room}})$: Newton's law of cooling, where a hot object cools faster when it is much hotter than the room.
- A general solution has an unknown constant; an initial condition (such as $N = 50$ when $t = 0$) gives the particular solution.
"the rate at which a rumour spreads is proportional to the number of people who know it" becomes $\frac{dP}{dt} = kP$.
Check yourself
What does dN/dt = 0.3N say about N?
Show the answer
Its rate of growth is 0.3 times its current size
The rate depends on N itself.
2Separating the variables
If the equation can be written as $\dfrac{dy}{dx} = f(x)\,g(y)$, then:
- Move all the $y$ terms to one side and the $x$ terms to the other: $\displaystyle\int \frac{1}{g(y)}\,dy = \int f(x)\,dx$.
- Integrate both sides, with one constant $c$.
- Use the initial condition to find $c$, then rearrange for $y$ if asked.
Exponential growth
- $\frac{dN}{dt} = 0.3N$, with $N = 50$ when $t = 0$.
- $\int \frac{1}{N}\,dN = \int 0.3\,dt$ gives $\ln N = 0.3t + c$.
- So $N = Ae^{0.3t}$, and $N(0) = 50$ gives $A = 50$.
- $N = 50e^{0.3t}$. After 5 hours, $N = 50e^{1.5} = 224$.
Newton's law of cooling
- $\frac{dT}{dt} = -0.1(T - 20)$, with $T = 90$ °C at $t = 0$ minutes.
- Separating: $\ln|T - 20| = -0.1t + c$, so $T = 20 + Ae^{-0.1t}$.
- $T(0) = 90$ gives $A = 70$: $T = 20 + 70e^{-0.1t}$.
- After 10 minutes, $T = 20 + 70e^{-1} = 45.8$ °C. It reaches 50 °C when $e^{-0.1t} = \frac{3}{7}$, at $t = 8.47$ minutes.
Check yourself
Solving dy/dx = x/y with y = 2 when x = 0 gives which result?
Show the answer
y² = x² + 4
∫y dy = ∫x dx gives y²/2 = x²/2 + c, and c = 2.
3Slope fields
A slope field draws a short line at many points $(x, y)$, with gradient equal to $\frac{dy}{dx}$ at that point.
- A solution curve follows the direction of the little lines, like a leaf on a stream.
- Each initial condition picks out one curve.
- Lines are horizontal where $\frac{dy}{dx} = 0$. The curve joining such points is called an isocline of zero gradient.
- You can sketch a solution without solving the equation at all.
Slope field for dy/dx = x + y, with the solution curve through (0, 1)
Reading a slope field
- For $\frac{dy}{dx} = x + y$, the gradient at $(1, 2)$ is 3 (steep) and at $(1, -1)$ it is 0 (flat).
- The flat lines lie along $y = -x$.
- The curve through $(0, 1)$ rises more and more steeply.
Check yourself
In a slope field for dy/dx = x + y, what is the gradient of the line at (2, −2)?
Show the answer
0
2 + (−2) = 0.
4Euler's method
Euler's method gives a numerical approximation when an equation cannot be solved exactly. Take small steps of size $h$, each time following the current gradient:
- $x_{n+1} = x_n + h$
- $y_{n+1} = y_n + h \times f(x_n, y_n)$, where $\frac{dy}{dx} = f(x, y)$
- A smaller step size $h$ is more accurate but needs more steps. Use a GDC spreadsheet or table.
- If the curve is bending upwards (concave up), Euler's method underestimates, because each step follows the old, lower gradient.
Three steps
- $\frac{dy}{dx} = x + y$, $y(0) = 1$, $h = 0.1$. Estimate $y(0.3)$.
- $y_1 = 1 + 0.1(0 + 1) = 1.1$.
- $y_2 = 1.1 + 0.1(0.1 + 1.1) = 1.22$.
- $y_3 = 1.22 + 0.1(0.2 + 1.22) = 1.362$.
- The exact value is $2e^{0.3} - 1.3 = 1.400$, so Euler underestimates here.
Check yourself
Euler's method with h = 0.5: y₀ = 2 and dy/dx = 4 at the start. What is y₁?
Show the answer
4
2 + 0.5 × 4.
5Coupled systems and phase portraits
Two quantities can affect each other, such as predators and prey:
$\dfrac{dx}{dt} = ax + by, \quad \dfrac{dy}{dt} = cx + dy$, or $\dot{\mathbf{x}} = M\mathbf{x}$ with $M = \begin{pmatrix}a & b\\c & d\end{pmatrix}$.
- If $M$ has eigenvalues $\lambda_1, \lambda_2$ with eigenvectors $\mathbf{p}_1, \mathbf{p}_2$, the solution is $\mathbf{x} = Ae^{\lambda_1 t}\mathbf{p}_1 + Be^{\lambda_2 t}\mathbf{p}_2$.
- A phase portrait plots $y$ against $x$ and shows how trajectories move.
- Both eigenvalues negative: every path heads into the origin (stable). Both positive: paths move away (unstable). Opposite signs: a saddle, where paths come in along one eigenvector and leave along the other.
- Complex eigenvalues give spirals: inwards if the real part is negative, outwards if positive. Purely imaginary eigenvalues give closed loops (a centre).
- A second-order equation such as $\ddot{x} + k\dot{x} + x = 0$ becomes a coupled system with $y = \dot{x}$. Euler's method extends to systems: update both variables at each step using the old values.
Phase portrait of a saddle: paths come in along one eigenvector and leave along the other
A saddle point
- $\dot{x} = x + 2y$, $\dot{y} = 2x + y$. So $M = \begin{pmatrix}1 & 2\\2 & 1\end{pmatrix}$.
- Eigenvalues 3 and $-1$, with eigenvectors $\begin{pmatrix}1\\1\end{pmatrix}$ and $\begin{pmatrix}1\\-1\end{pmatrix}$.
- General solution: $\mathbf{x} = Ae^{3t}\begin{pmatrix}1\\1\end{pmatrix} + Be^{-t}\begin{pmatrix}1\\-1\end{pmatrix}$.
- Starting at $(3, 1)$: $A + B = 3$ and $A - B = 1$, so $A = 2$, $B = 1$.
- As $t$ grows, the $e^{3t}$ term dominates and the path runs off along the line $y = x$.
Check yourself
A system's matrix has eigenvalues −2 and −5. What does the phase portrait show?
Show the answer
All trajectories move into the origin (stable)
Both exponentials decay to 0.
6Exponential growth from a differential equation
$\frac{dN}{dt} = 0.04N$, $N(0) = 500$
- Separate: $\int \frac{1}{N}\,dN = \int 0.04\,dt$.
- $\ln N = 0.04t + C$, so $N = Ae^{0.04t}$.
- $N(0) = 500$, so $A = 500$: $N = 500e^{0.04t}$.
- At $t = 10$: $N = 500e^{0.4} \approx 746$.
Check yourself
What is the general solution of $\frac{dN}{dt} = kN$?
Show the answer
$N = Ae^{kt}$
Exponential growth.
7Interpreting phase portraits
For a coupled system $\frac{dx}{dt} = ax + by$, $\frac{dy}{dt} = cx + dy$, the eigenvalues of the matrix decide the behaviour near the origin.
- Both eigenvalues negative: trajectories move towards the origin (stable).
- Both positive: trajectories move away (unstable).
- Opposite signs: a saddle point; most trajectories move away.
- Complex eigenvalues: spirals (stable if the real part is negative); purely imaginary gives closed loops.
Worked example
- System: $\frac{dx}{dt} = -2x$, $\frac{dy}{dt} = -3y$.
- Eigenvalues: $-2$ and $-3$, both negative.
- All trajectories approach the origin: a stable equilibrium.
Check yourself
What do complex eigenvalues with negative real part produce?
Show the answer
Spirals towards the origin
Stable spiral.
Now test yourself
This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.
Practise in Impera