---
title: Rates of change and slope
heading: How fast is it changing right now?
eyebrow: A5 · Lesson 1 · Rates of change and slope
xp: 40
---

::: hook
A capacitor charging toward 5 V climbs fast at first and slowly later. "How fast" over a stretch of time is easy: change in voltage over change in time. But how fast is it changing at one exact instant, say at $t = 1$ s, when an instant has no length? That question is where calculus begins.

::: play
- The curve is $v(t) = 5(1 - e^{-t})$ volts. The straight line passes through two points on it: one at $t_0$, the other a time $h$ later. Its slope is the average rate of change over that stretch.
- Shrink $h$ toward zero. The line pivots and settles. Compare its slope with the "tangent slope" in the strip.
- Move $t_0$. Where is the curve changing fastest?
:::
:::

```sim plot
view: graph
x: t = 0..5 s
y: v = 0..6 V
slider: t0 = 0..4 step 0.05 = 1 s
slider: h = 0.01..2 step 0.01 = 1 s
plot: 5*(1 - exp(-t)) | label: v(t)
plot: 5*(1 - exp(-t0)) + (5*(1 - exp(-t0 - h)) - 5*(1 - exp(-t0)))/h*(t - t0) | dashed | color: ch2 | label: secant
point: t0, 5*(1 - exp(-t0))
point: t0 + h, 5*(1 - exp(-t0 - h)) | color: ch2
readout: secant slope = (5*(1 - exp(-t0 - h)) - 5*(1 - exp(-t0)))/h
readout: tangent slope = 5*exp(-t0)
```

::: predict
## Set $t_0 = 1$ s and shrink $h$ toward zero. What happens to the secant's slope?

- [ ] It shrinks to zero, since the two points come together
- [x] It settles on a definite value, about 1.84 V/s
- [ ] It grows without limit
- [ ] It keeps changing, never settling

::: reveal
It settles, at about 1.84 V/s. The rise and the run both shrink to zero, but their ratio doesn't: it approaches the slope of the line that just touches the curve at $t_0$, the **tangent**. That limiting slope is the instantaneous rate of change, and it's what a meter of "volts per second" would read at that instant.
:::
:::

::: nameit
## From average rate to instantaneous rate

The **average rate of change** of $f$ from $a$ to $a + h$ is the slope of the secant line through the two points:

$$\frac{f(a + h) - f(a)}{h}$$

The **instantaneous rate of change** at $a$ is what that ratio approaches as $h$ shrinks to zero. It's the slope of the **tangent line**, written $f'(a)$:

$$f'(a) = \lim_{h \to 0} \frac{f(a + h) - f(a)}{h}$$

**An example you can do by algebra.** For $f(x) = x^2$:

$$\frac{(a + h)^2 - a^2}{h} = \frac{2ah + h^2}{h} = 2a + h$$

As $h \to 0$ this approaches $2a$, so the slope of $x^2$ at $x = a$ is $2a$. At $x = 3$ the curve climbs 6 units of $y$ per unit of $x$.

**Units.** A rate of change has the units of the output divided by the units of the input. $dv/dt$, the rate of change of a voltage, is in volts per second. The current through a wire is the rate at which charge passes, $i = dq/dt$, in coulombs per second, which is amps.

**The tangent line** at $a$ is the straight line with slope $f'(a)$ through the point $(a, f(a))$:

$$y = f(a) + f'(a)\,(x - a)$$

Close to $a$ it's an excellent stand-in for the curve. That idea, replacing a curve by its tangent line near a point, is how engineers analyze transistor amplifiers (A6 and C6).

**From measurements.** Given readings at closely spaced times, the slope between neighboring readings estimates the rate of change: $\Delta v/\Delta t$.
:::

::: example
## Find the average rate of change of $x^2$ from $x = 1$ to $x = 3$, and compare it with the slope at $x = 2$.

::: solution
1. **Average rate from 1 to 3.**
   $$\begin{aligned} \frac{\Delta y}{\Delta x} &= \frac{9 - 1}{3 - 1} \\ &= 4 \end{aligned}$$
2. **Slope at $x = 2$.** Take a tiny interval around 2:
   $$\begin{aligned} m &\approx \frac{(2.001)^2 - (1.999)^2}{0.002} \\ &= \frac{0.008}{0.002} \\ &= 4 \end{aligned}$$
3. **Why they match.** For a parabola the secant over any interval is parallel to the tangent at its midpoint, a fact lesson 28 explains.

