# When a shrinking hold gives linear error growth

Henry Shin · Refactor · Mathematical companion · November 27, 2026

Set h = 1/d, where d is the distance to a wall. The sharp thermometer error then grows linearly in d. Follow the checkerboard color and the smooth pulse to see why quadratic and logarithmic growth have different thresholds.

Set h = 1/d. Put the wall 16 steps from the center and let the heat stay put with probability 1/16 on each tick. Move the wall to 32 steps and halve the holding probability. What happens to the largest error that can reach the thermometer? For large d the error allowance is d times the local tolerance, with relative error tending to zero. Here is how quickly the calculation approaches that linear law on a line.

Sharp all-run error factors on the interval with walls at ±d and holding probability h = 1/d. The ratio C/d tends to 1 while the excess C − d grows. Values are rounded.

| Wall distance d | Error factor C | C/d | C − d |
| --- | --- | --- | --- |
| 16 | 17.1266 | 1.0704 | 1.1266 |
| 32 | 33.3346 | 1.0417 | 1.3346 |
| 64 | 65.5803 | 1.0247 | 1.5803 |
| 128 | 129.8475 | 1.0144 | 1.8475 |
| 256 | 258.1281 | 1.0083 | 2.1281 |

For example, at d = 64 a per-cell error of at most 0.01 °C per tick gives a worst-case allowance of about 0.656 °C on the line. On the square with the same wall distance and equally likely axes, the factor is about 66.3651, giving an allowance of about 0.664 °C. Why is the power of d exactly one? In the [checkerboard calculation](https://refactor.press/refactors/heat-grid-checkerboard), no holding gave quadratic growth, while a fixed positive chance of holding gave logarithmic growth. Let the chance vary with the wall distance and those two regimes turn out to have different thresholds.

## Try a weight for the two colors

Take the integer cells with |x_{i}| < d in each of n directions. The walls at ±d have temperature zero. On a moving tick choose axis i with fixed probability a_{i} > 0, with ∑ a_{i} = 1, and step either way with equal probability. Write B for this averaging update and A = hI + (1 − h)B for the update with holding. The dimension and the axis probabilities stay fixed as d grows.

The thermometer reads the center minus the average of its neighbors, weighted by the moving rule B. Its final weights are q = (I − B)e₀, where e₀ is a unit pulse at the center. An error from t ticks earlier is read with weights w_{t} = A^{t}q, since A is symmetric. Start from an exact grid. If every cell may add an error of either sign up to ε on each tick, the largest contribution from that lag is ε times the sum of the absolute weights. Choose each error’s sign to match its weight and every finite partial sum is attainable. The sharp factor covering every run length is therefore

C(d,h) = ∑_{t ≥ 0} ‖w_{t}‖₁.

Try giving every black cell weight +1 and every white cell weight −1, with the center black. Call this pattern J. On the grid without walls a move flips the sign and a hold keeps it, so AJ = (2h − 1)J. The initial thermometer weights have total signed pairing 2 with J. After t steps the magnitude of that pairing is 2(1 − 2h)^{t} for 0 < h ≤ 1/4. Add the geometric series and it gives exactly 1/h. We now have a candidate for the linear term. At h = 1/d the color can contribute about d ticks’ worth of error before holding washes it out.

## Make the weight fit the walls

The bare checkerboard sign stays nonzero at the walls. Multiply it by a profile that peaks at the center and vanishes at each wall. On a line, averaging cos(πj/(2d)) at its two neighbors multiplies it by λ = cos(π/(2d)). On a box, take the product of these cosines over all coordinates. Every axis average still has the same multiplier λ. Adding the checkerboard sign reverses that multiplier, so B sends the new pattern to −λ times itself.

This pattern has absolute value at most one and value one at the center. Pair it with w_{t}. The initial pairing is 1 + λ, and each backward tick multiplies it by h − (1 − h)λ. Its absolute pairing is a lower bound for the sum of absolute weights. Summing in t, for d ≥ 2 and 0 < h ≤ 1/4, gives a bound you can use at any finite grid size.

C(d,h) ≥ 1 / [h + tan²(π/(4d))].

The second term in the denominator is asymptotic to π²/(16d²). It records leakage through the walls. Holding erases the color on the scale 1/h ticks, while the spreading pulse needs order d² ticks to reach a wall. Comparing those two times gives the first threshold, h of order 1/d². Below that scale the color contributes order d². Well above it the bound approaches 1/h in relative terms. In particular, at h = 1/d the bound is d − π²/16 + O(1/d).

## The smooth part keeps adding

The cosine test measures what survives on alternating cells. Heat also spreads smoothly across many cells of both colors. To follow both patterns, try the Fourier wave with frequency θ. A move multiplies it by b(θ) = ∑ a_{i} cos θ_{i}. The multiplier for the backward thermometer weights is

(1 − b(θ)) [h + (1 − h)b(θ)]^{t}.

At θ = 0 we have b = 1. The thermometer factor vanishes quadratically there. Expand the cosines around zero and the spreading pulse is Gaussian to leading order. Its absolute change from tick to tick is of order 1/t. More precisely, the corresponding part of the thermometer weights has absolute mass K_{n}/[2(1 − h)t] + O(t^{−3/2}), where K_{n} = E|X − n| and X is the sum of the squares of n independent standard normal variables. This is the [Gaussian calculation for the square](https://refactor.press/refactors/heat-grid-size#where-the-logarithm-comes-from) in coordinates scaled to the width of the pulse.

At the opposite frequency, every θ_{i} = π. Now b = −1 and the thermometer factor is 2. Expand about this point and the pulse is another Gaussian, multiplied by the alternating sign and by (1 − 2h)^{t}. Its absolute mass is (1 − 2h)^{t}[2 + O(1/t)]. The other frequencies decay exponentially away from these two neighborhoods. Both expansions hold uniformly for small h, which lets us change h as we change d.

Here is the upper estimate that finishes the linear example. Reflect the free weights with alternating image signs across the walls to recover the finite box. Folding can only decrease their absolute mass. Through d² ticks the checkerboard’s leading geometric sum is at most 1/h, its accumulated O(1/t) correction is O(log d), and the smooth contribution is O(log d). After d² ticks the remaining contribution is bounded by the current absolute mass times the maximum mean exit time, which is O(d²). At h = 1/d the current absolute mass is O(d^{−2}) because the checkerboard has decayed exponentially in d. This last tail costs O(1). Together with the finite cosine bound, that proves

C(d,1/d) = d + O(log d).

We can also certify the opening table directly. On the line, step the vector of weights forward from q, adding its absolute mass at each lag. Once every entry of w_{T} is nonnegative, every later vector is nonnegative too. A unit at cell j will then contribute its entire mean remaining lifetime, (d² − j²)/(1 − h), to the tail beginning at T. Multiplying by w_{T}(j) and summing over j finishes the infinite series. For d = 64, outward-rounded integer bounds on the weights already certify their signs at T = 1,385 and enclose C between 65.58025478 and 65.58025482.

## Why the logarithm has its own threshold

Sum the smooth 1/t contribution to the wall time d² and it gives order log d. The color contributes order min(d², 1/h). The estimates in the printable proof bound their sum above and below by constant multiples of the sharp factor, uniformly for d ≥ 2 and 0 < h ≤ 1/4.

C(d,h) ≍ log(1 + d) + min(d², 1/h).

The symbol ≍ means that the ratio stays between two positive constants depending only on the fixed dimension and axis probabilities. For the logarithmic lower bound, try the same product of cosines without the checkerboard sign. At lag t choose an odd wave number of order d/√t. Its thermometer pairing starts at order 1/t and a fixed fraction survives t updates. Adding these certified contributions over the lags up to a fixed fraction of d² forces the logarithm.

Once holding has beaten the walls, the comparison becomes accumulated error against accumulated error. A geometric sum of size 1/h still outweighs log d until h reaches order 1/log d. That gives the second threshold. With log denoting the natural logarithm, the regimes read as follows.

- Quadratic. If hd² stays bounded, C has order d². Holding at the wall-time scale can change the leading coefficient.
- Between the thresholds. If hd² → ∞ and h log d → 0, then C ∼ 1/h. Choosing h = 1/d puts the linear example here.
- Logarithmic. Suppose h → 0. If h log d → c with 0 < c < ∞, then C ∼ (K_{n} + 1/c) log d. If h log d → ∞, then C ∼ K_{n} log d. On a square K₂ = 4/e.

Why can we add the leading coefficients at the second threshold? At each tick, the loss from taking the two absolute masses separately is at most twice the smaller one. Summed over ticks this costs O(1 + log(1/h)). When hd² → ∞ the folding and late-time estimates in the proof are also smaller than 1/h + log d. Summing the geometric part and the smooth part gives their separate leading contributions. This describes growth along h(d). The earlier constant for the increment on doubling d was proved with h held fixed.

## What happens right at the first threshold?

On the line, no holding gives C(d,0) = 2d² − 1. Set h = 1/d² instead. The power of d stays the same, and the coefficient changes from 2 to 1 − 1/cosh(2), about 0.734198. Direct backward iteration at d = 64 gives C/d² ≈ 0.734175. There is a way to calculate this change. Test each lag against the alternating sign and sum before taking the limit. This weights each possible time to exit by a geometric discount for the color lost to holding. At hd² → c the discount becomes exp(−2cs) at scaled time s. The limiting coefficient is twice the integral of that discount times the probability the scaled pulse is still inside the box at time s.

The three-page proof derives the discounted exit formula in every fixed dimension, the uniform Fourier estimates at both frequencies, and the finite-grid lower bound. [Download When holding becomes rare (PDF)](https://refactor.press/pdfs/shrinking-hold-proof.pdf).

Return to the opening table and subtract d. How much extra error is still reaching the thermometer? The next companion counts the backward weights whose signs disagree with the checkerboard. [What remains after the linear error?](https://refactor.press/refactors/shrinking-hold-remainder)
