Error Detection · Cambridge syllabus 2.2 · Lesson 3 of 5
Check Digits
A check digit is derived from the other digits in an identifier. Recalculating it helps detect data-entry mistakes. The algorithm must be specified: different identifier systems use different weightings and moduli.
By the end, you can
- Understand the purpose of a check digit.
- Use a check-digit calculation.
- Identify invalid data using a check digit.
- Identify uses of check digits, including ISBNs and bar codes.
Check digits
A check digit is the same idea applied to data people type or scan rather than data a machine transmits. The extra digit is calculated from the others and appended, so the number carries its own verification.
Barcodes, ISBNs and bank account numbers all end in a check digit. The calculation weights each digit by its position, totals the results, and derives a final digit from the total — for a 13-digit barcode, the digits are multiplied alternately by 1 and 3, the products are added, and the check digit is whatever brings the total up to the next multiple of 10.
The scanner or the entry system recalculates the check digit from the digits it read and compares it with the one that was read. If they differ, the number is rejected — the scanner beeps unhappily and you scan again.
Position-dependent weighting is the point. It catches the two commonest human errors: a mistyped digit, and two adjacent digits swapped. A plain sum would miss a transposition entirely, because swapping two digits leaves the total unchanged.
Worth remembering
- A digit calculated from the others and appended, as on a barcode or ISBN.
- The reader recalculates it and rejects the number if it does not match.
- Weighting by position is what catches transposed digits.
Worked example
With an illustrative rule “sum of data digits modulo 10”, digits 4, 7, 2 give check digit 3 because 13 MOD 10 = 3.
Practice
Warm-up · not marked
Check your understanding
Answer in your own words, then compare with the worked answer. Nothing here is saved or scored.
Worked answer
5 + 8 + 1 = 14; 14 MOD 10 = 4.
Check your method, units and explanation against it.
Marked practice
Set 1 of 5 · easiest first · Checked as you go, with the worked answer. Sign in or create a free account to save your progress.