Reading and display settings

Appearance

System follows your operating system and keeps following it, even if you change it later. The header's sun, moon and monitor cycle the same three options.

Text size (%) 100%

Default. Scales every text size on the site, equations and tables included.

Reading width 70ch

How much text runs across one line of prose. Narrower is easier to track; wider fits more on screen.

Line spacing 1.6

The leading on body text. Taller leading helps a tired eye stay on the line.

Density

Padding and gaps around controls, cards, and tables — how much breathing room the layout leaves itself.

Motion

System follows your operating system. Reduced removes every transition on this site. Full keeps them on unless your system asks for less.

1

Average rate of change

Rise over run, over an interval

Our running example is a robot moving along a straight line. Its position at time $t$ is $s(t) = \tfrac{1}{3}t^3 - \tfrac{3}{2}t^2 + 2t$, in metres, for $t$ in seconds. Pick two times $a$ and $b$ and the average velocity over that window is the slope of the line joining the two points on the graph:

$$ \text{average velocity} \;=\; \frac{\Delta s}{\Delta t} \;=\; \frac{s(b) - s(a)}{b - a}. $$

That line is called a secant line. It tells you what constant speed would cover the same ground in the same time. Drag either endpoint; the readout names the interval, the ground covered, and the average speed over it.

Position against time. The dashed line is the secant through a and b; the triangle shows the run and the rise.

2

Shrink the interval

The difference quotient, and its limit

Hold the first time $a$ fixed and slide the second time toward it. In the language of the interval, write $b = a + h$ so that $h$ is the width of the window. The average velocity becomes the difference quotient

$$ \frac{s(a+h) - s(a)}{h}, $$

and the derivative at $a$ is what this settles on as $h$ goes to zero:

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

That is the entire definition — no new machinery beyond a limit from Part 2. Shrinking $h$ slides the secant line around the fixed point until it lines up with the tangent. Watch the secant slope and the tangent slope in the readout converge.

The secant (dashed) through a and a+h, and the tangent (solid) at a. As h shrinks the dashed line rotates onto the solid one.

💡 Why the limit exists: for a smooth curve the quotient is a continuous function of $h$ with a removable hole at $h=0$. Computing it at small $h$ instead of zero is numerical differentiation — fine for a picture, and the seed of every optimizer later on.
3

The derivative is itself a function

Slope at every point, assembled

The definition above gives a number for each choice of $a$. Let $a$ vary and those numbers assemble into a new function, $s'(t)$. The top panel is position; the bottom panel is the numerical derivative, sampled point by point with the same difference quotient. Slide $t$ and watch the two markers move together — the bottom marker's height is the slope of the top tangent.

Read the sign of the bottom curve as the robot's direction: positive means moving forward, negative means backing up, and the two places it crosses zero are where the robot is momentarily at rest.

Top: position $s(t)$ with the tangent at the current time. Bottom: its derivative $s'(t)$, computed numerically from the top curve alone.

4

When there is no derivative

Corners, cusps and jumps

The limit has to be one number. If the secant slope approaches one value from the left of $a$ and a different value from the right, the limit does not exist and the function is not differentiable there. A corner — the point of $|t-1.6|$ — is the standard example: slope $-1$ on one side, $+1$ on the other. A jump is worse: the difference quotient grows without bound. Switch the function and shrink $h$; the left and right slopes come from secant lines just either side of the probe.

The probe sits at t = 1.6. Left and right secants are drawn from a point h away on each side; where they disagree in the limit, there is no derivative.

⚠️ Differentiable implies continuous, but continuous does not imply differentiable. Both the corner and the smooth curve are continuous at the probe; only the smooth one has a derivative there.
5

The derivative is the best linear approximation

What the derivative is for

The slope is one reading of the derivative. The other, the one every later part leans on, is this: near $a$, the tangent line is the best straight-line stand-in for the curve, and the error shrinks like $h^2$ — one power faster than the distance you moved.

$$ s(a+h) \;=\; \underbrace{s(a) + s'(a)\,h}_{\text{tangent line}} \;+\; \tfrac{1}{2}s''(a)\,h^2 + \cdots $$

Move $h$ and watch the quadratic error. The ratio $\text{error}/h^2$ stays close to $\tfrac{1}{2}s''(a)$ — a constant. That is the local-linearity idea from Part 1 made quantitative, and it becomes the Taylor series of Part 7.

The curve, the tangent at a, and the prediction error at a+h drawn as a vertical bar.

6

Where this shows up

The shape of the rest of the site

Every gradient descent step is this part's tangent line: the optimizer replaces a function it cannot solve with the straight line it can, and follows the slope downhill. That is exactly Nonlinear Optimization, whose first parts assume this definition is comfortable. In machine learning the same limit, applied one composition at a time, is backpropagation — Volume II, Part 9 — and it is why training a network is just calculus done in the right order.

7

Notation to carry forward

NotationReads asWhere it comes up
f'(a), s'(t)The derivative as a function, evaluated at a pointThis volume; rates of change
df/dx, ds/dtLeibniz notation — a limit of a ratio, and the one that carries unitsRelated rates, the chain rule
Δs / ΔtAn average rate over a finite interval (the secant slope)This part, Step 1
(f(a+h) − f(a)) / hThe difference quotient whose limit defines the derivativeThe chain rule, Taylor, numerics
f ∈ C¹f is differentiable and its derivative is continuousThe regularity every solver quietly assumes
8

Further reading

9

Check your understanding

0/4 answered