Part I — Calculus, Optimization & Gradients · Chapter 1

What is a derivative?

Hook

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?

Intuition

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.

Formalize

That tilt has a name: the derivative. It's the instantaneous rate of change of ff at the point xx

dfdx\frac{df}{dx}
  • df/dxdf/dx — the derivative of ff at the point xx: how fast ff changes as xx nudges slightly.
  • f(x)f(x) — the function whose steepness we're measuring.
  • xx — the point along the curve where the derivative is evaluated.
  1. Differentiate this specific curve

    For the curve above, f(x)=x24x+5f(x) = x^2 - 4x + 5. Differentiating term by term gives:

    dfdx=2x4\frac{df}{dx} = 2x - 4
  2. Read the sign

    Its sign tells you the direction:

    • positive means the curve rises as xx grows
    • negative means it falls
    • zero means you've hit a flat spot
Play
f'(5.00) = 2(5.00) − 4 = 6.00

Drag again — now watch the formula's value track the tangent line exactly. The derivative is the tangent's slope, nothing more.

Worked example
  1. Evaluate the derivative at x = 5
    f(5)=2(5)4=6f'(5) = 2(5) - 4 = 6
  2. Read the sign

    Positive, so the curve is rising there — to decrease ff, move in the negative xx direction. This one fact — "the derivative points toward increase, so step against it" — is the entire idea behind gradient descent, several chapters from now.

Checkpoint

Drag the point until the derivative reads (approximately) zero — that’s the flat spot where the curve stops rising or falling.

f'(5.00) = 6.00
Drag the point to try it
Summary
dfdx\frac{df}{dx}

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.