A difference table is a discrete derivative

Subtract consecutive terms of a sequence, then repeat. For a polynomial sequence, each pass removes one degree until only a constant remains. When the sequence counts genuinely nested stages, the first differences have an even more literal meaning: they count the points added in each new layer. Without nesting, they record only net change.

Start with the triangular numbers:

1, 3, 6, 10, 15, 21,…1,\ 3,\ 6,\ 10,\ 15,\ 21,\ldots

Subtract each term from the next. Then do the same to the new row.

Difference table of the triangular numbers
The triangular numbers have counting numbers as their first differences, constant second differences, and zero third differences.
Reproduce this figure
Download source bundleextract, then runtar -xf difference-tables-triangular_diff.tar && cd difference-tables-triangular_diff/difference-tables && typst compile triangular_diff.typ triangular_diff.png --ppi 500 --root ..

Requires Typst 0.15.1; pinned diagram packages download on first compile.

The first row says how much the triangles grow: add 2 dots, then 3, then 4. The next row says that those additions themselves grow by 1 each time. After one more subtraction, nothing changes.

That calculation introduces the main ideas used below.

For a sequence given by a function ff, its forward difference is

Δf(n)=f(n+1)−f(n).\Delta f(n)=f(n+1)-f(n).

# Differences peel off degree

If f(n)f(n) is a degree-dd polynomial, then Δf(n)\Delta f(n) has degree d−1d-1. For example, if the leading term is cndcn^d, the binomial theorem gives

Δ(cnd)=c((n+1)d−nd)=cd nd−1+lower-degree terms.\Delta(cn^d) =c\bigl((n+1)^d-n^d\bigr) =cd\,n^{d-1}+\text{lower-degree terms}.

Repeat this dd times and only the constant c d!c\,d! remains. One more difference gives zero. Thus:

The cubes make the last case visible.

Difference table of the cubes, with the left edge and constant third-difference row highlighted
For n³, the third differences are 6 = 3!, and the fourth differences are zero.
Reproduce this figure
Download source bundleextract, then runtar -xf difference-tables-cubes_table.tar && cd difference-tables-cubes_table/difference-tables && uv run --locked cubes_table.py

Requires uv and Python 3.12; the locked packages download on first run.

This works in reverse. If an infinite sequence has zero $(d+1)$st differences everywhere, it comes from a polynomial of degree at most dd. A short finite table can always be fitted by a polynomial, so the test becomes conclusive only when the pattern is known to continue.

The arithmetic needs only a few lines:

def difference_table(values):
    rows = [list(values)]
    while len(rows[-1]) > 1:
        previous = rows[-1]
        rows.append([b - a for a, b in zip(previous, previous[1:])])
    return rows

Finite differences also obey a product rule, but the shift cannot be omitted:

Δ(fg)(n)=f(n+1)Δg(n)+g(n)Δf(n).\Delta(fg)(n) =f(n+1)\Delta g(n)+g(n)\Delta f(n).

Equivalently, the shift may fall on gg instead. This small asymmetry is one way that finite differencing departs from ordinary differentiation. The coordinates adapted to this operator will appear when the article rebuilds a sequence from its left edge.

# When a difference is a new layer

Suppose XnX_n is the set of points present at stage nn, and let N(n)=∣Xn∣N(n)=|X_n|. Passing from the objects to their counts, then to their differences, gives a one-way flow:

Xn⟶N(n)=∣Xn∣⟶ΔN(n)=N(n+1)−N(n).X_n \longrightarrow N(n)=|X_n| \longrightarrow \Delta N(n)=N(n+1)-N(n).

Each arrow forgets something. The total N(n)N(n) forgets where the points are. The difference ΔN(n)\Delta N(n) forgets which points arrived and which departed.

If the stages are nested,

X0⊆X1⊆X2⊆⋯ ,X_0\subseteq X_1\subseteq X_2\subseteq\cdots,

then nothing departs. The new shell at stage nn is

