---
title: What a differential equation describes
heading: A rule for how something changes, and the curves that follow it
eyebrow: A8 · Lesson 1 · What a differential equation describes
xp: 40
---

::: hook
Ohm's law tells you a current from a voltage. A capacitor's law doesn't tell you its voltage at all: it tells you how fast the voltage is *changing*, given what it is now. A rule like that, connecting a quantity to its own rate of change, is a differential equation. Its solution isn't a number but a whole curve, and you can see every possible solution at once by drawing the rule itself.

::: play
- Each little segment shows the slope that the rule $\dfrac{dv}{dt} = \dfrac{5 - v}{\tau}$ demands at that point: a capacitor charging toward 5 V.
- The curve is the solution starting at $v_0$ when $t = 0$. Move $v_0$: every start gives a different curve, but they all follow the segments.
- Start above 5 V. Which way does the curve go? Change τ: what changes about the field?
:::
:::

```sim plot
view: flow
x: t = 0..10 ms
y: v = -2..10 V
slider: v0 = -2..10 step 0.5 = 0 V
slider: tau = 0.5..4 step 0.1 = 2 ms
dx: 1
dy: (5 - v)/tau
start: 0, v0 | label: v(0)
```

::: predict
## The capacitor starts at 8 V, above the 5 V it's being pulled toward. What does its voltage do?

- [ ] Climbs further away from 5 V
- [x] Falls toward 5 V, fast at first and then more slowly
- [ ] Jumps straight to 5 V
- [ ] Stays at 8 V

::: reveal
It falls toward 5 V, quickly at first and then more slowly. Above 5 V the rule makes $dv/dt$ negative, and the farther above, the steeper the fall. Every curve, from any start, homes in on $v = 5$, where the rate is zero: the **equilibrium**. That's the shape of every RC transient.
:::
:::

::: nameit
## Equations whose unknown is a function

A **differential equation** relates an unknown function to its derivatives. Its **solution** is a function that makes the equation true at every instant. A few you'll meet constantly:

| Equation | What it describes |
|---|---|
| $\dfrac{dv}{dt} = \dfrac{V_s - v}{\tau}$ | a capacitor charging through a resistor |
| $L\dfrac{di}{dt} + Ri = V$ | current building in an inductor |
| $\dfrac{d^2x}{dt^2} + \omega_0^2 x = 0$ | a mass on a spring, or an LC circuit, oscillating |

**Order** is the highest derivative that appears: the first two are first order, the oscillator is second order. **Linear** means the unknown and its derivatives appear only to the first power, multiplied by things that don't depend on them; every equation in this course is linear except where it says otherwise.

**Checking a solution** needs no solving at all: substitute it in. For $v = 5 + (v_0 - 5)e^{-t/\tau}$, the derivative is $-\frac{v_0 - 5}{\tau}e^{-t/\tau}$, and $\frac{5 - v}{\tau}$ is the same thing, so it works, for every $v_0$.

**Initial conditions.** That "for every $v_0$" is typical: a first-order equation has a whole family of solutions, one through each starting point, and knowing where you start picks one. A second-order equation needs two starting facts, like position and velocity, or a capacitor's voltage and an inductor's current.

**Slope fields** draw the rule itself: at each point, a segment with the slope the equation demands. Solutions are curves that follow the segments everywhere. A4 showed how a computer traces them: take small steps along the local slope.
:::

::: example
## For $\frac{dv}{dt} = \frac{5 - v}{2}$ ($t$ in ms), what is the slope where $v = 8$ V?

::: solution
1. **Put $v = 8$ V into the equation.**
   $$\begin{aligned} \frac{dv}{dt} &= \frac{5 - 8}{2} \\ &= -1.5\ \text{V/ms} \end{aligned}$$
2. **Read the sign.** The slope is negative, so the voltage is falling, toward 5 V.
3. **What this shows.** The equation gives the slope at every point without being solved, which is what a slope field draws.

**Answer:** the slope is −1.5 V/ms, so the voltage is falling toward 5 V.
:::
:::

::: example
## Check that $v = 5 - 3e^{-t/2}$ solves that equation.

::: solution
1. **Differentiate the candidate.**
   $$\frac{dv}{dt} = \frac{3}{2}e^{-t/2}$$
2. **Work out the right side.**
   $$\frac{5 - v}{2} = \frac{3e^{-t/2}}{2}$$
3. **Compare.** They match, so it's a solution: the one that starts at $v(0) = 2$ V.

**Answer:** yes, $v = 5 - 3e^{-t/2}$ solves the equation; it's the solution that starts at $v(0) = 2$ V.
:::
:::

::: example
## For which $k$ does $y = e^{kt}$ solve $\ddot y - 5\dot y + 6y = 0$?

::: solution
1. **Substitute the guess.** With $\dot y = ke^{kt}$ and $\ddot y = k^2e^{kt}$, the equation becomes
   $$(k^2 - 5k + 6)e^{kt} = 0$$
2. **Solve for $k$.** The exponential is never zero, so
   $$k^2 - 5k + 6 = 0$$
   giving $k = 2$ or $k = 3$.
3. **Combine the solutions.** Both $e^{2t}$ and $e^{3t}$ are solutions, and so is any combination of them, because the equation is linear:
   $$y = c_1e^{2t} + c_2e^{3t}$$
4. **The method.** Guessing an exponential and solving for its rate is the method behind every constant-coefficient equation in this course.

**Answer:** $k = 2$ or $k = 3$, so $e^{2t}$, $e^{3t}$ and any combination $c_1e^{2t} + c_2e^{3t}$ solve it.
:::
:::

