---
title: Models, Direction Fields, and Solution Curves
module: Foundations
moduleNumber: 1
lessonNumber: 1
order: 101
summary: >
  A differential equation relates an unknown function to its own rates of
  change. Three first-order models — a falling body, a cooling object, a
  population under predation — share the form dy/dt = ay - b; the slope field
  fixes their equilibria and long-run behavior before any formula is found.
  Solving the linear case gives the general solution, its integral curves, and
  the particular solution selected by an initial condition.
topics: [Foundations]
sources:
  - book: Boyce
    ref: "Ch. 1 — Introduction; §1.1 Some Basic Mathematical Models; Direction Fields"
  - book: Boyce
    ref: "§1.2 Solutions of Some Differential Equations"
  - book: Simmons
    ref: "Ch. 1 §1 Introduction; §2 General Remarks on Solutions"
---

Most laws of nature are statements about rates. Newton's second law relates the
acceleration of a body to the forces on it; the rate a population grows is tied
to its current size; heat leaves an object at a rate set by how much hotter it
is than its surroundings. Acceleration and growth rate and cooling rate are all
_derivatives_, so writing a law of this kind in symbols produces an equation
that contains derivatives of an unknown function. That is a differential
equation.[^sim-intro]

> **Definition (Differential equation).** An equation relating an unknown
> function to one or more of its derivatives. If the unknown depends on a single
> independent variable, so that only ordinary derivatives appear, the equation
> is an **ordinary differential equation** (ODE); if it depends on several
> variables and partial derivatives appear, it is a **partial differential
> equation** (PDE).

The first-order case has the form

$$
\frac{\d y}{\d t} = f(t, y),
$$

where $f$ is a given function of the independent variable $t$ and the dependent
variable $y$. Such an equation assigns a slope to every point of the plane, and
that assignment alone determines how solutions behave, often before one can be
written down.

## Building a model

A differential equation that describes a physical process is a **mathematical
model** of it.[^boyce-model] Deriving one is a fixed sequence: name the
variables, state the governing principle, and translate the principle into
symbols.

### A falling body

Suppose an object of mass $m$ falls near the earth's surface. Let $t$ be time
and $v(t)$ its velocity, positive downward. Newton's second law says mass times
acceleration equals net force, and acceleration is $\d v/\d t$:

$$
m\,\frac{\d v}{\d t} = F.
$$

Two forces act. Gravity pulls down with magnitude $mg$, where
$g \approx 9.8\ \mathrm{m/s^2}$. Air resistance opposes the motion; for a slowly
falling object it is well approximated as proportional to speed, with magnitude
$\gamma v$ for a **drag coefficient** $\gamma > 0$. Gravity acts in the positive
direction and drag in the negative, so the net force is $mg - \gamma v$ and the
model is

$$
m\,\frac{\d v}{\d t} = mg - \gamma v.
$$

The constants split into two kinds. The mass $m$ and drag coefficient $\gamma$
are **parameters**: they change from one object to another. The gravitational
acceleration $g$ is a **physical constant**, the same for every object. Taking
$m = 10\ \mathrm{kg}$ and $\gamma = 2\ \mathrm{kg/s}$ gives a concrete instance,

$$
\frac{\d v}{\d t} = 9.8 - \frac{v}{5}.
$$

### A cooling object

Newton's law of cooling states that the temperature $u(t)$ of an object changes
at a rate proportional to the difference between its temperature and the ambient
temperature $T$ of the surroundings:

$$
\frac{\d u}{\d t} = -k\,(u - T), \qquad k > 0.
$$

The sign is arranged so that an object hotter than its surroundings ($u > T$)
cools ($\d u/\d t < 0$) and a colder one warms. The same equation governs both cases.

### A population under predation

Let $p(t)$ be the size of a population that, left alone, grows at a rate
proportional to its current size, the rate constant $r$ absorbing birth and
death rates. If a predator removes members at a fixed rate $k$, the model is

$$
\frac{\d p}{\d t} = r p - k.
$$