Sn=Xn∖Xn−1,S_n=X_n\setminus X_{n-1},

and its size is exactly

∣Sn∣=N(n)−N(n−1)=ΔN(n−1).|S_n|=N(n)-N(n-1)=\Delta N(n-1).

That set identity – not the sequence alone – is what makes a difference into a new layer.

Now put points on a triangular grid. From any point, allow one step in any of the six grid directions. The points reachable in at most nn steps form a hexagon.

Four triangular-lattice balls of radii zero through three, with each newly added outer ring highlighted
The totals are 1, 7, 19, 37. Their first differences are 6, 12, 18: the exact sizes of the new rings.
Reproduce this figure
Download source bundleextract, then runtar -xf difference-tables-hexagonal_growth.tar && cd difference-tables-hexagonal_growth/difference-tables && uv run --locked hexagonal_growth.py

Requires uv and Python 3.12; the locked packages download on first run.

At radius nn, the total number of points is

Hn=1+3n(n+1).H_n=1+3n(n+1).

So the ring added at radius n≥1n\geq1 has

Hn−Hn−1=6nH_n-H_{n-1}=6n

points. The six sides each gain one point per unit of radius. The geometric layers and the rows of the difference table are the same count, with the initial point shown separately:

radius nn total HnH_n initial point or new ring
0 1 initial point
1 7 6
2 19 12
3 37 18

The figure’s source bundle also reproduces these lattice counts.

The totals are quadratic, the rings are linear, and the change in ring size is the constant 6.

Those degrees describe this measurement under its radius index. A process with size s(t)=ts(t)=t, sampled only at times t=n2t=n^2, instead gives the sequence s(n2)=n2s(n^2)=n^2. A difference table describes a chosen measurement under a chosen stage index, not an intrinsic degree of the underlying process.

The same hexagon is the ball of radius nn for the six moves (1,0)(1,0), (0,1)(0,1), (−1,1)(-1,1), and their negatives: a coordinate model of the A2A_2 root lattice.1 Changing the allowed moves changes the ball and can change the sequence.

# Net growth is not always a shell

The nesting condition is a separate requirement. Consider the interval P=[1,2]P=[1,2] on the integer line. Its $n$th dilation contains

nP∩Z={n,n+1,…,2n},nP\cap\mathbb Z=\{n,n+1,\ldots,2n\},

so its count is always n+1n+1. From n=2n=2 to n=3n=3, however, the set changes from

{2,3,4}to{3,4,5,6}.\{2,3,4\}\quad\text{to}\quad\{3,4,5,6\}.

Two points, 5 and 6, arrive; one point, 2, disappears. The count rises by one, but there is no one-point shell. The first difference records arrivals minus departures.

For a convex shape PP, putting the origin inside PP is a sufficient condition for nested dilations:

(n−1)P⊆nP.(n-1)P\subseteq nP.

That is why the centered hexagons above form nested set-theoretic layers while an arbitrary translation of the same counting problem may not.

# The polygon formula

There is a wider two-dimensional rule. Let PP be a polygon whose vertices lie on the integer lattice. If AA is its area and BB is the number of lattice points on its boundary, then the number of lattice points in its nn-fold dilation is

LP(n)=An2+B2n+1.L_P(n)=An^2+\frac{B}{2}n+1.

This is the polygon case of Ehrhart counting, and it follows directly from Pick’s theorem.2 One difference turns that quadratic total into a linear net increment. When the dilations are nested, that increment is the size of the new set. For the hexagon above, A=3A=3 and B=6B=6, so LP(n)=3n2+3n+1L_P(n)=3n^2+3n+1 and the $n$th layer has exactly 6n6n points.

A new layer need not equal the geometric boundary for every polygon. It does for this centered hexagon: the strictly interior lattice points of the $n$th hexagon are exactly the points already present at radius n−1n-1. The distinction matters when the shape is changed.

# A scalar count forgets the shape

