MMW LESSON 11 - Modular - Arithmetic - and - Group - Theory CHRISTIAN PAUL C. ARNAIZ
MMW LESSON 11 - Modular - Arithmetic - and - Group - Theory CHRISTIAN PAUL C. ARNAIZ
MMW LESSON 11 - Modular - Arithmetic - and - Group - Theory CHRISTIAN PAUL C. ARNAIZ
LESSON 11
GROUP THEORY
LESSONS COVERED
INTRODUCTION
Suppose you want to make a purchase on the Internet using a credit card.
You may have noticed that the typical http:// that precedes a web address is
replaced by https://. The “s” at the end indicates a secure website. This means that
someone who may be trying to steal credit card information cannot intercept the
information you send. The mathematics behind that is based on modular arithmetic.
OBJECTIVES/COMPETENCIES
PRETEST
3. How would you determine whether a given credit card number is a valid number?
_________________________________________________________________
__
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
LESSON 11.1 INTRODUCTION TO MODULAR ARITHMETIC
Many clocks have the familiar 12-hour design. We designate whether the time
is before noon or after noon by using the abbreviations A.M. and P.M. A reference to
7:00 A.M. means 7 hours after 12:00 midnight; a reference to 7:00 P.M. means 7
hours after 12:00 noon. In both cases, once 12 is reached on the clock, we begin
again with 1.
Example 11.1
Example 11.2
5 +□ 6 = 4 and 1 □+ 16 = 3
Another way to determine the day of the week is to note that when the sum 5
+ 6 = 11 is divided by 7, the number of days in a week, the remainder is 4, the
number associated with Thursday. When 1 + 16 = 17 is divided by 7, the remainder
is 3, the number associated with Wednesday. This works because the days of the
week repeat every 7 days.
The same method can be applied to 12-hour-clock arithmetic. From Example
12.1, when 8 + 7 = 15 is divided by 12, the number of hours on a 12-hour clock, the
remainder is 3, the time 7 hours after 8 o’clock.
𝑛
is an integer. In this case, we write
𝑎 𝑏 𝑚𝑜𝑑 𝑛
Example 11.3
a. 29 8 mod 3
b. 15 4 mod 6
a. Given: a = 29, b = 8, n = 3
𝑎−𝑏
𝑛
29 − 8 21
=
3 3 =7
b. Given: a = 15, b = 4, n = 6
𝑎−𝑏
𝑛
15 − 4 11
=
6 6 =7
Now suppose today is Friday. To determine the day of the week 16 days from
now, we observe that 14 days from now the day will be Friday, so 16 days from now
the day will be Sunday. Note that the remainder when 16 is divided by 7 is 2, or,
using modular notation, 16 2 mod 7. The 2 signifies 2 days after Friday, which is
Sunday.
Example 11.4
July 4, 2017 was a Tuesday. What day of the week is July 4, 2022?
There are 5 years between the two dates. Each year has 365 days except 2020,
which has one extra day because it is a leap year. So the total number of days
between the two dates is (5*365) + 1 = 1826. Because = 260 remainder 6, 1826
≡ 6 mod 7.
Any multiple of 7 days past a given day will be the same day of the week. So the day
of the week 1826 days after July 4, 2017, will be the same as the day 6 days after
July 4, 2017. Thus July 4, 2022, will be a Monday.
Activity 11.1
In 2016, Abraham Lincoln’s birthday fell on Friday, February 12. On what day of the
week does Lincoln’s birthday fall in 2025?
When we want to prove some properties about modular arithmetic, we often make
use of the quotient remainder theorem. It is a simple idea that comes directly from
long division.
Given any integer A, and a positive integer B, there exist unique integers Q and
𝑹 𝑠𝑢𝑐ℎ 𝑡ℎ𝑎𝑡
𝑨 𝑸 + 𝑹 𝒘𝒉𝒆𝒓𝒆 𝟎 𝑩
We can see that this comes directly from long division. When we divide A by B in
long division, Q is the quotient and R is the remainder. If we can write a number in
this form, then A mod B = R.
Example 11.5
Now, we only have to go around the circle clockwise the total of the number of
steps that contributed to each of numbers final position (as shown in the bottom right
modular circle). This method applies, in general, to any two integers and any
modular circle.
A mod C = R1
B mod C = R2
(A + B) mod C =
(C * (Q1 + Q2) + R1+ R2) mod C =
(A - B) mod C =
(C * (Q1 - Q2) + R1- R2) mod C =
Example 11.6
a. (218+256) mod 5
b. (2611+135) mod 13
c. (136-727) mod 12
d. (14 mod 23 - 86 mod 23) mod 14
e. (140 mod 23 - 80 mod 23 - 6 mod 23) mod 23
a. 474 mod 5 = 4
b. 2746 mod 13 = 3
c. -591 mod 12 = 9
d. -72 mod 14 = 12
e. 54 mod 23 = 8
Example 11.7
(A * B) mod C = (4 * 7) mod 6
(A * B) mod C = (28) mod 6
(A * B) mod C = 4
(A * B) mod C = (A * B) mod C
(A * B) mod C = ((C * Q1 + R1 ) * (C * Q2 + R2) ) mod C
(A * B) mod C = (C * C * Q1 * Q2 + C * Q1 * R2 + C * Q2 * R1 + R1 * R 2 ) mod C (A
* B) mod C = (C * (C * Q1 * Q2 + Q1 * R2 + Q2 * R1) + R1 * R2 ) mod C
For example:
2^90 = 1237940039285380274899124224
7^256 = 22135954000460481554501886154749459371625170502600730699163
6639052470497400798999684800343383794038078279445526231260759886736
3425940560014856027866381946458951205837379116473663246733509680721
264246243189632348313601
These huge values cause our calculators and computers to return overflow
errors. Even if they didn't, it would take a long time to find the mod of these huge
numbers directly.
To reduce the size of terms involved and make our calculation faster Here is a
simple divide and conquer strategy: we break down the exponent in smaller parts
using exponential rules.
Example 11.8
Suppose we want to calculate 2^90 mod 13, but we have a calculator that can't hold
any numbers larger than 2^50.
Example 11.9
Start at the rightmost digit, let k=0 and for each digit:
If the digit is 1, we need a part for 2^k, otherwise we do not
Add 1 to k, and move left to the next digit
117 = (20 + 22 + 24 + 25 + 26)
117 = (1 + 4 + 16 + 32 + 64)
𝑚𝑜𝑑 𝑚𝑜𝑑
𝑚𝑜𝑑 𝑚𝑜𝑑
Companies that issue credit cards also use modular arithmetic to determine
whether a credit card number is valid. This is especially important in e-commerce,
where credit card information is frequently sent over the Internet. The primary coding
method is based on the Luhn algorithm, which uses mod 10 arithmetic.
Credit card numbers are normally 13 to 16 digits long. The first one to six
digits are used to identify the card issuer. The table below shows some of the
identification prefixes used by four popular card issuers.
The Luhn algorithm, used to determine whether a credit card number is valid, is
calculated as follows:
Beginning with the next-to-last digit (the last digit is the check digit) and reading from
right to left, double every other digit. If a digit becomes a two-digit-number after being
doubled, treat the number as two individual digits. Now find the sum of the new list of
digits; the final sum must be congruent to 0 mod 10. The Luhn algorithm is
demonstrated in example 12.10.
Example 11.10
Determine whether 5234 8213 3410 1298 is a valid credit card number.
Solution
Highlight every other digit, beginning with the next-to-last digit and reading from right
to left.
5234821334101298
10 2 6 4 16 2 2 3 6 4 2 0 2 2 18 8
Finally, add all digits, treating two-digit numbers as two single digits.
(1 + 0) + 2 + 6 + 4 + (1 + 6) + 2 + 2 + 3 + 6 + 4 + 2 + 0 + 2 + 2 + (1 + 8) + 8 = 60
“There exists an e in the set G, such that a*e = a and e*a = a, for all elements a in G”
If we use the operation on any element and the identity, we will get that element
back. For the integers and addition, the identity is "0". Because 5+0 = 5 and 0+5 = 5.
In other words, it leaves other elements unchanged when combined with them.
There is only one identity element for every group.
The symbol for the identity element is e, or sometimes 0. But you need to start
seeing 0 as a symbol rather than a number. 0 is just the symbol for the identity, just
in the same way e is. It's defined that way. In fact, many times mathematicians prefer
to use 0 rather than e because it is much more natural.
If we have an element of the group, there's another element of the group such that
when we use the operator on both of them, we get e, the identity.
For the integers and addition, the inverse of 5 is -5. (because 5 + -5 = 0). In just the
same way, for negative integers, the inverses are positives. -5 + 5 = 0, so the inverse
of -5 is 5. In fact, if a is the inverse of b, then it must be that b is the inverse of a.
Inverses are unique. You can't name any other number x, such that 5 + x = 0
besides
-5.
Make a note that while there exists only one identity for every single element in the
group, each element in the group has a different inverse. The notation that we use
for inverses is a-1. So in the above example, a-1 = b. In the same way, if we are
talking about integers and addition, 5-1 = -5.
3. Associative.
*For all a, b, and c in G, a * (b * c) = (a * b) * c”
You should have learned about associative way back in basic algebra. All it means is
that the order in which we do operations doesn't matter.
a * (b * c) = (a * b) * c
If we have two elements in the group, a and b, it must be the case that a*b is also in
the group. This is what we mean by closed. It's called closed because from inside
the group, we can't get outside of it.
And as with the earlier properties, the same is true with the integers and addition. If x
and y are integers, x + y = z, it must be that z is an integer as well.
Therefore, if you have a set and an operation, and you can satisfy every one of
those conditions, then you have a Group.
In reality, there are only two operations. When we subtract numbers, we say "a
minus b" because it's short. But what we really mean is "a plus the additive inverse
of b". The minus sign really just means add the additive inverse. In the same way,
division just means "multiply by the multiplicative inverse". So there is really only
addition and multiplication.
Example 11.11
If we add 0 to anything else in the group, we hope to get 0. Since the only other
thing in the group is 0, and 0 + 0 = 0, we have found the identity.
Now we need to find inverses. Well, again, we only have one element. So
what's the inverse of 0? We want 0 + 0 −1 = 0. Well, 0 + 0 = 0, so 0 −1 = 0. And 0 is in
the group, so 0−1 is also in the group. Since we've tried all the elements, all one of
them, we're done.
Example 11.12
Back to the four steps. First, is there an identity? Well, this is going to be easy, there
are only three possibilities. Either:
• -1 is the identity,
• 1 is the identity, • or there isn't one.
•
1*-1 = -1 and -1*1 = -1. So it looks like 1 is the identity.
Now we need to find inverses. If we have a in the group, then we need to be able to
find an a−1 such that a * a−1 = 1 (or rather, e). So let's start off with 1.
Since we have found an inverse for every element, we know the group is closed with
respect to inverses.
Finally, is it closed? Is 1*1 in the group? Yes. How about 1 * -1? Yes. And -1 * -1?
Yes. And finally, -1 * 1? Yes. So it is closed under the operation.
Example 11.13
Now we need to find out if integers under multiplication have inverses. So if we take
a number a, can we find a−1 such that a * a−1 = e?
The applications of groups are very advanced. For example, they are used on your
credit cards to make sure the numbers scanned are correct.
They are used by space probes so that if data is misread, it can be corrected. They
are even used to tell if polynomials have solutions we can find. For example, when
we have a*x = b, where a and b were in a group G, the properties of a group tell us
that there is one solution for x, and that this solution is also in G.
Since it must be that both a-1 and b are in G, a-1 * b must be in G as well.
Also, since we know the operator * must be well defined, this must be a unique
solution. Otherwise, the operator isn’t defined very well.
LEARNING INSIGHTS
1. What is 14 mod 2?
5. 15 ≡ 1 mod 8
6. Evaluate each of the following.
(33 + 16) mod 6
GLOSSARY
Arithmetic. the branch of mathematics dealing with the properties and manipulation
of numbers.
Arithmetic Modulo n. After performing the operation as usual, divide the result by n;
the answer is the remainder.
ONLINE REFERENCES
https://www.khanacademy.org/computing/computer-
science/cryptography/modarithmetic/a/what-is-modular-arithmetic
https://www.mathsisfun.com/sets/groups-introduction.html
REFERENCES
Aufmann, R., Lockwood, J., Nation, R., Clegg, D., (2018) Mathematical Excursions
(4th ed.), Boston, MA: Cengage Learning