On this page
Type one digit wrong on a form and the refund or the admit card goes to the wrong place. Two everyday guards against this, the last digit of a book's ISBN and of an Aadhaar number, use very different maths.
What is a check digit?
A check digit is a digit added to an identification number and calculated from its other digits, so a computer can reject a mistyped number before using it. It detects errors but does not correct them. A UID Numbering Scheme, the 2010 design paper for Aadhaar by Hemant Kanakia, Srikanth Nadhamuni and Sanjay Sarma, says the check digit "enables error detection at data entry" but, being a published algorithm, "will not prevent guessing".
Which mistakes matter most? The same paper reproduces Verhoeff's measurements of real data-entry errors. Single-digit errors (191433 typed as 191933) made up 79.1% of them, and swaps of two neighbouring digits (433 typed as 343) made up 10.2%.
How do you calculate an ISBN-13 check digit?
Since 1 January 2007, national ISBN agencies have issued only 13-digit ISBNs, and the last digit is a check digit calculated with a modulus 10 algorithm, according to the ISBN Users' Manual from the International ISBN Agency. The manual's rule: multiply the first 12 digits alternately by 1 and 3, add the products, divide by 10, and subtract the remainder from 10; if the remainder is 0, the check digit is 0.
Worked example, using the manual's sample ISBN 978-0-571-08989-5:
First 12 digits: 9 7 8 0 5 7 1 0 8 9 8 9
Weights: 1 3 1 3 1 3 1 3 1 3 1 3
Products: 9, 21, 8, 0, 5, 21, 1, 0, 8, 27, 8, 27
Sum: 135, remainder 5 when divided by 10
Check digit: 10 − 5 = 5, which matches the printed last digit
To test a full ISBN, add the 13th digit with weight 1: the total, here 140, must divide by 10.
Which mistakes does the ISBN check miss?
Swap neighbouring digits a and b and the total changes by 2(b − a), up or down, since one moves from weight 1 to 3 and the other back. That is a multiple of 10 only when a and b differ by 5.
In our example, swap the 5 and the 7 (978075108989) and the sum becomes 131, so the check digit should be 9, not 5: caught. Swap the 0 and the 5 instead (978507108989) and the sum becomes 145, check digit 5: the mistake slips through.
No choice of weights fixes this: weights that catch every single-digit error must be odd, so their difference is even and digits 5 apart cancel. Weighting by position is also the trick behind the alternating-sum rule for divisibility by 11, and simple digit sums are why the sum-of-digits test for 3 and 9 works.
How does the Verhoeff algorithm check an Aadhaar number?
The 2010 UID design paper proposed 12 digits: 11 for the number itself and a 12th check digit using the Verhoeff scheme, with first digits 2 to 9 used for people. Its stated reason: the Verhoeff scheme "catches all single errors and all adjacent transpositions". The scheme comes from J. Verhoeff's 1969 book Error Detecting Decimal Codes, published by the Mathematisch Centrum in Amsterdam (Crossref record of a 1971 review).
Instead of ordinary addition, Verhoeff combines digits with the table of the dihedral group D5, the 10 symmetries of a regular pentagon (5 rotations, 5 reflections). In that table a # b is not always b # a, which is what lets a swap change the result. Each digit is also scrambled by a fixed permutation, applied once more for every place along the number.
A toy example with the standard permutation: run 236 through the tables from the right and the running value goes 3, 1, 2; the D5 inverse of 2 is 3, so the full number is 2363. Type 2633 and the test ends on 4 instead of 0: caught.
Open-source validators such as the python-stdnum Aadhaar module check 12 digits, a first digit that is not 0 or 1, that the number is not a palindrome, and the Verhoeff digit. Passing means well formed, not issued.
How can you practise check digits this week?
Work out the check digit of three 13-digit ISBNs at home, then compare.
Predict whether swapping two neighbouring digits in one ISBN will be caught, then calculate.
Write the two-line proof that a swap changes the total by 2(b − a), up or down.
Never type a real Aadhaar number, yours included, into a shared document or app; use toy numbers.
If your working goes wrong at a step, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer. For remainders and modular arithmetic themselves, the Fermi Concept Library gives every concept in mathematics its own lesson.
Then look at the bars under the ISBN: here is how a barcode scanner reads those black lines and white gaps.