The same count can come from a different picture. Compare the unit square

Q=[0,1]2Q=[0,1]^2

with the stretched triangle

T=conv{(0,0),(2,0),(1,1)}.T=\text{conv}\{(0,0),(2,0),(1,1)\}.

The $n$th dilation of the square has (n+1)2(n+1)^2 lattice points. The triangle has rows of lengths

2n+1, 2n−1, …, 3, 1,2n+1,\ 2n-1,\ \ldots,\ 3,\ 1,

whose sum is also

(2n+1)+(2n−1)+⋯+1=(n+1)2.(2n+1)+(2n-1)+\cdots+1=(n+1)^2.

The two shapes therefore have the same scalar count sequence and hence the same difference table for every nonnegative integer dilation. They are Ehrhart-equivalent. The counting step, before differencing, does not retain a unique geometry.

The equality is not a numerical accident. Both polygons have area 1, four boundary lattice points, and no interior lattice points, so the polygon formula gives (n+1)2(n+1)^2 for each. Their shapes and their corresponding counting arguments remain different.

Equal totals at every scale are therefore weaker than equal point sets, equal layers, or a geometric map between the shapes. The loss occurs when each stage is reduced to one number; a complete difference table only rearranges that sequence.

# Keep one coordinate and the collision disappears

The input can retain more information. Instead of giving every lattice point weight 1, retain its horizontal coordinate:

CP(q)=∑(x,y)∈P∩Z2qx.C_P(q)=\sum_{(x,y)\in P\cap\mathbb Z^2}q^x.

At scale one, the square gives

CQ(q)=2+2q,C_Q(q)=2+2q,

while the stretched triangle gives

CT(q)=1+2q+q2.C_T(q)=1+2q+q^2.

Their ordinary counts agree because both expressions become 4 at q=1q=1. Before that substitution, the weighted counts remember enough horizontal position to tell the shapes apart. A two-variable sum

∑(x,y)∈P∩Z2uxvy\sum_{(x,y)\in P\cap\mathbb Z^2}u^xv^y

records the entire finite lattice-point set at that scale. It still does not turn one sampled scale into the continuous polygon, but it makes the information tradeoff explicit. Weighted Ehrhart theory develops this idea systematically.5

There are other ways to ask a richer family of questions. For example, the Ehrhart quasipolynomials of all rational translations of a rational polytope determine it up to an integer translation.6 One count is coarse; a carefully chosen profile can distinguish much more.

# Changing the weight changes the question

Coordinate weights preserve more location. A different weighting can instead remove a feature that the ordinary count mixes in.

For a positive dilation of a lattice polygon, give an interior lattice point weight 1, a nonvertex point on an edge weight 1/21/2, and a vertex the fraction of a full turn occupied by the polygon’s interior angle. The sum of these solid-angle weights is

area(P)n2.\text{area}(P)n^2.

In the unit square, for example, nQnQ has (n−1)2(n-1)^2 interior points, 4(n−1)4(n-1) nonvertex edge points, and four right-angle vertices. The weighted sum is

(n−1)2+4(n−1)2+44=n2.(n-1)^2+\frac{4(n-1)}{2}+\frac{4}{4}=n^2.

The ordinary count is (n+1)2(n+1)^2; the solid-angle count is n2n^2. The first includes the boundary correction and the universal stage-zero point. The second isolates area. Neither is the uniquely correct count: each answers a different question. Macdonald’s solid-angle analogue of Ehrhart counting places this calculation in a general valuation theory.7

This name now has a concrete job. Cardinality, coordinate-weight sums, and solid-angle sums are all valuations: measurements satisfying v(A∪B)+v(A∩B)=v(A)+v(B)v(A\cup B)+v(A\cap B)=v(A)+v(B). The same filtered objects can therefore give different sequences before any difference is taken. Whether a difference still describes a literal layer depends on what that measurement retained.

# Summation stacks the layers

Differencing removes a layer. Summation puts the layers back.

