Newton’s divided difference method builds the interpolating polynomial one data point at a time. You arrange the data in a divided difference table, read the coefficients off its top diagonal, and plug them into
Want to check your result? The Lagrange interpolation calculator gives the same polynomial from the same points.
p(x) = f[x0] + f[x0, x1](x − x0) + f[x0, x1, x2](x − x0)(x − x1) + …
Its big advantage over the Lagrange form is that adding a new data point only adds one new term. Everything you already calculated stays.
The first two terms of Newton’s formula are ordinary linear interpolation, the same thing our interpolation calculator does. Each extra term is a curvature correction. For the theory of why the polynomial is unique and how its error behaves, see polynomial interpolation. This article is about the working method.
What a divided difference is
- Zeroth order: f[xi] = yi, the data value itself.
- First order: f[xi, xi+1] = (f[xi+1] − f[xi]) / (xi+1 − xi), the slope between two neighbouring points.
- Second order: f[xi, xi+1, xi+2] = (f[xi+1, xi+2] − f[xi, xi+1]) / (xi+2 − xi), how fast the slope changes.
- Higher orders follow the same pattern: take the difference of two neighbouring lower-order values and divide by the gap between the outermost x values.
The x values do not need to be evenly spaced.
Worked example: air density at 2.5 km altitude
Air density from the International Standard Atmosphere (ISA) model, in kg/m³, at four altitudes. The 2 km row is deliberately missing, to show the method with uneven spacing:
| Altitude x (km) | Density f(x) (kg/m³) |
|---|---|
| 0 | 1.2250 |
| 1 | 1.1116 |
| 3 | 0.9091 |
| 4 | 0.8191 |
Values come from the ISA troposphere formula using geopotential altitude. Printed tables that list geometric altitude can differ in the fourth decimal.
Goal: estimate the density at x = 2.5 km.
Step 1: build the divided difference table
First differences (slope between neighbours):
- f[0, 1] = (1.1116 − 1.2250) / (1 − 0) = −0.1134
- f[1, 3] = (0.9091 − 1.1116) / (3 − 1) = −0.10125
- f[3, 4] = (0.8191 − 0.9091) / (4 − 3) = −0.0900
Second differences:
- f[0, 1, 3] = (−0.10125 − (−0.1134)) / (3 − 0) = 0.00405
- f[1, 3, 4] = (−0.0900 − (−0.10125)) / (4 − 1) = 0.00375
Third difference:
- f[0, 1, 3, 4] = (0.00375 − 0.00405) / (4 − 0) = −0.000075
The complete table:
| x | f[x] | 1st order | 2nd order | 3rd order |
|---|---|---|---|---|
| 0 | 1.2250 | |||
| −0.1134 | ||||
| 1 | 1.1116 | 0.00405 | ||
| −0.10125 | −0.000075 | |||
| 3 | 0.9091 | 0.00375 | ||
| −0.0900 | ||||
| 4 | 0.8191 |
The bold values along the top diagonal are the Newton coefficients.
Step 2: write the polynomial
p(x) = 1.2250 − 0.1134(x − 0) + 0.00405(x − 0)(x − 1) − 0.000075(x − 0)(x − 1)(x − 3)
Step 3: evaluate at x = 2.5, one term at a time
| Term | Calculation | Value | Running total |
|---|---|---|---|
| 1 | 1.2250 | 1.2250 | 1.2250 |
| 2 | −0.1134 × 2.5 | −0.2835 | 0.9415 |
| 3 | 0.00405 × 2.5 × 1.5 | +0.015188 | 0.956687 |
| 4 | −0.000075 × 2.5 × 1.5 × (−0.5) | +0.000141 | 0.956828 |
The ISA model’s exact value at 2.5 km is 0.956859 kg/m³, so the cubic is off by only about 0.00003.
The running total also shows how much each degree adds:
| Polynomial used | Estimate at 2.5 km | Error |
|---|---|---|
| Degree 1 (points 0, 1) | 0.9415 | 0.015359 |
| Degree 2 (points 0, 1, 3) | 0.956687 | 0.000172 |
| Degree 3 (all four points) | 0.956828 | 0.000031 |
The degree 1 line here is a poor estimate because it extrapolates from 0 and 1 km out to 2.5 km. A straight line between the two nearest points (1 km and 3 km) does much better: 0.959725, an error of 0.002866. When you only use linear interpolation, always pick the two points that bracket x.
Check it with the calculator The linear interpolation calculator shows two decimals, so enter density in g/m³ (multiply by 1000): X1 = 1, Y1 = 1111.6, X2 = 3, Y2 = 909.1, X3 = 2.5, leave Y3 empty. It returns 959.73, which is 0.95973 kg/m³. Compare that with the cubic’s 956.83 to see the size of the curvature correction.
Adding a data point without starting over
Now say you find the missing 2 km value: 1.0065 kg/m³. With Lagrange you would rebuild every basis polynomial. With Newton you add one row at the bottom of the table, compute one new diagonal of differences, and get one new coefficient:
f[0, 1, 3, 4, 2] = 0.0000125
The new term is that coefficient times the product of all previous (x − xi) factors:
0.0000125 × (2.5 − 0)(2.5 − 1)(2.5 − 3)(2.5 − 4) = 0.0000125 × 2.8125 = 0.000035
The estimate becomes 0.956828 + 0.000035 = 0.956863, now within 0.000004 of the model value. You did not redo any earlier work.
Two practical notes:
- The order of points does not change the final polynomial. It only changes the intermediate coefficients. Adding the new point at the end is the easiest way to update a table.
- A tiny new coefficient is a useful signal. If the next divided difference is close to zero, the data already behaves like a lower-degree polynomial and more points will not help much.
The forward-difference shortcut for equal spacing
Many tables use evenly spaced x values: steam tables every 5 °C, finance tables every 1 percent. With spacing h, divided differences turn into plain differences, and Newton’s formula becomes Newton’s forward difference formula:
p(x0 + s h) = y0 + s Δy0 + s(s − 1)/2! Δ²y0 + s(s − 1)(s − 2)/3! Δ³y0 + …
where s = (x − x0)/h and Δ means “next value minus this value”.
Example: density at 0.5 km from evenly spaced data
| x (km) | y | Δy | Δ²y | Δ³y |
|---|---|---|---|---|
| 0 | 1.2250 | |||
| −0.1134 | ||||
| 1 | 1.1116 | 0.0083 | ||
| −0.1051 | −0.0006 | |||
| 2 | 1.0065 | 0.0077 | ||
| −0.0974 | ||||
| 3 | 0.9091 |
Here h = 1 and s = 0.5:
- y0 = 1.2250
- s Δy0 = 0.5 × (−0.1134) = −0.0567
- s(s − 1)/2 × Δ²y0 = 0.5 × (−0.5)/2 × 0.0083 = −0.001038
- s(s − 1)(s − 2)/6 × Δ³y0 = 0.5 × (−0.5) × (−1.5)/6 × (−0.0006) = −0.000037
Total: 1.167225 kg/m³. The model value at 0.5 km is 1.167269. Plain linear interpolation between 0 and 1 km gives 1.1683, an error more than 20 times larger.
The third difference here (−0.0006) is mostly rounding noise from four-decimal data. When the highest differences in a table start jumping around in sign and size, you have reached the precision of the table, and adding more terms will not improve the answer.
Newton vs Lagrange at a glance
| Newton divided differences | Lagrange | |
|---|---|---|
| Final polynomial | Same | Same |
| Adding a point | One new term | Recompute everything |
| Hand calculation from tables | Easy, read a running total | Tedious for more than 3 points |
| Shows when to stop | Yes, small higher differences | No |
| Common use | Tables, numerical methods courses | Proofs, closed-form formulas |
For the formal definition, see Wolfram MathWorld on Newton’s divided difference formula.
FAQ
What is a divided difference table used for? It produces the coefficients of Newton’s interpolating polynomial. The top diagonal of the table gives them directly.
Do the x values need to be equally spaced? No. Divided differences work with any spacing. Equal spacing only allows the simpler forward-difference version.
How many terms should I use? Stop when the next term is smaller than the precision of your data. In table work, two or three terms are usually enough.
Is Newton’s method more accurate than Lagrange? No. Both give exactly the same polynomial. Newton’s form is just easier to compute and to extend.
What is the backward difference formula? The same idea read from the bottom of the table, using the last value and differences ending there. It is more accurate for x values near the end of a table, the same way the forward formula is best near the start. For two-input tables, see double interpolation.
To compare Newton’s form with the linear, Lagrange and bilinear formulas, see our interpolation formula page.