Вы находитесь на странице: 1из 4

Modular Arithmetic

In mathematics, modular mathematics (sometimes known as clock arithmetic) is a


special type of arithmetic that makes use of only integers, where numbers “wrap around” upon
reaching a given fixed quantity. Modular arithmetic was developed by Carl Friedrich Gauss in
his book Disquisitiones Arithmeticae, published in 1801.
If we want to determine a time in the future or in the past, we need to consider whether
we have passes 12 o’clock. If the time is 5 o’clock. now, then 3 hours later it will be 8 o’clock,
which is the sum of 5 and 3 (5 + 3 = 8). However, If the time is 6 o’clock, then 8 hours later it
will be 2 o’clock. Usual addition would suggest that the later time should be 6 + 8 = 14, but this
is not the answer because we need to consider that once we have passed 12 o’clock, we begin
again with 1. To denote addition on a 12-hour clock, we will use the symbol ⊕. We can also use
subtraction on a 12-hour clock. To determine the time 4 hours before 8 o’clock, we subtract 4
from 8, the time was 4 o’clock. However, if the time is 5 o’clock, notice that 10 hours ago it was 7
o’clock. To denote subtraction on a 12-hour clock we will use the symbol ⊖.

Example:
Calculate using a 12-hour clock.
a. 8 ⊕ 10 solution: 6
b. 6 ⊕ 7 solution: 1
c. 10 ⊕ 6 solution: 4
d. 5 ⊖8 solution: 9
e. 3 ⊖ 11 solution: 4

Another way to determine the time in the future or in the past is to note that when the
sum 8 + 10 = 18 is divided by 12, the number of hours on a 12-hour clock, the remainder is 6,
the time 10 hours after 8 o’clock.
The same method can be applied to day-of-the-week arithmetic. If we assign each day of
the week with a number, (Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5,
Saturday = 6, and Sunday = 7), then 6 days after Tuesday is Monday and 18 days after Monday
is Friday. If we use the symbol ⊞ to denote addition for day-of-the-week arithmetic, we can
write

2⊞6=1 1 ⊞ 18 = 5

Modulo n
a−b
Let n be a natural number. Integers a and b are said to be congruent modulo n if
n
is an integer. The number n is called the modulus. The statement a ≡ b mod n is called a
congruence.
Example:
Determine whether the congruence is true.
a−b 18−6
a. 18 ≡ 6 mod 3 Solution: Find = =4
n 3
18 ≡ 6 mod 2 is a true congruence because 4
is an integer.
a−b 23−9 14
b. 23≡ 9 mod 4 Solution: Find = =
n 4 4
7
=
2
23 ≡ 9 mod 4 is not a true congruence
7
because is not an integer.
2

Arithmetic Operations Modulo n


To evaluate a modular expression, perform the arithmetic operation and then divide by
the modulus. The answer is the remainder. The result is always a whole number less than
modulus.
Example:
Perform the modular arithmetic.
a. (9 + 14) mod 8
Solution: Add 9 + 14 = 23. Divide the sum by the modulus,
8. The remainder is the answer, which is 7. In
symbol, (9 + 14) mod 8 = 7.

b. (22 – 13) mod 5


Solution: Subtract 22 – 13 = 9. Divide the difference by the
modulus, 5. The remainder is the answer, which
is 4. In symbol, (22 – 13) mod 5 = 4.

c. (4 – 15) mod 3 Solution: Subtract 4 – 15 = - 11. Since the


result is negative, find a whole number x less
than the modulus 3, so that -11 ≡ x mod 3. Thus,
−11−x
we must find x so that the value of, is
3
an integer. Trying the whole number
values of x less than the modulus, we find
−11−1
that when x = 1, =−4 . Therefore, (4
3
– 15) mod 3 = 1.

d. (8 ⋅ 13) mod 7 Solution: Multiply 8 ⋅ 13 = 104. Divide the


product by the modulus, 7. The remainder
is the answer, which is 6. In symbol, (8 ⋅ 13) mod
7 = 6.

Solving Congruence Equations


Solving a congruence equation means finding all values for x that make the congruence true.
Example: Find all the solutions of the congruence equation 3x + 2 ≡ 5 mod 8
Solution: Substitute the whole numbers less than the modulus in
the congruence equation.
x = 0 3(0) + 2 ≢ 5 mod 8 Not a Solution
x = 1 3(1) + 2 ≡ 5 mod 8 x = 1 is a Solution
x = 2 3(2) + 2 ≢ 5 mod 8 Not a Solution
x = 3 3(3) + 2 ≢ 5 mod 8 Not a Solution
x = 4 3(4) + 2 ≢ 5 mod 8 Not a Solution
x = 5 3(5) + 2 ≢ 5 mod 8 Not a Solution
x = 6 3(6) + 2 ≢ 5 mod 8 Not a Solution
x = 7 3(7) + 2 ≢ 5 mod 8 Not a Solution
Additional solutions can be found by repeatedly adding the modulus to this solution. The
solutions are 1, 9, 17, …

Modular Additive Inverse


In modular arithmetic, the modular additive inverse of x is the number a such that a + x
≡ 0 mod n. The modular additive inverse always exists.
Example:
Find the additive inverse of the following.
a. 8 in modulo 13 arithmetic Solution: The additive inverse is 5 because it is
the solution in a + 8 ≡ 0 mod 13

b. 3 in modulo 15 arithmetic Solution: The additive inverse is 12 because it


is the solution in a + 3 ≡ 0 mod 15.

Modular Multiplicative Inverse


In modular arithmetic, the modular multiplicative inverse of x is the number a such that
ax ≡ 1 mod n. The modular multiplicative inverse exists if and only if a and n are coprime.
Example:
Find the multiplicative inverse of the following.
a. 3 in modulo 11 arithmetic Solution: To find the multiplicative inverse of
3, solve the congruence equation 3a
≡1 mod 11.
a = 1 3(1) ≢ 1 mod 11
a = 2 3(2) ≢ 1 mod 11
a = 3 3(3) ≢ 1 mod 11
a = 4 3(4) ≡ 1 mod 11
a = 5 3(5) ≢ 1 mod 11
a = 6 3(6) ≢ 1 mod 11
a = 7 3(7) ≢ 1 mod 11
a = 8 3(8) ≢ 1 mod 11
a = 9 3(9) ≢ 1 mod 11
a = 10 3(10) ≢ 1 mod 11
The multiplicative inverse is 4
because it is the solution in 3a ≡ 1
mod 11.
b. 5 in modulo 7 arithmetic Solution: To find the multiplicative inverse of
5, solve the congruence equation 5a
≡1 mod 7.
a = 1 5(1) ≢ 1 mod 7
a = 2 5(2) ≢ 1 mod 7
a = 3 5(3) ≡ 1 mod 7
a = 4 5(4) ≢ 1 mod 7
a = 5 5(5) ≢ 1 mod 7
a = 6 5(6) ≢ 1 mod 7
The multiplicative inverse is 3
because it is the solution in 5a ≡ 1
mod 7.

Вам также может понравиться