The Mathematics of Barcodes


Appendices
UPCA Background for Mathematics Lessons
Universal Product Code (UPC) was established for the benefit of the
food/supermarket industry to facilitate automatic scanning of item numbers
with associated price lookup at the point of sale. UPC is also utilized
on all retail products sold. The UPCA system is a 12 digit code.
The code consists of a number system character, a 5digit manufacturer
identification number, a 5digit item code number, and a check digit.
UPCE is a 6 digit code that is found on beverage containers among other
items, but will not be used in this series of lessons.
The number system character or data identifier, which is the first
number in the code is typically located at the lower left hand side of
the bar code and usually outside the bars and spaces. There are currently
7 categories of the number system character. The "0" is assigned to all
items except: "2" is designated for randomweight items such as meat and
produce; "3" is used for companies which have been assigned their National
Drug Code Number as their UPC; "4" is assigned for retailer use only; "5"
is designated for coupons; and "6" and "7" are used for industrial applications
including retail applications where they serve the same function as "0".
Important Notes Regarding UPC:

It codes only numbers from 0 to 9.

A narrow dark bar indicates a binary one and a narrow white space a binary
zero.

A bar or space may be from 1 to 4 spaces wide.

Each digit is coded by 2 bars and 2 spaces occupying a total of 7 spaces.

Digits to the left of the center pattern are coded spacebarspacebar.

Digits to the right of the center pattern are coded barspacebarspace.

Each digit has two binary codes. One is for the left hand of the
center pattern and one for the right.

Digits to the left of the center pattern are made up of an odd number (3
or 5) of binary ones (odd parity) and the digits on the right are made
up of an even number (2 or 4) of binary ones (even parity).

The binary number that is the used for each number is the binary code,
not the binary representation for that number.

The check digit is the twelfth digit encoded into the symbology but is
not necessarily printed in numeral form.

Each bar code consists of a right and left quiet zone, a right and left
guard pattern, a center pattern and of course the twelve number codes.

The quiet zone is 11 times the narrow bar width on the left and 7 times
the narrow bar width on the right.

The guard pattern for each side is barspacebar (101).

The center pattern divides the 12 numbers in half and consists of spacebarspacebarspace
(01010).

A complete UPCA symbology is made up of 30 bars and 29 spaces.

The complete symbology including quiet zones at 100% magnification is approximately
1.5 inches horizontally and 1.0 inches vertically.
Table 1  UPC ENCODING
SCHEME
Number value 
Left characters (odd parity) 
Right characters (even parity) 
0 
0001101 
1110010 
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 
OTHER TOPICS FOR CONSIDERATION
Statistics: Lesson could focus on entry errors such as approximately
1 in 300 for human keyboard entry and 1 in 3,000,000 for bar code entry.
Students could collect data from users of keyboard entry and bar code scanners
that would either validate or dispute these statistics. Data on the
cost to the company for these kinds of errors could be collected.
Another set of statistics that could be compiled is the cost of personnel
for the various means of data entry as opposed to the cost of the technology
being used. Students could then make conclusions concerning their
findings as to the most costefficient means of data entry.
Statistics: Lesson could focus on the cost of various kinds of
scanners (handheld wand about $100, heliumneon $600$2000,...), the errorrate
of each or the errorrate of the operator of each, and the type of material
being scanned (lowpriced retail goods or blood in a blood bank).
Students in this applied problem would have to gather the information,
set up some guidelines, make a decision, and then justify it to the "board."
ISBN Code: The International Standard Book Numbers are a number
code that includes a language or nation indicator, a number for the publisher,
a number for the published article or book itself, and a check number.
The check number is based on a modulo 11 scheme. A lesson of this
type would utilize equation solving skills and modular arithmetic.
Code 39: The "3 of 9" code scheme utilizes 3 wide elements (bars
or spaces) and 6 narrow ones. It allows more characters to be coded
(44 in all) and may also have a check number. Have students compare
code 39 to the UPCA system.
Developing a Bar Code: Students could be challenged to create
a bar code that utilized 2D symbology (for example, the length and width
of the bars would hold meaning instead of just the width).
LeftRight Parity: Students could investigate the coding scheme
in UPCA where the leftright parity is of utmost importance in terms of
bidirectional scanning. Some of the findings might include the total amount
of "barred" space for any number when the left and right codes are combined
is seven, with every "place" having a bar and that the lefthand code has
an odd number of bars (3 or 5) while the righthand code has an even number
of bars (2 or 4). Also, the seven spaces allowed for each number
are always filled by 2 bars and 2 spaces of width varying from 1 to 4 spaces
wide. A question that could be posed is, "Are there any more characters
could be coded using the existing UPCA scheme?"
BIBLIOGRAPHY
Gallian, J. A., The Mathematics of Identification Numbers, The College
Mathematics Journal 22 (1991) 194202.
Gallian, J. A. and S. Winters, Modular Arithmetic in the Marketplace,
American Mathematical Monthly 95 (1988) 548551.
Gumm, H. P., A New Class of Check Digit Methods for Arbitrary Number
Systems, IEEE Transactions on Information Theory 31 (1985) 102105.
Gumm, H. P., Encoding of Numbers to Detect Typing Errors, International
Journal of Applied Engineering Education 2 (1986) 6165.
Jacobs, Harold R., Mathematics: A Human Endeavor, San Francisco:
W.H. Freeman and Company (1982) 378409, 510517.
Knill, George, International Standard Book Numbers, Mathematics Teacher
74 (1981) 4748.
Peck, Lyman C., Secret Codes, Remainder Arithmetic and Matrices,
Reston, VA: National Council of Teachers of Mathematics (1975) 111, 2935.
Thornton, Davey S., Check Out UPCs, 80 Micro 46 (1983) 114120.
Wood, Eric F., Selfchecking CodesAn Application of Modular Arithmetic,
Mathematics Teacher 80 (1987) 312316.
© 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_t4.htm
