Nc1, Nc2 - Forward and central difference methods
Estimate a derivative from a function or a table using forward and central differences. Choose the points and step length carefully, recognise first- and second-order behaviour in numerical output, and explain why decreasing the step eventually becomes unhelpful in limited precision.
Estimate a gradient from the point ahead
You want the gradient of at . A numerical calculation with step gives a useful answer close to . With a much smaller step, , the same calculation can give zero. How can moving the points closer together destroy the answer?
First separate the geometry from the machine arithmetic. Consider the exact values below for . We want the gradient at , but can start by measuring the rise between two nearby points.
You already know
A derivative is a tangent gradient, and the gradient between two points is change in divided by change in . Rounding stored values can lose information, especially when nearly equal numbers are subtracted. The order of a step-length method describes how its error depends on the step, rather than merely how many digits appear on screen.
A chord gives an average gradient over an interval. A forward difference uses the target point and a point to its right. For a smooth curve and a sufficiently small step, this chord gradient estimates the tangent gradient at the target.
Forward difference estimate
For a positive step , with both function values available,
The denominator is the actual separation of the two inputs. The estimate is useful when the function behaves smoothly near the target and the input values have adequate accuracy.
Not in the formula booklet: learn it.
If the function is supplied, evaluate it at the required inputs. If only data are supplied, use available inputs: a smaller step is not a licence to invent an intermediate function value.
Worked example 1: a forward step from an endpoint
Question. Use the table above to estimate by the forward difference method with .
Plan. Select the target value and the value to its right, then divide their change by .
Why this step? The derivative is being estimated at ; the forward chord must start there, rather than join two other convenient table entries.
Answer. .
Check. Differentiating the supplied function gives . The curve becomes steeper to the right, so a forward average larger than makes sense.
Change only the step length, from to . The target and function stay fixed, so the two estimates can be compared fairly.
Worked example 2: halve the forward step
Question. Use to estimate the same derivative by the forward difference method.
Plan. Keep the target value and replace the right-hand value by the one at .
Why this step? Changing the numerator without changing the denominator would no longer calculate the gradient between the selected points.
Answer. , closer to the reference value than .
Check. The estimate is still above , but is nearer to the tangent gradient as the chord shortens.
At an endpoint of a data set, a forward estimate may be possible even though a central estimate is unavailable.
Watch out
Wrong: divide by . Right: divide by . The denominator is a change in input, not the input itself.
Use a shorter interval in a fresh two-point data set.
Balance the gradient estimate about the target
A forward chord lies wholly to one side of the target. A central chord uses points on opposite sides, which usually balances much of that one-sided error. Its gradient need not be the gradient at either endpoint.
[DIAGRAM: asset_name: Forward and central chords beside the same tangent; asset_slug: h645_b131_chord_geometry; caption: Both panels use x equal to 1 and h equal to 0.4. The central chord is much closer to parallel with the tangent; description: Two plots of y equals x cubed show the tangent at the target one comma one in sage. The forward panel joins one comma one to one point four comma two point seven four four in blue and labels gradient 4.36. The central panel joins zero point six comma zero point two one six to one point four comma two point seven four four in clay and labels gradient 3.16. Both show the tangent gradient 3 and labelled horizontal spans h or 2h. The central chord does not pass through the target point.]

The central chord spans twice the step length. This is the reason for the in its denominator.
Central difference estimate
For a positive step , with both values available at equal distances from the target,
The target is the midpoint of the two inputs. As with forward differences, useful accuracy depends on smooth behaviour near the target and sufficiently accurate function values.
Not in the formula booklet: learn it.
The following exact cubic values let us compare forward and central estimates at the same target with the same .
Worked example 3: use a symmetric pair
Question. Estimate by the central difference method with . Compare its error with the forward estimate .
Plan. Use the values at and , then compare both estimates with the exact gradient .
Why this step? The numerator uses the right and left points, not the right and target points. Its denominator must cover the same interval.
Answer. . Its absolute error is , compared with for the forward estimate.
Check. The input separation is . The answer is close to the known tangent gradient.
Change only to . Both endpoints move towards the same target by the same amount.
Worked example 4: halve the central step
Question. Estimate centrally with , and compare its error with the preceding central estimate.
Plan. Select the symmetric pair and divide by their separation.
Why this step? A central step of means a total chord width of . Confusing those two lengths would double the answer.
Answer. , with absolute error .
Check. Both central estimates overestimate , and shortening the chord has reduced the discrepancy.
With a supplied function defined on both sides, you can evaluate a new symmetric pair. With a table alone, you need a symmetric pair already in that table. At its left endpoint there may be no such pair; at its right endpoint even a forward estimate may be unavailable. These are limitations of the supplied data, not evidence that the derivative fails to exist.
Watch out
Wrong: use the two nearest entries if they are at different distances from the target, and call their chord gradient a central estimate there. Right: check that the target is their midpoint before using the central formula.
Compare another central estimate with a supplied forward result.
Read the order from changing errors or differences
One successful step reduction does not establish a general pattern. Use a sequence of step lengths, keep the target fixed, and examine what happens as the step shrinks. Work with retained values, rather than repeatedly rounding the displayed output.
Order of a difference method
A method has order when, in the small-step range where its leading step-length error dominates, the magnitude of that error is approximately proportional to . The forward difference method is generally first order; the central difference method is generally second order.
“Generally” matters: a particular function or target can make an error term vanish. Poorly resolved or insufficiently smooth functions need not show the usual pattern.
This statement concerns the error caused by replacing a tangent by a finite chord. It assumes arithmetic errors are small enough not to hide that pattern.
Step reduction and empirical order
If the step-length error is approximately proportional to , reducing by a factor multiplies its magnitude approximately by
In particular, halving usually halves the forward error and quarters the central error.
Not in the formula booklet: learn it.
You are identifying an observed rate, rather than proving the order. For this investigation, the exact derivative of at is . The table displays ten decimal places; calculations retain more digits.
Worked example 5: a known reference reveals the errors
Question. The table gives estimates of the derivative of at , with their absolute errors. What order does each column suggest?
| Forward error | Central error | |||
|---|---|---|---|---|
Plan. Divide each new error by the previous error and relate the limiting ratios to the halved steps.
Why this step? A ratio has meaning only alongside the change in . Quartering an error when is halved indicates a different order from quartering it when is quartered.
Answer. The evidence suggests order for forward differences and order for central differences, in agreement with their usual behaviour.
Check. At every displayed step, the central error is smaller; its error also falls faster as is reduced.
Change only the availability of the reference derivative. Suppose the central output is known, but the exact derivative is not. Consecutive changes can still reveal an order when one leading error term dominates.
Continue this lesson.
You’re previewing NovaLearn without an account. Create a free account to read the rest.
Create free account