Lesson
The theory โ Check Digits: Luhn, Barcodes, ISBN & the Mistakes They Miss
A check digit is one extra digit chosen so that the whole number satisfies a rule: here, that the digits, each multiplied or transformed according to its place, add up to a multiple of the modulus, 10 or 11. A mistake that breaks the rule is detected. One that keeps it is not, so a check digit can prove a number wrong and can never prove it right.
What each symbol means
dแตข- the digit i places from the right; the check digit is d0
wแตข- the weight of place i: 1 and 3 alternately for a barcode, i + 1 for ISBN-10
D(d)- Luhn's doubling: 2d, less 9 when that is more than 9, so 0 2 4 6 8 1 3 5 7 9
S- the sum of what every digit contributes
m- the modulus, 10 for Luhn and the barcode, 11 for ISBN-10; the number passes when S is a multiple of m
- Assumes
- One mistake at a time. Two mistakes in one number can cancel, and the page's counts say nothing about them. The ladder counts every pair of digits as equally likely, which real typing is not: Luhn's one blind neighbour pair is 09 and 90, and how often those two sit side by side depends on what the numbers are.
- Breaks when
- A check digit is not security. Anyone who knows the scheme can make a number that passes, which is why a card number that passes Luhn is only a number that was typed correctly, and ISBN-13 uses the barcode's scheme because an ISBN-13 is itself a barcode number, under the prefixes 978 and 979 that GS1 made available.
Problem solved in full
-
Recovering a smudged digit of an ISBN-10 4 steps
An ISBN-10 reads 0-11-000?22-9, with the seventh digit smudged. Find it, and say why there is exactly one answer. Press ISBN-10 to check the result.
-
The weights run 10 down to 1 from the left, so the smudged seventh digit carries weight 4. Add up the other nine digits times their weights.
-
The whole sum has to be a multiple of 11, so 4 times the missing digit must make up the difference.
-
Mod 11 you can divide, because 11 is prime: 4 ร 3 = 12 is 1 more than 11, so multiplying by 3 undoes multiplying by 4.
-
Put the 2 back and the page's sum is 44, four elevens exactly.
Answer
The digit is 2, and the ISBN is 0-11-000222-9. It is the only digit that fits because multiplying by 4 sends the eleven values 0 to 10 to eleven different remainders mod 11, so exactly one of them lands on 8. That is the same property that lets the scheme catch every wrong digit at this place, seen from the other side: a weight that makes every single mistake visible also makes every single smudge recoverable. A mod-10 scheme with a weight of 2 at that place would give two candidates or none, and it would miss every wrong digit there that is five away from the right one.
-
References (3)
- The Luhn check digit as the IMEI standard defines it, step by step, with the worked example the page's IMEI preset reproduces (26053179311383, sum 53, check digit 7): 3GPP TS 23.003, "Numbering, addressing and identification", Annex B (normative): IMEI Check Digit computation. Published as ETSI TS 123 003 V18.7.0 (2024-09).
- The ISBN-13 check digit, the 1-3 weighting that barcodes use, with the manual's own example 978-0-11-000222-4: International ISBN Agency, ISBN Users' Manual, International Edition, sixth edition. London, 2012. Appendix 1, "Check digit calculation".
- ISBN-10's mod 11, the barcode's blind pairs 05, 16, 27, 38, 49 and Luhn's 09 and 90, the frequencies of real mistakes from Verhoeff's study, Gumm's theorem that no even-modulus scheme catches every swap, and Verhoeff's dihedral scheme with its tables: J. A. Gallian, "Error detection methods." ACM Computing Surveys 28(3), 1996, pp. 504-517. DOI 10.1145/243439.243457