**Answer:** the average rate of change from 1 to 3 is 4, the same as the slope at $x = 2$.
:::
:::

::: example
## A scope reads 2.10 V at 1.000 ms and 2.35 V at 1.010 ms. Estimate the rate of change.

::: solution
1. **Average rate over the 10 µs.**
   $$\begin{aligned} \frac{\Delta v}{\Delta t} &= \frac{2.35 - 2.10}{0.010 \times 10^{-3}} \\ &= \frac{0.25}{10^{-5}} \\ &= 25\,000\ \text{V/s} \end{aligned}$$
   or 25 V/ms.
2. **How good an estimate it is.** Over just 10 µs this average is a good estimate of the instantaneous rate, as long as the waveform doesn't bend much in that time.

**Answer:** the voltage is rising at about 25 000 V/s, or 25 V/ms.
:::
:::

::: example
## A battery's voltage is logged each minute while it discharges: 3.95 V at 10 min, 3.92 V at 11 min and 3.88 V at 12 min. Estimate how fast it's falling at 11 minutes.

::: solution
1. **Backward difference.** From 10 to 11 minutes:
   $$\begin{aligned} m &= \frac{3.92 - 3.95}{1} \\ &= -0.03\ \text{V/min} \end{aligned}$$
2. **Forward difference.** From 11 to 12 minutes:
   $$\begin{aligned} m &= \frac{3.88 - 3.92}{1} \\ &= -0.04\ \text{V/min} \end{aligned}$$
3. **Central difference.** It uses the points on both sides:
   $$\begin{aligned} m &= \frac{3.88 - 3.95}{2} \\ &= -0.035\ \text{V/min} \end{aligned}$$
4. **Pick the best.** The central estimate is the best of the three: its errors from the curve's bending cancel between the two sides.
5. **Check.** The voltage is falling faster as time goes on, which is why the forward difference is steeper than the backward one.

**Answer:** at 11 minutes the voltage is falling at about 0.035 V/min.
:::
:::

::: check
given: a = 1..9 int; h = 0.1 | 0.5 | 2
answer: 2*a + h
tolerance: 0.5%

## What is the average rate of change of $f(x) = x^2$ from $x = \given{a}$ to $x = \given{a} + \given{h}$?

::: right
Right. $\big((\given{a} + \given{h})^2 - \given{a}^2\big)/\given{h} = 2\cdot\given{a} + \given{h}$ = {answer}.
:::

::: misses
- [(a + h)^2 - a^2] That's the change in output. Divide it by the change in input, {h}.
- [2*a] That's the tangent slope at {a}, the limit as h goes to 0. Over a stretch of {h}, the secant is a little steeper.
- [any] Not yet. Work out $f$ at both ends, subtract, and divide by {h}.
:::
:::

::: check
given: a = -5 | -4 | -2 | 2 | 4 | 5
answer: 3*a^2
tolerance: 0.001

## By the same algebra, $\dfrac{(a + h)^3 - a^3}{h} = 3a^2 + 3ah + h^2$. What is the slope of $f(x) = x^3$ at $x = \given{a}$?

::: right
Right. As $h \to 0$ only $3a^2$ survives: {answer}.
:::

::: misses
- [a^3] That's the value of the function. The slope is how fast it changes.
- [3*a] Square the {a}: the surviving term is $3a^2$.
- [any] Not yet. Let $h$ shrink to zero in $3a^2 + 3ah + h^2$.
:::
:::

::: check
kind: expression
given: a = 1..5 int
answer: a^2 + 2*a*(x - a)
vars: x = -5..5

## Write the tangent line to $y = x^2$ at $x = \given{a}$, as a formula in $x$.

::: right
Right. It goes through $(\given{a}, \given{a}^2)$ with slope $2 \cdot \given{a}$.
:::

::: misses
- [2*a*x] That has the right slope but goes through the origin. It must pass through $(\given{a}, \given{a}^2)$.
- [a^2 + 2*a*x] Measure the run from $x = \given{a}$: use $(x - \given{a})$.
- [x^2] That's the curve itself. The tangent is the straight line that touches it at {a}.
- [any] Not yet. Use $y = f(a) + f'(a)(x - a)$ with $f'(a) = 2a$.
:::
:::

::: check
given: v1 = 2..8 sig 3; dv = 0.01..0.2 sig 2; let v2 = v1 + dv
answer: dv/1e-5
unit: V/s
tolerance: 1%