The square-pyramidal numbers make this literal:

1, 5, 14, 30, 55,…1,\ 5,\ 14,\ 30,\ 55,\ldots

They count stacks whose horizontal layers contain 12,22,32,42,…1^2,2^2,3^2,4^2,\ldots points. Therefore

S(n)=∑k=1nk2andS(n+1)−S(n)=(n+1)2.S(n)=\sum_{k=1}^{n}k^2 \qquad\text{and}\qquad S(n+1)-S(n)=(n+1)^2.

The same argument works for a height-one lattice pyramid over any lattice polytope QQ. Its integer-height slices are copies of 0Q,1Q,…,nQ0Q,1Q,\ldots,nQ, in reverse order, so

LPyr(Q)(n)=∑k=0nLQ(k).L_{\mathrm{Pyr}(Q)}(n)=\sum_{k=0}^{n}L_Q(k).

Taking one forward difference recovers the next slice:

ΔLPyr(Q)(n)=LQ(n+1).\Delta L_{\mathrm{Pyr}(Q)}(n)=L_Q(n+1).

Sam and Woods use this slice-and-sum idea as the elementary core of a proof of Ehrhart’s theorem.3 The general proof is more careful, but the picture already explains why summing raises polynomial degree by one and differencing lowers it by one.

# The left edge keeps the sequence

A difference table does not only reveal the degree. Its left edge rebuilds the sequence.

Let EE shift a sequence forward, so Ef(n)=f(n+1)Ef(n)=f(n+1). The definition of a forward difference says

E=I+Δ.E=I+\Delta.

Advancing from a0a_0 to ana_n applies the shift nn times. Because II and Δ\Delta commute, the ordinary binomial theorem gives

an=Ena0=(I+Δ)na0=∑k=0n(nk)Δka0.\begin{aligned} a_n &=E^n a_0\\ &=(I+\Delta)^n a_0\\ &=\sum_{k=0}^{n}\binom{n}{k}\Delta^k a_0. \end{aligned}

This is Newton’s forward formula.4 The formula is therefore a finite operator identity at each integer nn, not a convergence claim and not a test that the sequence is polynomial. What is special about a degree-dd polynomial is that the expansion terminates globally: Δka0=0\Delta^k a_0=0 for every k>dk>d, so the upper limit can be replaced by dd for every nn.

The basis in that formula is not arbitrary. Pascal’s identity gives

Δ(nk)=(n+1k)−(nk)=(nk−1).\begin{aligned} \Delta\binom{n}{k} &=\binom{n+1}{k}-\binom{n}{k}\\ &=\binom{n}{k-1}. \end{aligned}

The binomial polynomials lower one index at a time under differencing, just as ordinary powers lower degree under differentiation. That lowering property is why the left-edge values are their coefficients.

For the triangular sequence as indexed in the opening, the left edge is 1,2,11,2,1. Therefore

an=(n0)+2(n1)+(n2)=(n+1)(n+2)2.a_n =\binom{n}{0}+2\binom{n}{1}+\binom{n}{2} =\frac{(n+1)(n+2)}{2}.

The apparent shift is only indexing: a0=1a_0=1 is the first triangular number, not the zeroth. For a general sequence, the same identity still reconstructs each term, but the number of left-edge coefficients needed grows with nn.

# Why the cube table contains 1, 6, 6

The left edge of the cube table is

0, 1, 6, 6, 0,…0,\ 1,\ 6,\ 6,\ 0,\ldots

Those numbers are not specific to cubes. For the sequence an=nma_n=n^m,

Δknm∣n=0=∑j=0k(−1)k−j(kj)jm=k! S(m,k),\left.\Delta^k n^m\right|_{n=0} =\sum_{j=0}^{k}(-1)^{k-j}\binom{k}{j}j^m =k!\,S(m,k),

where S(m,k)S(m,k) is a Stirling number of the second kind: the number of ways to partition an mm-element set into kk nonempty blocks.

