Modulo Arithmetic
The modulo of a number x to a
base b is defined as the remainder when x is divided by b. It is denoted
by [ x ] b. It is called " x modulo b".
The value of [ x ] b will always lie between 0 and (b - 1). This is very
obvious because the remainder cannot be greater than the divisor.
If x is less than b, then [x]b = x.
For example, let b = 3.
(i) Let x = 10. Then, [10] 3 = 1, which is the remainder when 10 is divided by
3.
(ii) Let x = 2. Then, [2] 3 = 2.
(iii) [0] 3 = 0. This holds for any base b.
(iv) [3] 3 = 0.
Modulo Addition :
The rule for modulo addition is -
[x] b + [y] b = [x + y] b
For example, let b = 5. Let x = 2 and y = 1.
Then, [2] 5 + [1] 5 = [2 + 1] 5 = [3] 5 = 3.
If, for the same base 5, x = 14 & y = 12,
then, [14] 5 + [12] 5 = [14 + 12] 5 = [26] 5 =
1.
Modulo subtraction :
The rule for modulo subtraction is -
[x] b - [y] b = [x - y] b
Taking the same example as for addition, we get
[2] 5 - [1] 5 = [2 - 1] 5 = [1] 5 = 1.
Again, if x = 14 & y = 12,
then [14] 5 - [12] 5 = [14 - 12] 5 = [2] 5 =
2.
Modulo multiplication :
The rule for multiplication is similar to addition & subtraction.
[x] b * [y] b = [x * y] b
Example : Let b = 7.
Let x = 5 and y = 1.
[5] 7 * [1] 7 = [5 * 1] 7 = [5] 7 = 5.
If x = 6 & y = 3,
[6] 7 * [3] 7 = [6 * 3] 7 = [18] 7 = 4.
If x = 8 & y = 9,
[8] 7 * [9] 7 = [8 * 9] 7 = [72] 7 = 2.