Lecture 5
Lecture 5
قومية كلية
ل معتمدة من الهيئة ال عتماد
ضمان جودة التعليم واال
Closure properties under +, −, : If a, b are integers, then a+b, a −b, a b are integers.
Additive inverse
For all integer a, a + (−a) = (−a)+a = 0
Division
If a, b Z, b 0, then it may be that (a / b) Z, so integers are not closed under division.
Divisibility
• If a and b are integers with a ≠ 0, we say that a divides b if there is an integer c such that b = ac, or
equivalently, if b/a is an integer. When a divides b we say that a is a factor or divisor of b, and that b is a
multiple of a. The notation a | b denotes that a divides b.
• We can express a | b using quantifiers as ∃c(ac = b), where the universe of discourse is the set of integers.
For any a, b Z
3) If a | b and b | a, then a = b
4) If a | b and b>0 and a>0, then a b
5) If mZ, m0, then a | b if and only if (ma)|(mb)
Divisibility (Cont.)
For any a, b, c
THEOREM: If a | b and b | c, then a | c.
Proof.
a | b → b = ax for some xZ (by definition of divisibility)
b | c → c = by for some yZ (by definition of divisibility)
By substitution we have c = (ax)y.
By associative law, c = a(xy).
xy=k is an integer by the closure property of integers under
multiplication.
c = ak means that a | c .
Divisibility (Cont.)
THEOREM : If a | b then a | bc.
Proof
By the definition of divisibility, a | b implies that there is some integer x such that b = ax.
For any integer c, bc = (ax)c = a(xc) by associative property of multiplication.
By the closure property integers under multiplication
xc = k, an integer, so bc =ak, i. e. a | bc
Divisibility (Cont.)
• THEOREM : If a | b and a | c then a | (bx + cy) for any x, y Z
Proof is left as an exercise.
Divisibility (Cont.)
• THEOREM
• THE DIVISION ALGORITHM Let a be an integer and d a positive integer. Then there are unique
integers q and r, with 0 ≤ r < d, such that a = dq + r.
• Note that the remainder cannot be negative.
• In the equality given in the division algorithm, d is called the divisor, a is called the dividend, q is
called the
quotient, and r is called the remainder. This notation is used to express the quotient and
remainder: q = a div d, r = a mod d.
• when a is an integer and d is a positive integer, we have
• a div d = 𝑎/𝑑
• Example: What are the quotient and remainder when 101 is divided by 11?
• We have 101 = 11 ・ 9 + 2.
• the quotient when 101 is divided by 11 is 9 = 101 div 11, and the remainder is 2 = 101 mod 11.
• Example: What are the quotient and remainder when −11 is divided by 3?
• Hence, the quotient when −11 is divided by 3 is −4 = −11 div 3, and the remainder is 1 = −11 mod 3.
• Consequently, the remainder is not −2, even though −11 = 3(−3) − 2, because r = −2 does not satisfy 0 ≤ r < 3.
Modular Arithmetic
• We now introduce a notation that indicates that two integers have the same remainder when they are divided
by the positive integer m.
• DEFINITION: If a and b are integers and m is a positive integer, then a is congruent to b modulo m if m
divides a − b. We use the notation a ≡ b (mod m) to indicate that a is congruent to b modulo m. We say that a
≡ b (mod m) is a congruence and that m is its modulus (plural moduli).
• THEOREM: 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.
• Example: Determine whether 17 is congruent to 5 modulo 6
• Because 6 divides 17 − 5 = 12, we see that 17 ≡ 5 (mod 6).
• Example: Determine whether 24 is congruent to 14 modulo 6
• 24 − 14 = 10 is not divisible by 6, we see that 24 is not congruent to 14 (mod 6).
Arithmetic Modulo m
• We can define arithmetic operations on Zm, the set of nonnegative integers less than m, that is, the set {0, 1, . .
. , m − 1}.
• We define addition of these integers, denoted by +m by a +m b = (a + b) mod m.
• We define multiplication of these integers, denoted by ・m by a ・m b = (a ・ b) mod m.
• Example: find 7 +11 9
• 7 +11 9 = (7 + 9) mod 11 = 16 mod 11 = 5
• DEFINITION: The integers a and b are relatively prime if their greatest common divisor is 1.
• Example: it follows that the integers 17 and 22 are relatively prime, because gcd(17, 22) = 1.
Greatest Common Divisors (Cont.)
Suppose that the prime factorizations of the integers a and b are:
a a
a = p1 1 p2 2 ...pna n b b
b = p1 1 p22 ...pnbn
(ai, bi 0 )
• Theorem. For any two integers a and b ab = gcd (a, b) lcm(a, b)
a a a b b b
a b = ( p1 1 p2 2 ... pk k ) ( p1 1 p22 ... pkk )
a + b1 a + b2 a + bk
= p1 1 p2 2 ... pk k
125 = 1*87 + 38
= 2*38 + 11
= 3*11 + 5
11 = 2*5 + 1
= 5*1
125 = 6*20 + 5
= 4*5,
For example, to find integer solution for 85x +34y = 51, find the gcd(85, 34) using Euclid Algorithm:
85=342+17
34= 172
So, gcd(85, 34)=17.
Since 17|51 a solution exists
• So, if a solution (x, y) exists, then there are infinitely many solutions (x −6k, y+15k), k is any integer.