A check digit catches mistakes when a person types a number or a scanner misreads a barcode. ARQ makes sure transmitted data arrives correctly by asking for it again until it does. Both are about detecting errors, but at different moments.
A check digit is an extra digit calculated from the other digits of a number and added to the end. When the number is entered, the check digit is recalculated and compared; if it does not match, a data entry error has been made. Check digits are used in ISBNs and barcodes. Automatic repeat query (ARQ) checks transmitted data: the receiver sends a positive acknowledgement if the data is correct or a negative acknowledgement if not, and the sender resends if it gets a negative acknowledgement or if a timeout passes with no acknowledgement.
Fig. 1: calculating an ISBN-13 check digit with weights 1 and 3
Section 01
What a check digit catches.
Check digits protect data entry: a person typing a code, or a scanner reading one. They are not used to check data during transmission.
Incorrect digit: one digit typed or scanned wrongly, e.g. 5 entered as 8.
Transposition: two digits swapped, e.g. 61 typed as 16.
Omitted or extra digits: a digit left out or added.
Where: ISBNs on books, barcodes on products, and other ID numbers such as bank card numbers.
Examiner trap
A check digit detects errors in data entry. Parity, checksums and echo checks detect errors in transmission. Mixing these up loses marks.
Section 02
The ISBN-13 method.
Use the lab to calculate an ISBN-13 check digit, then change one digit or swap two and see the check fail.
1. Multiply the first 12 digits by 1, 3, 1, 3 ... in turn (odd positions by 1, even positions by 3).
2. Add all the products.
3. Find the remainder when the total is divided by 10 (total MOD 10).
4. If the remainder is 0, the check digit is 0; otherwise the check digit is 10 minus the remainder.
Barcodes on products (EAN-13) use the same weights of 1 and 3.
Worked example Calculate
Calculate the check digit for the ISBN that begins 978095748422.