Operations on Modular Arithmetic
Specific Objective:
At the end of the lesson, the students should be able to:
1. Name and explain the different operations on modular arithmetic.
2. Perform and solve the operations on module n such as addition, subtraction,
multiplication, the additive and multiplicative inverse.
3. Solve the congruence equation.
Arithmetic module n (where n is a natural number) requires us to evaluate a modular
expression after using the standard rules of arithmetic. Thus, we perform the arithmetic
operation and then divide by modulus. The answer is the remainder. The result of an arithmetic
operation mod n is always whole number less than n.
PROPERTIES OF MODULAR ARITHMETIC
Addition Modulo n
Subtraction Modulo n
Multiplication Modulo n
Additive and Multiplicative Inverses in Modular Arithmetic
ADDITION MODULO N
To do the addition modulo n, let us have some examples.
Evaluate (23 + 38) mod 12.
Add 23 + 38 to produce 61. To evaluate 61 mod 12, divide 61 by modulus, 12. The answer is
the remainder.
So (23 + 38) mod 12 = 1 since 61 = 12•5 + 1 where 1 is the remainder.
In modular arithmetic, adding the modulus to a number does not change the equivalent value of
the number.
For instance; 13 ≡ 6 (mod 7)
20 ≡ 6 (mod 7) add 7 to 13
27 ≡ 6 (mod 7) add 7 to 20 and so on.
Another example is; 12 ≡ 7 (mod 5)
17 ≡ 7 (mod 5) add 5 to 12
22 ≡ 7 (mod 5) add 5 to 17 and so on.
This property of modular arithmetic is sometimes used in subtraction. It is possible to use
negative numbers modulo n. For instance;
-2 ≡ 5 mod 7 is a true congruence. Why? Applying the definition; a ≡ b (mod n) where n | a –
b, then
SUBTRACTION MODULO N
Let’s evaluate (33 – 16) mod 6.
Here, subtracting 16 from 33, we will be able to get a positive result, i.e., 17. Divide the
difference by the modulus, 6 we get:
17 = 6•2 + 5.
So, (33 – 16) mod 6 = 5.
Next, evaluate (14 – 21) mod 5.
If we subtract 21 for 14, we will get a negative answer, i.e., -13. On that case, we must find x so
−13−x −(13+ x )
that -13 ≡ x mod 5. Thus, we must find x so that the value of = is an integer.
5 5
Trying the whole number values of x less than 5, the modulus, i.e., x = 0, 1, 2, 3, and 4, then;
So, the only value for x is 2. Hence, (14 – 27) mod 5 = 2.
MULTIPLICATION MODULO N
Like in addition and subtraction, let us evaluate given example under multiplication modulo n to
perform the operation multiplication.
Evaluate (15•23) mod 11.
We need to find the product of 15 and 23. The product is 345. This product must be divided by
the modulus, 11 to be able to find its remainder.
345 = 11•31 + 4
Hence, (15•23) mod 11 = 4.
ADDITIVE AND MULTIPLICATIFVE INVERSES IN MODULAR ARITHMETIC
a. Recall that if the sum of two numbers is zero (0), i.e., a + (-a) = 0, then the numbers are
additive inverses of each other. For instance, 5 + (-5) = 0. So, 5 is the additive invers of -5 and -
5 is the additive inverse of 5. The same concept applies in modular arithmetic. For example;
(3 + 5) ≡ 0 mod 8.
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 number smaller that the modulus. Note that 3 + 5 = 8; that is, the
sum of a number and its additive inverse equals the modulus. Using this fact, we can easily find
the additive invers of a number for any modulus. For instance, in mod 11 arithmetic, the additive
inverse of 5 is 6 because 5 + 6 = 11.
Let us have additional example.
Find the additive inverse of 7 in mod 16 arithmetic.
In mod 16 arithmetic, 7 + 9 = 16. So, the additive inverse of 7 is 9.
b. If the product of two number is 1, then the numbers are multiplicative inverses of each other.
This is one of the properties of real number, i.e., ( a ) ( 1a )=1. So, the multiplicative inverse of 2 is
1/2 and the multiplicative inverse of 1/2 is 2.
The same concept applies to modular arithmetic (although the multiplicative inverses will always
be natural number). For example, in mod 7 arithmetic, 5 is the multiplicative invers of 3 (and 3 is
the multiplicative inverse of 5) because 5•3 ≡ 1 mod 7. 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.
Example:
In mod 7 arithmetic, find the multiplicative inverse of 2.
To find the multiplicative inverse of 2, solve the equation 2x 1 mod 7 by trying different natural
number values of x less than the modulus.
Here, x = 1,2,3,4,5, and 6.
2x ≡ 1 mod 7
2(1) ≡ 1 mod 7 (this is not a true congruence)
2(2) ≡ 1 mod 7 (this is not a true congruence)
2(3) ≡ 1 mod 7 (this is not a true congruence)
2(4) ≡ 1 mod 7 (this is a true congruence)
2(5) ≡ 1 mod 7 (this is not a true congruence)
2(6) ≡ 1 mod 7 (this is not a true congruence)
Hence, in mod 7 arithmetic, the multiplicative of 2 is 4.
SOLVING CONGRUENCE EQUATION
Solving a congruence equation means finding all whole numbers values of the variable for
which the congruence is true.
Let us have an example on how to solve the congruence equation.
Example:
Solve 3x + 5 ≡ 3 mod 4. Here, we need to search for whole number values of x for which the
congruence is true.
Solution:
3x + 5 ≡ 3 mod 4
If x = 0 3(0) + 5 ≡ 3 mod 4 (this is not a true congruence)
If x = 1 3(1) + 5 ≡ 3 mod 4 (this is not a true congruence)
If x = 2 3(2) + 5 ≡ 3 mod 4 (this is a true congruence, so 2 is a solution)
If x = 3 3(3) + 5 ≡ 3 mod 4 (this is not a true congruence)
If x = 4 3(4) + 5 ≡ 3 mod 4 (this is not a true congruence)
If x = 5 3(5) + 5 ≡ 3 mod 4 (this is not a true congruence)
If x = 6 3(6) + 5 ≡ 3 mod 4 (this is a true congruence, so 6 is a solution).
Now, if we continue trying to find the other values to be a solution, we could find that 10 and 14
are also a solution. Note that 6, 10 and 14 are all congruent to 2 mod 4. Thus, the solutions of
3x + 5 3 mod 4 are 2, 6, 10, 14, 18, ...
Example: Solve 3x + 4 = 2x + 8 (mod 9)
Solution: