Number Theory: Modular Arithmetic
Modular Arithmetic
Table of Content:
- Introduction
- 12-Hour Clock
- Notation
- Modular Arithmetic of Negative Number
- Conclusion
Introduction
In Mathematics, Modular Arithmetic is part of Number theory, a branch that studies integers and arithmetic functions. Number theory is used in cryptography for encryption of data. Modular Arithmetic is a system of arithmetic where when reaching a certain threshold, the number wraps around/ loops back to the start. Lets take an example, the 12- hour clock.
12-Hour Clock
Lets analyze it!
7 + 8 = 15. How can we translate 15 to 3?
We can get 3 from 15 when using Modular Arithmetic. Modular Arithmetic deals with the remainder parts of the division.
When using Modular Arithmetic, the remainder part will never become negative.
Here are the set of numbers that we can get when performing Modulo on a 12-Hour Clock.
List = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
Lets say that instead of 12, we use n. the list will range from 0 to n - 1. Below is the Modular Clock of 12.
Notation
The notation of Modulo is MOD. We can represent it as:
or we can represent it as a congruency.
This is read as "26 is congruent to 14 MOD 12". As 26 - 14 is 12 which is divisible by 12 and the modulo of 26 and 14 is both 2 as shown in the modulo 12 clock.
Modular Arithmetic of Negative Number
For this example, lets look at Modulo 8.
Modulo of 8 |
lets assume:
For positive value of a, we move clockwise and for negative value of a, we move anti-clockwise.
The formula for modulo is:
Formula |
Lets take an example:
14 MOD 8 = R [Answer: 6]
ALWAYS ROUND DOWN THE QUOTIENT.
Lets take another example:
-11 MOD 8 = R [Answer: 5]
Comments
Post a Comment