Chapter 7 ยท Introduction to Differential Equations

7.2 Direction Fields and Euler's Method

Read a differential equation as a map of slopes, find its equilibria and their stability, and follow the slopes step by step with Euler's method.

In Section 7.1 every equation we met could be solved with a formula. Most differential equations cannot. There is no elementary function solving $y^\prime=x^2+y^2$, and the equations used for weather, epidemics or a spacecraft's path are far harder still. Yet a first-order equation $y^\prime=f(x,y)$ always tells us one thing for free: the slope of the solution curve through any point $(x,y)$. That is enough information to draw the solutions, to predict their long-term behaviour, and to compute them numerically.

This section develops three tools built on that single observation: the direction field (a picture of all the slopes at once), equilibrium solutions and their stability (where the slopes are zero, and whether nearby solutions are drawn in or pushed away), and Euler's method (walking along the slopes in small steps) โ€” the ancestor of every numerical solver used in science and engineering today.

Direction Fields

At each point $(x,y)$ the equation $y^\prime=f(x,y)$ gives a number โ€” the slope that a solution passing through that point must have there. Draw a short line segment with that slope at each point of a grid and the plane fills with little arrows showing which way solutions flow.

๐Ÿ“˜ Definition 7.5 โ€” Direction field
The direction field (or slope field) of the first-order equation $y^\prime=f(x,y)$ is a collection of short line segments, one through each point $(x,y)$ of a grid, each with slope $f(x,y)$.

A solution curve is tangent to the field at every one of its points. A curve along which $f(x,y)$ is constant, $f(x,y)=c$, is called an isocline: all the segments on it are parallel.

๐Ÿงญ Problem-solving strategy โ€” sketching a direction field and a solution
  1. Find a few isoclines $f(x,y)=c$, especially $c=0$ (horizontal segments). Draw segments of slope $c$ along each.
  2. Fill in more slopes at grid points as needed (a table helps).
  3. To sketch the solution through $(x_0,y_0)$, start at that point and draw a smooth curve that is tangent to the segments everywhere, going both forwards and backwards.
  4. Look for special curves: lines where the segments point along the line are themselves solutions.
โœ๏ธ Example 1 โ€” A direction field and a straight-line solution
For $y^\prime=x-y$: (a) compute the slopes at $(0,0)$, $(1,0)$, $(0,1)$, $(2,1)$, $(-1,1)$ and $(1,-1)$; (b) describe the isoclines; (c) show that one isocline is itself a solution; (d) verify that $y=x-1+Ce^{-x}$ is the general solution and describe what happens to every solution as $x\to\infty$.
a Slope $=x-y$:
$(x,y)$$(0,0)$$(1,0)$$(0,1)$$(2,1)$$(-1,1)$$(1,-1)$
slope$0$$1$$-1$$1$$-2$$2$
b The isocline of slope $c$ is $x-y=c$, i.e. the line $y=x-c$. So all isoclines are lines of slope $1$: segments are horizontal on $y=x$, have slope $1$ on $y=x-1$, slope $-1$ on $y=x+1$, and so on.
c On the line $y=x-1$ every segment has slope $c=1$ โ€” the same as the slope of the line itself. So the field points along this line and it is a solution. Check: $y=x-1$ gives $y^\prime=1$ and $x-y=x-(x-1)=1$ โœ“.
d $y=x-1+Ce^{-x}$ gives $y^\prime=1-Ce^{-x}$ and $x-y=1-Ce^{-x}$ โœ“ for every $C$. As $x\to\infty$, $Ce^{-x}\to0$, so every solution approaches the line $y=x-1$ โ€” exactly what the field in Interactive 1 shows.
Interactive 1 โ€” Direction Field Explorer

The grey segments are the direction field. Click anywhere to choose an initial point: the solution through it is traced forwards and backwards along the slopes. Dashed horizontal lines are equilibrium solutions, coloured stable, unstable or semi-stable. โ–ถ Play traces a set of sample solutions.

