Lecture Notes: Modular Arithmetic, Groups, & Codes
Clock Arithmetic
If it's 4 o'clock now, what time will it be in 2 hours? Answer: 6 o'clock
If it's 11 o'clock now, what time will it be in 2 hours? Answer: 1 o'clock
Thus, in clock arithmetic 4 + 2 = 6, and 11 + 2 = 1
We can create an addition table that describes how addition works on the clock numbers: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
+ 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 Just to make sure we have a handle on clock arithmetic, let's calculate the following amounts using clock arithmetic:
9 + 5 = 2 (if it's 9 o'clock now, in 3 hours it will be 12 o'clock, in another 2 hours it will be 2 o'clock. Thus, 5 hours from 9 o'clock is 2 o'clock).
4 + 11 = 3
4 - 9 = 7 (if it's 4 o'clock now, 4 hours ago it was 12 o'clock, 5 hours before that it was 7 o'clock. Can also think of this problem as 4 - 9 = x if and only if 4 = 9 + x. From the chart we see 9 + 7 = 4. Thus x = 7).
4 x 9 = 9 + 9 + 9 + 9 = 6 + 6 =12 (9 hours after 9 o'clock is 6 hours. Thus 9 + 9 = 6 in clock arithmetic. 6 hours after 6 o'clock is 12 o'clock).
4/7 = 4 (4 divided by 7 = x if and only if 4 = 7*x. Looking at the chart we see 7*1 = 7, 7*2 = 2, 7*3 = 9, and 7*4 = 4. Thus, x = 4).
4/9 = undefined ( 4/9 = x if and only if 4 = 9*x. Looking at the chart we see (9*1 = 9), (9*2 = 6), (9*3 = 3), (9*4 = 12), (9*5 = 9), (9*6 = 6), (9*7 = 3), (9*8 = 12), (9*9 = 9), (9*10 = 6), (9*11 = 3), (9*12 = 12). Thus, there isn't a clock number x such that 9*x = 4. Therefore, 4 divided by 9 is undefined).
Observations about the clock numbers and the operation of clock arithmetic:
The clock numbers are closed under clock addition
clock addition is associative on the clock numbers
There is an additive identity (namely 12 since 12 + x = x for all of the clock numbers)
Every element has an additive inverse. For example, the additive inverse of 10 is 2 since 10 + 2 = 12 which is the additive identity.
Clock addition is associative.
Observations 1-4 tell us that the clock numbers with clock addition form a group. Observation 5 implies this group is Albelian (or commutative).
There is not an multiplicative inverse for 2, 3, 4, 6, 8, 9, or 10. Thus, the standard clock number with addition and multiplication do not form a field.
Modular Systems and Other Clocks
We don't have to limit our discussion to the standard 12 hour clock. We could look at other clocks, such as the 5 hour clock. Addition and multiplication on the 5 hour clock is described in the following tables.
+ 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
x 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 Example Calculations:
4x2 = 3. 4x2 = 4 + 4. If it's 4 o'clock on the 5 hour clock in one hour it's 0 o'clock, and in another 3 hours it's 3 o'clock.
3x4=2 on the 5 hour clock. 3x4 = 4+4+4. From the last example we know 4 + 4 is 3 on the 5 hour clock. Thus, 3x4 = 3 + 4. If it's 3 o'clock, in 2 hours it will be 0 o'clock and in another 2 hours it will be 2 o'clock. Another way to think of it is to notice that 3x4 = 12. If you start at 0 o'clock, 12 hours would be 2 trips around the 5 hour clock and you'd end at 2 o'clock on the 3rd trip.
Observations about the 5 hour clock
Both addition and multiplication are closed on the 5 hour clock.
Both addition and multiplication are associative and commutative.
There is an additive identity (0) and a multiplicative identity (1)
All 5-hour clock numbers ( i.e. 0, 1, 2, 3, and 4) have an additive inverse. For example, 2+3 = 0. Thus 3 is the additive inverse of 2.
All 5-hour clock numbers have a multiplicative inverse, except for 0 which is the additive identity. For example 4x4 = 1. Thus, 4 is its own multiplicative inverse.
2x(1+4) = 0 = 2x1 + 2x4. Trying out similar examples we see multiplication distributes over addition on the 5 hour clock numbers.
Thus the 5 hour clock numbers with clock addition and multiplication form a field.
Instead of talking about "arithmetic on the 5 hour clock" mathematicians usually speak of modulo 5 arithmetic. {0,1,2,3,4} with addition and multiplication is called the mod 5 system.
Def: If a = b on the m hour clock, we say a = b (mod m). This is the same as saying a = b (mod m) if and only if (a-b) is divisible by m. Another way to think of equality in a modular system is that a = b (mod m) if and only if a and b have the same remainder under division by m. Instead of saying "a equals b" if a = b (mod m), we usually say "a is congruent to b," or "a equals b mod m."
Examples: Decide whether each statement is true
3 = 8 (mod 5) TRUE: (3-8) = -5 which is divisible by 5
53 = 3 (mod 5) TRUE: (53-3) = 50 which is divisible by 5
13 = 63 (mod 5) TRUE: The remainder of 13/5 = 3 and the remainder of 63/5 = 3. Thus they are equal in the mod 5 system
3 = 19 (mod 5) FALSE: (3-19) = -16 which is not divisible by 5
3 = 19 (mod 4) TRUE: (3 - 19) = -16 which is divisible by 4
15 + 92 = 2 (mod 5) TRUE: 15 + 92 = 107. The remainder of 107/5 is 2 and the remainder of 2/5 is 2. Equivalently, (107-2) = 105 which is divisible by 5.
7*5 = 0 (mod 5) and 7*5 = 0 (mod 7) TRUE: Clearly, 7*X will be divisible by 7 for any number X, and 5*X will be divisible by 5 for any number X. Thus, the remainder of 7*X when divided by 7 and the remainder of 5*X when divided by 5 will always be 0.
Properties of Modular Arithmetic:
if a = b (mod m) then the following are all true:
a-c = b-c (mod m) for any number c
a+c = b+c (mod m) for any number c
c*a = c*b (mod m) for any number c
a/c = b/c (mod m) for any number c
Thus, the modular equal sign works just like the equal sign we all know and love. You can add the same quantity to both sides of the equals, subtract the same quantity from both sides, multiply both sides by the same number, or divide both sides by the same amount and the equality will hold.
We've already seen that the mod 5 system forms a field. How about the mod 6 system?
The two tables to the right describe addition and multiplication on the mod 6 system.
+ 0 1 2 3 4 5 0 0 1 2 3 4 5 1 1 2 3 4 5 0 2 2 3 4 5 0 1 3 3 4 5 0 1 2 4 4 5 0 1 2 3 5 5 0 1 2 3 4
* 0 1 2 3 4 5 0 0 0 0 0 0 0 1 0 1 2 3 4 5 2 0 2 4 0 2 4 3 0 3 0 3 0 3 4 0 4 2 0 4 2 5 0 5 4 3 2 1 Observations about the mod 6 system:
First, make sure you understand how I filled in the previous two tables. You will need to something similar in your homework. Why is 2 + 4 = 0? Well, 2 + 4 = 6 which is = 0 (mod 6) since the remainder of 6 when divided by 6 is zero. 5 + 4 = 3 because 5 + 4 = 9 which when divided by 6 has remainder 3. Thus, 5 + 4 = 9 = 3 (mod 6). 4*3 = 0 since 4*3 = 12 which has remainder 0 when divided by 6. 5*5 = 1 because 5*5=25 which has remainder 1 when divided by 6.
The mod 6 system is closed under addition and multiplication
Addition and multiplication are associative and commutative on the mod 6 system.
There is a multiplicative identity (1) and an additive identity (0)
For every element in the mod 6 system (i.e. 0, 1, 2, 3, 4, 5) there is an additive inverse. For example, 2+4 = 0. Thus 4 is the additive inverse of 2.
Observations 2-5 indicate that the mod 6 system forms an Albelian group under addition.
There are several elements that do not have multiplicative inverses. Since 1 is the multiplicative identity, for two elements to be multiplicative inverses of each other, their product should = 1. We see that there is no number that when multiplied by 2 = 1 (mod 6). Thus 2 does not have a multiplicative inverse. In fact 2, 3, and 4 do not have multiplicative inverses. Thus, the mod 6 system with multiplication does not form a group.
Observations about modular systems in general:
The mod m system with addition forms an albelian group for all m.
The mod m system with multiplication never forms a group since the 0 element never has an inverse.
1 is always the multiplicative identity, and 0 is always the additive identity for all mod m systems.
The mod m system with addition and multiplication forms a field if and only if 0 is the only element not to have a multiplicative inverse. There are only specific m for which all non-zero elements of the mod m system have multiplicative inverses.
An element a of the mod m system has a multiplicative inverse if and only if a is relatively prime to m (that is to say, 1 is the only number that divides both m and a).
Can you determine for which m the mod m system with addition and multiplication forms a field? HINT: The mod 5 system formed a field. The mod 6 and mod 12 systems did not. The only elements of the mod 12 and mod 6 systems to have multiplicative inverses were those elements relatively prime to 12 and 6, respectively.
Examples: Solve for x
x + 3 = 0 (mod 7) There are several possible answers. Whatever x is, 3 + x must be divisible by 7 (since x + 3 = 0 (mod 7) implies the remainder of x+3 when divided by 7 = 0). Perhaps the most obvious answer is 4, but 11, 18, 25, -3, -10, -17, 354, etc. are all possible answers too. In fact any number of the form 4 + k7 will work.
4x = 1 (mod 5) One possible answer is 4 since 4*4 = 16 = 1 (mod 5). 5, -4, 9, etc. are also possible answers.
4k = x (mod 4) Since 4k is divisible by 4 no matter what k is, the remainder when divided by 4 will always be 0. Thus, 0 is the most obvious answer. In fact, any number = 0 (mod 4) would work.
4k +2 = x (mod 4) Since 4k is divisible by 4 it is = 0 (mod 4). Thus, 4k + 2 = 0 + 2 = 2 (mod x). Thus x =2 is one possible answer, as is any number congruent to 2 (mod 4).
2*x2 - 1 = 3 (mod 7) By properties of Modular arithmetic, we know 2*x2 - 1 = 3 (mod 7) means 2*x2 - 4 = 0 (mod 7). We can divide both sides by 2 to get (2*x2 - 4)/2 = 0/2 (mod 7) which is the same as x2 - 2 = 0 (mod 7). Adding 2 to both sides we see x2=2 (mod 7). 42 = 16 = 2 (mod 7), 32 = 9 = 2 (mod 7). Thus 4 and 3 are both possible answers. There are many other possible answers.
Note: On your homework, you need only give one possible answer.