Maths WorkshopMaths problems with full solutions
Exercise 956Calculus › Single-variable calculus › Differentiation › Taylor expansionsL3Added 3 Nov 2026

Finite difference formulas for f′

#finite differences#numerical differentiation#error estimate

Statement

Let ff be sufficiently smooth. Using Taylor expansions, show that
1. f(x+h)−f(x−h)2h=f′(x)+h26f′′′(x)+O(h4)\dfrac{f(x+h)-f(x-h)}{2h}=f'(x)+\dfrac{h^2}6f'''(x)+O(h^4),
2. −f(x+2h)+8f(x+h)−8f(x−h)+f(x−2h)12h=f′(x)−h430f(5)(x)+O(h6)\dfrac{-f(x+2h)+8f(x+h)-8f(x-h)+f(x-2h)}{12h}=f'(x)-\dfrac{h^4}{30}f^{(5)}(x)+O(h^6).

Test on f=exp⁡f=\exp at x=0x=0 with h=0.1h=0.1.

Hint

In f(x+h)−f(x−h)f(x+h)-f(x-h) the even-order terms cancel.

Show solutionHide solution

Solution

1. f(x±h)=f±hf′+h22f′′±h36f′′′+h424f(4)±h5120f(5)+⋯f(x\pm h)=f\pm hf'+\frac{h^2}2f''\pm\frac{h^3}6f'''+\frac{h^4}{24}f^{(4)}\pm\frac{h^5}{120}f^{(5)}+\cdots, so
f(x+h)−f(x−h)=2hf′+h33f′′′+h560f(5)+⋯f(x+h)-f(x-h)=2hf'+\frac{h^3}3f'''+\frac{h^5}{60}f^{(5)}+\cdots
Dividing by 2h2h gives the first formula.

2. Let D(h)=f(x+h)−f(x−h)2h=f′+h26f′′′+h4120f(5)+⋯D(h)=\dfrac{f(x+h)-f(x-h)}{2h}=f'+\dfrac{h^2}6f'''+\dfrac{h^4}{120}f^{(5)}+\cdots (from part 1, pushed one order further). Consider 4D(h)−D(2h)3\dfrac{4D(h)-D(2h)}3:
- the coefficient of f′f' is 4−13=1\frac{4-1}3=1,
- the coefficient of h2f′′′h^2f''' is 4/6−4/63=0\frac{4/6-4/6}3=0,
- the coefficient of h4f(5)h^4f^{(5)} is 4/120−16/1203=−130\frac{4/120-16/120}3=-\frac1{30}.

Explicitly,
4D(h)−D(2h)3=8(f(x+h)−f(x−h))−(f(x+2h)−f(x−2h))12h,\frac{4D(h)-D(2h)}3=\frac{8\left(f(x+h)-f(x-h)\right)-\left(f(x+2h)-f(x-2h)\right)}{12h},
which is the stated formula, with error −h430f(5)(x)-\frac{h^4}{30}f^{(5)}(x).

Numerics. For f=exp⁡f=\exp, x=0x=0, h=0.1h=0.1 (exact value 11):
- formula 1 gives 1.00166751.0016675 (error 1.7⋅10−3≈h261.7\cdot10^{-3}\approx\frac{h^2}6),
- formula 2 gives 0.99999670.9999967 (error −3.3⋅10−6≈−h430-3.3\cdot10^{-6}\approx-\frac{h^4}{30}).

Remark. Cancelling terms through a clever combination gains two orders of accuracy for the price of two more function evaluations.