Articles for kids about math in everyday life, written by Ivars Peterson for Muse magazine.

May 4, 2007

Decoding Bar Codes

Just about every package you buy at the supermarket has a small label made of wide and narrow bars. This pattern stands for a 12-digit number, called a Universal Product Code (UPC), that identifies the product.

A 15-ounce box of Cheerios, for example, has the following number:
0 16000 66610 8

The first digit, 0, gives the product category—in this case, general groceries. The next five digits (16000) identify the manufacturer (General Mills). The following five digits (66610) identify the specific product: a 15-ounce box of Cheerios. A larger or smaller box would have a different number.

When you check out, the bar code is scanned and the store's computer retrieves the price for that product. The computer also does some arithmetic to help make sure the bar code scanned correctly. That's where the final digit of a UPC comes in. It's called a check digit.

In the tiny amount of time before the price appears on a cash register screen, the computer performs the following calculation using the first 11 digits of the UPC.

• Adds the six digits in the odd positions: 0 + 6 + 0 + 6 + 6 + 0 = 18
• Multiplies the result by 3: 18 x 3 = 54
• Adds the five digits in the even positions: 54 + 1 + 0 + 0 + 6 + 1 = 62
• Subtracts the sum from the next-highest multiple of 10: 70 – 62 = 8

If the result matches the UPC check digit, as it does in this case, the computer sends the price to the cash register. If it doesn't, the cashier hears a beep.
Try the calculation yourself on the UPC of your favorite product. It's amazing how much math goes on behind the scenes—even at a grocery store!

Muse, November 2001, p. 33.

No comments: