---
title: Equilibria and the logistic equation
heading: Where a system settles, and whether it stays there
eyebrow: A6 · Lesson 18 · Equilibria and the logistic equation
xp: 50
---

::: hook
A resistor heats up, its resistance rises, and with a fixed current it dissipates more, so it heats further. Does it settle at a warmer temperature, or run away until it burns? You can answer without solving anything. For an equation $y' = f(y)$, the places where $f(y) = 0$ are equilibria, and the sign of $f$ on either side says whether the system returns to them or flees. The logistic equation, which describes growth that saturates, is the standard example.
:::

::: play
- The curves are solutions of the logistic equation $y' = ry(1 - y/K)$ with $K$ = 1000, from three starting values: 100, 500 and 1500.
- All three head for $K$, from below or above: $K$ is a stable equilibrium. The other equilibrium, 0, repels.
- Change the growth rate $r$. It sets how fast they arrive, not where.
:::

```sim plot
view: graph
x: t = 0..20
y: y = 0..1600
slider: r = 0.2..2 = 0.5
plot: 1000/(1 + 9*exp(-r*t)) | samples: 300 | label: from 100
plot: 1000/(1 + 1*exp(-r*t)) | samples: 300 | color: ch2 | label: from 500
plot: 1000/(1 - (1/3)*exp(-r*t)) | samples: 300 | color: ch3 | label: from 1500
marker: y = 1000 | label: K
readout: time from 100 to 500 = ln(9)/r | digits: 4
```

::: predict
## For $y' = y^2 - 4$, the equilibria are $y = -2$ and $y = 2$. Which is stable?

- [x] $y = -2$
- [ ] $y = 2$
- [ ] Both
- [ ] Neither

::: reveal
$y = -2$. Just above $-2$ (say $y = -1.9$), $y^2 - 4$ is negative, so $y$ falls back toward $-2$; just below, it's positive and $y$ rises toward it. Near $+2$ it's the other way round: above 2, $y' > 0$ pushes $y$ further up. The quick test is the slope of $f$ at the equilibrium: $f'(-2) = -4 < 0$ is stable, $f'(2) = 4 > 0$ is unstable.
:::
:::

::: nameit
## Equilibria and stability

