The Verification Venue · pointed at a reflex every bookkeeper trusts
The Difference Divisible by Nine
The folklore says a trial balance out by a multiple of nine means transposed digits. The forward arithmetic is exact: a transposed pair always moves the difference by a multiple of nine, and a wrong-side posting always moves it by twice the amount. The converse is false: many multiples of nine have no transposition behind them at all. Below you can catch it failing.
First, a boundary worth marking. A check digit detects a corrupted identifier: it rides along with a number and screams when that number is mistyped. This page does a different job. Here the numbers are fine and the books are not: a ledger does not balance, and the size of the imbalance is itself evidence about what kind of mistake happened. Below is a small double-entry ledger, eight entries, typed in whole cents. Plant an error with the buttons, or edit any amount yourself. The page recomputes the difference on every keystroke and ranks the plausible causes with the arithmetic shown for each. Your job is the hunt.
An eight-entry ledger, typed in whole cents
| entry | side | amount |
|---|
Total debits
·
Total credits
·
Difference (debits minus credits)
balanced
Type amounts as dollars and cents; the page reads whole cents. The ledger is illustrative, chosen to balance, not observed from anyone's books. ↓
Ranked suspects
Why nine. Every power of ten leaves remainder 1 when divided by 9: 1, 10, 100, 1000, all of them. So a number, taken modulo 9, only cares about its digit sum, and swapping two digits leaves the digit sum alone. More precisely, putting digit b where digit a sat, at place values 10j and 10i, changes the value by (a − b) × (10j − 10i), and the bracket is always a multiple of 9. For adjacent digits only (j = i + 1) the bracket collapses to 9 × 10i, which gives the cleanest form: the change is then exactly 9 × (a − b) × 10i. Non-adjacent pairs carry the extra repunit factor Rj−i shown in the general form below.
Why two. Posting an amount to the wrong side puts it on the wrong end of the subtraction twice: once missing where it belonged, once sitting where it did not. The difference moves by exactly twice the amount. An even difference therefore puts half the difference on the table as a candidate amount to search the ledger for. Half of all integers are even, so divisibility by two alone is weak evidence; the doubling mechanism, not the parity, is the content.
Neither argument runs backwards. A difference divisible by nine is consistent with a transposition; it is also consistent with a coincidence, and with a decimal slide, which moves an entry by a factor of ten: up, it moves the difference by nine times the entry; down, when whole cents survive, by minus nine tenths of it. The ranking narrows the search. The audit trail closes the case. Everything below is built to let you watch both halves of that sentence.
The digit bench: tap two digits to trade them
The trade
tap two digits
Closed form, same number two ways
A slide up lands on nine times the entry; a slide down, when whole cents survive, on minus nine tenths of it. Either way the difference moves by a multiple of nine, which is exactly why the transposition clue alone never convicts.
Which multiples of nine have a transposition behind them?
Click a cell: marked cells name the transposition that lands on them; empty cells have nothing behind them at this length.
The check: every number recomputed in front of you
This table is computed by this page's own code every time it loads, from the constants embedded in this file (the JSON script tags aw-seed-ledger and aw-bench). Nothing in it is typed in. The direct column subtracts the two rendered numbers; the closed-form column evaluates the identity; the last column is the live comparison.
| case | direct Δ (cents) | closed form (cents) | agree |
|---|
Free choices and uncertainties, named where they arise:
- Difference means total debits minus total credits. Positive means debits lead.
- Amounts are whole cents. No rounding anywhere.
- A hypothesis is a single change to one entry that would bring the difference to exactly zero; equivalently, the single error that, applied to a balanced ledger, would have produced the observed difference. The ranking proposes repairs and never convictions.
- One error at a time, in one entry. When the ranking finds nothing, the page says so rather than guessing.
- Transpositions include swaps that create a leading zero (105 becoming 015). The delta arithmetic is identical either way, but the corrupted numeral no longer contains the inverse swap, so the ranking cannot recover that particular plant. The limit is stated here rather than hidden.
- Decimal slides move one place. Up changes the entry by 9x; down changes it by −9x/10, and is considered only when the result stays in whole cents.
- The sweep counts transpositions of every L-digit numeral, including outcomes with a leading zero. The closed-form and brute-force methods agree on all of it; the verifier checks that agreement case by case.
- History: double-entry predates Pacioli's 1494 printed account of it. Nobody is named here as the origin of the nine rule, because its origin is folklore.
Run the independent check yourself: node research/the-difference-divisible-by-nine/verify-the-difference-divisible-by-nine.mjs. It recomputes every number on this page by a second method and exits non-zero on any disagreement.
What's idealised here, and what's exactly true
Exactly true. The transposition identity is algebra, not statistics. For any digits a and b at place values 10i and 10j, swapping them changes the value by (a − b)(10j − 10i) = 9 × (a − b) × 10i × Rj−i, where Rm is m ones; the compact 9 × (a − b) × 10i form belongs to adjacent digits only. This page confirms it by direct subtraction for the cases it shows; the verifiers confirm it for every ordered pair of distinct digits and every position pair in numbers up to five digits. The wrong-side doubling is immediate from the definition of the difference. The slide identities are one line of arithmetic each: up one place changes the value by 9x; down one place, when the result stays in whole cents, by −9x/10. A hypothesis anywhere on this page means a single change to one entry that would bring the difference to exactly zero.
Idealised. A single error, in a single entry, in whole cents. No tax, no fees, no rounding, no carried-forward balances. Slides move the decimal point exactly one place. Transpositions may create a leading zero, which a real clerk might not write down, though the arithmetic of the difference is unchanged either way. The eight amounts were chosen to balance; they model a ledger, they do not record one.
Representative, not universal. Real imbalances come in compounds: two errors can mask each other, a difference can be divisible by nine by accident, and the same difference usually has several candidate causes. The ranking survives all of that as a ranking. It was never a conviction, and the second layer of this page exists to show what the ranking cannot reach.