Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Instructor: Shawn Michael Dela Rosa

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.

• Once12 is reached on the clock, we begin


again with 1.

• Situations such as these that repeat in cycles


are represented mathematically by using
modular arithmetic, or arithmetic modulo n.

• If we want to determine a time in the future or in


the past, it is necessary to consider whether we
have passed 12 o’clock.

• To determine the time 8 hours after 3 o’clock,


we add 3 and 8. Because we did not pass 12
o’clock, the time is 11 o’clock.

• However, to determine the time 8 hours after 9


o’clock, we must take into consideration that
once we have passed 12 o’clock, we begin
again with 1. Therefore, 8 hours after 9 o’clock is
5 o’clock.

• We will use the symbol to denote addition on


a 12-hour clock.

• We can also perform subtraction on a 12-hour


clock. If the time now is 10 o’clock, then 7 hours
ago the time was 3 o’clock, which is the
difference between 10 and 7(10-7=3).

• However, if the time now is 3 o’clock, 7 hours


ago it was 8 o’clock. We will use the symbol
to denote subtraction on a 12-hour clock.

• Examples: Perform Clock Arithmetic

12

11

• A similar example involves day-of-the-week arithmetic. If we


associate each day of the week with a number, Monday=1
up to Sunday=7, 6 days after Friday is Thursday; 16 days after
Monday is Wednesday. Symbolically, we write 5 6=4
and 1 16 = 3

• Note: We are using symbol for days-of-the-week


arithmetic.

Congruent Modulo
DEFINITION!

• Two integers a and b are said to be congruent


modulo n, where n is a natural number called
the modulus, if the remainder when a is divided
by n equals the remainder when b is divided by
n. In this case, we write .

EXAMPLE: Verify the following

MMW 2024 Page 1


1.

1.

1.

• For a given number n, there are infinitely many


numbers that are congruent modulo n. For
example, 2, 5, 8, 11, 14, .. . .are all congruent to
2 modulo 3. Each number in the list has the
same remainder, 2, when divided by 3.

• For instance, if today is Tuesday, then 7 days


from now, 14 days from now, 21 days from now,
and so on with multiples of 7, will all be
Tuesdays. Note that 7, 14, 21, . . .are all
congruent to 0 modulo 7.

• Arithmetic modulo n, where n is a natural


number, uses a variation of the standard rules of
arithmetic we have used before.

• Addition:

• Perform the arithmetic operation and then


divide by the modulus. The answer is the
remainder. Thus the result of an arithmetic
operation mod n is always a whole number less
than n.

• EXAMPLE:

• 1.

• 2.

• Subtraction:

• When subtracting two numbers modulo n, if the


difference is positive, divide the difference by
the modulus. The answer is the remainder.

• If the difference is negative, repeatedly add the


modulus to the difference until you first reach a
whole number. The whole number is the answer.

• EXAMPLE:

• 1.

• 2.

MMW 2024 Page 2


• 4. Disregarding A.M or P.M if it is 5 o’clock now,
what time was it 57 hours ago?

• Multiplication: Get the product of the numbers,


then divide the result by the modulus. The
remainder is the answer.
EXAMPLE:

• 1.

• 2.

SOLVING A CONGRUENCE EQUATION

• When solving a congruence equation, it is necessary to check only


the whole numbers less than the modulus. For the congruence
equation
, we needed to check only 0, 1, 2, and 3.

• Each time a solution is found, additional solutions can be found by


repeatedly adding the modulus to it.

• A congruence equation can have more than one solution among


the whole numbers less than the modulus. The next example illustrates
that you must check all whole numbers less than the modulus.

ADDITIVE INVERSE IN
MODULAR ARITHMETIC

• Recall that if the sum of two numbers is 0, then


the numbers are additive inverses of each
other. The same concept applies in modular
arithmetic. For example,

• Thus, in mod 8 arithmetic, 3 is the additive


inverse of 5 and 5 is the additive inverse of 3.
Here we consider only those whole numbers
smaller than the modulus. Using this fact, we
can easily find the additive inverse of a number
for any modulus. For instance, in mod 11
arithmetic, the additive inverse of 5 is 6 because
5+6=11.

MULTIPLICATIVE INVERSE
IN MODULAR
ARITHMETIC
• If the product of two numbers is 1, then the numbers are multiplicative
inverses of each other. The same concept applies to modular
arithmetic (although the multiplicative inverses will always be natural
numbers).

• For example, in mod 7 arithmetic, 5 is the multiplicative inverse of 3


(and 3 is the multiplicative inverse of 5) because (Here
we will concern ourselves only with natural numbers less than the
modulus.) To find the multiplicative inverse of a mod m, solve the
modular equation ax 1 mod m for x.

• In mod n arithmetic, every number has an additive inverse but not


necessarily a multiplicative inverse. For instance, in mod 12 arithmetic,
3 does not have a multiplicative inverse.

Find the additive inverse and the multiplicative


inverse of the given number.

• 4 in modulo 6 arithmetic

MMW 2024 Page 3


• 3 in modulo 8 arithmetic

• 2 in modulo 7 arithmetic

MMW 2024 Page 4

You might also like