Chapter 10 · Introduction

Chapter 10 — Numerical Differentiation & Integration

How to differentiate and integrate a function known only through a table of values: difference quotients and their error terms, the trapezoidal and Simpson rules and their composite forms, Gauss–Legendre quadrature, and Richardson extrapolation and Romberg integration.

In the autumn of 1613 Johannes Kepler, about to marry for the second time, watched a wine merchant price his barrels by pushing a rod through the bung-hole to the far edge of the lid and reading off the length. Kepler doubted that one length could measure every barrel shape, and in his Nova stereometria doliorum vinariorum (1615) he worked out better rules for the volume of a barrel. One of them — weight the two end cross-sections by $1$, the middle one by $4$, and multiply by one sixth of the length — is still called Kepler's barrel rule in German schools. English readers know it as Simpson's rule, after Thomas Simpson, who published it in 1743, although Cavalieri and James Gregory had used it earlier. Roger Cotes extended the idea to any number of equally spaced points (published in 1722, after his early death), and in 1814 Gauss showed that if you are free to choose where to sample, $n$ well-placed points integrate every polynomial of degree $2n-1$ exactly — twice the degree you would expect.

The problem behind all of this is everywhere today. Most integrals that arise in practice have no elementary antiderivative ($\int_0^x e^{-t^2}dt$, the length of an ellipse), and most functions arrive only as numbers: a speedometer read every ten seconds, the depth of a river measured across a channel, a temperature logged every hour. Numerical differentiation and integration replace $f'(x)$ and $\int_a^b f$ by finite combinations $\sum w_if(x_i)$, and the mathematics is in the error: why the central difference beats the forward one, why Simpson's parabola rule is exact for cubics, why halving the step divides the trapezoidal error by four and Simpson's by sixteen, why too small a step makes a derivative worse, and how Richardson (1911) and Romberg (1955) turned the predictable shape of the error into a way of removing it.

table f(xᵢ)→f′ ≈ (f₁ − f₋₁)/2h: O(h²)→truncation vs rounding: best h→∫ f ≈ ∫ interpolant→trapezoid · Simpson 1/3 · 3/8→degree of precision→composite: O(h²), O(h⁴)→Gauss: n points, degree 2n − 1→Richardson · Romberg
🎯 By the end of this chapter you can…
  • derive forward, backward and central difference formulas for $f'$ and $f''$ from Taylor's theorem or from Newton's interpolation formulas, state their error terms and order, compute derivatives from a table, and find the step that balances truncation against rounding error;
  • build the trapezoidal, Simpson 1/3 and 3/8 rules (and Boole's rule) as integrals of interpolating polynomials, state their error terms, and find the degree of precision of any given rule, or the weights and nodes that make a rule exact up to a given degree;
  • apply the composite rules, explain why their errors are $O(h^2)$ and $O(h^4)$, and compute the number of subintervals that guarantees a prescribed accuracy;
  • use the two- and three-point Gauss–Legendre rules on any interval, explain why $n$ nodes give degree $2n-1$ and no more, and why the nodes are zeros of Legendre polynomials;
  • accelerate a sequence of approximations by Richardson extrapolation, build a Romberg table, and recognise its first columns as the Simpson and Boole rules.
Teaser — Where Should the Points Go? Newton–Cotes versus Gauss

Every rule here integrates $f$ over $[-1,1]$ by sampling it at a few points, passing a polynomial through the samples (shaded) and integrating that polynomial exactly. The trapezoidal rule and two-point Gauss both use two values of $f$; Simpson's rule and three-point Gauss both use three. Only the positions differ — yet compare the errors. Try the cubic and $x^4$ to see the degree of precision at work. Section 10.1 proves every number shown.

exact ∫ f—
trapezoid error—
Gauss 2 error—
Simpson error—
Gauss 3 error—

How this is examined

Numerical differentiation and integration is one of the most computational parts of the CSIR NET Unit 3 syllabus. Part B questions typically ask you to evaluate a trapezoidal or Simpson approximation from a short table or a given integrand; to find the degree of precision of a stated rule, or the weights (sometimes a node) that make a rule exact for polynomials up to some degree; to give the value of a two-point Gauss–Legendre approximation, possibly after changing the interval to $[-1,1]$; to bound the error of a composite rule or find the least number of subintervals for a required accuracy; to estimate a derivative from tabulated values by a forward or central difference; or to combine two trapezoidal values by Richardson extrapolation. Part C, where several options may be correct, tests the theory behind the recipes: which rules are exact for cubics, how the composite error scales when $h$ is halved, the sign of the trapezoidal error for a convex function, why high-order Newton–Cotes rules are not used, and why a smaller step does not always give a better derivative. The wrong options are usually one of the counterexamples in the ⚠️ box of Section 10.1. GATE MA asks very similar questions, often with numerical answers, and the same rules return in Chapter 11 as Runge–Kutta methods.

Sections in this chapter

✅ Before you start

From the CSIR NET Unit 1 course you need: Taylor's theorem with the Lagrange form of the remainder and the mean value theorem (every error term in this chapter comes from them), the intermediate value theorem, and the Riemann integral with the mean value theorem for integrals. From this course: the forward and backward differences, Newton's interpolation formulas and the interpolation error term of §9.1 — every quadrature rule here is the integral of an interpolating polynomial, and Runge's phenomenon there explains why high-order Newton–Cotes rules fail; the Legendre polynomials of §2.2, whose zeros are the Gauss nodes; and the idea of order of convergence from §7.1. Chapter 11 (§11.1) uses these rules again: Euler, Heun and RK4 reduce to the rectangle, trapezoidal and Simpson rules when $f$ does not depend on $y$. If this is your first visit, the welcome page explains how each section is organised.