Download Clock Arithmetic: Solving Time and Number Problems Using Modular Arithmetic and more Study notes Algebra in PDF only on Docsity! Clock Arithmetic It’s 6 o’clock at night. You eat supper for one hour, watch TV for 2 hours, study for 4 hours. What time are you done studying? If we add the time intervals, we get 6+1+2+4 = 13. But 13 o’clock is not a valid time (except in the army). The time will be 1 in the morning, which we get by subtracting 12 from 13. In mathematics we write this as: 13 mod 12 = 1. On a standard 12-clock, once you reach the number 12, the time resets to 0. Similarly, 25 mod 12 = 1 and −2 mod 12 = 10, that is, 2 hours before 12 is 10 o’clock. We are familiar with different clocks besides the 12-clock. For example, we can think of the days of the week as lying on a 7-clock. It is convenient to assign the days the values: Sun = 0, Mon = 1, Tues = 2, · · · , Sat = 6. Suppose you begin a trip for Florida on Wednesday. You spend 2 days driving. You stay in a hotel in Orlando for 6 days, and a hotel in Miami for 5 days. It takes 2 days to drive home. On what day do you return home? Since Wednesday is day number 3, we can add up all the days to get: 3 + 2 + 6 + 5 + 2 = 18. On a 7-clock, 18 is the same as 4, which we write as: 18 mod 7 = 4. So you return on day number 4, or Thursday. The number of pennies needed in the exact change for a purchase can be computed using a 5-clock. For example, suppose you buy a $1.99 sandwich, a $.89 drink, and the tax is 26 cents. How many pennies do you need to pay the bill? Adding the three numbers as cents, we have (199 + 89 + 26) mod 5 = 314 mod 5 = 4. You need 4 pennies (plus a dime and 3 dollars). 1 2 In general, on an n-clock we write a mod n = r if r is the remainder when you divide a by n. We also say “a reduces to r mod n.” Here are the addition and multiplication tables for 5-clock arith- metic: + 0 1 2 3 4 0 0 1 2 3 4 1 1 2 3 4 0 2 2 3 4 0 1 3 3 4 0 1 2 4 4 0 1 2 3 × 0 1 2 3 4 0 0 0 0 0 0 1 0 1 2 3 4 2 0 2 4 1 3 3 0 3 1 4 2 4 0 4 3 2 1 Let’s examine the times table. The zero row and zero column consists of all 0’s. What did we expect? Zero times anything is zero. If we ignore the 0 row and column, the rest of the times table has some interesting properties. Notice, for example, the numbers 1, 2, 3, and 4 are scrambled when we multiply by 2, 3, or 4. That is, each of the rows list the numbers 1, 2, 3, 4 in some order. In the second row we get 2, 4, 1, 3; in the third row we get 3, 1, 4, 2; in the last row the numbers are backwards 4, 3, 2, 1. This scrambling phenomenon is the key idea in constructing the secret codes discussed in the next section.