In UPC-A barcode symbology, the 12th digit is known as check digit and it is used by the scanner to determine if it scanned the number correctly or not.
the check digit is calculated as follows: 1.Add the digits in the odd-numbered positions (first, third, fifth, etc.) together and multiply by three. 2.Add the digits in the even-numbered positions (second, fourth, sixth, etc.) to the result. 3.Find the result modulo 10 (i.e. the remainder when divided by 10.. 10 goes into 58 5 times with 8 leftover). 4.If the result is not zero, subtract the result from ten. For example, in a UPC-A barcode "03600029145x" where x is the unknown check digit, x can be calculated by adding the odd-numbered digits (0 + 6 + 0 + 2 + 1 + 5 = 14), multiplying by three (14 × 3 = 42), adding the even-numbered digits (42 + (3 + 0 + 0 + 9 + 4) = 58), calculating modulo ten (58 mod 10 = 8), subtracting from ten (10 − 8 = 2). The check digit is thus 2.
What is the logic behind calculating 'check digit' in such manner?
Can't two different combination of digits produce the same check digit?