1.2 Modular Arithmetic and Check Digit Schemes Recall Long Division
Total Page:16
File Type:pdf, Size:1020Kb
1.2 Modular Arithmetic and Check Digit Schemes Recall Long Division: a = mq + r and 0 ≤ r < m (division algorithm) Dividend = a Divisor = m Quotient = q Remainder = r If r = 0, "m divides a" and we write m a Example: a) Given a = 543 and m= 13, find q and r: b) Use a calculator to divide 543 ÷ 13 to determine q and r. Procedure for finding r with calculator: 1. Divide a÷m. The whole number portion is q. 2. Multiply the decimal portion of the above result by m to approximate r. 3. Round r to the nearest whole number. Example: Use a calculator to find q and r for -359÷7 Congruence Modulo m The difference between two numbers is divisible by m: m≥2. a is congruent to b modulo m is: a≡b mod m and this means that m evenly divides (ab): or m (ab) "m" is called the modulus. If the modulus is obvious, we can write a≡b (Check out the patterns in table 1.5 on page 23) Examples: 1. Verify the congruences a) 66≡38 mod7 b) 3422≡-153 mod13 c) -34≡ -89 mod5 2. a) Determine the integer r that is congruent to 132 mod5 such that r ≡ 132 mod5 b) List all the integers that are congruent to 132 modulo 5 Modular Arithmetic (See Theorem page 25) Let m≥2 be a fixed integer and let a, b, c, and d be arbitrary integers. Then the following are true: 1. a ≡ a mod m 2. If a≡b mod m, then b≡a mod m. 3. If a≡b mod m and b≡c mod m, then a≡c mod m. 4. If a≡b mod m and c≡d mod m, then a+c≡b+d mod m. 5. If a≡b mod m and c≡d mod m, then axc≡bxd mod m. 6. If a≡b mod m, then ak ≡bk mod m, for any positive integer k. Practice: Verify that 16x31 ≡ 6 mod 7 1) Use definition: 2) Use #5 above: 3) find "r" for r≡210 mod 7 (use property #5) 4) Compute 2300 modulo 7 (use property #6) Mod 9 Check Digit Scheme: the check digit is the whole number from 0 to 8 that is congruent to the ID number modulo 9. (see p. 26 for the formal definition) Examples: 1. Determine the check digit (in the fifth position) for 5368_ 2. Find the missing digit: 73_11 Another Example: ("casting out nines") Suppose a U.S. Post Office money order is identified by the 10digit number 2995709918_. What should be the check digit in the 11th position? Now work with a partner or two...read the rest of pp. 28 and 29 and work out the Examples. Be prepared to explain! Summary and Table 1.7 (VIN numbers).