All three models share a form. Writing the dependent variable as $y$,

$$
\frac{\d y}{\d t} = a y - b,
$$

with constants $a$ and $b$: the falling body is the case $a = -\gamma/m$,
$b = -g$; cooling is $a = -k$, $b = -kT$; the population is $a = r$, $b = k$.
One analysis covers all three.

> **Definition (Rate function).** For a first-order equation
> $\d y/\d t = f(t, y)$, the right-hand side $f$ is the **rate function**. It
> returns, at any point $(t, y)$, the slope $\d y/\d t$ that a solution passing
> through that point must have.

## Reading the slope field

The rate function turns the equation into a geometric object. At each point
$(t, y)$ of the plane, $f(t, y)$ is the slope a solution curve must have there.
Drawing a short segment of that slope at each point of a grid produces a
**direction field** (or slope field). A solution is then any curve that stays
tangent to the segments as it threads through them.[^boyce-df]

The construction never requires solving the equation. It evaluates $f$ on a grid
and draws a segment at each point — work a computer does in an instant, even for
equations no elementary method can solve.

```algorithm
caption: $\textsc{DirectionField}(f, [t_0, t_1] \times [y_0, y_1], h)$ — sample the slope field
for each grid point $(t, y)$ with $t \in [t_0, t_1]$, $y \in [y_0, y_1]$ stepped by $h$ do
  $m \gets f(t, y)$ // the slope the equation demands here
  draw a short segment centered at $(t, y)$ with slope $m$
end
```

For the falling body $\d v/\d t = 9.8 - v/5$, the slope is $1.8$ along the line
$v = 40$, drops to $-0.2$ along $v = 50$, and reaches $-2.2$ along $v = 60$.
Below some critical velocity every segment tilts upward and the object speeds
up; above it every segment tilts down and the object slows. The generic form
$\d y/\d t = a y - b$ shows the same split around a single horizontal line.

$$
% caption: Slope field of $dy/dt = 2 - y$: segments flatten toward the line
% $y = 2$, and every solution curve bends to follow them onto it.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{2A7DB0}
% slope-field segments over the grid
\foreach \t in {0,0.5,...,5}{
  \foreach \yy in {0,0.4,...,4}{
    \pgfmathsetmacro{\m}{2-\yy}
    \pgfmathsetmacro{\ang}{atan(\m)}
    \draw[black] ({\t-0.17*cos(\ang)},{\yy-0.17*sin(\ang)}) -- ({\t+0.17*cos(\ang)},{\yy+0.17*sin(\ang)});
  }
}
% equilibrium line y = 2
\draw[acc, dashed, thick] (0,2) -- (5,2);
\node[acc, anchor=west, font=\scriptsize] at (5.02,2) {equilibrium $y=2$};
% three solution curves y = 2 + (y0-2) e^{-t}
\draw[acc, very thick] plot[domain=0:5, samples=80] (\x, {2+(0.3-2)*exp(-\x)});
\draw[acc, very thick] plot[domain=0:5, samples=80] (\x, {2+(3.8-2)*exp(-\x)});
\draw[acc, very thick] plot[domain=0:5, samples=80] (\x, {2+(1.0-2)*exp(-\x)});
% axes
\draw[->, black] (0,-0.15) -- (0,4.4) node[left, font=\scriptsize] {$y$};
\draw[->, black] (-0.15,0) -- (5.3,0) node[below, font=\scriptsize] {$t$};
\end{tikzpicture}
$$

Four conclusions come straight off that picture, none of them requiring a
formula:

- **A special constant solution exists.** Where the slope is zero the segments
  are horizontal, and the horizontal line through them is itself a solution.
- **The other solutions bend toward it.** Below the line slopes are positive and
  curves rise; above it slopes are negative and curves fall.
- **Behavior is set by starting position, not by the exact start.** Two curves
  starting close together end up close together, both approaching the line.
- **The long-run value is the same for all of them.** As $t$ grows, every
  solution converges to $y = 2$.