initial point $(x_0,y_0)$โ€”
slope $f(x_0,y_0)$โ€”
$y$ at the right edgeโ€”
equilibriaโ€”
๐Ÿ“ Theorem 7.2 โ€” Existence and uniqueness
Suppose $f(x,y)$ and its partial derivative $\dfrac{\partial f}{\partial y}$ (the derivative of $f$ with respect to $y$, holding $x$ fixed) are continuous on an open rectangle $R$ containing the point $(x_0,y_0)$. Then the initial-value problem $$y^\prime=f(x,y),\qquad y(x_0)=y_0$$ has exactly one solution on some open interval containing $x_0$.

Consequence. Inside such a rectangle, two different solution curves can never cross or touch: if they met at a point, they would be two solutions of the same IVP.

Equilibrium Solutions and Stability

Many models do not involve $x$ (or $t$) explicitly at all: the cooling law $T^\prime=-k(T-22)$ and the growth law $P^\prime=0.4P$ depend only on the current value. For such equations the direction field looks the same along every horizontal line, and the most important features are the heights where the slope is zero.

๐Ÿ“˜ Definition 7.6 โ€” Autonomous equation; equilibrium solution
A first-order equation of the form $y^\prime=f(y)$, with no explicit dependence on the independent variable, is called autonomous.

A constant function $y=c$ is an equilibrium solution of $y^\prime=f(y)$ when $f(c)=0$. (Indeed $y=c$ gives $y^\prime=0=f(c)$.) Its graph is a horizontal line.

๐Ÿ“˜ Definition 7.7 โ€” Stable, unstable and semi-stable equilibria
Let $y=c$ be an equilibrium solution of the autonomous equation $y^\prime=f(y)$, with $f$ continuous. The equilibrium is
  • stable (asymptotically stable) if every solution that starts close enough to $c$, on either side, tends to $c$ as $x\to\infty$;
  • unstable if solutions starting arbitrarily close to $c$, on both sides, move away from $c$;
  • semi-stable if solutions on one side approach $c$ while solutions on the other side move away.
๐Ÿงญ Problem-solving strategy โ€” the phase line
  1. Solve $f(y)=0$ to find the equilibria; mark them on a vertical $y$-axis (the phase line).
  2. In each interval between equilibria, find the sign of $f(y)$ (test one value). Draw an arrow up where $f\gt0$ (solutions increase) and down where $f\lt0$ (solutions decrease).
  3. Arrows pointing towards $c$ from both sides: stable. Both away: unstable. One towards and one away: semi-stable.
๐Ÿ“ Theorem 7.3 โ€” Derivative test for stability
Let $f$ have a continuous derivative near $c$ and let $f(c)=0$. For the equation $y^\prime=f(y)$:
  • if $f^\prime(c)\lt0$, the equilibrium $y=c$ is stable;
  • if $f^\prime(c)\gt0$, it is unstable;
  • if $f^\prime(c)=0$, the test is inconclusive โ€” use the phase line.

Why. If $f^\prime(c)\lt0$, then $f$ is decreasing through $0$ at $c$, so $f\gt0$ just below $c$ (solutions rise towards $c$) and $f\lt0$ just above (solutions fall towards $c$). The case $f^\prime(c)\gt0$ is the mirror image.

