The Mathematics
of Barcodes

Cracking Barcodes
The UPC a Scheme
Coding Errors
Appendices
Credits




Student CopyTeacher CopyReference Copy

Activity 1: Cracking Barcodes
(Reference Copy)

Student Glossary

Binary number system
Base two number system as opposed to the decimal (base 10) system which is the standard system.  For example, 5 in base 10 is 101 in binary (1 four, no twos, and 1 one).

Complement Rule
The sum of the probabilities of an event happening or not happening is one [P(a) + P(not a) = 1].  For example, if the probability of rain is .4, the probability of not having rain is .6.

Congruence ()
Symbol used to describe numbers in modular arithmetic that are equivalent to each other.  These numbers have the same remainder when divided by the modulus.  In mod 10, for example, 23133.

Counting Principle
Method used to find the number of ways of making several decisions in succession.  To find the number of ways, multiply the number of choices that can be made in each decision.

Modular Arithmetic
An arithmetic system based on the remainder obtained when dividing a given number by the base number which is called a modulus.

Permutation
Any ordered arrangement of a set of objects.  In the coding permutation (1248), 1 is coded as 2, 2 becomes 4, 4 is coded as 8, and 8 becomes 1.

Probability
The chance or likelihood of an event happening.  The theoretical probability of an event happening is defined as the number of favorable outcomes divided by the total number of outcomes.  When rolling a die, for example, the chance of getting an even number is 3/6 because 3 of the 6 numbers on a die are even.


UPC Encoding Scheme

  • 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 space-bar-space-bar.
  • Digits to the right of the center pattern are coded bar-space-bar-space.
  • 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 bar-space-bar (101).
  • The center pattern divides the 12 numbers in half and consists of space-bar-space-bar-space (01010).
  • A complete UPC-A 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 
0011001 1100110 
0010011  1101100 
0111101  1000010 
0100011 1011100
0110001  1001110 
0101111  1010000 
0111011  1000100
8 0110111 1001000 
9 0001011  1110100
GUARD BARS  101 101 
CENTER                                   01010 
 

 



Bar Codes from common household products
Bar Code 1 
The 12th digit is missing 
Click on the picture to see the bar code in a new window.
 



 
Bar Code 2 
The 12th digit is missing 
Click on the picture to see the bar code in a new window.
 



 
Bar Code 3 
The 12th digit is missing 
Click on the picture to see the bar code in a new window.


 
Bar Code 4 
A 12 digit code 
Click on the picture to see the bar code in a new window.


 
Bar Code 5 
A 12 digit code 
Click on the picture to see the bar code in a new window.


 
Bar Code 6 
A 12 digit code 
Click on the picture to see the bar code in a new window.




© 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_r1.htm