## Equilibrium solutions

The horizontal line in the figure is an equilibrium.

> **Definition (Equilibrium solution).** A constant solution $y(t) = c$, arising
> where the rate function vanishes. For an autonomous equation $\d y/\d t = f(y)$
> the equilibria coincide with the roots of $f(y) = 0$: a constant function has
> zero derivative, so at such a point $f$ must supply zero slope to match.

For the falling body, setting $9.8 - v/5 = 0$ gives $v = 49\ \mathrm{m/s}$. The
constant function $v(t) = 49$ satisfies the equation: substitute it and both
sides are zero. Physically it is the velocity at which gravity and drag balance,
the **terminal velocity**, and every other solution approaches it. In general
$\d y/\d t = ay - b$ has the single equilibrium $y = b/a$.

Not every equilibrium attracts. The two behaviors are distinguished by the sign
of the rate function on either side of the constant line.

$$
% caption: An attracting equilibrium (left, $a<0$) pulls neighboring solutions
% in; a repelling one (right, $a>0$) pushes them away. The line is a solution in
% both panels.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{2A7DB0}
\definecolor{warn}{HTML}{B0562A}
% --- left panel: attracting ---
\begin{scope}
  \draw[->, black] (0,-0.1) -- (0,3.6) node[left, font=\scriptsize] {$y$};
  \draw[->, black] (-0.1,0) -- (4.3,0) node[below, font=\scriptsize] {$t$};
  \draw[acc, dashed, thick] (0,1.8) -- (4,1.8);
  \node[acc, anchor=south east, font=\scriptsize] at (4,1.8) {equilibrium};
  \begin{scope}
    \clip (-0.1,0) rectangle (4.2,3.5);
    \foreach \s in {0.2,0.7,2.9,3.4}{
      \draw[acc, very thick] plot[domain=0:4, samples=60] (\x, {1.8+(\s-1.8)*exp(-1.2*\x)});
    }
  \end{scope}
  \node[font=\scriptsize, align=center] at (2,-0.75) {attracting\\(stable)};
\end{scope}
% --- right panel: repelling ---
\begin{scope}[xshift=5.6cm]
  \draw[->, black] (0,-0.1) -- (0,3.6) node[left, font=\scriptsize] {$y$};
  \draw[->, black] (-0.1,0) -- (4.3,0) node[below, font=\scriptsize] {$t$};
  \draw[warn, dashed, thick] (0,1.8) -- (4,1.8);
  \node[warn, anchor=south east, font=\scriptsize] at (4,1.8) {equilibrium};
  \begin{scope}
    \clip (-0.1,0) rectangle (4.2,3.5);
    \foreach \s in {1.35,1.6,2.0,2.25}{
      \draw[warn, very thick] plot[domain=0:3, samples=70] (\x, {1.8+(\s-1.8)*exp(1.25*\x)});
    }
  \end{scope}
  \node[font=\scriptsize, align=center] at (2,-0.75) {repelling\\(unstable)};
\end{scope}
\end{tikzpicture}
$$

The falling body and cooling object have $a < 0$ and attracting equilibria: left
alone long enough, they settle. The predation model has $a = r > 0$ and a
repelling one at $p = k/r$: a population starting above it grows without bound,
one starting below it dwindles to extinction. The equilibrium is the boundary
between those two outcomes, observed in practice only if the population begins
exactly on it. This attracting-versus-repelling distinction generalizes into
[stability theory](/differential-equations/first-order/autonomous-and-population-dynamics),
which classifies equilibria systematically.

| | Attracting (stable) | Repelling (unstable) |
| --- | --- | --- |
| Slope of $f$ at equilibrium | $f'(y^\ast) < 0$ | $f'(y^\ast) > 0$ |
| Nearby solutions | converge to $y^\ast$ | diverge from $y^\ast$ |
| Falling body / cooling | terminal velocity, ambient temp. | — |
| Population under predation | — | critical population $k/r$ |
| Observed after long time | the equilibrium itself | any value but the equilibrium |

