A slope is a local statement

After thiswhat you will be able to doEstimate a slope at one point with shrinking intervals and finite differences, and state why neither estimate guarantees behaviour far from that point.

Questionwhat this lesson answersWhen one quantity depends on another, how sharply does it respond to a small nudge, and what does an answer measured at one point promise about anywhere else?

Not coveredwhat this lesson leaves outWe keep one input quantity only. We do not treat quantities depending on several inputs, prove any limit result, give general rules for differentiating expressions beyond the worked case and the chain rule as stated, cover integration, or develop what happens when a quantity has no slope at a point beyond noting that such points exist.

A lift’s height depends on how much time has passed. Its height tells you where the cabin is, but not whether it is crawling toward a floor or passing it quickly. That needs a second quantity: how sharply the height responds when time advances.

Suppose the lift rises from 8m\SI{8}{m} at 2s\SI{2}{s} to 20m\SI{20}{m} at 6s\SI{6}{s}. Divide the height gained by the time taken:

20m8m6s2s=12m4s=3m/s.\dfrac{\SI{20}{m}-\SI{8}{m}}{\SI{6}{s}-\SI{2}{s}} =\dfrac{\SI{12}{m}}{\SI{4}{s}} =\SI{3}{m/s}.

The stretch from one time to the other is an interval. The quotient is the average rate over that interval. It answers exactly how much height was gained per second across the whole stretch.

The interval is the problem

That average does not say what happened at any one instant. One lift could move steadily. Another could wait, then move twice as fast:

steady motion: 3m/s×4s=12m,wait, then move: 0m/s×2s+6m/s×2s=12m.\begin{aligned} \text{steady motion: } &\SI{3}{m/s}\times\SI{4}{s}=\SI{12}{m},\\ \text{wait, then move: } &\SI{0}{m/s}\times\SI{2}{s} +\SI{6}{m/s}\times\SI{2}{s}=\SI{12}{m}. \end{aligned}

Both average 3m/s\SI{3}{m/s} across 4s\SI{4}{s}. For the first 2s\SI{2}{s}, one is moving and the other is not. An answer about the interval cannot choose between them.

Shrink the interval

Take a simple rule that assigns one output to each input, called a function: f(x)=x2{f(x)=x^2}. Ask how sharply its output responds at x=3{x=3}. Compare the output there with the output a positive width hh to the right. The average rate is

f(3+h)f(3)h=(3+h)232h=6+h.\begin{aligned} \dfrac{f(3+h)-f(3)}{h} &=\dfrac{(3+h)^2-3^2}{h}\\ &=6+h. \end{aligned}

Now shrink the width while keeping the starting point fixed:

h=1:average rate=7,h=0.1:average rate=6.1,h=0.01:average rate=6.01,h=0.001:average rate=6.001.\begin{aligned} h=1 &:\quad \text{average rate}=7,\\ h=0.1 &:\quad \text{average rate}=6.1,\\ h=0.01 &:\quad \text{average rate}=6.01,\\ h=0.001 &:\quad \text{average rate}=6.001. \end{aligned}

