The Mathematics
of Barcodes

Cracking Barcodes
The UPC a Scheme
Coding Errors
Appendices
Credits




Student CopyTeacher Copy

Activity 3: Coding Errors
(Student Copy)

Part A

The UPC-A is designed with a check number (the 12th number in the sequence) that catches all single number errors in the modulo 10 numbering system.  However, if two numbers are in error, there is the possibility that the two mistakes will "cancel each other out" and the scanner will not catch the errors.  Although any two numbers in the encoding scheme that were in error could create a problem, the most likely mistake in recording two numbers is that of transposition (for example, 68294  68924).  Because of the way that the system is designed, when two numbers are transposed most of these errors are caught by the mod 10 coding formula and resulting check number, but some errors are not picked up.

In order for the UPC-A number to be valid, the twelve numbers in the bar code must satisfy the following condition: 3a1 + a2 + 3a3 + a4 + 3a5 + a6 + 3a7 + a8 + 3a9 + a10 + 3a11 + a12 º 0 (mod 10).  A transposition error would go undetected if 2 numbers x and y in the bar code fit the following form: 3x + y º x + 3y.

  1. Find the transposition errors that would create problems for the user of the UPC-A system by virtue of the fact that they are not detected.

  2. Because of the way that the UPC-A check system is designed, when two numbers are transposed only those combinations of numbers a and b that meet the condition |a - b| = 5 go undetected.  For the IBM system, the only errors that go undetected are of the form |a - b| = 9.  Why does the IBM system detect for errors?  Find the probability of a two-digit transposition error going undetected in the UPC-A system.  Answer both parts to this question below.

Part B

The binary number system is used to develop the code used for the UPC-A system.  This lesson will investigate this base 2 system which is also an integral part of computer technology.

First let us compare the base 2 and base 10 systems to show their similarities and differences.  The base 10 system is a place value system consisting of the following places: ones place (100), tens place (101), hundreds place (102), thousands place (104), and so on.  The base 2 system consists of a ones place (20), twos place (21), fours place (22), eights place (23), and so on.  In base 10, the largest numeral that can be used in a particular place is 9, with the range of possible numbers being 0 through 9.  In base 2, the largest numeral that can be used is 1 with 0 being the only other choice of digit.

The number 13 in base 10 is represented by the number 1101 in base 2 with the 13 being made up of 1 eight, 1 four, 0 twos, and 1 one.  The number 1110010 in base 2 which is the right hand parity code for zero in the UPC-A system, is 114 in base 10.

Convert the left and right hand parity numbers in the table below into base 10.

UPC ENCODING SCHEME

Number value Left characters
(odd parity)
Base 10 Right characters
(even parity)
Base 10
0 0001101 13 1110010 114
1 0011001 .. 1100110 .
2 0010011 . 1101100 .
3 0111101 . 1000010 .
4 0100011 . 1011100 .
5 0110001 . 1001110 .
6 0101111 . 1010000 .
7 0111011 . 1000100 .
8 0110111 . 1001000 .
9 0001011 . 1110100 .
GUARD BARS 101 . 101 .
CENTER
01010



© Copyright
Area 10 Mathematics and Technology Professional Development Center
Permission is granted to duplicate these materials for classroom use.

Last updated on 1/30/1999
Comments: egalindo@indiana.edu
http://www.indiana.edu/~atmat/units/barcodes/bar_s3.htm