The alternating sum has a direct counting meaning. There are jmj^m functions from an mm-element set to jj labeled targets. Inclusion-exclusion removes the functions that miss one or more targets, leaving the surjections onto kk targets. An unordered partition into kk blocks becomes a surjection after the blocks are assigned to the kk target labels, which can be done in k!k! ways.

For m=3m=3,

S(3,1)=1,S(3,2)=3,S(3,3)=1.S(3,1)=1,\qquad S(3,2)=3,\qquad S(3,3)=1.

Multiplying by 1!,2!,3!1!,2!,3! gives 1,6,61,6,6. Newton’s formula then reads

n3=(n1)+6(n2)+6(n3).n^3 =\binom{n}{1}+6\binom{n}{2}+6\binom{n}{3}.

This is the change of basis hiding in the difference table: ordinary powers are being rewritten in binomial polynomials, and Stirling numbers are the conversion coefficients.

# Tables that do not flatten

Polynomial tables eventually reach zero. Other sequences leave different signatures.

# A polynomial with a clock

Integer polytopes give polynomial counts. Rational polytopes generally give quasipolynomials: each residue class follows a polynomial, but the formulas can differ periodically.

The interval

P=[0,12]P=\left[0,\frac12\right]

already shows the effect. Its $n$th dilation contains

LP(n)=⌊n2⌋+1L_P(n)=\left\lfloor\frac n2\right\rfloor+1

integer points, so the totals begin

1, 1, 2, 2, 3, 3,…1,\ 1,\ 2,\ 2,\ 3,\ 3,\ldots

and the first differences alternate

0, 1, 0, 1,…0,\ 1,\ 0,\ 1,\ldots

The linear trend has been removed, but the period-two clock remains. Higher differences keep oscillating instead of becoming zero. A nonflattening table can therefore mean “polynomial growth plus a periodic residue,” not only exponential or recursive growth.

# Exponential and recursive signatures

For an=2na_n=2^n,

Δan=2n+1−2n=2n,\Delta a_n=2^{n+1}-2^n=2^n,

so every row of the table repeats the same powers of two, shifted and shortened. More generally, ana^n is an eigenfunction of the difference operator:

Δan=(a−1)an.\Delta a^n=(a-1)a^n.

The Fibonacci numbers have a different pattern.

Difference table of the Fibonacci numbers with the alternating Fibonacci left edge highlighted
The left edge is 0, 1, −1, 2, −3, 5, −8, …: Fibonacci again, with alternating signs.
Reproduce this figure
Download source bundleextract, then runtar -xf difference-tables-fibonacci_diff.tar && cd difference-tables-fibonacci_diff/difference-tables && typst compile fibonacci_diff.typ fibonacci_diff.png --ppi 500 --root ..

Requires Typst 0.15.1; pinned diagram packages download on first compile.

Reading down the left edge applies the signed binomial transform

bn=Δna0=∑k=0n(−1)n−k(nk)ak.b_n=\Delta^n a_0 =\sum_{k=0}^{n}(-1)^{n-k}\binom{n}{k}a_k.

For Fibonacci,

ΔnF0=(−1)n+1Fn.\Delta^n F_0=(-1)^{n+1}F_n.

One quick explanation comes from Binet’s formula. Differencing sends an exponential αn\alpha^n to (α−1)αn(\alpha-1)\alpha^n at the row level, and sends its left-edge transform to (α−1)n(\alpha-1)^n. The two Fibonacci roots satisfy φ−1=−ψ\varphi-1=-\psi and ψ−1=−φ\psi-1=-\varphi, so the roots exchange places and pick up alternating signs.

The table never becomes constant because Fibonacci is not polynomial, but it still exposes the algebra governing the sequence.

# Exact sequences and noisy measurements

Everything above uses exact values. A difference table is much less forgiving when the entries contain measurement or rounding error.

Suppose an otherwise smooth sequence contains a small alternating error ε(−1)n\varepsilon(-1)^n. One difference turns it into

