ISU MODULE
Subject: GEC 3- Mathematics in the Modern World
1. Title of the Module
Chapter 12 – Modular Arithmetic
2. Introduction
Modular arithmetic is a special type of arithmetic that involves only integers. This goal of
this article is to explain the basics of modular arithmetic while presenting a progression of more
difficult and more interesting problems that are easily solved using modular arithmetic.
3. Learning Outcome
After completing this module, the students must be able to:
1. Discuss modular arithmetic.
2. Solve problems on modular arithmetic.
3. Illustrate the different applications of modular arithmetic.
4. Learning Content
Topic 1- Modular arithmetic
Motivation
Let's use a clock as an example, except let's replace the at the top of the clock with a .
Starting at noon, the hour hand points in order to the following:
This is the way in which we count in modulo 12. When we add to , we arrive back at . The
same is true in any other modulus (modular arithmetic system). In modulo , we count
We can also count backwards in modulo 5. Any time we subtract 1 from 0, we get 4. So, the
integers from to , when written in modulo 5, are
where is the same as in modulo 5. Because all integers can be expressed as , , , ,
or in modulo 5, we give these integers their own name: the residue classes modulo 5. In
general, for a natural number that is greater than 1, the modulo residues are the integers that
are whole numbers less than :
This just relates each integer to its remainder from the Division Theorem. While this may not
seem all that useful at first, counting in this way can help us solve an enormous array of number
theory problems much more easily!
Residue
We say that is the modulo- residue of when , and .
Congruence
There is a mathematical way of saying that all of the integers are the same as one of the modulo
5 residues. For instance, we say that 7 and 2 are congruent modulo 5. We write this using the
symbol : In other words, this means in base 5, these integers have the same residue modulo 5:
The (mod 5) part just tells us that we are working with the integers modulo 5. In modulo 5, two
integers are congruent when their difference is a multiple of 5. In general, two
integers and are congruent modulo when is a multiple of . In other
words, when is an integer. Otherwise, , which means
that and are not congruent modulo .
Examples
▪ because is a multiple of .
▪ because , which is an integer.
▪ because , which is not a multiple of .
▪ because , which is not an integer.
Sample Problem
Find the modulo residue of .
Solution:
Since R , we know that
and is the modulo residue of .
Another Solution:
Since , we know that
We can now solve it easily
and is the modulo residue of
Another Solution:
We know is a multiple of since is a multiple of . Thus, and is the
modulo residue of .
Making Computation Easier
We don't always need to perform tedious computations to discover solutions to interesting
problems. If all we need to know about are remainders when integers are divided by , then we
can work directly with those remainders in modulo . This can be more easily understood with a
few examples.
Addition
Problem
Suppose we want to find the units digit of the following sum:
We could find their sum, which is , and note that the units digit is . However, we could
find the units digit with far less calculation.
Solution
We can simply add the units digits of the addends:
The units digit of this sum is , which must be the same as the units digit of the four-digit sum
we computed earlier.
Why we only need to use remainders
We can rewrite each of the integers in terms of multiples of and remainders:
.
When we add all four integers, we get
At this point, we already see the units digits grouped apart and added to a multiple of (which
will not affect the units digit of the sum):
.
Solution using modular arithmetic
Now let's look back at this solution, using modular arithmetic from the start. Note that
Because we only need the modulo residue of the sum, we add just the residues of the
summands:
so the units digit of the sum is just .
Addition rule
In general, when , and are integers and is a positive integer such that
the following is always true:
.
And as we did in the problem above, we can apply more pairs of equivalent integers to both
sides, just repeating this simple principle.
Proof of the addition rule
Let , and where and are integers. Adding the two equations
we get:
Which is equivalent to saying
Subtraction
The same shortcut that works with addition of remainders works also with subtraction.
Problem
Find the remainder when the difference between and is divided by .
Solution
Note that and . So,
Thus,
so 1 is the remainder when the difference is divided by . (Perform the subtraction yourself,
divide by , and see!)
Subtraction rule
When , and are integers and is a positive integer such that
the following is always true:
Multiplication
Modular arithmetic provides an even larger advantage when multiplying than when adding or
subtracting. Let's take a look at a problem that demonstrates the point.
Problem
Jerry has boxes of soda in his truck. The cans of soda in each box are packed oddly so that
there are cans of soda in each box. Jerry plans to pack the sodas into cases of cans to sell.
After making as many complete cases as possible, how many sodas will Jerry have leftover?
Solution
First, we note that this word problem is asking us to find the remainder when the
product is divided by .
Now, we can write each and in terms of multiples of and remainders:
This gives us a nice way to view their product:
Using FOIL, we get that this equals
We can already see that each part of the product is a multiple of , except the product of the
remainders when each and are divided by 12. That part of the product is ,
which leaves a remainder of when divided by . So, Jerry has sodas leftover after making as
many cases of as possible.
Solution using modular arithmetic
First, we note that
Thus,
meaning there are sodas leftover. Yeah, that was much easier.
Multiplication rule
When , and are integers and is a positive integer such that
The following is always true:
.
Exponentiation
Since exponentiation is just repeated multiplication, it makes sense that modular arithmetic
would make many problems involving exponents easier. In fact, the advantage in computation is
even larger and we explore it a great deal more in the intermediate modular arithmetic article.
Note to everybody: Exponentiation is very useful as in the following problem:
Problem #1
What is the last digit of if there are 1000 7s as exponents and only one 7 in the
middle?
We can solve this problem using mods. This can also be stated as . After that, we see that 7
is congruent to -1 in mod 4, so we can use this fact to replace the 7s with -1s, because 7 has a
pattern of repetitive period 4 for the units digit. is simply 1, so therefore ,
which really is the last digit.
Problem #2
What are the tens and units digits of ?
We could (in theory) solve this problem by trying to compute , but this would be extremely
time-consuming. Moreover, it would give us much more information than we need. Since we
want only the tens and units digits of the number in question, it suffices to find the remainder
when the number is divided by . In other words, all of the information we need can be found
using arithmetic mod .
We begin by writing down the first few powers of mod :
A pattern emerges! We see that (mod ). So for any positive integer , we
have (mod ). In particular, we can write
(mod ).
By the "multiplication" property above, then, it follows that
(mod ).
Therefore, by the definition of congruence, differs from by a multiple of . Since
both integers are positive, this means that they share the same tens and units digits. Those digits
are and , respectively.
Problem #3
Can you find a number that is both a multiple of but not a multiple of and a perfect square?
No, you cannot. Rewriting the question, we see that it asks us to find an integer that
satisfies .
Taking mod on both sides, we find that . Now, all we are missing is proof
that no matter what is, will never be a multiple of plus , so we work with cases:
This assures us that it is impossible to find such a number.
Summary of Useful Facts
Consider four integers and a positive integer such
that and . In modular arithmetic, the
following identities hold:
▪ Addition: .
▪ Subtraction: .
▪ Multiplication: .
▪ Division: , where is a positive integer that
divides and .
▪ Exponentiation: where is a positive integer.
Topic 2- Applications
In theoretical mathematics, modular arithmetic is one of the foundations of number theory,
touching on almost every aspect of its study, and it is also used extensively in group theory, ring
theory, knot theory, and abstract algebra. In applied mathematics, it is used in computer
algebra, cryptography, computer science, chemistry and the visual and musical arts.
A very practical application is to calculate checksums within serial number identifiers. For
example, International Standard Book Number (ISBN) uses modulo 11 (for 10 digit ISBN) or
modulo 10 (for 13 digit ISBN) arithmetic for error detection. Likewise, International Bank
Account Numbers (IBANs), for example, make use of modulo 97 arithmetic to spot user input
errors in bank account numbers. In chemistry, the last digit of the CAS registry number (a unique
identifying number for each chemical compound) is a check digit, which is calculated by taking
the last digit of the first two parts of the CAS registry number times 1, the previous digit times 2,
the previous digit times 3 etc., adding all these up and computing the sum modulo 10.
In cryptography, modular arithmetic directly underpins public key systems such
as RSA and Diffie–Hellman, and provides finite fields which underlie elliptic curves, and is used
in a variety of symmetric key algorithms including Advanced Encryption
Standard (AES), International Data Encryption Algorithm (IDEA), and RC4. RSA and Diffie–
Hellman use modular exponentiation.
In computer algebra, modular arithmetic is commonly used to limit the size of integer coefficients
in intermediate calculations and data. It is used in polynomial factorization, a problem for which
all known efficient algorithms use modular arithmetic. It is used by the most efficient
implementations of polynomial greatest common divisor, exact linear algebra and Gröbner
basis algorithms over the integers and the rational numbers. As posted on Fidonet in the 1980's
and archived at Rosetta Code, modular arithmetic was used to disprove Euler's sum of powers
conjecture on a Sinclair QL microcomputer using just one-fourth of the integer precision used by
a CDC 6600 supercomputer to disprove it two decades earlier via a brute force search.[9]
In computer science, modular arithmetic is often applied in bitwise operations and other
operations involving fixed-width, cyclic data structures. The modulo operation, as implemented in
many programming languages and calculators, is an application of modular arithmetic that is often
used in this context. The logical operator XOR sums 2 bits, modulo 2.
In music, arithmetic modulo 12 is used in the consideration of the system of twelve-tone equal
temperament, where octave and enharmonic equivalency occurs (that is, pitches in a 1∶2 or 2∶1
ratio are equivalent, and C-sharp is considered the same as D-flat).
The method of casting out nines offers a quick check of decimal arithmetic computations
performed by hand. It is based on modular arithmetic modulo 9, and specifically on the crucial
property that 10 ≡ 1 (mod 9).
Arithmetic modulo 7 is used in algorithms that determine the day of the week for a given date. In
particular, Zeller's congruence and the Doomsday algorithm make heavy use of modulo-7
arithmetic.
More generally, modular arithmetic also has application in disciplines such
as law (e.g., apportionment), economics (e.g., game theory) and other areas of the social sciences,
where proportional division and allocation of resources plays a central part of the analysis.
5. Teaching and Learning Activities
Answer the following questions below.
A. Essay
1. Discuss modular arithmetic.
2. Explain the different applications of modular arithmetic.
B. Problem solving
1. Given that 5x ≡ 6 (mod 8), find x.
[Solution: 6]
2. Find the last digit of 7100
[Solution: 1] 7 100 ≡ (72 ) 50 ≡ 4950 ≡ (−1)50 ≡ 1 mod 10.
6. Recommended learning materials and resources for supplementary reading.
All related Mathematics in the Modern World books are recommended for reading.
7. Flexible Teaching Learning Modality (FTLM) adopted
Online (synchronous)
TelEducation, Moodle, Facebook messenger, Zoom, Google Classroom, etc..
Remote (asynchronous)
module
8. Assessment Task
Assignments
Quizzes
9. References (at least 3 references preferably copyrighted within the last 5 years,
alphabetically arranged)
Book/s:
Aufman Richard, et. al., Mathematics in the Modern World, 14th Edition
Mathematics in the Modern World, Philippine Edition by Rex Book Store
Mathematics in the Modern World, by Esmeralda A. Manlulu and Liza Marie M. Hipolito
Online;