The slope of the tangent line at x can be approximated by the slope of a secant line through two nearby points. Depending on which pair of nearby points we choose, we get three distinct finite difference formulas. All three use a small step size h: the smaller h is, the better the approximation (up to a limit imposed by rounding error, covered in a later section).
Forward Difference
The forward difference formula uses the current point x and the next point x+h:
f′(x)≈hf(x+h)−f(x)
It approximates the tangent slope by looking ahead by a step of size h. Geometrically, this draws a secant line connecting f(x) and f(x+h). As h shrinks, the green secant line rotates downward to match the orange tangent line.
Worked Example
Problem: Using forward difference with h=0.1, approximate f′(2) for f(x)=x3−4x+1.
Step 1 — Identify the evaluation points
x=2,x+h=2+0.1=2.1
Step 2 — Evaluate f at both points
f(2)=(2)3−4(2)+1=8−8+1=1
f(2.1)=(2.1)3−4(2.1)+1=9.261−8.4+1=1.861
Step 3 — Apply the formula
f′(2)≈0.1f(2.1)−f(2)=0.11.861−1=0.10.861=8.61
Backward Difference
The backward difference formula uses the current point x and the previous point x−h:
f′(x)≈hf(x)−f(x−h)
It approximates the tangent slope by looking behind by a step of size h. Geometrically, the secant line is drawn between the points f(x−h) and f(x).
Worked Example
Problem: Using backward difference with h=0.1, approximate f′(2) for f(x)=x3−4x+1.
Step 1 — Identify the evaluation points
x=2,x−h=2−0.1=1.9
Step 2 — Evaluate f at both points
f(2)=1(computed above)
f(1.9)=(1.9)3−4(1.9)+1=6.859−7.6+1=0.259
Step 3 — Apply the formula
f′(2)≈0.1f(2)−f(1.9)=0.11−0.259=0.10.741=7.41
Central Difference
The central difference formula uses one point ahead of x and one point behind x:
f′(x)≈2hf(x+h)−f(x−h)
Because it is symmetric around x, the secant line spans from f(x−h) all the way to f(x+h). Visually, this resulting green secant line runs nearly parallel to the true orange tangent line, bypassing the localized curvature at x.
This is why the first-order errors from both sides partially cancel each other, making central difference significantly more accurate than forward or backward difference for the same step size h.
Worked Example
Problem: Using central difference with h=0.1, approximate f′(2) for f(x)=x3−4x+1.