For an autonomous equation $y' = f(y)$, where the rate depends only on $y$:
- **equilibria** are the values $y_*$ with $f(y_*) = 0$: start there and you stay there;
- an equilibrium is **stable** if $f'(y_*) < 0$ (nearby values are pushed back) and **unstable** if $f'(y_*) > 0$ (they're pushed away).

A **phase line** summarizes it: mark the equilibria on the $y$ axis, and between them draw an arrow up where $f > 0$ and down where $f < 0$. Every solution moves along its arrow toward a stable equilibrium or off to infinity, never crossing an equilibrium.

## Slope fields

Drawing a short segment of slope $f(t, y)$ at many points of the $(t, y)$ plane shows the shape of every solution at once: solutions are curves that follow the segments. For autonomous equations the segments are the same along every horizontal line.

## The logistic equation

$y' = ry\left(1 - \frac yK\right)$ grows exponentially when $y$ is small and levels off at the carrying capacity $K$. Its equilibria are 0 (unstable) and $K$ (stable). Separating with partial fractions gives

$$y(t) = \frac{K}{1 + \frac{K - y_0}{y_0}e^{-rt}}$$

It rises fastest at $y = K/2$, the inflection point.

## Thermal runaway

A part with thermal resistance $\theta$ dissipates $P = P_0(1 + \alpha\Delta T)$ when it's $\Delta T$ above ambient (its resistance rises with temperature at fixed current). Its temperature rise obeys $\tau\,\Delta T' = \theta P_0(1 + \alpha\Delta T) - \Delta T$. The equilibrium is $\Delta T_* = \frac{\theta P_0}{1 - \alpha\theta P_0}$, and the slope of the right side there is $\alpha\theta P_0 - 1$. It's stable only if $\alpha\theta P_0 < 1$; otherwise the temperature runs away.
:::

::: example
## A logistic quantity has $K$ = 1000, $r$ = 0.5 and starts at 100. When does it reach 500, and where is it at $t$ = 4?

::: solution
1. **Write the solution.**
   $$y = \frac{1000}{1 + 9e^{-0.5t}}$$
2. **Find when it reaches 500.** That happens when $9e^{-0.5t} = 1$:
   $$\begin{aligned} t &= \frac{\ln 9}{0.5} \\ &= 4.39 \end{aligned}$$
3. **Evaluate at $t = 4$.**
   $$\begin{aligned} y &= \frac{1000}{1 + 9e^{-2}} \\ &= 451 \end{aligned}$$
   just before the inflection at 500, where its growth is fastest.

**Answer:** it reaches 500 at $t = 4.39$, and at $t = 4$ it's at 451.
:::
:::

::: example
## A resistor has $\theta$ = 20 °C/W, dissipates $P_0$ = 1 W when cool, and its power rises 0.4% per °C. Where does its temperature settle?

::: solution
1. **Check $\alpha\theta P_0$.**
   $$\begin{aligned} \alpha\theta P_0 &= 0.004 \times 20 \times 1 \\ &= 0.08 \end{aligned}$$
   This is less than 1, so there's a stable equilibrium.
2. **Find the equilibrium.**
   $$\begin{aligned} \Delta T_* &= \frac{20}{1 - 0.08} \\ &= 21.7\ \text{°C} \end{aligned}$$
   above ambient.
3. **Compare.** Without the temperature dependence it would be 20 °C; the feedback adds 8.7%.
4. **Check the limiting case.** If $\alpha\theta P_0$ reached 1, say with a 12.5 W part on the same heat sink, there'd be no equilibrium at all.

**Answer:** it settles 21.7 °C above ambient, 8.7% more than the 20 °C it would reach without the feedback.
:::
:::

::: example
## Find and classify the equilibria of $y' = y^2 - 4$.

::: solution
1. **Find the equilibria.**
   $$y^2 - 4 = 0 \quad\text{at}\quad y = \pm 2$$
2. **Classify them with $f'(y) = 2y$.**
   $$\begin{aligned} f'(-2) &= -4 \quad\text{stable} \\ f'(2) &= 4 \quad\text{unstable} \end{aligned}$$
3. **Describe the solutions.** Solutions starting below 2 settle at $-2$; solutions starting above 2 grow without bound (in fact they reach infinity in finite time).

**Answer:** $y = -2$ is stable and $y = 2$ is unstable.
:::
:::

::: check
given: K = 100 | 1000; y0 = 10 | 20; r = 0.2 | 1
answer: ln((K - y0)/y0)/r
tolerance: 0.5%

## A logistic quantity with $K$ = {K} and $r$ = {r} starts at {y0}. When does it reach $K/2$?

::: right
Right. $\frac{1}{r}\ln\frac{K - y_0}{y_0}$ = {answer}.
:::

::: misses
- [any] Not yet. $y = K/2$ when the denominator equals 2.
:::
:::

::: check
given: K = 100 | 1000; y0 = 10 | 20; r = 0.2 | 1; t = 2 | 5
answer: K/(1 + (K - y0)/y0*exp(-r*t))
tolerance: 0.5%

## The same logistic quantity: what is it at $t$ = {t}?

::: right
Right. {answer}.
:::

::: misses
- [any] Not yet. Use $y = \frac{K}{1 + \frac{K - y_0}{y_0}e^{-rt}}$.
:::
:::

::: check
given: th = 10 | 20 | 40; P0 = 0.5 | 1; a = 0.002 | 0.004
answer: th*P0/(1 - a*th*P0)
unit: °C
tolerance: 0.5%

## A part with $\theta$ = {th} °C/W dissipates {P0} W when cool, rising {a} per °C of its own heating. Where does its temperature rise settle?

::: right
Right. $\Delta T_* = \frac{\theta P_0}{1 - \alpha\theta P_0}$ = {answer}.
:::

::: misses
- [th*P0] That ignores the feedback: the power rises as it heats.
- [any] Not yet. Set $\theta P_0(1 + \alpha\Delta T) = \Delta T$.
:::
:::

::: check
given: a = 0.002 | 0.005; P0 = 1 | 2
answer: 1/(a*P0)
unit: °C/W
tolerance: 0.5%

## A part dissipates {P0} W cool, with power rising {a} per °C. Above what thermal resistance does it run away?

::: right
Right. Runaway when $\alpha\theta P_0 \ge 1$: $\theta \ge$ {answer}.
:::

::: misses
- [any] Not yet. The equilibrium disappears when $1 - \alpha\theta P_0 = 0$.
:::
:::

::: check
kind: choice

## For $y' = y(y - 3)$, which equilibrium is stable?

- [x] $y = 0$
- [ ] $y = 3$
- [ ] Both
- [ ] Neither

::: misses
- [2] $f'(y) = 2y - 3$, which is $+3$ at $y = 3$: unstable.
- [3] Check the sign of $f'$ at each.
- [4] $f'(0) = -3 < 0$, so 0 is stable.
:::
:::

::: check
kind: parts
given: r = 0.3 | 0.6; K = 50 | 200

## The logistic equation $y' = \given{r}y(1 - y/\given{K})$.

::: part
answer: K/2
tolerance: 0.5%

### At what $y$ does it grow fastest?

::: misses
- [K] At $K$ the growth stops.
- [any] Maximize $ry(1 - y/K)$ over $y$.
:::
:::

::: part
answer: r*K/4
tolerance: 0.5%

### What is that fastest rate?

::: misses
- [any] Put $y = K/2$ in.
:::
:::
:::

::: check
kind: derivation
vars: th = 5..50, P0 = 0.1..2, a = 0.001..0.005, d = 0..30

## Find the equilibrium of $\tau\,\Delta T' = \theta P_0(1 + \alpha\Delta T) - \Delta T$, and its stability.

::: step
answer: th*P0/(1 - a*th*P0)

### Set the right side to zero and solve for $\Delta T$. (Write $\theta$ as th, $\alpha$ as a, $\Delta T$ as d.)
:::

::: step
answer: a*th*P0 - 1

### Differentiate the right side with respect to $\Delta T$.
:::

::: right
Right. It's stable when $\alpha\theta P_0 - 1 < 0$: the feedback must be weaker than the cooling.
:::
:::

::: explain
## Why can you tell whether an equilibrium is stable from the sign of $f'(y_*)$ alone, without solving the equation?

::: model
Near an equilibrium, $f(y)$ is close to its tangent line, $f(y) \approx f'(y_*)(y - y_*)$, since $f(y_*) = 0$. So a small deviation $u = y - y_*$ obeys $u' \approx f'(y_*)\,u$, the exponential equation. If $f'(y_*) < 0$, the deviation decays like $e^{f'(y_*)t}$ and the system returns; if $f'(y_*) > 0$ it grows and the system leaves. The sign of one derivative decides it, and its size sets the time scale. This linearization is how engineers check the stability of an operating point in any circuit, thermal system or control loop, long before solving the full nonlinear equations.
:::
:::

::: practice

::: check
given: K = 10..10000; y0 = 1..9; r = 0.05..3
answer: ln((K - y0)/y0)/r
tolerance: 0.5%

## Logistic: $K$ = {K}, $y_0$ = {y0}, $r$ = {r}. When does it reach $K/2$?

::: misses
- [any] $\frac1r\ln\frac{K - y_0}{y_0}$.
:::
:::

::: check
given: th = 1..30; P0 = 0.1..2; a = 0.0001..0.005
answer: th*P0/(1 - a*th*P0)
tolerance: 0.5%

## Thermal equilibrium: $\theta$ = {th}, $P_0$ = {P0}, $\alpha$ = {a}?

::: misses
- [any] $\frac{\theta P_0}{1 - \alpha\theta P_0}$.
:::
:::
:::