## A scope reads {v1} V at $t$ = 2.000 ms and {v2} V at $t$ = 2.010 ms. Estimate the rate of change of the voltage, in volts per second.

::: right
Right. The change is {dv} V over 10 µs, which is 0.000 01 s, so about {answer} V/s.
:::

::: misses
- [dv] That's the change in voltage. Divide by the time it took.
- [dv/0.01] The time step is 0.01 ms. In seconds that's 0.000 01 s.
- [any] Not yet. Divide the change in voltage by the change in time, in seconds.
:::
:::

::: check
kind: parts
given: a = 1 | 2 | 3; h = 0.1 | 0.5

## Take $f(x) = x^3$ near $x$ = {a}.

::: part
answer: ((a + h)^3 - a^3)/h
tolerance: 0.5%

### What is the average rate of change from {a} to $\given{a} + \given{h}$?

::: misses
- [3*a^2] That's the exact slope at {a}. Work out the difference quotient itself.
- [any] $\frac{f(a + h) - f(a)}{h}$.
:::
:::

::: part
answer: 3*a^2
tolerance: 0.5%

### What is the exact slope at {a}?

::: misses
- [any] Let $h \to 0$ in $3a^2 + 3ah + h^2$.
:::
:::

::: part
answer: 3*a*h + h^2
tolerance: 0.5%

### By how much does the average rate overshoot the slope?

::: misses
- [any] The difference quotient is $3a^2 + 3ah + h^2$; subtract $3a^2$.
:::
:::
:::

::: check
kind: derivation
vars: a = -3..3, h = 0.01..1

## Derive the slope of $x^3$ at $x = a$ from the difference quotient.

::: step
answer: 3*a^2 + 3*a*h + h^2
form: simplified

### Expand $(a + h)^3 - a^3$ and divide by $h$.
:::

::: step
answer: 3*a^2

### Let $h \to 0$.
:::

::: right
Right. The quotient is $3a^2 + 3ah + h^2$, and its limit is $3a^2$: the power rule for $n = 3$, derived.
:::
:::

::: explain
## Why does the slope of the secant line approach a definite value as $h$ shrinks, even though both the rise and the run go to zero?

::: model
Zoomed in close enough, a smooth curve looks almost straight. As the two points move together, the secant runs along a smaller and smaller piece of the curve, which is closer and closer to a straight piece, so the rise and run shrink together in a nearly fixed proportion. That proportion is the slope of the tangent line, so the ratio settles on it even though both parts vanish.
:::
:::

::: practice

::: check
given: a = -5..5 int; h = 0.1 | 0.2 | 0.5 | 1
answer: 3*a^2 + 3*a*h + h^2
tolerance: 0.5%

## What is the average rate of change of $x^3$ from $x = \given{a}$ to $x = \given{a} + \given{h}$?

::: misses
- [3*a^2] That's the tangent slope, the limit. Over a stretch of {h}, keep all the terms.
- [any] Work out $\big((\given{a} + \given{h})^3 - (\given{a})^3\big)/\given{h}$.
:::
:::

::: check
given: a = -9 | -6 | -3 | -1 | 1 | 3 | 6 | 9; m = 2..5 int
answer: 2*m*a
tolerance: 0.001

## What is the slope of $y = \given{m}x^2$ at $x = \given{a}$?

::: misses
- [m*a^2] That's the height. The slope of $x^2$ is $2x$; multiply by {m}.
- [2*a] Multiply by the constant {m} too.
- [any] The slope of $x^2$ at $a$ is $2a$; scaling the curve by {m} scales the slope.
:::
:::

::: check
given: a = 1..5 int; d = 1 | 1.5 | 2 | 2.5; let x = a + d
answer: a^2 + 2*a*(x - a)
tolerance: 0.5%

## Use the tangent line to $y = x^2$ at $x = \given{a}$ to estimate $y$ at $x = \given{x}$.

::: misses
- [x^2] That's the exact value. The tangent line gives $a^2 + 2a(x - a)$.
- [any] Use $y \approx a^2 + 2a(x - a)$.
:::
:::

::: check
given: q1 = 1..9 sig 2; dq = 1..9 sig 2; dt = 1 | 2 | 5
answer: dq/1000/(dt/1000)
unit: A
tolerance: 1%

## The charge that has passed a point rises from {q1} mC to {q1} mC + {dq} mC in {dt} ms. What average current flowed?

::: misses
- [any] Current is charge per time: divide the change in charge (C) by the time (s).
:::
:::
:::
