A check digit is a checksum represented by one symbol and included in an identifier to help detect errors. It is calculated from the data digits, rather than carrying independent identification information. Examples occur in UPC and ISBN.
For a common decimal scheme, let be the data digits, indexed
from right to left. Set
when
is odd
and
when
is even. The check digit appended
on the right is
where denotes the common
residue of
modulo
.
Thus,
and
is divisible
by 10 (GS1).
Since 1 and 3 are relatively prime to 10, changing any single digit, including , makes
no longer divisible
by 10. However, swapping adjacent unequal digits leaves
this sum unchanged modulo 10 iff
their values differ by 5. A successful check therefore does not guarantee that the
identifier is free of errors.