A derivative is a local rate of change, but a computer often receives only finitely many function values. Numerical differentiation chooses sample locations and weights, then asks how accurate that combination remains in finite precision.
Lecture note Sections 4.1–4.4 are the primary source: is the sample spacing; , , and denote forward, backward, and centred differences. The second-derivative formula is . Every required sample must lie in the function’s domain. The basic difference names follow the lecture note; we add the argument to its and similar notation to expose step dependence. Labels such as and are auxiliary notation defined here. Workbooks and slides supply supplementary derivations and examples [1][1] S. Rojas, “Lecture Notes on Computational Mathematics,” 2025. Course lecture note distributed with MTH2051; local source course-lecture-notes.pdf., [2][2] M. U. School of Mathematics, “MTH2051: Introduction to Computational Mathematics: Course Lecture Notes and Study Workbooks,” 2026. Monash University course materials and study workbooks, Semester 2, 2026., [3][3] R. L. Burden and J. D. Faires, Numerical Analysis, 9th ed. Brooks/Cole, Cengage Learning, 2011..
Taylor’s theorem gives the basic formulas
Whenever the required samples exist, define
Assume for the one-sided formulas and for the centred formula. There are points in the respective sampling intervals such that
Taylor’s theorem with a Lagrange remainder gives
Rearrange and divide by . Expanding gives the backward formula; its linear term changes sign while its quadratic term does not.
For the centred formula, keep separate cubic remainders:
Subtracting cancels the even terms. The remainder contains the average of two values of . Continuity and the intermediate value theorem identify this average with at a point between them. Division by proves the claim.
The basic one-sided formulas have accuracy order one; the centred formula has order two. Accuracy order and derivative order are different concepts. For a convex function, the forward formula overestimates the derivative and the backward formula underestimates it, directly from the signs above.
Differentiate an interpolating polynomial
Polynomial interpolation gives another construction: build through the samples and evaluate . Following lecture note Section 5.1, lowercase denotes a general interpolating polynomial of degree at most ; uppercase is reserved for Legendre polynomials.
Let , let be distinct, and assume on their convex hull. Write
At any node , there is a point in the node interval with
Distinct nodes give . Set
All nodes are zeros of , and . There are at least zeros counting multiplicity. Repeated Rolle’s theorem gives . Since and , the claimed value of follows.
This does not differentiate an unknown remainder location . Differentiating the pointwise interpolation remainder while treating that location as constant is invalid.
For nodes , the differentiated Lagrange weights at the left endpoint are :
The nodal theorem gives
At the right endpoint use
with the same signed remainder . The three-point centred formula is ; its middle sample has weight zero.
The five-point centred and forward formulas are
For , their errors are
The constants follow from at the centred node and at the forward endpoint, divided by . A backward five-point formula follows by replacing with throughout the forward formula, including its denominator.
These three- and five-point formulas are the derivatives of the corresponding Lagrange interpolants.
Write nodes as . Their basis polynomials satisfy
Differentiate with respect to and multiply by to obtain the weights. An independent check is polynomial reproduction: a formula must satisfy
The three-point forward weights have moments . The five-point centred weights and forward weights both have moments . Two weight vectors satisfying these conditions agree on every Lagrange basis polynomial, hence agree componentwise. This proves uniqueness.
Second derivatives and general moment conditions
Define
If , there is such that
Expand each side through the cubic term, with fourth-order Lagrange remainders. Addition cancels the odd terms. Subtract and divide by . The remainder is times an average of two fourth derivatives; continuity and the intermediate value theorem give the stated location.
Section 4.3 also gives the five-point centred second derivative. We introduce the auxiliary name :
For , as ,
Offsets have weights . Their moments through degree five are ; the sixth moment is . Taylor expansion through degree six, divided by , gives and the term . Continuity of the sixth derivative gives a remainder .
At a boundary, a four-point forward second-derivative formula is
under . The weights have moments through degree three and moment at degree four. Taylor substitution gives ; the fifth-order remainder divided by is .
More generally, approximate an th derivative with . To achieve order , match moments through degree : only the degree- moment is nonzero, with value . Taylor’s theorem then gives an error when the necessary derivatives are continuous and bounded. More samples alone do not guarantee higher accuracy.
Smaller steps can give larger errors
Following Section 4.4, denotes machine precision. Suppose each sampled value has absolute error at most . The centred first derivative amplifies these perturbations by at most . The centred second derivative has bound . These are sample-perturbation bounds; argument rounding and arithmetic introduce additional terms.
For positive and , the model
has a unique minimum for , at
The derivative is , with the sign of the strictly increasing expression . It crosses zero exactly once, from negative to positive. The model diverges at both ends, so this point is the unique global minimum. Substitution gives a minimum of order , with constants depending on .
For a second derivative, the perturbation term scales as , giving a model optimum proportional to . The first-derivative scaling does not apply. Actual floating-point errors may oscillate or vanish accidentally; a U-shaped envelope is a trend model.
Experiment: truncation and rounding
This interactive figure needs JavaScript.
The experiment uses at , where both derivatives equal one. Halve a moderate step: forward error falls by roughly two, centred error by roughly four. Continue reducing the step and compare the measured error with the illustrative envelope. Switch to a second derivative to see stronger perturbation amplification.
| Formula | Approximation at | Absolute error from one |
|---|---|---|
| Forward | 1.051709181 | 0.051709181 |
| Centred | 1.001667500 | 0.001667500 |
| Five-point centred | 0.999996663 | 0.000003337 |
These values check the derivation; they do not replace the error theorems. For measured data, also inspect noise and whether the sampling geometry matches the formula.
Choosing a formula
Start with a centred formula at an interior point when the function is smooth; use a one-sided formula at a boundary. Check sample availability before choosing accuracy order, then estimate derivative and noise scales. Richardson extrapolation can remove a leading error term under a suitable expansion. It cannot remove arbitrary measurement noise.
References
- [1] S. Rojas, “Lecture Notes on Computational Mathematics,” 2025. Course lecture note distributed with MTH2051; local source course-lecture-notes.pdf. ↩
- [2] M. U. School of Mathematics, “MTH2051: Introduction to Computational Mathematics: Course Lecture Notes and Study Workbooks,” 2026. Monash University course materials and study workbooks, Semester 2, 2026. ↩
- [3] R. L. Burden and J. D. Faires, Numerical Analysis, 9th ed. Brooks/Cole, Cengage Learning, 2011. ↩
Comments