The one-dimensional summary is the **phase line**: the $y$-axis alone, marked
with the equilibria and with arrows giving the sign of the rate function between
them. For the falling body it carries a single attracting point.

$$
% caption: Phase line of the autonomous falling body $dv/dt = 9.8 - v/5$. The
% single equilibrium $v = 49$ attracts from both sides — the rate $f$ is
% positive below it and negative above it — so every solution slides onto
% terminal velocity.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{2A7DB0}
\draw[thick, black] (0,0) -- (10.6,0);
\node[black, anchor=west, font=\scriptsize] at (10.7,0) {$v$};
\foreach \x/\lab in {0/0, 4.29/30, 10/70}{
  \draw (\x,-0.08) -- (\x,0.08);
  \node[anchor=north, font=\scriptsize] at (\x,-0.14) {\lab};
}
\draw (7,-0.08) -- (7,0.08);
\fill[acc] (7,0) circle (3pt);
\node[acc, anchor=south, font=\scriptsize] at (7,0.16) {$v=49$};
\node[acc, anchor=north, font=\scriptsize] at (7,-0.58) {terminal speed};
\draw[acc, very thick, ->] (2,0.62) -- (5.6,0.62);
\draw[acc, very thick, ->] (10,0.62) -- (7.9,0.62);
\node[acc, anchor=south, font=\scriptsize] at (3.6,0.68) {$f>0$};
\node[acc, anchor=south, font=\scriptsize] at (9,0.68) {$f<0$};
\end{tikzpicture}
$$

## Solving the linear model

The equation $\d y/\d t = ay - b$ can be solved outright, confirming every
conclusion drawn from the slope field.[^boyce-sol]

> **Worked example.** Solve the field-mouse model $\d p/\d t = 0.5\,p - 450$.[^boyce-sol]
>
> Isolate the $p$-dependence, using $0.5\,p - 450 = \frac{1}{2}(p - 900)$:
>
> $$
> \frac{\d p/\d t}{p - 900} = \frac{1}{2}, \qquad p \neq 900.
> $$
>
> The left side is $\dfrac{\d}{\d t}\ln\lvert p - 900\rvert$ by the chain rule,
> so integrating both sides in $t$ gives
>
> $$
> \ln\lvert p - 900\rvert = \frac{t}{2} + C.
> $$
>
> Exponentiating and absorbing signs into a constant $c = \pm e^{C}$,
>
> $$
> p(t) = 900 + c\,e^{t/2}.
> $$
>
> The constant solution $p = 900$ is the case $c = 0$, so this one formula holds
> every solution.

The same steps applied to $\d y/\d t = ay - b$ produce

$$
y(t) = \frac{b}{a} + c\,e^{at},
$$

the equilibrium $b/a$ plus a transient $c\,e^{at}$ that decays when $a < 0$ and
grows when $a > 0$, exactly the attracting and repelling cases of the figure.

> **Definition (General solution, integral curves).** A formula containing an
> arbitrary constant that yields _every_ solution of the equation as the
> constant varies is a **general solution**. Its graph is a one-parameter family
> of curves, the **integral curves**; each value of the constant selects one
> curve.

Every solution of a first-order equation carries one arbitrary constant because
solving involves one integration, and each integration brings a constant with
it.[^sim-genl] The family fills the strip of the plane where the model applies,
one curve through each point.

$$
% caption: Integral curves $p = 900 + c\,e^{t/2}$ of $dp/dt = 0.5p - 450$. The
% equilibrium $c=0$ divides curves that rise from those that fall; the marked
% curve is the one with $p(0)=850$.
\begin{tikzpicture}[>=stealth, font=\footnotesize, xscale=1.15]
\definecolor{acc}{HTML}{2A7DB0}
\definecolor{warn}{HTML}{B0562A}
% p in [600,1200] mapped to y in [0,4] by (p-600)/150; t in [0,5]
\draw[->, black] (0,0) -- (0,4.35) node[left, font=\scriptsize] {$p$};
\draw[->, black] (0,0) -- (5.3,0) node[below, font=\scriptsize] {$t$};
\foreach \pv/\yy in {600/0,800/1.333,1000/2.667,1200/4}
  \draw (-0.06,\yy) -- (0,\yy) node[left, font=\scriptsize] {\pv};