โœ๏ธ Example 2 โ€” Finding and classifying equilibria
Find and classify the equilibrium solutions of $y^\prime=y^2-y-2$, and describe the solution with $y(0)=0$ and with $y(0)=3$.
Equilibria $y^2-y-2=(y-2)(y+1)=0$ gives $y=-1$ and $y=2$.
Phase line Test values: $f(-2)=4\gt0$ (up), $f(0)=-2\lt0$ (down), $f(3)=4\gt0$ (up).
interval$y\lt-1$$-1\lt y\lt2$$y\gt2$
sign of $f$$+$ โ†‘$-$ โ†“$+$ โ†‘
Arrows point towards $-1$ from both sides: $y=-1$ is stable. Arrows point away from $2$ on both sides: $y=2$ is unstable.
Check by Theorem 7.3 $f^\prime(y)=2y-1$: $f^\prime(-1)=-3\lt0$ (stable) โœ“, $f^\prime(2)=3\gt0$ (unstable) โœ“.
Solutions With $y(0)=0$ the solution decreases and approaches $-1$ as $x\to\infty$ (it cannot cross the equilibrium, by Theorem 7.2). With $y(0)=3$ the solution increases without bound โ€” in fact it blows up in finite time.
โœ๏ธ Example 3 โ€” A semi-stable equilibrium
Classify the equilibria of $y^\prime=y(y-3)^2$.
Equilibria $y(y-3)^2=0$ gives $y=0$ and $y=3$.
Derivative test $f^\prime(y)=(y-3)^2+2y(y-3)$. $f^\prime(0)=9\gt0$, so $y=0$ is unstable. $f^\prime(3)=0$: inconclusive.
Phase line at $3$ $(y-3)^2\ge0$, so $f$ has the sign of $y$. For $0\lt y\lt3$: $f\gt0$, solutions rise towards $3$. For $y\gt3$: $f\gt0$, solutions rise away from $3$. Hence $y=3$ is semi-stable.
Check $f(1)=1\cdot4=4\gt0$ and $f(4)=4\cdot1=4\gt0$ โœ“; $f(-1)=-1\cdot16=-16\lt0$, so below $0$ solutions fall away from $0$ โ€” consistent with โ€œunstableโ€.
โš ๏ธ Analysis โ€” what stability means in practice

1. Stable equilibria are what we observe. A cup of coffee always ends at room temperature, whatever its starting temperature: $T=22$ is a stable equilibrium of $T^\prime=-k(T-22)$. Unstable equilibria are like a pencil balanced on its tip โ€” mathematically possible, never seen for long.

2. Semi-stable is fragile. A small disturbance on the โ€œwrongโ€ side sends the solution away for good, so in a model a semi-stable state usually signals that a parameter is sitting exactly on a tipping point.

3. Equilibria act as barriers. By uniqueness (Theorem 7.2), a solution that starts between two equilibria stays between them for ever.

Euler's Method

A direction field shows the shape of solutions; Euler's method turns it into numbers. Start at the initial point $(x_0,y_0)$. The equation tells us the slope there, $f(x_0,y_0)$. Walk a short horizontal distance $h$ along the tangent line โ€” the straight line with that slope โ€” to reach a new point $(x_1,y_1)$. Recompute the slope there and repeat. The result is a polygon (a broken line) that hugs the true solution curve when $h$ is small. It is the tangent line of Calculus I ยง3.1, used again and again: near $x_k$ the curve is close to its tangent line.

๐Ÿงญ Euler's method for $y^\prime=f(x,y)$, $y(x_0)=y_0$
Choose a step size $h\gt0$ (to reach $x=b$ in $n$ steps, take $h=\dfrac{b-x_0}{n}$). For $k=0,1,2,\dots,n-1$: $$x_{k+1}=x_k+h,\qquad y_{k+1}=y_k+h\,f(x_k,y_k).$$ Then $y_k\approx y(x_k)$. Organise the work in a table with columns $k$, $x_k$, $y_k$, $f(x_k,y_k)$, $y_{k+1}$.
โœ๏ธ Example 4 โ€” Euler's method step by step
Use Euler's method with $h=0.1$ to approximate $y(0.5)$ for $y^\prime=x+y$, $y(0)=1$. Compare with the exact solution $y=2e^x-x-1$.
Set up $f(x,y)=x+y$, $x_0=0$, $y_0=1$, $h=0.1$, $n=5$ steps.
Iterate
$k$$x_k$$y_k$$f(x_k,y_k)=x_k+y_k$$y_{k+1}=y_k+0.1f$
00111.1
10.11.11.21.22
20.21.221.421.362
30.31.3621.6621.5282
40.41.52821.92821.72102
So $y(0.5)\approx y_5=1.72102$.
Exact value First check the formula: $y^\prime=2e^x-1$ and $x+y=2e^x-1$ โœ“, $y(0)=2-0-1=1$ โœ“. Then $y(0.5)=2e^{0.5}-1.5\approx1.79744$.
Error $1.79744-1.72102\approx0.0764$. Euler underestimates here: the solution is concave up ($y^{\prime\prime}=1+y^\prime\gt0$), so each tangent line lies below the curve.
Interactive 2 โ€” Euler's Polygon versus the Exact Solution

