Functions, Limits, and Derivatives
Objective
Start from average slope over an interval to understand limits and derivatives. Use a derivative for local linear approximation, recognize continuous-but-nondifferentiable points, unequal left/right derivatives, and discrete jumps, and understand why numerical differences need an appropriate step.
A function maps input to output
means input produces output . In ML, can be a parameter and a loss; in retrieval, changing a threshold changes recall. Define input, output, and domain before discussing change.
From average rate to instantaneous rate
The average rate over is:
If the limit exists as approaches zero, it is the derivative:
It is the local slope near one point. If :
so . At , increasing input by about 0.01 increases output by about .
A limit is about approaching, not necessarily taking, a value. Differentiability at a point implies continuity there, but continuity does not imply differentiability: is continuous at 0 but has different left and right slopes. A function can be undefined at a point while still having a limit as it approaches it.
Local linear approximation
This is the central intuition of gradient descent: when the derivative is positive, a small move in the negative direction usually lowers the function. The approximation works only in a sufficiently small neighborhood; with a large step, higher-order curvature matters.
Minimum derivative rules
Learn product, quotient, and chain rules when needed rather than memorizing them without context; difference quotients can check results.
ML also often uses:
The logarithm’s domain and numerical stability need explicit handling. In cross-entropy implementations, use a framework’s stable composite operator rather than calculate an extremely small probability and then take a separate logarithm.
Nondifferentiability and subgradients
At 0, has left slope -1 and right slope 1, so the ordinary derivative does not exist. ReLU and L1 loss in ML also have nondifferentiable points. Implementations choose a specified subgradient or other handling. A few nondifferentiable points do not make training impossible, but the framework definition must be known.
Uses and misconceptions
- A loss derivative with respect to parameters describes the impact of a small parameter change on loss.
- A local slope on a latency-concurrency curve can indicate approaching saturation, but noisy observations need statistical treatment.
- Threshold metrics can be step functions and cannot simply inherit smooth derivatives.
- A derivative carries units: if is seconds and is cost, is cost/second. Milliseconds rescale the numerical value.
Misconceptions: a zero derivative can be a maximum, saddle point, or flat region rather than a minimum. A derivative’s existence does not imply global linearity. A finite-difference that is too large has truncation error, while one that is too small has floating-point cancellation error.
Exercises and self-check
- Derive the derivative of with a difference quotient.
- At , approximate the derivative with and observe convergence to 4.
- Calculate left and right difference quotients of at 0 and explain why it is continuous but not differentiable.
- State the domain of and describe gradient/numerical risk near 0.
- Derive how a derivative changes when input units change from seconds to milliseconds.
- I can explain a derivative from a difference quotient.
- I know local approximation requires small steps.
- I do not automatically treat a stationary point as a minimum.
- I can distinguish limit, continuity, and differentiability.
- I check derivative units, domain, and numerical step.
References
Sources were checked on 2026-07-14.
Previous: Variables, functions, graphs, and scales · Next: Partial derivatives and gradients.