Figure 3.40If aIf a credit card number is entered incorrectly, error checking algorithms will often catch the mistake. (credit: modification of work “Senior couple at home checking finance on credit card from above” by Nenad Stojkovic/Flickr, CC BY 2.0)
Learning Objectives
After completing this section, you should be able to:
Add, subtract, and multiply using clock arithmetic.
Apply clock arithmetic to calculate real-world applications.
Online shopping requires you to enter your credit card number, which is then sent electronically to the vendor. Using an ATM involves sliding your bank card into a reader, which then reads, sends, and verifies your card. Swiping or tapping for a purchase in a brick–and-mortar store is how your card sends its information to the machine, which is then communicated to the store’s computer and your credit card company. This information is read, recorded, and transferred many times. Each instance provides one more opportunity for error to creep into the process, a misrecorded digit, transposed digits, or missing digits. Fortunately, these card numbers have a built-in error checking system that relies on modular arithmetic, which is often referred to as clock arithmetic. In this section, we explore clock, or modular, arithmetic.
Adding, Subtracting, and Multiplying Using Clock Arithmetic
When we do arithmetic, numbers can become larger and larger. But when we work with time, specifically with clocks, the numbers cycle back on themselves. It will never be 49 o’clock. Once 12 o’clock is reached, we go back to 1 and repeat the numbers. If it's 11 AM and someone says, “See you in four hours,” you know that 11 AM plus 4 hours is 3 PM, not 15 AM (ignoring military time for now). Math worked on the clock, where numbers restart after passing 12, is called clock arithmetic.
Clock arithmetic hinges on the number 12. Each cycle of 12 hours returns to the original time (Figure 3.41). Imagine going around the clock one full time. Twelve hours pass, but the time is the same. So, if it is 3:00, 14 hours later and two hours later both read the same on the clock, 5:00. Adding 14 hours and adding 2 hours are identical. As is adding 26 hours. And adding 38 hours.
Figure 3.41Clock showing 3:00 with arrow going around the clock one full time, or 12 hours
What do 2, 14, 26, and 38 have in common in relation to 12? When they are divided by 12, they each have a remainder of 2. That's the key. When you add a number of hours to a specific time on the clock, first divide the number of hours being added by 12 and determine the remainder. Add that remainder to the time on the clock to know what time it will be.
A good visualization is to wrap a number line around the clock, with the 0 at the starting time. Then each time 12 on the number line passes, the number line passes the starting spot on the clock. This is referred to as modulo 12 arithmetic. Even though the process says to divide the number being added by 12, first perform the addition; the result will be the same if you add the numbers first, and then divide by 12 and determine the remainder.
In general terms, let be a positive integer. Then modulo 12, written ( mod 12), is the remainder when is divided by 12. If that remainder is , we would write (mod 12).
Subtracting time on the clock works in much the same way as addition. Find the value of the number of hours being subtracted modulo 12, then subtract that from the original time.
Recall that clock arithmetic was referred to as modulo 12 arithmetic. Multiplying in modulo 12 also relies on the remainder when dividing by 12. To multiply modulo 12 is just to multiply the two numbers, and then determine the remainder when divided by 12.
Calculating Real-World Applications with Clock Arithmetic
Clock arithmetic processes can be applied to days of the week. Every 7 days the day of the week repeats, much like every 12 hours the time on the clock repeats. The only difference will be that we work with remainders after dividing by 7. In technical terms, this is referred to as modulo 7. More generally, let be a positive integer. Then modulo 7, written mod 7, is the remainder when is divided by 7. If that value is , we may write (mod 7).
Key Terms
clock arithmetic
modulo 7
modulo 12
Key Concepts
Clock arithmetic uses the idea that after 12 o’clock comes 1 o’clock. For clock arithmetic, this means that every time 12 is passed in an arithmetic process, the next number is 1, not 13.
To determine the clock result of an arithmetic operation, divide the final result by 12 and keep the remainder. If the remainder is 0, then the time is 12 o’clock.
Clock arithmetic is technically called modulo 12 arithmetic. To perform modulo 12 arithmetic, calculate the expression, then divide the result by 12. The modulo 12 result is the remainder.
Days, in our system, pass in groups of seven. To calculate in day arithmetic, modulo 7 is used. To perform modulo 7 arithmetic, calculate the expression, then divide the result by 7. The modulo 7 result is the remainder.