Δ(ε(−1)n)=−2ε(−1)n.\Delta\bigl(\varepsilon(-1)^n\bigr) =-2\varepsilon(-1)^n.

After kk rows, its magnitude is 2kε2^k\varepsilon. The highest-frequency error doubles at every step even while differencing removes the smooth polynomial trend.

Random error has a related but distinct amplification law. If the observation errors εn\varepsilon_n are independent, have mean zero, and share variance σ2\sigma^2, then

Δkεn=∑j=0k(−1)k−j(kj)εn+j.\Delta^k\varepsilon_n =\sum_{j=0}^{k}(-1)^{k-j}\binom{k}{j}\varepsilon_{n+j}.

Independence removes the cross terms in the variance, so

Var(Δkεn)=σ2∑j=0k(kj)2=σ2(2kk).\text{Var}(\Delta^k\varepsilon_n) =\sigma^2\sum_{j=0}^{k}\binom{k}{j}^2 =\sigma^2\binom{2k}{k}.

Thus the standard deviation grows by (2kk)\sqrt{\binom{2k}{k}}, asymptotically close to 2k/(πk)1/42^k/(\pi k)^{1/4}. The exact 2k2^k gain above belongs to a deterministic alternating mode. If errors are correlated, the variance is instead c⊤Σcc^\top\Sigma c, where cj=(−1)k−j(kj)c_j=(-1)^{k-j}\binom{k}{j}; the independence formula must not be reused unchanged.

For an exact sequence with a difference law known to continue, a constant row settles the polynomial question. With measured data, high-order differences are a diagnostic, not proof of a polynomial law; smoothing, uncertainty, and out-of-sample checks matter.

# What the table is saying

A first difference is the net change at the next step. It becomes the amount added only when the underlying stages are nested. Repeated differences measure how that growth itself changes. For polynomial sequences, the process ends after finitely many rows, and the left edge records the coefficients in the binomial basis.

In geometric counting, the flow of information matters. A filtered family of objects is measured by a valuation; differencing then takes the discrete derivative of that measurement. Weighted counts retain selected structure that a plain total discards. When the sets form a filtration, totals become layers, layers become changes in the boundary, and a pyramid is a running sum of its slices. The table is not only a way to guess a formula. Read with its assumptions visible, it records how a chosen measurement changes under a chosen indexing, along with what was forgotten in reducing an object to a sequence.

Verify the article's exact identities

verification program uv run verify_identities.py --max-n 6

# References

[1] Ardila, F., Beck, M., Hoşten, S., Pfeifle, J., and Seashore, K. “Root Polytopes and Growth Series of Root Lattices.” SIAM Journal on Discrete Mathematics 25(1):360–378, 2011. ↩

[2] Beck, M. and Robins, S. Computing the Continuous Discretely. Springer, 2007. Chapters 2 and 3 cover Pick’s theorem and Ehrhart counting. ↩

[3] Sam, S. V. and Woods, K. M. “A Finite Calculus Approach to Ehrhart Polynomials.” The Electronic Journal of Combinatorics 17, R68, 2010. ↩

[4] Graham, R. L., Knuth, D. E., and Patashnik, O. Concrete Mathematics: A Foundation for Computer Science. 2nd ed., Addison-Wesley, 1994. Chapter 2 develops finite differences, falling factorials, and Newton’s formula. ↩

[5] De Loera, J. A., Valencia, C. E., Villarreal, R. H., and Wang, C. “Ehrhart Functions of Weighted Lattice Points.” arXiv:2412.17679. ↩

[6] Higashitani, A., Murai, S., and Yoshinaga, M. “Ehrhart Quasi-polynomials and Parallel Translations.” arXiv:2307.08151. ↩

[7] Beck, M. and Ehrenborg, R. “Ehrhart-Macdonald Reciprocity Extended.” Moscow Mathematical Journal 5(3):495–504, 2005. ↩