% equilibrium p = 900 -> y = 2
\draw[black, dashed, thick] (0,2) -- (5,2);
\node[black, anchor=south west, font=\scriptsize] at (0.05,2.05) {equilibrium $p=900$};
% curves, clipped to the plot box; y = (300 + c*exp(t/2))/150
\begin{scope}
  \clip (0,0) rectangle (5,4.05);
  \foreach \c in {60,110,160}
    \draw[warn, thick] plot[domain=0:5, samples=90] (\x, {(300+\c*exp(\x/2))/150});
  \foreach \c in {-60,-110}
    \draw[acc, thick] plot[domain=0:5, samples=90] (\x, {(300+\c*exp(\x/2))/150});
  % highlighted particular solution p(0)=850, c=-50
  \draw[acc, very thick] plot[domain=0:5, samples=90] (\x, {(300-50*exp(\x/2))/150});
\end{scope}
\fill[acc] (0,1.667) circle (2.6pt);
\node[acc, anchor=west, font=\scriptsize] at (0.12,1.5) {$p(0)=850$};
\end{tikzpicture}
$$

## Initial conditions and the initial value problem

A single solution is picked out by naming a point the curve must pass through.
That extra requirement is an **initial condition**, and the equation together
with it is an **initial value problem**.

> **Worked example.** Solve the initial value problem
> $\d p/\d t = 0.5\,p - 450$, $p(0) = 850$, and find when the population becomes
> extinct.[^boyce-sol]
>
> Substituting $t = 0$, $p = 850$ into the general solution
> $p = 900 + c\,e^{t/2}$ gives $850 = 900 + c$, so $c = -50$ and
>
> $$
> p(t) = 900 - 50\,e^{t/2}.
> $$
>
> The exponential term grows, so this population declines. Setting $p(T) = 0$
> gives $50\,e^{T/2} = 900$, hence $e^{T/2} = 18$ and
> $T = 2\ln 18 \approx 5.78$ months.

> **Definition (Initial value problem).** A differential equation paired with an
> initial condition $y(t_0) = y_0$ that fixes the solution's value at one point.
> Solving it means finding the single integral curve through $(t_0, y_0)$ — the
> **particular solution** — from the general family.

| | General solution | Particular solution |
| --- | --- | --- |
| Arbitrary constant | free ($c$ ranges over $\mathbb{R}$) | fixed by $y(t_0)=y_0$ |
| Graph | family of integral curves | one curve through $(t_0, y_0)$ |
| Example | $p = 900 + c\,e^{t/2}$ | $p = 900 - 50\,e^{t/2}$ |

Whether such a problem has a solution, and only one, is the **existence and
uniqueness** question. For rate functions as well-behaved as these the answer is
yes, and the picture already assumed it: one integral curve through each point.
The precise hypotheses, and the equations where uniqueness fails, wait for a
[later lesson](/differential-equations/first-order/existence-uniqueness-euler).

## The cooling family and a worked case

The cooling model $\d u/\d t = -k(u - T)$ has the same structure, with equilibrium
$u = T$ and $a = -k < 0$, so every solution decays to ambient temperature. Its
general solution is

$$
u(t) = T + (u_0 - T)\,e^{-kt},
$$

an exponential approach to $T$ from whatever the initial temperature $u_0$ was.

