Integers
Integers
Integers
Definition
If a and b are integers and m is a positive integer, then a is congruent to b modulo m iff m|
(a − b).
The notation a ≡ b( mod m) says that a is congruent to b modulo m. We say that a ≡
b( mod m) is a congruence, and that m is its modulus.
Two integers are congruent mod m if and only if they have the same remainder when
divided by m.
If a is not congruent to b modulo m, we write a ≡/ b( mod m).
CONGRUENCE
Exercise 1
1. Determine whether 17 is congruent to 5 modulo 6, and whether 24 and 14 are
congruent modulo 6.
Terminology
The uses of “mod” in the following expressions are different.
a ≡ b( mod m), and
a mod m = b
a ≡ b( mod m) describes a binary relation on the set of integers.
In a mod m = b, the notation mod denotes a function (from integers to integers).
The relationship between these notations is made clear in this theorem.
Theorem 3.
Let a and b be integers, and let m be a positive integer.
Then a ≡ b( mod m) if and only if a mod m = b mod m
A Theorem on Congruences
Theorem 4.
Let m be a positive integer. The integers a and b are congruent modulo m if and only if there
is an integer k such that a = b + km.
Proof.
If a ≡ b( mod m), then (by the definition of congruence) m|(a − b).
Hence, there is an integer k such that a − b = km and equivalently a = b + km.
Conversely, if there is an integer k such that a = b + km, then km = a − b.
Hence, m|(a − b) and a ≡ b( mod m).
Congruences of Sums and Products
Theorem 5.
Let m be a positive integer. If a ≡ b( mod m) and c ≡ d( mod m), then a + c ≡ b + d( mod m)
and ac ≡ bd( mod m).
Proof.
Since a ≡ b( mod m) and c ≡ d( mod m), by the Theorem 4 above there are integers s and t
with b = a + sm and d = c + tm.
Therefore;
b + d = (a + sm) + (c + tm) = (a + c) + m(s + t), and
bd = (a + sm)(c + tm) = ac + m(at + cs + stm).
Hence, a + c ≡ b + d( mod m) and ac ≡ bd( mod m).
Corollary 5.1
Let m be a positive integer and let a and b be integers. Then (a + b) mod m =
((a mod m) + (b mod m)) mod m ab mod m = ((a mod m)(b mod m)) mod m.
Arithmetic modulo m
Let Zm = {0, 1, . . . , m − 1}.
The operation +m is defined as a +m b = (a + b) mod m. This is addition modulo m.
The operation ·m is defined as a ·m b = (a · b) mod m. This is multiplication modulo m.
Using these operations is said to be doing arithmetic modulo m.
Example:
1. Find 7 +11 9 and 7 ·11 9.
Solution:
Using the definitions above:
7 +11 9 = (7 + 9) mod 11 = 16 mod 11 = 5
7 ·11 9 = (7 · 9) mod 11 = 63 mod 11 = 8
Exercise 2
Find addition and multiplication tables for Z5
Arithmetic modulo m
The operations +m and ·m satisfy many of the same properties as ordinary addition and
multiplication.
Closure: If a, b ∈ Zm , then a +m b and a ·m b belong to Zm.
Associativity: If a, b, c ∈ Zm, then (a +m b) +m c = a +m (b +m c) and (a ·m b) ·m c = a ·m (b ·m c).
Commutativity: If a, b ∈ Zm, then a +m b = b +m a and a ·m b = b ·m a.
Identity elements: The elements 0 and 1 are identity elements for addition and multiplication
modulo m, respectively.
If a ∈ Zm then a +m 0 = a and a ·m 1 = a.
Additive inverses: If 0 =/ a ∈ Zm, then m − a is the additive inverse of a modulo m. Moreover, 0 is
its own additive inverse. a +m (m − a) = 0 and 0 +m 0 = 0.
Distributivity: If a, b, c ∈ Zm, then a ·m (b +m c) = (a ·m b) +m (a ·m c) and (a +m b) ·m c = (a ·m c) +m (b ·m
c).
Base b Representation of Integers
Theorem 6
Let b be a positive integer greater than 1. Every positive integer n can be expressed uniquely
in the form:
n = akbk + ak−1bk−1 + · · · + a1b + a0
where k is a nonnegative integer, a0, a1, . . . ak ∈ {0, . . . , b − 1} and ak =/ 0.
The a0, a1, . . . ak are called the base-b digits of the representation
.
• Approach 1: if any number x < n divides it. If yes, it is a composite. If we test all numbers
x < n and do not find the proper divisor, then n is a prime.
• Approach 2: if any prime number x < n divides it. If yes, it is a composite. If we test all
primes x < n and do not find a proper divisor, then n is a prime.
• Approach 3: if any prime number x < divides it. If yes, it is a composite. If we test all
primes x < and do not find a proper divisor, then n is a prime.
Exercise 4*
Discuss distribution of prime numbers.
Greatest Common Divisor
Definition
Let a, b ∈ Z − {0}. The largest integer d such that d|a and also d|b is called the greatest
common divisor of a and b. It is denoted by gcd(a, b).
A systematic way to find the gcd using factorization:
• Let a=p1 a1 p2 a2 p3 a3 … pk ak and b= p1 b1 p2 b2 p3 b3 … pk bk
• gcd(a,b)= p1 min(a1,b1) p2 min(a2,b2) p3 min(a3,b3) … pk min(ak,bk)
Examples:
• gcd(24,36) = ?
• 24 = 2*2*2*3=23*3
• 36= 2*2*3*3=22*32
• gcd(24,36) =22*3 = 12
Definition
The integers a and b are relatively prime (coprime) iff gcd(a, b) = 1
Exercise 5
Give three examples of relatively prime numbers.
Definition
The integers a1, a2, . . . , an are pairwise relatively prime iff gcd(ai , aj) = 1 whenever 1 ≤ i < j ≤
n. Example:
10, 17 and 21 are pairwise relatively prime, since gcd (10, 17) = gcd (10, 21) = gcd (17, 21) = 1.
Least Common Multiple
Definition
The least common multiple of the positive integers a and b is the smallest positive integer that is
divisible by both a and b. It is denoted by lcm(a, b).
A systematic way to find the lcm using factorization:
• Let a =p1 a1 p2 a2 p3 a3 … pk ak and b = p1 b1 p2 b2 p3 b3 … pk bk
• Lcm(a,b)= p1 max(a1,b1) p2 max(a2,b2) p3 max(a3,b3) … pk max(ak,bk)
Example:
• What is lcm(12,9) =?
• 12 = 2*2*3=22*3
• 9=3*3 =32
• Lcm(12,9) = 22 * 32 = 4 * 9 = 36
Factorization is a very inefficient method to compute gcd and lcm. The Euclidian algorithm is much better.
Euclidian Algorithm
Lemma
Let a = bq + r, where a, b, q, and r are integers. Then gcd(a, b) = gcd(b, r).
The solution of the congruence are all the integers x that satisfy it.
Definition
An integer a such that aa¯≡ 1( mod m) is called a multiplicative inverse of a modulo m .
Multiplicative Inverses
Example:
Let m = 15. Find a multiplicative inverse of 8 modulo 15.
2 · 8 = 16 ≡ 1( mod 15).
Thus 2 is a multiplicative inverse of 8 modulo 15.
Exercise 6
Find a multiplicative inverse of 7 modulo 15.
What is the multiplicative inverse of 5 modulo 15?