The dark curve is the exact solution; the red polygon is Euler's method with $n$ steps of size $h$. The blue segment shows the slope $f(x_k,y_k)$ used for the current step. โ–ถ Play builds the polygon step by step and then doubles $n$ โ€” watch the error and the ratio error รท $h$.

4
step size $h$โ€”
Euler value $y_n$โ€”
exact $y(b)$โ€”
error $y(b)-y_n$โ€”
error รท $h$โ€”

How Accurate Is Euler's Method?

Each Euler step follows a tangent line instead of the curve, so it makes a small error, and the errors of the steps accumulate. Halving $h$ makes each step's error about four times smaller (a tangent-line error is roughly proportional to $h^2$), but doubles the number of steps โ€” so the total error at a fixed point is roughly halved.

๐Ÿ“ Theorem 7.4 โ€” Euler's method is first-order accurate
Suppose $f(x,y)$ and its first partial derivatives are continuous on a closed rectangle containing the graph of the exact solution $y(x)$ of $y^\prime=f(x,y)$, $y(x_0)=y_0$, for $x_0\le x\le b$. Let $y_n$ be Euler's approximation of $y(b)$ with step $h=\dfrac{b-x_0}{n}$. Then there is a constant $K$, depending on $f$, $x_0$, $y_0$ and $b$ but not on $h$, such that $$\left|y(b)-y_n\right|\le K\,h\qquad\text{for all sufficiently small }h.$$ In words: the error is proportional to $h$. Halving the step size roughly halves the error; ten times as many steps give about one more correct decimal place.
โœ๏ธ Example 5 โ€” Watching the error shrink
For $y^\prime=y$, $y(0)=1$ (exact solution $e^x$), use Euler's method to approximate $y(1)=e$ with $h=0.5,\ 0.25,\ 0.1,\ 0.05,\ 0.01$, and examine the error.
A formula Here $y_{k+1}=y_k+hy_k=(1+h)y_k$, so after $n=1/h$ steps $y_n=(1+h)^{1/h}$.
Compute
$h$$y_n=(1+h)^{1/h}$error $e-y_n$error รท $h$
0.52.250.46830.937
0.252.44140.27691.108
0.12.59370.12451.245
0.052.65330.06501.300
0.012.70480.01351.347
Interpret Each time $h$ is halved the error is roughly halved, and error รท $h$ settles down to a constant (it approaches $e/2\approx1.359$). This is Theorem 7.4 in action. Notice also that $(1+h)^{1/h}\to e$ as $h\to0^+$ โ€” Euler's method rediscovers the limit definition of $e$.
โœ๏ธ Example 6 โ€” Cooling coffee
Coffee at $90^\circ$C is placed in a $22^\circ$C room and cools according to $\dfrac{dT}{dt}=-0.08(T-22)$, $t$ in minutes. (a) Find the equilibrium and its stability. (b) Use Euler's method with $h=1$ min to estimate $T(3)$. (c) Compare with the exact solution $T=22+68e^{-0.08t}$.
a $f(T)=-0.08(T-22)=0$ at $T=22^\circ$C. $f^\prime(T)=-0.08\lt0$, so the equilibrium is stable: every cup tends to room temperature.
b $T_{k+1}=T_k-0.08(T_k-22)$:
$k$$t_k$ (min)$T_k$ (ยฐC)$f(T_k)$ (ยฐC/min)$T_{k+1}$
0090โˆ’5.4484.56
1184.56โˆ’5.004879.5552
2279.5552โˆ’4.60441674.950784
So $T(3)\approx74.95^\circ$C.
c Exact: $T(3)=22+68e^{-0.24}\approx75.49^\circ$C, so the error is about $0.54^\circ$C. Euler cools the coffee too fast, because it keeps using the steeper slope from the start of each minute while the true rate of cooling eases off.
Check $T^\prime=68(-0.08)e^{-0.08t}=-0.08(T-22)$ โœ“ and $T(0)=90$ โœ“.
โš ๏ธ Common mistakes and a warning about large steps
  • Using the slope at the new point instead of the old one: Euler's method uses $f(x_k,y_k)$, the slope where you are standing.
  • Forgetting to update $x$: the slope at step $k$ is $f(x_k,y_k)$ with $x_k=x_0+kh$, not $f(x_0,y_k)$.
  • Rounding too early: keep at least five or six significant figures in intermediate values.
  • Too large a step can be disastrous. For $y^\prime=-2y$, Euler gives $y_{k+1}=(1-2h)y_k$. With $h=1$ the factor is $-1$ and the approximations flip between $4$ and $-4$ for ever, while the true solution $4e^{-2x}$ decays smoothly to $0$. Try it in Interactive 2 with problem 4 and $n=3$.

