Title: A%20Mathematical%20View%20of%20Our%20World
1A Mathematical View of Our World
- 1st ed.
- Parks, Musser, Trimpe, Maurer, and Maurer
2Chapter 1
3Section 1.1ID Numbers and Check Digits
- Goals
- Study social security numbers
- Study general identification numbers
- Transmission errors
- Check digits
- Study universal product codes
41.1 Initial Problem
- Can you be confident that you will be charged the
correct price if you purchase the item with this
UPC? - The solution will be given at the end of the
section.
5Social Security Numbers
- A social security number (SSN) is made up of
- A three-digit area number
- A two-digit group number
- A four-digit serial number
6Area Number
- XXX-XX-XXXX
- Area numbers range from 001 728.
- Before 1973, the area number depended on the
state in which the office issuing the number was
located. - Since 1973, the area number is determined by the
mailing address of the applicant.
7Area Number, contd
8Area Number, contd
9Group Number
- XXX-XX-XXXX
- Group numbers range from 01 99.
- The group number groups together certain social
security numbers. - The group number is not determined by any group
to which a person belongs.
10Group Number, contd
- Group numbers are issued as follows
- First, odd numbers from 01 to 09.
- Second, even numbers from 10 to 98.
- Third, even numbers from 02 to 08.
- Fourth, odd numbers from 11 to 99.
11Serial Number
- XXX-XX-XXXX
- Serial numbers range from 0001 9999.
- Serial numbers are issued in numerical order from
smallest to largest.
12Example 1
- Which state was listed in the mailing address of
the applicant who received the number 501-92-3287
? - Which number was issued first
- 362-13-4158 or 362-14-9725 ?
13Example 1, contd
- Solution The area number in 501-92-3287 is 501.
According to Table 1.1, this social security
number was issued to someone with a mailing
address in North Dakota. - Solution The group number 14 is issued before
the group number 13, so 362-14-9725 was issued
before 362-13-4158.
14General ID Numbers
- Many items besides people are assigned
identification numbers. - For example
- International Standard Book Numbers (ISBN) for
books - Vehicle Identification Numbers (VIN) for cars
- Universal Product Codes (UPC) for grocery items
15General ID Numbers, contd
- Identification numbers are divided into two
types - Numeric ID numbers
- Strings of digits
- Alphanumeric ID numbers
- Strings of digits, letters, and/or other symbols
16General ID Numbers, contd
- All digits, letters, or other symbols in an
identification number are called characters. - The length of an identification number is the
number of characters in the string. - Spaces, dashes, or other separators are not
counted in the length of the string.
17Question
- A numeric identification number can contain
- a. numbers only.
- b. letters and numbers only.
- c. letters, numbers, and other characters.
18Example 2
- Determine the type and length of each ID number.
- SSN 876-87-6543
- ISBN 0-07-231821-X
- VIN GHN5UC265518G
- UPC 0 51000 01031 5
19Example 2, contd
- Solutions
- The SSN 876-87-6543 is a numeric ID number of
length 9. - The ISBN 0-07-231821-X is an alphanumeric ID
number of length 10. - The VIN GHN5UC265518G is an alphanumeric ID
number of length 13. - The UPC 0 51000 01031 5 is a numeric ID number of
length 12.
20Transmission Errors
- An error in recording, reading, or relating an
identification number is called a transmission
error. - Two common ways in which transmission errors
occur are replacement and transposition. - One character may accidentally be replaced by a
different, incorrect, character. - Two adjacent characters may be interchanged.
21Example 3
- What type of error occurred in each situation?
- The SSN 123-45-6789 was recorded as 123-45-6798.
- The SSN 123-45-6789 was recorded as 123-45-6788.
22Example 3, contd
- Solutions
- The last two characters 89 were incorrectly
written as 98. This is a transposition error. - The last character 9 was incorrectly written as
an 8. This is a replacement error.
23Transmission Errors, contd
- Suppose every possible ID number is a valid
number in the identification system being used. - Any transmission errors in the number will
result in the wrong person or item being
identified. - It will not be evident that an error was made.
- Most modern ID number systems are designed to
guard against transmission errors.
24Check Digits
- Additional digits added to an identification
number so that errors in transmission can be
found are called check digits. - Ideally, a check-digit system should insure that
any single-digit transmission error will result
in an invalid ID number so that the error will be
detected.
25Question
- Suppose a company assigns each employee a
four-digit ID number in which the first three
digits come from 0 through 9 and the last digit
is a check digit chosen so that the sum of all
four digits is divisible by 7. Fill in the
missing digit in the ID number 3_82. - a. 7 b. 5 c. 3 d. 1
26Example 4
- Suppose a biology professor assigns a four-digit
numeric ID number to each of the almost 1000
students in his class. - The first three digits are randomly assigned.
- The fourth digit is the smallest number that
makes the sum of all 4 digits divisible by 9.
27Example 4, contd
- If a replacement error is made in a single digit,
it may be detected. - A 9 changed to a 0 or a 0 changed to a 9 will not
be detected. - Other single-digit errors will be detected.
- Transposition errors will not be detected.
- Replacement errors in two or more digits may not
be detected.
28Example 5
- Suppose the professor from example 4 assigns a
four-digit numeric ID number with the same check
digit scheme, but using only the digits 0 8. - Any single-digit transmission error will be
detected. - If a digit is changed to another digit from 0
8, the sum changes and is no longer divisible by
9. - If a digit is changed to a 9, it will be
recognized as an invalid digit.
29Universal Product Codes (UPC)
- Almost every retail product has a 12-digit
numeric identification number, called a UPC,
printed on its packaging. - Examples of UPCs are shown below.
30UPCs, contd
- The first digit, called the number system
character, indicates the type of product.
31UPCs, contd
- The first group of five digits, called the
manufacturer number, indicates the company that
makes the product.
32UPCs, contd
- The second group of five digits, called the
product number, indicates the specific product
being sold. - Items sold by weight are not printed with product
numbers. - Different manufacturers may use different or the
same product numbers. There is no relationship
between product numbers for various manufacturers.
33UPCs, contd
- The last digit is the check digit.
- If the digits in a UPC are labeled as
then the check digit is chosen so that the sum
is divisible by 10.
34UPCs, contd
- The check-digit scheme for UPC numbers is a
two-weight scheme. - The weights used are 3 and 1.
- The sum
is called a weighted sum.
35Example 6
- Answer questions a b about the chicken broth
UPCs from the example earlier 0 74785 00252 8
and - 0 74785 50352 0.
- What is the number system character and what does
it represent? - Solution The number system character for both is
0 and it indicates that the chicken broth is a
general grocery item.
36Example 6, contd
- What is the manufacturer number and what does it
represent? - Solution The manufacturer number for both is
74785 and it indicates that the manufacturer is
Valley Fresh Inc. (not given in the previous
table of common manufacturers).
37Example 6, contd
- What is the product number and what does it
represent? - Solution The product number for the can of clear
broth is 00252. The product number for the can
of fat free broth is 50352. - Two different products from the same company have
two different product numbers.
38Example 6, contd
- Verify that the check digits are correct.
- Solution For the can of clear broth, the
calculation is
The weighted sum is divisible by 10, so the check
digit is correct.
39Example 6, contd
- Solution For the can of fat free broth, the
calculation is
The weighted sum is divisible by 10, so the check
digit is correct.
40Example 7
- If the first 11 digits of a UPC are 2 13576
05341, what must the check digit be?
41Example 7, contd
- Adding a 1 to 69 would make the weighted sum
divisible by 10. The check digit must be a 1.
42Example 8
- The first digit of a UPC is missing. If the
remaining code is 01947 12513 3, what was the
missing digit?
43Example 8, contd
- The missing digit must be a 2, so that 6 64
70 will be divisible by 10.
441.1 Initial Problem Solution
- Can you be confident that you will be charged the
correct price if you purchase the item with this
UPC?
45Initial Problem Solution, contd
- The UPC is 2 26080 80291 8.
- The initial digit of 2 indicates this item is
sold by weight. - When the item was weighed a machine produced a
label with the cost 2.91 in positions 9 through
11 of the UPC. - The check digit is 8. Using the weighted sum
check digit scheme will verify that this is
correct. - The UPC is correct and you will be charged the
right amount.
46Section 1.2Modular Arithmetic andCheck Digit
Schemes
- Goals
- Study the division algorithm
- Study congruence modulo m
- Study modular check digit schemes
471.2 Initial Problem
- Suppose you want to buy a car. The vehicle
identification number is 1G4HP54C5KH410030. - Is this number legitimate?
- The solution will be given at the end of the
section.
48Numbers
- Whole numbers are represented by the numerals 0,
1, 2, 3, 4, - Integers are represented by the numerals , -3,
-2, -1, 0, 1, 2, 3,
49The Division Algorithm for Whole Numbers
- The constants a and m must be whole numbers with
m not equal to zero. - There are unique whole numbers q and r such that
a mq r. - The constant r, the remainder, is less than m and
greater than or equal to zero. - The constant a is the dividend, m is the divisor,
and q is the quotient. - If r 0, we say that m divides a or write ma.
50Example 1
- Use the division algorithm to find the quotient
and remainder for the divisor 5 and the dividend
21.
51Example 1, contd
- Solution We see that 21 5(4) 1, so the
quotient is q 4 and the remainder is r 1. - Since the remainder is not 0, 5 does not divide
21.
52Example 2
- Use the division algorithm to find the quotient
and remainder for the divisor 6 and the dividend
108.
53Example 2, contd
- Solution We see that 108 6(18) 0, so the
quotient is q 18 and the remainder is r 0 - Since the remainder is 0, 6 divides 108.
54Division Algorithm, contd
- Many check digit schemes are based on using the
division algorithm. - Usually it is the remainder from a division that
is used as a check digit. - The quotient and remainder can be found by doing
long division or by dividing on a calculator.
55Division Algorithm, contd
- To find the quotient and remainder for a whole
number division using a calculator - Perform the division a/m on the calculator. The
whole number portion of the result is the
quotient q. - Multiply the decimal portion of the result from
Step 1 by the divisor m to get an approximation
of the remainder r. - Round r to the nearest whole number to find the
remainder.
56Example 3
- Use a calculator to find the quotient and
remainder for the divisor 13 and the dividend 543.
57Example 3, contd
- Solution
- Divide 543 by 13. The calculator shows a result
of 41.7692307692. The quotient is 41. - Multiply 0.7692307692 by 13. The result is
9.9999999996. - Round 9.9999999996 to the nearest whole number to
find the remainder. The remainder is 10. Check
that 13(41) 10 543.
58Question
- Find the quotient and remainder for the divisor
39 and the dividend 217. - a. q 22, r 5
- b. q 0, r 39
- c. q 5, r 22
- d. q 3, r 0
59The Division Algorithm for Integers
- The constants a and m must be integers with m
greater than or equal to one. - There are unique integers q and r such that a
mq r. - The constant r, the remainder, is less than m and
greater than or equal to zero. - The constant a is the dividend, m is the divisor,
and q is the quotient. - If r 0, we say that m divides a or write ma.
60Division Algorithm, contd
- To find the quotient and remainder for an integer
division using a calculator - Perform the division a/m on the calculator.
- If the result is a whole number, the result is q.
- If the result is not a whole number, q is the
next smallest negative number.
61Division Algorithm, contd
- Contd
- Subtract q from the results from Step 1 and then
multiply this value by the divisor m to get an
approximation of the remainder r. - Round r to the nearest whole number to find the
remainder.
62Example 4
- Use a calculator to find the quotient and
remainder for the divisor 7 and the dividend -359.
63Example 4, contd
- Solution
- Divide -359 by 7. The calculator shows a result
of -51.2857142857. The quotient is - -52.
- Subtract -52 from -51.2857142857 to get
0.7142857143. Multiply 0.7142857143 by 7. The
result is 5.0000000001. - Round 5.0000000001 to the nearest whole number to
find the remainder. The remainder is 5. Check
that 7(-52) 5 - -359.
64Congruence Modulo M
- The constants a, b, and m must be integers with m
greater than or equal to two. - Then if m evenly divides a b, we say a is
congruent to b modulo m. - The constant m is called the modulus, and the
phrase modulo m is often shortened to mod m. - The definition above can be written symbolically
as follows
65Question
- Choose the number below that is NOT congruent to
85 mod 3. - a. 52
- b. 55
- c. 62
- d. 64
66Example 5
- Verify each of the congruencies.
-
- Solution 66 38 28 4(7). Since the
difference of the two integers is a multiple of
7, they are congruent mod 7. -
- Solution 3422 -153 3575 275(13). The two
integers are congruent mod 13.
67Modular Arithmetic
- Let modulus m gt 0 be a fixed integer. The
numbers a, b, and c are integers. - Modular arithmetic has the following rules
-
-
-
68Modular Arithmetic, contd
-
-
-
-
- Where k is any positive integer
69Modular Check Digit Schemes
- Common choices of a modulus for check digit
schemes are 7, 9, 10, and 11. - Modular check digit schemes follow this pattern
- If necessary, replace each non-numeric character
with a digit according to a standard code.
70Modular Check Digit Schemes
- Contd
- Treat the string as a whole number or combine the
digits in some type of weighted sum. - The check digit is the whole number r between 0
and m 1 that is congruent mod m to the number
from step 2. If a check digit is greater than 9,
it must be replaced by an alphanumeric character.
71A Mod 9 Check Digit Scheme
- An ID number has k 1 digits, where k is some
positive integer - The check digit, which is the last digit, is the
whole number from 0 to 8 that is congruent modulo
9 to the number made up of the first k digits.
72Example 6
- A company uses a mod 9 check digit scheme for
5-digit ID numbers. What is the check digit for
5368?
73Example 6, contd
- Solution Calculate 5368/9 596.444444444.
- Multiply 0.444444444 by 9 to get 3.99999999996.
- The remainder, which is the check digit, is 4.
The complete ID number is 53684.
74Mod 9 Check Digit Scheme, contd
- The check digit in this type of scheme can also
be found through the shortcut of casting out
nines. - Add the first k digits of the ID number.
- This sum must be congruent modulo 9 to the check
digit - Example 5368 22, which is congruent to 4
mod 9. The check digit is again found to be 4.
75Example 7
- A company uses a mod 9 check digit scheme for
5-digit ID numbers. What is the missing digit in
the smudged number?
76Example 7, contd
- Solution Call the missing digit X. The ID
number is 73X11. Using the procedure of casting
out nines we find that 7 3 X 1 11 X
must be congruent mod 9 to the check digit 1. We
see that 11 8 19, which is 1 more than a
multiple of 9. The missing digit X must be 8. - The ID number is 73811.
77Example 8
- A U.S. Post Office money order has an 11 digit ID
number with a mod 9 check digit scheme. - If a money order has an ID number of 2995709918
what is the check digit that should go in the
11th place in the string?
78Example 8, contd
- Solution 2995709918 is congruent mod 9 to its
check digit. The sum of its digits is 2 9 9
5 7 0 9 9 1 8 59, which is
congruent to 5 mod 9. - The check digit is 5.
- The entire ID number for the money order is
29957099185.
79Example 9
- Euro banknotes use a check digit scheme in which
the check digit is chosen so that the entire
serial number is divisible by 9. - The code is alphanumeric, with values assigned to
the letters as shown in the next slide.
80Example 9, contd
81Example 9, contd
- Suppose a 20-euro banknote has a serial number of
S07090546498 - Verify that the serial number is correct.
82Example 9, contd
- Solution The serial number is S07090546498. The
character S has a value of 2. - The serial number is worth 207090546498.
- The sum of its digits is 2 0 7 0 9 0
5 4 6 4 9 8 54, which is congruent to
0 mod 9.
83A Mod 7 Check Digit Scheme
- An ID number has k 1 digits, where k is some
positive integer - The check digit, which is the last digit, is the
whole number from 0 to 6 that is congruent modulo
7 to the number made up of the first k digits.
84Example 10
- An airline ticket has an ID number with a mod 7
check digit scheme. - Verify that the number located in the bottom
center of the ticket below is a valid ID number.
85Example 10, contd
- Solution The ID number is equal to
1615042694252. - For the ID number to be valid, the number made of
the first 12 digits must be congruent to 2 mod 7.
- Check that 7 divides (161504269425 2)
161504269423, so the congruency holds and the
number is valid.
86A Mod 11 Check Digit Scheme
- A check digit scheme for VINs uses congruence
modulo 11. - A VIN is a 17-digit alphanumeric ID number with
values assigned to the characters according to
the table below.
87Mod 11 Check Digit Scheme, contd
- The check digit is the 9th character. A check
digit of 10 is represented by X. A weighted sum
is used with weights of 8, 7, 6, 5, 4, 3, 2, 10,
9, 8, 7, 6, 5, 4, 3, and 2 for the characters.
881.2 Initial Problem Solution
- The cars VIN is 1G4HP54C5KH410030. Is this
number legitimate? - The digit 5 in the 9th position is the check
digit. - Convert each letter to a digit.
- The 16 digits, without the check digit, are
17487543 28410030.
89Initial Problem Solution, contd
- Calculate the weighted sum
- 8(1) 7(7) 6(4) 5(8) 4(7) 3(5) 2(4)
10(3) 9(2) 8(8) 7(4) 6(1) 5(0) 4(0)
3(3) 2(0) 327. - If the VIN is valid, 327 must be congruent modulo
11 to the check digit 5. However, this is not
the case. - The VIN is not valid. Do not buy the car.
90Section 1.3Encoding Data
- Goals
- Study binary codes
- Morse code
- UPC bar codes
- Braille code
- ASCII
- Postnet code
911.3 Initial Problem
- The envelope below has been damaged. Use the
Postnet bar code to determine the ZIP4 code. - The solution will be given at the end of the
section.
92Binary Codes
- Coding methods are used to encode numbers and
other data before they are transmitted. - A data coding system made up of two states or
symbols is called a binary code.
93Binary Codes, contd
- Many common coding systems are binary codes.
- Morse code
- UPC bar codes
- Braille code
- ASCII
- Postnet code
94Morse Code
- In Morse code, each character is encoded using
dots and dashes. - Morse code is a binary code because it was
developed for telegraphs which have two states,
ON and OFF. - The code is created by leaving the telegraph
circuit ON or OFF for a certain length of time.
95Morse Code, contd
- The circuit is ON for one unit of time to create
a dot. - The circuit is ON for three units of time to
create a dash. - The circuit is OFF for one unit of time between
any dots or dashes in a character.
96Morse Code, contd
- The circuit is OFF for three units of time
between characters. - The circuit is OFF for six units of time between
words.
97Morse Code, contd
- The codes for each character are shown below.
98Example 1
- The Morse code for the word MATH is illustrated
in the figure below. - ON is represented by a black square and OFF by a
white square.
99Morse Code, contd
- ON and OFF can also be represented by the binary
digits 0 and 1. - ON is represented by 1.
- OFF is represented by 0.
- Example The letter A can be encoded using 0s and
1s as shown below.
100Morse Code, contd
101Example 2
- Convert the message MATH to Morse code using 0s
and 1s.
102Example 2, contd
- Solution
- M is encoded as 1110111
- A is encoded as 10111
- T is encoded as 111
- H is encoded as 1010101
- A 0 is inserted between each character.
- The coded message is 11101110001011100011100010
10101.
103Example 3
- Convert the Morse code message 101010100010100000
01110001010101000100010111010001 to English. - Recall that the code 000 separates characters,
while 000000 separates words.
104Example 3, contd
- Solution
- The first word is 1010101000101.
- 1010101 H
- 000 break between characters
- 101 I
- The first word is HI.
105Example 3, contd
- The second word is 1110001010101000100010111010001
- 111 T
- 000 break between characters
- 1010101 H
- 1 E
- 1011101 R
- 1 E
- The decoded message is HI THERE
106Question
- Translate the message SMILE into Morse code.
- a. 10101011101110101010111010101
- b. 1010100011101110001010001011101010001
- c. 10101000000111011100000010100000010111010100000
01 - d. 10101000111011100010111000101110101000101110101
107UPC Bar Codes
- Universal Product Code (UPC) numbers on retail
items are encoded using a binary code. - The encoding is represented by vertical bars.
- The bars are easily read by the laser scanner.
108UPC Bar Codes, contd
- Each digit is first replaced with a binary code.
109Question
- Does the UPC binary code below represent a
manufacturer number or a product number? - 1010000101110011101000
- a. manufacturer number
- b. product number
- c. impossible to determine
110UPC Bar Codes, contd
- Similarly to Morse code, each 0 is represented by
a white bar and each 1 by a black bar.
111Example 4
- Convert the manufacturer number 365 into a
sequence of 0s and 1s.
112Example 4, contd
- Solution
- The digit 3 is encoded as 0111101.
- The digit 6 is encoded as 0101111.
- The digit 5 is encoded as 0110001.
- The encoding is 011110101011110110001.
113Example 5
- Convert the manufacturer number 365 into a bar
code.
114Example 5, contd
- Solution The individual bar codes for 3, 6, and
5 are found in the table.
115Example 5, contd
- Solution, contd The individual bar codes are
placed in order from left to right, and then
scaled to look like a UPC.
116UPC Bar Codes contd
- The laser scanner at the store must be able to
read - In which direction a bar code is scanned
- Where a bar code begins and ends
- Various widths of bars used on different products.
117UPC Bar Codes contd
- Every UPC bar code begins and ends with a guard
bar pattern. - The pattern consists of a white strip between two
black strips, all the same width. - The width of each strip is called a module and is
the unit of width for that particular bar code.
118UPC Bar Codes contd
- Every UPC bar code also has a center bar pattern.
- The pattern consists of five alternating strips,
starting with white. - Each strip is one module wide.
119UPC Bar Codes contd
- A bar code from a can of Campbells Cream of
Chicken Soup is shown below.
120Example 6
- Check this bar code for Campbells Cream of
Chicken Soup. The manufacturer number is 51000
and the product number is 01031. - Recall that a UPC consists of a single digit,
followed by the manufacturer number, the product
number, and finally a check digit. - For general grocery items the initial digit is 0.
121Example 6, contd
- Solution The first 11 digits of the UPC number
are 05100001031. The check digit, d, must be
found. - We know that the weighted sum
- 3(0 1 0 0 0 1) 1(5 0 0 1 3
d) must be a multiple of 10. So 6 9 d 15
d indicates that d must be a 5. - The UPC number is 051000010315.
122Example 6, contd
- Solution contd The bar code for the UPC
051000010315 must be created. - A guard bar pattern begins the code.
- The bar code for each digit in the manufacturer
number and the product number follows. - Recall that the center bar pattern goes between
the manufacturer and product codes. - A guard bar pattern ends the code.
123Example 6, contd
- Solution contd The bar code is shown below, in
its initial state and its final scaled version.
124Example 6, contd
- Solution contd Compare our bar code for the
soup to a bar code from an actual can of soup.
125Braille Code
- The Braille system of writing is a binary code.
- Every Braille symbol is a pattern of 6 dots, each
of which is raised or not raised.
126Braille Code, contd
- The Braille code for the alphabet is shown below.
127Example 7
- Decode the Braille message shown below.
128Example 7, contd
- Solution Find each character in the Braille
alphabet.
- The message is decoded as NEVERMORE.
129ASCII
- The American Standard Code for Information
Interchange (ASCII) is used by most computers. - ASCII is pronounced ask-key.
- Each character is encoded using 8 binary digits,
called a byte.
130ASCII, contd
131ASCII, contd
- A second table below gives the ASCII code for 32
non-printing control characters.
132Example 8
- Convert the message from ASCII to English.
- 01001000 01000101 01001100 01001100 01001111.
133Example 8, contd
- Solution
- 01001000 H
- 01000101 E
- 01001100 L
- There are two of these.
- 01001111 E
- The message reads HELLO.
134Postnet Code
- The U.S. Postal Service uses a code called
Postnet to encode ZIP codes as bars. - Postnet encodes
- 9-digit ZIP4 codes used on business reply forms
- 11-digit ZIP4 plus delivery-point code used on
reduced-rate business mail. - A delivery-point code consists of the last two
digits of the street address or box number.
135Postnet Code, contd
- Postnet uses 5 bits to allow for error detection.
The code for each digit is shown in the table
below.
136Postnet Code, contd
- On pieces of mail, the Postnet code is
represented as a series of bars. - The 1s are represented by tall bars.
- The 0s are represented by short bars.
- The Postnet bar codes are shown below.
137Postnet Code, contd
- Complete Postnet codes include
- Guard bars, consisting of a single tall bar on
each end. - An extra check digit before the last guard bar.
- The check digit is chosen so that the sum of all
the digits is divisible by 10.
1381.3 Initial Problem Solution
- The envelope below has been damaged. Use the
Postnet bar code to determine the ZIP4 code.
139Initial Problem Solution, contd
- Each set of 5 bars inside the guard bars
represents a digit. Compare the code on the
envelope to the decoding table.
140Initial Problem Solution, contd
- The final 0 is the check digit. The ZIP4 code
is 80323-8510.