The set of integers in mathematics are denoted with double struck Z.
It stands for "zahlen" which means numbers in German. In , counting from 0 to 10 are simply
Meanwhile the set of integers modulo is denoted by
and counting 1 to 10 in works as follows
This sequence repeats every 6 numbers starting from 0. The modulo operator
while returns the remainder of divided by , also yields the -th number in the sequence of integers modulo (). The 10th number in the sequence of integers modulo 6
is also the remainder of 10 divided by 6.
Periodicity
Two integers a,b are in the same equivalence class modulo n if both integers returns the same remainder after division by n. The -th and -th number in the sequence of will be the same.
Take 10 and 16 modulo 6 for example
In the sequence of , integers within the same equivalence class are the same.
In congruence relations, this can be written as follows
stating that a is congruent to b modulo n. Two integers are said to be congruent modulo n if they returns the same remainder when divided by n. With modulo operator, this will be
Notice the repeating nature of sequence. For example n=6
Any term is the same as the n-th next term.
This can be generalized further given any integer q
showing that and are congruent modulo .
Compare it to sequence
The only scenario where
is when (if and only if?) .
Quotient Remainder Theorem
Division between any two integers does not always yield another integer. Division between 22 and 7
left a remainder of 1. Quotient Remainder Theorem states that given any integer a and a natural number n, there exist another two integers q and r such that
this can be rewritten with modulo operator into
and the division above can be rewritten algebraically into
or with modulo operator
This is used to better demonstrate
Modular Addition
Given two integers and , a positive integer n, and
This can be algebraically written into
with integers and . Add together and gives
Take modulo on both sides
Because
and
we can drop out from the equation which results into a more tidy equation
Plugging back the definitions of and gives
The equation above can be used as a tool to simplify additions under modulo operator. For example
Substituting gives similar equation for subtraction
In case of negative integers inside modulo operator,
Modular Multiplication
Similar to addition, start with two integers and , a positive integer n, and
This can be algebraically written into
multiplying and gives
take modulo on both sides
removing inside the modulo gives
Plugging back the definitions of and gives
The equation above can be used as a tool to simplify multiplications under modulo operator similar to additions under modulo operator. For example 190 squared divided by 7
which is easier to evaluate this way. It would've taken longer to first find out that
Sidenote :
-Some programming language like Python uses percent sign (%) for modulo operator. In excel, modulo operator is written with '=mod([number];[divisor])'
-I am very sorry for night mode readers as the latex rendered are transparent.
-There's more to modular arithmetic but i'm going to leave it here. I might add more on my next posts.