Exercises

I
Direction fields, equilibria and stability.
  • 1 For $y^\prime=x-y$, find the slope of the direction field at $(2,1)$, $(0,3)$ and $(-1,-1)$.
  • 2 Find and classify the equilibria of $y^\prime=y(2-y)$.
  • 3 Find and classify the equilibria of $y^\prime=y^2-4$.
  • 4 Find and classify the equilibria of $y^\prime=(y-1)^2$.
  • 5 Find and classify the equilibria of $y^\prime=-3(y-5)$.
  • 6 Find and classify the equilibria of $y^\prime=y^3-y$.
  • 7 Show that $y^\prime=1+y^2$ has no equilibrium solutions. What can you say about every solution?
  • 8 For $y^\prime=y(2-y)$ describe the long-term behaviour of the solutions with $y(0)=0.5$, $y(0)=3$ and $y(0)=-0.1$.
  • 9 For $y^\prime=x^2+y^2$, on which curve are all the slopes equal to $1$? Where is the direction field horizontal?
  • 10 For $y^\prime=(y-1)(y-3)$, what happens as $x\to\infty$ to the solution with $y(0)=2$? With $y(0)=4$?
  • 11 Find and classify the equilibria of $y^\prime=\sin y$ in the range $-4\le y\le4$.
1 Slope $x-y$: at $(2,1)$ it is $1$; at $(0,3)$ it is $-3$; at $(-1,-1)$ it is $0$.
2 $y=0$ and $y=2$. $f^\prime(y)=2-2y$: $f^\prime(0)=2\gt0$, unstable; $f^\prime(2)=-2\lt0$, stable.
3 $y=\pm2$. $f^\prime(y)=2y$: $f^\prime(-2)=-4\lt0$, $y=-2$ stable; $f^\prime(2)=4\gt0$, $y=2$ unstable.
4 $y=1$; $f^\prime(1)=0$ is inconclusive. $(y-1)^2\gt0$ on both sides, so solutions increase: towards $1$ from below, away from $1$ above. Semi-stable.
5 $y=5$; $f^\prime(5)=-3\lt0$: stable.
6 $y^3-y=y(y-1)(y+1)=0$: $y=-1,0,1$. $f^\prime(y)=3y^2-1$: $f^\prime(\pm1)=2\gt0$ so $y=\pm1$ are unstable; $f^\prime(0)=-1\lt0$ so $y=0$ is stable.
7 $1+y^2\ge1\gt0$ is never zero, so there are no equilibria. Every solution has $y^\prime\ge1$: it is strictly increasing (in fact it is $y=\tan(x+C)$, which blows up in finite time).
8 $y(0)=0.5$: between $0$ and $2$, $f\gt0$, so it increases towards the stable equilibrium: $y\to2$. $y(0)=3$: above $2$, $f\lt0$, so it decreases towards $2$: $y\to2$. $y(0)=-0.1$: below $0$, $f\lt0$, so it decreases, away from $0$, without bound.
9 Slope $1$ where $x^2+y^2=1$: the unit circle. Slope $0$ only where $x^2+y^2=0$, i.e. at the origin alone.
10 Equilibria $1$ (stable, $f^\prime(1)=-2$) and $3$ (unstable, $f^\prime(3)=2$). From $y(0)=2$: $f(2)=-1\lt0$, so $y$ decreases to $1$. From $y(0)=4$: $f(4)=3\gt0$, so $y$ increases without bound.
11 $\sin y=0$ at $y=-\pi,0,\pi$ (these are the only zeros in $[-4,4]$). $f^\prime(y)=\cos y$: $\cos(\pm\pi)=-1\lt0$, so $y=\pm\pi$ are stable; $\cos0=1\gt0$, so $y=0$ is unstable.
II
Euler's method. Keep at least five decimal places in your working.
  • 1 $y^\prime=2x$, $y(0)=0$, $h=0.5$: estimate $y(2)$ and compare with the exact value.
  • 2 $y^\prime=y$, $y(0)=1$, $h=0.2$: estimate $y(1)$ and find the error.
  • 3 $y^\prime=x-y$, $y(0)=1$, $h=0.25$: estimate $y(1)$. Compare with the exact solution $y=x-1+2e^{-x}$.
  • 4 $y^\prime=-2y$, $y(0)=4$, $h=0.1$: estimate $y(0.3)$ and compare with $4e^{-0.6}$.
  • 5 $y^\prime=x^2+y^2$, $y(0)=0$, $h=0.1$: estimate $y(0.3)$. (This equation has no elementary solution formula.)
  • 6 $y^\prime=xy$, $y(0)=1$, $h=0.5$: estimate $y(1)$; the exact value is $e^{1/2}$.
  • 7 Show that Euler's method with $n$ steps for $y^\prime=y$, $y(0)=1$ gives $y(1)\approx\left(1+\tfrac1n\right)^n$. What is the limit as $n\to\infty$?
  • 8 Euler's method with $h=0.1$ gives an error of $0.12$ at $x=2$ for a certain IVP. Predict the error with $h=0.05$ and with $h=0.01$.
  • 9 Explain why Euler's method underestimates the solution of $y^\prime=y$, $y(0)=1$ for every $h\gt0$.
  • 10 Show that Euler's method for $y^\prime=ky$ gives $y_n=y_0(1+kh)^n$. For $k=-3$, for which step sizes $h$ do the approximations oscillate in sign? For which do they grow instead of decay?
Check: Euler table generator โ€” compare every row with your own working
1 $y_{k+1}=y_k+0.5(2x_k)$: $y$-values $0,\ 0,\ 0.5,\ 1.5,\ 3$. So $y(2)\approx3$; exact $y=x^2$ gives $4$; error $1$.
2 $y_{k+1}=1.2y_k$: $1,\ 1.2,\ 1.44,\ 1.728,\ 2.0736,\ 2.48832$. So $y(1)\approx2.48832$; error $e-2.48832\approx0.2300$.
3 $y_{k+1}=y_k+0.25(x_k-y_k)$: $1,\ 0.75,\ 0.625,\ 0.59375,\ 0.6328125$. Exact $y(1)=2e^{-1}\approx0.73576$; error $\approx0.1029$.
4 $y_{k+1}=0.8y_k$: $4,\ 3.2,\ 2.56,\ 2.048$. Exact $4e^{-0.6}\approx2.19525$; error $\approx0.1472$.
5 $y_1=0+0.1(0+0)=0$, $y_2=0+0.1(0.01+0)=0.001$, $y_3=0.001+0.1(0.04+0.000001)=0.0050001$. So $y(0.3)\approx0.0050$. (A very accurate numerical solution gives $y(0.3)\approx0.0090$; the step is far too coarse here.)
6 $y_1=1+0.5(0)(1)=1$, $y_2=1+0.5(0.5)(1)=1.25$. Exact $e^{0.5}\approx1.64872$; error $\approx0.399$.
7 $h=\tfrac1n$ and $y_{k+1}=\left(1+\tfrac1n\right)y_k$, so after $n$ steps $y_n=\left(1+\tfrac1n\right)^n\to e$ as $n\to\infty$.
8 Error $\approx Kh$ with $K\approx0.12/0.1=1.2$: for $h=0.05$ about $0.06$; for $h=0.01$ about $0.012$.
9 $y^{\prime\prime}=y^\prime=y\gt0$, so solutions are concave up and every tangent line lies below the curve. Each Euler step follows a tangent line and starts from a value that is already too low, so the estimates stay below the true values. (Algebraically, $(1+h)^{1/h}\lt e$ for every $h\gt0$.)
10 $y_{k+1}=y_k+hky_k=(1+kh)y_k$, so $y_n=(1+kh)^ny_0$. With $k=-3$ the factor is $1-3h$. It is negative โ€” signs alternate โ€” when $h\gt\tfrac13$. Its size exceeds $1$ โ€” the approximations grow โ€” when $|1-3h|\gt1$, i.e. $h\gt\tfrac23$. The true solution $y_0e^{-3x}$ always decays, so only $h\lt\tfrac13$ gives qualitatively correct behaviour.
III
Applications. Give units in every answer.
  • 1 Tea at $85^\circ$C cools in a $20^\circ$C room according to $\dfrac{dT}{dt}=-0.1(T-20)$ ($t$ in minutes). Use Euler's method with $h=2$ to estimate $T(6)$, and compare with the exact solution $T=20+65e^{-0.1t}$.
  • 2 For the model in part 1, find the equilibrium temperature and its stability.
  • 3 Drug infusion. A drip delivers a drug at $5$ mg/h and the body removes $25\%$ of the amount present per hour: $\dfrac{dA}{dt}=5-0.25A$, $A(0)=0$. Find the equilibrium level and its stability. Use Euler's method with $h=1$ h to estimate $A(3)$ and compare with the exact solution $A=20\left(1-e^{-0.25t}\right)$.
  • 4 Harvesting. A fish population (in thousands) obeys $\dfrac{dP}{dt}=0.5P-100$, $t$ in years. Find the equilibrium and its stability, and explain what it means for the fishery.
  • 5 Falling with air resistance. A skydiver's velocity satisfies $\dfrac{dv}{dt}=9.8-0.2v$, $v(0)=0$ (m/s). Find the terminal velocity. Use Euler's method with $h=1$ s to estimate $v(2)$; the exact value is $49\left(1-e^{-0.4}\right)$.
  • 6 Repeat the estimate in part 5 with $h=0.5$ s. By what factor did the error shrink? Is this consistent with Theorem 7.4?
