Associated Topics || Dr. Math Home || Search Dr. Math

### Bar Codes and Check Digits

```
Date: 10/13/2001 at 23:02:57
From: Melissa DeSouza
Subject: Bar Codes

Dr. Math,

I've been looking through books, the Internet, articles, and other
resources about Bar Codes. I understand their application to the real
world, but don't understand how it could be used in a science/math
fair. I don't understand what they have to do with math. I find bar
codes under sections of math. Can you please tell me why?
I would greatly appreciate it.

Thank you!
```

```
Date: 10/14/2001 at 02:27:22
From: Doctor Jeremiah
Subject: Re: Bar Codes

Hi Melissa,

Bar codes have a lot to do with math. A string of numbers has to be
represented by bars. How many bars does it take to represent one
number and what different widths of bars?

Also, because bar code readers might make a mistake, error-checking
bars are used to check the answer. This is the same as any other
string of numbers. The last number on a credit card number is a check
digit used to decide whether the number is typed in correctly or not,
and the last digit on an ISBN number (serial numbers for books) is a
check digit. Bar codes have both parity bars (some for each digit) and
a check digit. But how do you calculate a check digit? And what is the
smallest check digit that provides a certain probability of catching
an error?

A check digit can't catch all the errors. To be completely accurate
the check would have to be the exact same size as the rest of the
number, and thats inefficient. So if a bar code is 9 digits and there
is one check digit, the probability of the number and size of errors
it will catch has to do with how it's calculated.

There are many ways to calculate check digits. Credit cards use the
Luhn code, computers use polynomial CRC values, and bar codes use a
wide variety of different schemes:
POSTNET, Code 39, Codabar, Interleaved 2 of 5, Code 128 (sets A, B and
C), UPC-A, EAN-13, EAN-8, EAN-128, UCC-128, MSI / Plessy, Code 11,
RM4SCC, PLANET, 4-State, SSCC-18 and SCC-14 are just some of them!

For a math fair you could describe how the check digits are
calculated, do some analysis to see which offers the best error
checking ability, and so on.

Here are some Web sites with information on check digits:

Decode the Bar Code! - Lasco Fittings
http://www.lascofittings.com/BarCode-EDI/Decode.htm

How UPC Bar Codes Work - HowStuffWorks
http://www.howstuffworks.com/upc.htm

How To Strip Check Digit From Code 3 Of 9 Barcode Data
http://www.pixtran.com/support/kb/1113.shtml

Bar Code Check Digit Calculator and Printing Application
for Barcode Fonts
http://www.bizfonts.com/barcodeapp/

Or you could just search the Internet for "bar code" and "check
digit," as I did. There are lots of sites out there!

- Doctor Jeremiah, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
High School Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search