::: check
given: Vs = 4 | 6 | 8 | 10 | 12; tau = 2..5 int; v = 1 | 3 | 5 | 7 | 9 | 11 | 13
answer: (Vs - v)/tau
unit: V/ms
tolerance: 0.5%

## For $\dfrac{dv}{dt} = \dfrac{\given{Vs} - v}{\given{tau}}$ (t in ms), what is the slope of the solution passing through $v$ = {v} V, in volts per ms?

::: right
Right. The equation gives the slope directly: $(\given{Vs} - \given{v})/\given{tau}$ = {answer}.
:::

::: misses
- [(v - Vs)/tau] Check the sign: it's $V_s - v$ on top.
- [Vs - v] Divide by τ.
- [any] Not yet. Put v = {v} into the right-hand side.
:::
:::

::: check
kind: choice

## Which function solves $\dfrac{dy}{dt} = -3y$?

- [ ] $y = -3t$
- [x] $y = 4e^{-3t}$
- [ ] $y = e^{3t}$
- [ ] $y = 3e^{-t}$

::: right
Right. Its derivative is $-12e^{-3t}$, which is $-3$ times $4e^{-3t}$.
:::

::: misses
- [1] Its derivative is −3, but $-3y = 9t$. They don't match.
- [3] Its derivative is $3e^{3t} = +3y$: the sign is wrong.
- [4] Its derivative is $-3e^{-t} = -y$, not $-3y$.
:::
:::

::: check
given: v0 = 1 | 3 | 5 | 7 | 9 | 11; Vs = 4 | 6 | 8 | 10; tau = 2..5 int; t = 1..2 int
answer: Vs + (v0 - Vs)*exp(-t/tau)
tolerance: 0.5%

## A capacitor follows $\dfrac{dv}{dt} = \dfrac{\given{Vs} - v}{\given{tau}\text{ ms}}$ from $v(0)$ = {v0} V. Using the solution $v = V_s + (v_0 - V_s)e^{-t/\tau}$, what is $v$ at $t$ = {t} ms?

::: right
Right. {answer} V: the gap to {Vs} V shrinks by $e^{-t/\tau}$.
:::

::: misses
- [Vs*(1 - exp(-t/tau))] That starts from 0 V. This one starts at {v0} V.
- [v0*exp(-t/tau)] That decays toward 0. This one heads toward {Vs} V.
- [any] Not yet. Substitute into $V_s + (v_0 - V_s)e^{-t/\tau}$.
:::
:::

::: check
kind: choice

## How many starting conditions does a second-order equation like $\ddot x + \omega_0^2x = 0$ need to pick out one solution?

- [ ] One
- [x] Two
- [ ] None
- [ ] Infinitely many

::: right
Right. A second-order equation's solutions form a two-parameter family, like $A\cos\omega_0t + B\sin\omega_0t$; a starting position and a starting velocity fix both.
:::

::: misses
- [1] One condition fixes one constant; this family has two.
- [3] Without conditions you get a whole family of solutions.
- [4] Two well-chosen conditions pin it down.
:::
:::

::: check
kind: parts
given: a = 2 | 3; b = 4 | 5

## $y = e^{kt}$ is tried in $\ddot y - (\given{a} + \given{b})\dot y + \given{a}\cdot\given{b}\,y = 0$.

::: part
answer: a
tolerance: 0.5%

### What is the smaller rate $k$ that works?

::: misses
- [any] $k^2 - (a + b)k + ab = (k - a)(k - b)$.
:::
:::

::: part
answer: b
tolerance: 0.5%

### And the larger?

::: misses
- [any] The other root.
:::
:::
:::

::: check
kind: derivation
vars: a = 0.5..3, t = 0..2

## Check that $v = 5 - 3e^{-at}$ solves $\dot v = a(5 - v)$.

::: step
answer: 3*a*exp(-a*t)

### What is $\dot v$?
:::

::: step
answer: a*3*exp(-a*t)

### What is $a(5 - v)$?
:::

::: right
Right. Both sides are $3ae^{-at}$, so the curve satisfies the equation at every $t$.
:::
:::

::: explain
## Why does the equation $\dfrac{dv}{dt} = \dfrac{5 - v}{\tau}$ have many solutions, and what picks out the right one?

::: model
The equation only gives the rate of change at each value of v; it doesn't say where you start. From any starting voltage, following that rule traces out a different curve, so there's one solution for every starting value. Knowing the initial condition, the voltage at $t = 0$, picks out the one curve that passes through that point.
:::
:::

::: practice

::: check
given: k = 2..9 int; y = 1..9 int
answer: -k*y
tolerance: 0.5%

## For $\dfrac{dy}{dt} = -\given{k}y$, what is the slope where $y$ = {y}?

::: misses
- [k*y] Mind the minus sign.
- [any] Put y = {y} into $-ky$.
:::
:::

::: check
given: C0 = 2..9 int; k = 2..5 int
answer: C0
tolerance: 0.5%

## $y = Ce^{-\given{k}t}$ solves $dy/dt = -\given{k}y$ for any C. If $y(0)$ = {C0}, what is C?

::: misses
- [any] At $t = 0$, $e^0 = 1$, so $y(0) = C$.
:::
:::

::: check
kind: choice

## What is the order of $3\dfrac{d^2y}{dt^2} + \dfrac{dy}{dt} = \sin t$?

- [ ] First
- [x] Second
- [ ] Third
- [ ] It has no order

::: right
Right. The highest derivative is the second.
:::

::: misses
- [1] There's a second derivative in it.
- [3] The highest derivative is the second.
- [4] Every differential equation has an order: its highest derivative.
:::
:::
:::
