Difference quotient / numerical differentiation
The derivative is defined as a limit of slopes: pull a secant line tighter until its two points fuse, and its slope becomes the tangent slope. A computer cannot fuse points. Subtract two nearly equal floating-point numbers and most of the significant digits cancel, leaving rounding noise; shrink the step further and the noise eats the answer. Numerical differentiation is the craft of living with this trade.
The standard tool is the difference quotient: rise over run between two nearby points. Choose the step well and the error falls linearly — halve the step, halve the error — until rounding pushes back and the total error climbs again. The best step sits at the bottom of that U-shaped curve, closer to the square root of machine precision than to anything heroic. Central differences, which sample symmetrically on both sides, push the line further: their error falls quadratically, so each halving buys four times the accuracy at the same cost.
The deeper lesson carries through all of numerical analysis: a formula exact in the limit can misbehave badly in finite arithmetic. Designing for the computer means choosing the step where theory and rounding agree to lose least.
The interactive figure below lets you drag the step and watch truncation error and rounding error trade places.
Sources
- Textbook: Stewart, Calculus (9e), §2.7–3.1
- Course: MIT OCW 18.01 Single Variable Calculus
- Reference: Difference quotient
Terms
difference quotient ↔ Differenzenquotient;step size ↔ Schrittweite;truncation error ↔ Abbruchfehler;roundoff error ↔ Rundungsfehler