Division Algorithm in Z
It states that for any integers 'a' and 'b' (where 'b' is positive), there exist unique
integers 'q' (quotient) and 'r' (remainder) such that a = bq + r, and 0 ≤ r < b.
What it means:
The division algorithm essentially means that when you divide any integer 'a' by a
positive integer 'b', you can always find a unique quotient 'q' and a unique remainder 'r' that
satisfy the given equation.
Formula:
a = bq + r, where:
'a' is the dividend (the integer being divided).
'b' is the divisor (the positive integer you are dividing by).
'q' is the quotient (the result of the division).
'r' is the remainder (the leftover after the division).
0 ≤ r < b (the remainder is always non-negative and less than the divisor).
Uniqueness:
The key part of the algorithm is that the quotient ('q') and remainder ('r') are unique
for a given 'a' and 'b'. This means there's only one possible pair of 'q' and 'r' that satisfies the
equation and the remainder condition.
Example
Let a = 25, b = 4. We have 25 = 4 * 6 + 1, where q = 6 and r = 1, with 0 ≤ r < b (0 ≤ 1 < 4)
If m is a positive integer and n is any integer, then there exist unique integers q and r
such that
n = m q + r and 0 £ r < m
Here we regard q as the quotient and r as the nonnegative remainder when n is divided by m.
Example:
Find the quotient q and remainder r when 38 is divided by 7.
Answer: q=5, r=3
Find the quotient q and remainder r when -38 is divided by 7.
Answer: q=-6, r=4
Modular Operations
The modulo operations finds the remainder after division of one number by another
number (called the modulus of the operation)
Given two prime numbers, a and n, a modulo (abbreviation as a mod n) is the
remainder of the Euclidean division of a by n, where a is the dividend and n is the divisor.
Modulo ℤ/n
ℤ/n = {0, 1,2,3,…n-1}
Example:
ℤ/2 = {0,1}
ℤ/3 = {0,1,2}
ℤ/4 = {0,1,2,3}
Addition table for modulo
Example: ℤ/3 = {0,1,2}
+ 0 1 2
0 0 1 1
1 1 2 0
2 2 0 1
Multiplication table for modulo
Example: ℤ/3 = {0,1,2}
⦁ 0 1 2
0 0 0 0
1 0 1 2
2 0 1 1