Taylor and the truncation error

Taylor's theorem and its remainder, why the remainder is the truncation error, and how finite differences arise from it.

Taylor's theorem

The Taylor series expands a function around a point a as a polynomial. Taking only the first n terms incurs a truncation error, which the theorem quantifies with a remainder term.

If x−a is of the order of a step h, the remainder is of order h^{n+1}. That exponent is the order of the method, and Taylor is the tool that justifies it in finite differences, quadrature and ODEs.

From Taylor to finite differences

To approximate derivatives we discretize the interval into equally spaced nodes xi=a+ihx_i=a+ih, with step h=banh=\frac{b-a}{n}. Truncating Taylor at first order between neighbouring nodes yields the finite differences, studied in detail in numerical differentiation.

xi=a+ih,h=ban,i=0,1,,nx_i=a+ih,\qquad h=\frac{b-a}{n},\qquad i=0,1,\dots,n
DerivationDerivation: finite differences from TaylorView as its own page →
  1. Take Taylor with a=xia=x_i and x=xi+1x=x_{i+1}, keeping first order. Solving for the derivative gives the forward difference:

    f(xi+1)=f(xi)+f(xi)(xi+1xi)+R1  f(xi)f(xi+1)f(xi)xi+1xif(x_{i+1})=f(x_i)+f'(x_i)(x_{i+1}-x_i)+R_1\ \Longrightarrow\ f'(x_i)\approx\frac{f(x_{i+1})-f(x_i)}{x_{i+1}-x_i}
  2. With a=xi1a=x_{i-1} and x=xix=x_i (looking backward) we get the backward difference:

    f(xi)f(xi)f(xi1)xixi1f'(x_i)\approx\frac{f(x_i)-f(x_{i-1})}{x_i-x_{i-1}}
  3. Subtracting the forward minus the backward expansion cancels the even term and yields the central difference, more accurate. With equally spaced nodes (step h), x_{i+1}−x_{i−1}=2h:

    f(xi)f(xi+1)f(xi1)xi+1xi1=f(xi+1)f(xi1)2hf'(x_i)\approx\frac{f(x_{i+1})-f(x_{i-1})}{x_{i+1}-x_{i-1}}=\frac{f(x_{i+1})-f(x_{i-1})}{2h}