1 $T_{k+1}=T_k-0.2(T_k-20)$, so $T_{k+1}-20=0.8(T_k-20)$: $85,\ 72,\ 61.6,\ 53.28$. So $T(6)\approx53.3^\circ$C. Exact $20+65e^{-0.6}\approx55.7^\circ$C; error $\approx2.4^\circ$C.
2 $T=20^\circ$C (room temperature); $f^\prime(T)=-0.1\lt0$, so it is stable.
3 Equilibrium $5-0.25A=0$: $A=20$ mg, stable ($f^\prime=-0.25\lt0$) โ€” the drug level settles at $20$ mg. Euler: $A_1=0+5=5$, $A_2=5+(5-1.25)=8.75$, $A_3=8.75+(5-2.1875)=11.5625$ mg. Exact $20\left(1-e^{-0.75}\right)\approx10.55$ mg; Euler overestimates by about $1.0$ mg.
4 $0.5P-100=0$ at $P=200$ (thousand fish). $f^\prime(P)=0.5\gt0$: unstable. Above $200\,000$ fish the population grows; below it, harvesting outpaces births and the population declines to collapse. The fishery sits on a knife-edge โ€” a small overfishing year can start an irreversible decline.
5 Terminal velocity: $9.8-0.2v=0$, $v=49$ m/s (stable). Euler: $v_1=0+1(9.8)=9.8$, $v_2=9.8+1(9.8-1.96)=17.64$ m/s. Exact $49\left(1-e^{-0.4}\right)\approx16.15$ m/s; error $\approx1.49$ m/s.
6 $v_{k+1}=0.9v_k+4.9$: $4.9,\ 9.31,\ 13.279,\ 16.8511$. Error $\approx16.851-16.154=0.70$ m/s. The error shrank by a factor of about $1.49/0.70\approx2.1$ when $h$ was halved โ€” consistent with error $\approx Kh$.
๐Ÿ”ฌ Researchโ€“Teaching NexusResearch-tutored ยท optional, about 30 minutes

