Bar Codes Module1
Bar Codes Module1
Number Theory
Barcodes
Module
Jesster U. Belen
MAED – Mathematics
BARCODES
Pre-Assessment
Barcodes
Learning Objectives
Assigned Reading
History of Barcodes
They can also be used to keep track of objects and people; they are
used to keep track of rental cars, airline luggage, nuclear waste, registered
mail, express mail and parcels.
• A database can link the UID to relevant information about the box; such
as order number, items packed, quantity packed, destination, etc.
• When the price of an item changes, you only need to update the
database in the computer, and not the items themselves.
The bar code is simply these bit strings put together and converted to
bars. Two (or more) active bits next to each other correspond to a wider bar ,
not two bars next to each other. The beginning and end symbols are two long
narrow lines with a narrow gap between them. The middle symbol is a narrow
gap followed by a narrow line, then a narrow gap, a narrow line and a final
narrow gap. The digits in UPC are encoded into a sequence of lines and gaps
in the following manner.
5 = 1-2-3-1
6 = 1-1-1-4
E
7 = 1-3-1-2
8 = 1-2-1-3
9 = 3-1-1-2
Something to notice:
All of these encodings seem to add up to 7
Do the same for the right-hand side, but start with a black bar
The last digit of the UPC code is called a check digit. This digit lets the
scanner determine if it scanned the number correctly or not. Here is how the
check digit is calculated for the other 11 digits, using the code 63938200039
wherein the check digit is 3. We’re going to use Modulo 10.
1st Method
Step 1
Add together the value of all of the digits in odd positions (digits 1, 3, 5, 7, 9
and 11).
6 + 9 + 8 + 0 + 0 + 9 = 32
Step 2
32 * 3 = 96
Step 3
Add together the value of all of the digits in even positions (digits 2, 4, 6, 8
and 10).
3 + 3 + 2 + 0 + 3 = 11
Step 4
Add this sum to the value in step 2.
96 + 11 = 107
Step 5
Take the number in Step 4. To create the check digit, determine the number
that, when added to the number in step 4, is a multiple of 10.
107 + 3 = 110
11 10
10 – [(3∑ ai + ∑ ai) mod 10] mod 10
i=1 i=2
11
3∑ ai = 96 (Odd Positions)
i=1
10
∑ ai = 11 (Even Positions)
i=2
10 – 7 mod 10
10 – 7 = 3 (Check digit)
2nd Method
Step 1
6 + 3 + 9 + 3 + 8 + 2 + 0 + 0 + 0 + 3 + 9 = 43
Step 2
2(32) = 64
Step 3
Add together the sum from Step 1 and Answer from Step 2.
43 + 64 = 107
Step 4
Take the number in Step 3. To create the check digit, determine the number
that, when added to the number in step 4, is a multiple of 10.
107 + 3 = 110
Assigned Writing
Try This!
1. 2.
Activity 1
1.
2.
Activity 2
Determine if the following barcode has an error using the check digit.
1.
2
Activity 3
Identify and solve for the check digit of the following barcodes.
1.
2.
For Further Study
https://science.howstuffworks.com/innovation/
repurposed-inventions/2d-barcodes.htm
http://www.waspbarcode.com/buzz/barcode/
https://www.explainthatstuff.com/how-data-matrix-codes-work.html
http://www.masabi.com/2011/03/04/connecting-the-dots-an-
introduction-to-2d-barcodes-3/
https://www.gs1.org/barcodes/2d
Assessment
1. B.
2. C.
3. A.
4. A.
5. B.
6. B.
7. C.
8. D.
9. C.
10. A.
Key To Correction Assign Writing (Barcodes)
1.
11 10
10 – [(3∑ ai+ ∑ ai) mod 10] mod 10
i=1 i=2
11
3∑ ai = 42 (Odd Positions)
i=1
10
∑ ai = 16 (Even Positions)
i=2
2.
11 10
10 – [(3∑ ai+ ∑ ai) mod 10] mod 10
i=1 i=2
11
3∑ ai = 78 (Odd Positions)
i=1
10
∑ ai = 20 (Even Positions)
i=2
10 – [(78 + 20) mod 10] mod 10
10 – (98 mod 10) mod 10
10 – 8 mod 10
10 – 8 = 2 (Check digit)
1.
022334545453
11 10
10 – [(3∑ ai+ ∑ ai) mod 10] mod 10
i=1 i=2
11
3∑ ai = 60 (Odd Positions)
i=1
10
∑ ai = 17 (Even Positions)
i=2
2.
836049290175
11 10
10 – [(3∑ ai+ ∑ ai) mod 10] mod 10
i=1 i=2
11
3∑ ai = 81 (Odd Positions)
i=1
10
∑ ai = 22 (Even Positions)
i=2
1.
12360105707
11 10
10 – [(3∑ ai+ ∑ ai) mod 10] mod 10
i=1 i=2
11
3∑ ai = 54 (Odd Positions)
i=1
10
∑ ai = 14 (Even Positions)
i=2
2.
12345678901
11 10
10 – [(3∑ ai+ ∑ ai) mod 10] mod 10
i=1 i=2
11
3∑ ai = 78 (Odd Positions)
i=1
10
∑ ai = 20 (Even Positions)
i=2
1. A.
2. C.
3. B.
4. D.
5. C.
6. C.
7. D.
8. D.
9. A.
10. D.
References:
https://www.irishtimes.com/news/science/that-s-maths-how-barcodes-and-qr-
codes-work-1.2055593
http://mathforum.org/library/drmath/view/56033.html
https://en.wikipedia.org/wiki/Barcode
https://www.quora.com/What-is-the-mathematics-behind-bar-codes
http://www.ams.org/publicoutreach/feature-column/fcarc-barcodes2
https://www.futurelearn.com/courses/maths-puzzles/0/steps/14004
https://prezi.com/6qbj5jzoh9tp/the-math-behind-bar-codes/
https://www.wikihow.com/Read-12-Digit-UPC-Barcodes
https://science.howstuffworks.com/innovation/repurposed-inventions/2d-
barcodes.htm
http://www.waspbarcode.com/buzz/barcode/
https://www.explainthatstuff.com/how-data-matrix-codes-work.html
http://www.masabi.com/2011/03/04/connecting-the-dots-an-introduction-to-2d-
barcodes-3/
https://www.gs1.org/barcodes/2d