$$
% caption: Cooling curves $u = 20 + (u_0 - 20)e^{-t}$ for several starting
% temperatures. Objects hotter and colder than the ambient $20$ both relax onto
% it, the difference shrinking exponentially.
\begin{tikzpicture}[>=stealth, font=\footnotesize, xscale=1.1, yscale=0.09]
\definecolor{acc}{HTML}{2A7DB0}
\draw[->, black] (0,0) -- (0,42) node[left, font=\scriptsize] {$u$};
\draw[->, black] (0,0) -- (5.3,0) node[below, font=\scriptsize] {$t$};
\foreach \uv in {10,20,30,40} \draw (-0.06,\uv) -- (0,\uv) node[left, font=\scriptsize] {\uv};
\draw[black, dashed, thick] (0,20) -- (5,20);
\node[black, anchor=south east, font=\scriptsize] at (5,20) {ambient $T=20$};
\foreach \uz in {38,32,26,14,8,2}
  \draw[acc, very thick] plot[domain=0:5, samples=70] (\x, {20+(\uz-20)*exp(-\x)});
\end{tikzpicture}
$$

> **Worked example.** A falling object of mass $m = 10\ \mathrm{kg}$ and drag
> coefficient $\gamma = 2\ \mathrm{kg/s}$ is dropped from rest, so
> $\d v/\d t = 9.8 - v/5$ with $v(0) = 0$. Find its velocity, the time to fall
> $300\ \mathrm{m}$, and its speed at impact.[^boyce-sol]
>
> Isolating and integrating as for the mouse model gives the general solution
> $v(t) = 49 + c\,e^{-t/5}$. The condition $v(0) = 0$ forces $c = -49$, so
>
> $$
> v(t) = 49\bigl(1 - e^{-t/5}\bigr).
> $$
>
> The velocity climbs from zero and levels off at the terminal
> $49\ \mathrm{m/s}$. The distance fallen satisfies $\d x/\d t = v(t)$ with
> $x(0) = 0$; integrating,
>
> $$
> x(t) = 49t + 245\,e^{-t/5} - 245.
> $$
>
> Setting $x(T) = 300$ gives $49T + 245\,e^{-T/5} - 245 = 300$, which no
> rearrangement solves in closed form. A numerical root-finder returns
> $T \approx 10.51\ \mathrm{s}$, and then $v(T) \approx 43.01\ \mathrm{m/s}$,
> just under terminal velocity.[^boyce-sol]

## Limitations of the models

A model is only as good as its assumptions, and each of these has a limited
range.[^boyce-model] The linear drag law holds for small, slow objects; a fast
one needs a drag force proportional to $v^2$, a nonlinear term that changes the
analysis. The predation model predicts unbounded growth above the equilibrium
and negative populations below it, both physically impossible past a short
horizon; the [logistic equation](/differential-equations/first-order/autonomous-and-population-dynamics)
bends growth down as crowding sets in. These first models are worth studying for
the method rather than their numbers: derive the equation from a principle, read
the slope field for equilibria and long-run behavior, then solve when the
equation is simple enough and fix the constant with an initial condition.

[^sim-intro]: **Simmons**, _Differential Equations with Applications and Historical Notes_, Ch. 1 §1 — Introduction: differential equations as the natural language of laws relating quantities to their rates of change, with the freely falling body as the opening example.
[^boyce-model]: **Boyce & DiPrima**, _Elementary Differential Equations and Boundary Value Problems_, §1.1 — Some Basic Mathematical Models: the falling-object and field-mouse derivations, the modeling steps, parameters versus physical constants, and the limitations of each model.
[^boyce-df]: **Boyce & DiPrima**, §1.1 — Direction Fields: constructing the slope field by evaluating the rate function on a grid, and drawing qualitative conclusions (equilibria, convergence) without solving.
[^boyce-sol]: **Boyce & DiPrima**, §1.2 — Solutions of Some Differential Equations: solving $\d y/\d t = ay - b$ by integration, the general solution $y = b/a + c\,e^{at}$, integral curves, the initial value problem, and the $300\ \mathrm{m}$ falling-object computation.
[^sim-genl]: **Simmons**, Ch. 1 §2 — General Remarks on Solutions: verifying solutions by substitution, the appearance of arbitrary constants equal in number to the order, and the general versus particular solution.
