You're standing on a curve and can only feel the ground right under your feet — no view of the whole shape. Which way is downhill?
Drag the point along the curve. The dashed line is its tangent — tilt down to the right means the curve is falling there; tilt up means it's rising.
That tilt has a name: the derivative. It's the instantaneous rate of change of at the point —
- — the derivative of at the point : how fast changes as nudges slightly.
- — the function whose steepness we're measuring.
- — the point along the curve where the derivative is evaluated.
- Differentiate this specific curve
For the curve above, . Differentiating term by term gives:
- Read the sign
Its sign tells you the direction:
- positive means the curve rises as grows
- negative means it falls
- zero means you've hit a flat spot
Drag again — now watch the formula's value track the tangent line exactly. The derivative is the tangent's slope, nothing more.
- Evaluate the derivative at x = 5
- Read the sign
Positive, so the curve is rising there — to decrease , move in the negative direction. This one fact — "the derivative points toward increase, so step against it" — is the entire idea behind gradient descent, several chapters from now.
Drag the point until the derivative reads (approximately) zero — that’s the flat spot where the curve stops rising or falling.
The derivative is the slope of the tangent line at a point: it points in the direction the function increases fastest, and it's exactly zero at a flat spot like a minimum. The next chapter generalizes this same idea to functions of several variables at once — the gradient.