The rates settle toward 6{6}. Letting a changing number settle toward one value as hh shrinks is the process called taking a limit. This lesson uses that process without building its proof. The settled value is the slope at the point. The result of finding such a slope is called the derivative, so here f(3)=6{f'(3)=6}. Some rules have a corner or a break where the shrinking rates do not settle. They have no slope at that point; their treatment stops outside this lesson.

What one point promises

At x=3{x=3} the function value is 9{9} and the slope is 6{6}. Draw a straight line through that point with that slope:

L(x)=9+6(x3).L(x)=9+6(x-3).

This line matches the function’s first response to a small nudge. A line chosen this way is called the tangent. It is the straight-line stand-in for the curved quantity near the chosen point.

Near the point, the agreement is close. Farther away, it is not:

xf(x)L(x)difference3.19.619.60.01525214\begin{array}{c|c|c|c} x & f(x) & L(x) & \text{difference}\\ \hline 3.1 & 9.61 & 9.6 & 0.01\\ 5 & 25 & 21 & 4 \end{array}

No distance is guaranteed. How far the line can be trusted depends on the function and on how much error the question allows, so it has to be checked. The slope at one point says nothing whatever about behaviour far away: the function could be changed outside a small neighbourhood without changing either its value or slope at the measured point. The farther you carry the tangent, the less its local promise is worth. Treating one slope as a rule for the whole function is the common mistake.

A slope of zero is equally local. It says a small nudge from either direction has no straight-line response there. The rule x2x^2 has zero slope at its lowest point. The rule x2-x^2 has zero slope at its highest point. The rule x3x^3 also has zero slope at 0{0}, but it rises from negative values to positive values through that point, so the point is neither highest nor lowest. Zero slope alone cannot tell these cases apart.

Responses multiply

One output can feed the next rule. At x=1{x=1}, the rule x2x^2 turns a small input change into about twice that change. Its output, also 1{1}, then enters the rule that cubes it, where a small change becomes about three times as large. The response from the first input to the last output is

first response=2,second response=3,whole response=2×3=6.\begin{aligned} \text{first response} &= 2,\\ \text{second response} &= 3,\\ \text{whole response} &= 2\times3=6. \end{aligned}

The factor relating one small change to the next is its sensitivity. When quantities feed one another in a chain, their sensitivities multiply along the route. This multiplication rule is called the chain rule. It is stated here and not proved here.

When only evaluation is available

If you have a formula for a function, its slope can often be worked out exactly. Sometimes all you have is a procedure you can run: supply an input and receive an output. Then evaluate it at xx and again at x+h{x+h}, subtract, and divide by the nudge:

Dhf(x)=f(x+h)f(x)h.D_h f(x)=\dfrac{f(x+h)-f(x)}{h}.

This uses a nonzero interval, so it is called a finite difference. Shrinking hh usually removes more of the interval error. On a real computer that improvement has a limit.

Use the same bowl shifted upward by one trillion, F(x)=1012+x2{F(x)=10^{12}+x^2}. The shift changes no exact slope, so at x=3{x=3} the slope is still 6{6}. But the computer must subtract two stored numbers near 1012{10^{12}}. The distance from an estimate to 6{6}, without regard to which side it falls on, is called its absolute error. These are the results from the solver used below:

hestimated slopeabsolute error0.16.0998535156250.0998535156250.016.0058593750.0058593750.0015.98144531250.01855468750.00016.1035156250.1035156250.0000106\begin{array}{c|c|c} h & \text{estimated slope} & \text{absolute error}\\ \hline 0.1 & 6.099853515625 & 0.099853515625\\ 0.01 & 6.005859375 & 0.005859375\\ 0.001 & 5.9814453125 & 0.0185546875\\ 0.0001 & 6.103515625 & 0.103515625\\ 0.00001 & 0 & 6 \end{array}

Among the tested sizes, the best nudge is 0.01{0.01}, with error 0.005859375{0.005859375}. It is positive, not the smallest available, and not extremely tiny. Below it, subtracting nearly equal stored numbers loses useful digits faster than the shorter interval removes error. That limit on stored detail is called precision. By h=0.00001{h=0.00001} both outputs are stored as the same number, so the estimated slope is zero. The error curve has turned around.

This search can name its best nudge because the exact slope of the toy rule is known. If a procedure can only be evaluated, the true error column is hidden too. You try several nudge sizes and look for the range where the estimate stops stabilising. The useful size depends on the scale of the outputs and the arithmetic doing the subtraction.

One point, shrinking intervals

Closer helps, until the arithmetic turns

The drawn curve has the shape x squared. Its stored output also includes one trillion, hidden here because moving a whole curve vertically does not change its slope. Move the point or shrink the nudge. The left plot compares the two lines. The right plot keeps the whole error curve visible, including its turn.

Two points close onto one

The solid interval line uses the two values the computer stored. The dashed line is the exact line that touches at the movable point.

Interval line closing onto a touching lineThe curve is x squared with a hidden baseline of 1 × 10¹². At x 3, the exact touching line has slope 6. The line through the stored point and the point 1 × 10⁻² to its right has slope 6.0058594 and error 5.859375 × 10⁻³.inputoutput above hidden baseline

The error has a bottom

Nudge size shrinks from left to right. Lower is better. The marked bottom is found by testing every shown size, not by assuming the smallest wins.

Finite difference error turns upwardThe error falls to 5.859375 × 10⁻³ at nudge 1 × 10⁻², then rises for smaller tested nudges. The selected nudge is 1 × 10⁻², which is the best tested nudge.minimumlarger nudgesmaller nudgeerror, logarithmic height
Nudge
1 × 10-2
Estimated slope
6.0058594
Exact slope
6
Absolute error
5.859375 × 10-3
The reversalAt this point, the lowest tested error is 5.859375 × 10-3 at a nudge of 1 × 10-2. Every candidate far enough to its right is smaller and worse.

This is the lowest tested error. The nudge is positive and visibly not the smallest available.

Doorswhat to read next, and why

Symbolswhat each one means, and whether we defined it, measured it, or just started there

xStatus: defined
The symbol x is defined as the single input quantity whose change is being followed.
f(x)Status: defined
The expression f(x) is defined as the output quantity assigned to input x by the rule under study.
R[a,b]Status: defined
The average rate R[a,b] over the interval from a to b is defined as the output change f(b) minus f(a), divided by the input change b minus a.
h -> 0Status: door
Letting the nonzero interval width h shrink toward zero uses a limit, and the general meaning and proof machinery of that process are not built here.
f'(x_0)Status: defined
The derivative f'(x_0) is defined as the single value approached by the average rates over shrinking intervals at the point x_0, when they settle.
L_{x_0}(x)Status: defined
The line L at x_0 is defined to pass through f(x_0) with slope f'(x_0), so it is the straight-line stand-in that agrees with the quantity near that point.
the useful range of LStatus: empirical
How far the straight-line stand-in remains accurate depends on the particular quantity and required accuracy, so its useful range is found by checking rather than guaranteed by the slope.
f'(x_0) = 0Status: defined
A zero slope is defined to mean that the straight-line response to a small input nudge is zero at x_0, without classifying that point as high, low, or neither.
S[z<-x] = S[z<-y] S[y<-x]Status: defined
The chain rule is defined here as the rule that sensitivities multiply when a change in x passes through y before reaching z; this lesson states the rule and does not prove it.
D_h f(x)Status: defined
The finite difference D_h f(x) is defined as f(x+h) minus f(x), divided by the positive nudge h, and estimates the point slope from two evaluations.
h_bestStatus: empirical
The best nudge size is the tested positive h with the least error, and its value depends on the scale of the calculation and the arithmetic the machine actually performs.
What these classifications mean
defined
circular by construction, true because we chose it
empirical
a measured claim about the world that could have come out otherwise
bottoms out
a primitive of the model, with nothing under it here
door
used here, explained elsewhere