Research question. If you want a cup of tea to be as cool as possible in $10$ minutes, should you add the cold milk at the start or at the end?

Why it matters. The same reasoning โ€” a cooling rate proportional to a temperature difference, solved step by step โ€” is used by engineers to design heat exchangers and electronics cooling, by food-safety agencies to set chilling times for cooked food, and by forensic scientists to estimate time of death.

What to do.

  1. Model: $200$ mL of tea at $90^\circ$C in a $22^\circ$C room, $\dfrac{dT}{dt}=-0.08(T-22)$ ($t$ in min). Adding $20$ mL of milk at $5^\circ$C instantly mixes to $T_{\text{new}}=\dfrac{200T+20\cdot5}{220}$.
  2. Option A: add milk at $t=0$, then cool for $10$ min. Option B: cool for $10$ min, then add milk.
  3. In a spreadsheet, run Euler's method for both options with $h=1$ and with $h=0.5$ min. Then use the exact solution $T=22+(T_0-22)e^{-0.08t}$ and compare.
  4. If you can, test it with a kitchen thermometer and two identical mugs; estimate $k$ for your own mug from two readings.

Tools: Spreadsheet, calculator; optionally a kitchen thermometer

Hand in: A half-page note: your Euler and exact results for both options, which option wins and by how much, and why (in terms of the direction field or the cooling rate).

Going further. Change the room temperature to that of a summer afternoon where you live, or let the room itself warm up slowly, and see whether the conclusion changes.

Instructor note: exact values are about $49.1^\circ$C for option A and $48.2^\circ$C for option B; with $h=1$ Euler gives $47.3^\circ$C for B. Adding milk late wins because hotter tea loses heat faster. Students should notice that Euler with $h=1$ overestimates the cooling but still ranks the options correctly.

๐Ÿงช Self-check quiz

0/5 correct

Q1. In the direction field of $y^\prime=xy$, the segment at $(2,-1)$ has slope

Q2. For $y^\prime=y(4-y)$, which statement is true?

Q3. One Euler step with $h=0.1$ for $y^\prime=2x+y$, $y(0)=1$ gives $y_1=$

Q4. If the step size in Euler's method is halved, the error at a fixed point is approximately

Q5. The equilibrium $y=2$ of $y^\prime=(y-2)^2$ is