
Introduction to Modular Arithmetic Subodh Sharma Subhashis Banerjee IIT Delhi, Computer Science Department Detour svs, suban: Introduction to Modular Arithmetic 2 I Given a; n 2 Z; n > 0 the notation r = a mod n represents the remainder of the division of a by n and q = ba=nc represents the quotient of the division. I Formally, [a]n = fa + kn : k 2 Zg I Example: [3]7 = {· · · ; −11; −4; 3; 10; 17; · · · g = [−4]7 = [10]7 I Thus, a 2 [b]n is the same as writing a ≡ b (mod n). I Division Theorem: For any integer a and any positive integer n, there exist unique integers q and r s.t.: a = qn + r where 0 ≤ r < n. I [a]n be the equivalence classes according to the remainders modulo n. I Set of all such equivalence classes: Zn = f[a]n : 0 ≤ a ≤ n − 1g will be read as f0; 1; ··· ; n − 1g Theory of Division I Let Z = {· · · ; −2; −1; 0; 1; 2; · · · g be the set of integers. svs, suban: Introduction to Modular Arithmetic 3 I Formally, [a]n = fa + kn : k 2 Zg I Example: [3]7 = {· · · ; −11; −4; 3; 10; 17; · · · g = [−4]7 = [10]7 I Thus, a 2 [b]n is the same as writing a ≡ b (mod n). I Given a; n 2 Z; n > 0 the notation r = a mod n represents the remainder of the division of a by n and q = ba=nc represents the quotient of the division. I [a]n be the equivalence classes according to the remainders modulo n. I Set of all such equivalence classes: Zn = f[a]n : 0 ≤ a ≤ n − 1g will be read as f0; 1; ··· ; n − 1g Theory of Division I Let Z = {· · · ; −2; −1; 0; 1; 2; · · · g be the set of integers. I Division Theorem: For any integer a and any positive integer n, there exist unique integers q and r s.t.: a = qn + r where 0 ≤ r < n. svs, suban: Introduction to Modular Arithmetic 3 I Formally, [a]n = fa + kn : k 2 Zg I Example: [3]7 = {· · · ; −11; −4; 3; 10; 17; · · · g = [−4]7 = [10]7 I Thus, a 2 [b]n is the same as writing a ≡ b (mod n). I [a]n be the equivalence classes according to the remainders modulo n. I Set of all such equivalence classes: Zn = f[a]n : 0 ≤ a ≤ n − 1g will be read as f0; 1; ··· ; n − 1g Theory of Division I Let Z = {· · · ; −2; −1; 0; 1; 2; · · · g be the set of integers. I Division Theorem: For any integer a and any positive integer n, there exist unique integers q and r s.t.: a = qn + r where 0 ≤ r < n. I Given a; n 2 Z; n > 0 the notation r = a mod n represents the remainder of the division of a by n and q = ba=nc represents the quotient of the division. svs, suban: Introduction to Modular Arithmetic 3 I Formally, [a]n = fa + kn : k 2 Zg I Example: [3]7 = {· · · ; −11; −4; 3; 10; 17; · · · g = [−4]7 = [10]7 I Thus, a 2 [b]n is the same as writing a ≡ b (mod n). I Set of all such equivalence classes: Zn = f[a]n : 0 ≤ a ≤ n − 1g will be read as f0; 1; ··· ; n − 1g Theory of Division I Let Z = {· · · ; −2; −1; 0; 1; 2; · · · g be the set of integers. I Division Theorem: For any integer a and any positive integer n, there exist unique integers q and r s.t.: a = qn + r where 0 ≤ r < n. I Given a; n 2 Z; n > 0 the notation r = a mod n represents the remainder of the division of a by n and q = ba=nc represents the quotient of the division. I [a]n be the equivalence classes according to the remainders modulo n. svs, suban: Introduction to Modular Arithmetic 3 I Example: [3]7 = {· · · ; −11; −4; 3; 10; 17; · · · g = [−4]7 = [10]7 I Thus, a 2 [b]n is the same as writing a ≡ b (mod n). I Set of all such equivalence classes: Zn = f[a]n : 0 ≤ a ≤ n − 1g will be read as f0; 1; ··· ; n − 1g Theory of Division I Let Z = {· · · ; −2; −1; 0; 1; 2; · · · g be the set of integers. I Division Theorem: For any integer a and any positive integer n, there exist unique integers q and r s.t.: a = qn + r where 0 ≤ r < n. I Given a; n 2 Z; n > 0 the notation r = a mod n represents the remainder of the division of a by n and q = ba=nc represents the quotient of the division. I [a]n be the equivalence classes according to the remainders modulo n. I Formally, [a]n = fa + kn : k 2 Zg svs, suban: Introduction to Modular Arithmetic 3 I Set of all such equivalence classes: Zn = f[a]n : 0 ≤ a ≤ n − 1g will be read as f0; 1; ··· ; n − 1g Theory of Division I Let Z = {· · · ; −2; −1; 0; 1; 2; · · · g be the set of integers. I Division Theorem: For any integer a and any positive integer n, there exist unique integers q and r s.t.: a = qn + r where 0 ≤ r < n. I Given a; n 2 Z; n > 0 the notation r = a mod n represents the remainder of the division of a by n and q = ba=nc represents the quotient of the division. I [a]n be the equivalence classes according to the remainders modulo n. I Formally, [a]n = fa + kn : k 2 Zg I Example: [3]7 = {· · · ; −11; −4; 3; 10; 17; · · · g = [−4]7 = [10]7 I Thus, a 2 [b]n is the same as writing a ≡ b (mod n). svs, suban: Introduction to Modular Arithmetic 3 Theory of Division I Let Z = {· · · ; −2; −1; 0; 1; 2; · · · g be the set of integers. I Division Theorem: For any integer a and any positive integer n, there exist unique integers q and r s.t.: a = qn + r where 0 ≤ r < n. I Given a; n 2 Z; n > 0 the notation r = a mod n represents the remainder of the division of a by n and q = ba=nc represents the quotient of the division. I [a]n be the equivalence classes according to the remainders modulo n. I Formally, [a]n = fa + kn : k 2 Zg I Example: [3]7 = {· · · ; −11; −4; 3; 10; 17; · · · g = [−4]7 = [10]7 I Thus, a 2 [b]n is the same as writing a ≡ b (mod n). I Set of all such equivalence classes: Zn = f[a]n : 0 ≤ a ≤ n − 1g will be read as f0; 1; ··· ; n − 1g svs, suban: Introduction to Modular Arithmetic 3 I Eg: gcd(24; 30) = 6. I 24 = 2:2:2:3 I 30 = 2:3:5 I A useful characterization of gcd: If a and b are nonzero, then gcd(a; b) is the smallest positive number of the set fax + by : x; y 2 Zg. I If gcd(a; b) = 1, then a and b are relatively prime. I Relatively prime integers: gcd(a; b) = 1 I From above ) dja + b; dja − b. In general, djax + by for any integers x and y. I Greatest Common Divisor (gcd): Among all the common divisors of a and b, the largest among them is the gcd(a; b) I Note: No efficient solution for integer factorization. Common Divisors I If dja and djb, we say d is a common divisor of a and b. svs, suban: Introduction to Modular Arithmetic 4 I Eg: gcd(24; 30) = 6. I 24 = 2:2:2:3 I 30 = 2:3:5 I A useful characterization of gcd: If a and b are nonzero, then gcd(a; b) is the smallest positive number of the set fax + by : x; y 2 Zg. I If gcd(a; b) = 1, then a and b are relatively prime. I Relatively prime integers: gcd(a; b) = 1 I Greatest Common Divisor (gcd): Among all the common divisors of a and b, the largest among them is the gcd(a; b) I Note: No efficient solution for integer factorization. Common Divisors I If dja and djb, we say d is a common divisor of a and b. I From above ) dja + b; dja − b. In general, djax + by for any integers x and y. svs, suban: Introduction to Modular Arithmetic 4 I Eg: gcd(24; 30) = 6. I 24 = 2:2:2:3 I 30 = 2:3:5 I A useful characterization of gcd: If a and b are nonzero, then gcd(a; b) is the smallest positive number of the set fax + by : x; y 2 Zg. I If gcd(a; b) = 1, then a and b are relatively prime. I Relatively prime integers: gcd(a; b) = 1 I Note: No efficient solution for integer factorization. Common Divisors I If dja and djb, we say d is a common divisor of a and b. I From above ) dja + b; dja − b. In general, djax + by for any integers x and y. I Greatest Common Divisor (gcd): Among all the common divisors of a and b, the largest among them is the gcd(a; b) svs, suban: Introduction to Modular Arithmetic 4 I A useful characterization of gcd: If a and b are nonzero, then gcd(a; b) is the smallest positive number of the set fax + by : x; y 2 Zg. I If gcd(a; b) = 1, then a and b are relatively prime.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages65 Page
-
File Size-