Presentation is loading. Please wait.

Presentation is loading. Please wait.

Quotient-Remainder Theory, Div and Mod

Similar presentations


Presentation on theme: "Quotient-Remainder Theory, Div and Mod"โ€” Presentation transcript:

1 Quotient-Remainder Theory, Div and Mod
If ๐‘› and ๐‘‘ are integers and ๐‘‘>0, then ๐‘› ๐‘‘๐‘–๐‘ฃ ๐‘‘=๐‘ž and ๐‘› ๐‘š๐‘œ๐‘‘ ๐‘‘=๐‘Ÿ โŸบ ๐‘›=๐‘‘๐‘ž+๐‘Ÿ where ๐‘ž and ๐‘Ÿ are integers and 0โ‰ค๐‘Ÿ<๐‘‘. Quotient: q=๐‘› ๐‘‘๐‘–๐‘ฃ ๐‘‘= ๐‘› ๐‘‘ Reminder: r=๐‘› ๐‘š๐‘œ๐‘‘ ๐‘‘=๐‘›โˆ’๐‘‘๐‘ž

2 Exercise Prove that for all integers a and b, if a mod 7 = 5 and b mod 7 = 6 then ab mod 7 = 2. What values are ๐‘‘, ๐‘ž, and ๐‘Ÿ?

3 Exercise Prove that for all integers a and b, if a mod 7 = 5 and b mod 7 = 6 then ab mod 7 = 2. Hint: ๐‘‘ = 7 ๐‘Ž = 7๐‘š+5, b = 7๐‘›+6 ๐‘Ž๐‘ = 7๐‘š+5 7๐‘›+6 =49๐‘š๐‘›+42๐‘š+35๐‘›+30=7 7๐‘š๐‘›+6๐‘š+3๐‘›+4 +2

4 Floor & Ceiling Floor: If ๐‘ฅ is a real number and ๐‘› is an integer, then
Definition: Floor: If ๐‘ฅ is a real number and ๐‘› is an integer, then ๐‘ฅ =๐‘› โŸบ ๐‘›โ‰ค๐‘ฅ<๐‘›+1 Ceiling: if ๐‘ฅ is a real number and ๐‘› is an integer, then ๐‘ฅ =๐‘› โŸบ ๐‘›โˆ’1<๐‘ฅโ‰ค๐‘› ๐‘ฅ ๐‘› ๐‘›+1 floor of ๐‘ฅ= ๐‘ฅ ๐‘ฅ ๐‘›โˆ’1 ๐‘› ceiling of ๐‘ฅ= ๐‘ฅ

5 Relations between Proof by Contradiction and Proof by Contraposition
To prove a statement โˆ€๐‘ฅ in ๐ท, if ๐‘ƒ ๐‘ฅ then ๐‘„(๐‘ฅ) Proof by contraposition proves the statement by giving a direct proof of the equivalent statement โˆ€๐‘ฅ in ๐ท, if ๐‘„ ๐‘ฅ is false then ๐‘ƒ ๐‘ฅ is false Proof by contradiction proves the statement by showing that the negation of the statement leads logically to a contradiction. Suppose ๐‘ฅ is an arbitrary element of ๐ท such that ~๐‘„(๐‘ฅ) ~๐‘ƒ(๐‘ฅ) Sequence of steps Suppose โˆƒ๐‘ฅ in ๐ท such that ๐‘ƒ(๐‘ฅ) and ~๐‘„(๐‘ฅ) Same sequence of steps Contradiction: ๐‘ƒ(๐‘ฅ) and ~๐‘ƒ(๐‘ฅ)

6 Summary of Chapter 4 Number theories: Proofs:
Even, odd, prime, and composite Rational, divisibility, and quotient-remainder theorem Floor and ceiling The irrationality of 2 and gcd Proofs: Direct proof and counterexample Indirect proof by contradiction and contraposition

7 ๐‘Ÿ is rational โ‡” โˆƒ integers ๐‘Ž and ๐‘ such that ๐‘Ÿ = ๐‘Ž ๐‘ and ๐‘ โ‰  0.
The Irrationality of 2 How to proof: Direct proof? Proof by contradiction? Proof by contraposition? If ๐‘Ÿ is a real number, then ๐‘Ÿ is rational โ‡” โˆƒ integers ๐‘Ž and ๐‘ such that ๐‘Ÿ = ๐‘Ž ๐‘ and ๐‘ โ‰  0. A real number that is not rational is irrational.

8 The Irrationality of 2 Proof by contradiction: Starting point:
Negation: 2 is rational. To show: A contradiction. 2 = ๐‘š ๐‘› , where ๐‘š and ๐‘› are integers with no common factors and ๐‘›โ‰ 0, by definition of rational. ๐‘š 2 = 2 ๐‘› 2 , by squaring and multiplying both sides with ๐‘› 2 ๐‘š 2 is even, then ๐‘š is even. Let ๐‘š = 2๐‘˜ for some integer ๐‘˜. (2๐‘˜) 2 =4 ๐‘˜ 2 =2 ๐‘› 2 , by substituting ๐‘š = 2๐‘˜ into ๐‘š 2 = 2 ๐‘› 2 . ๐‘› 2 is even, and so ๐‘› is even. Hence both ๐‘š and ๐‘› have a common factor of 2.

9 Irrationality of 1+3 2 Proof by contradiction: Starting point:
Negation: is rational. To show: A contradiction.

10 1+3 2 = ๐‘Ž ๐‘ for some integers ๐‘Ž and ๐‘ with ๐‘โ‰ 0.
Irrationality of Proof by contradiction: By definition of rational, = ๐‘Ž ๐‘ for some integers ๐‘Ž and ๐‘ with ๐‘โ‰ 0. It follows that 3 2 = ๐‘Ž ๐‘ โˆ’ by subtracting 1 from both sides = ๐‘Ž ๐‘ โˆ’ ๐‘ ๐‘ by substitution = ๐‘Žโˆ’๐‘ ๐‘ by the rule for subtracting fractions with a common denominator Hence, 2 = ๐‘Žโˆ’๐‘ 3๐‘ by dividing both sides by 3. ๐‘Ž โˆ’ ๐‘ and 3๐‘ are integers and 3๐‘โ‰ 0 by the zero product property. Hence 2 is quotient of the two integers ๐‘Ž โˆ’ ๐‘ and 3๐‘ with 3๐‘โ‰ 0, so 2 is rational by the definition of rational. This contradicts the fact that 2 is irrational.

11 Property of a Prime Divisor
Proposition 4.7.3 For any integer ๐‘Ž and any prime number ๐‘, if ๐‘|๐‘Ž then ๐‘ | (๐‘Ž+1) If a prime number divides an integer, then it does not divide the next successive integer. Starting point: there exists an integer ๐‘Ž and a prime number ๐‘ such that ๐‘ | ๐‘Ž and ๐‘ | (๐‘Ž + 1). To show: a contradiction. ๐‘Ž = ๐‘๐‘Ÿ and ๐‘Ž + 1 = ๐‘๐‘  for some integers ๐‘Ÿ and ๐‘  by definition of divisibility. It follows that 1 = (๐‘Ž + 1) โˆ’ ๐‘Ž = ๐‘๐‘  โˆ’ ๐‘๐‘Ÿ = ๐‘(๐‘  โˆ’ ๐‘Ÿ ), ๐‘  โˆ’ ๐‘Ÿ =1/๐‘, by dividing both sides with ๐‘. ๐‘ > 1 because ๐‘ is prime, hence, 1/๐‘ is not an integer, thus ๐‘ โˆ’๐‘Ÿ is not an integer, which is a contradict ๐‘ โˆ’๐‘Ÿ is an integer since ๐‘Ÿ and ๐‘  are integers. if ๐‘› and ๐‘‘ are integers and ๐‘‘โ‰ 0: ๐‘‘|๐‘› โŸบ โˆƒ an integer ๐‘˜ such that ๐‘›=๐‘‘โˆ™๐‘˜

12 Infinitude of the Primes
Theorem Infinitude of the Primes The set of prime numbers is infinite. Proof by contradiction: Starting point: the set of prime number is finite. To show: a contradiction. Assume a prime number ๐‘ is the largest of all the prime numbers 2, 3, 5, 7, 11,. . . ,๐‘. Let ๐‘ be the product of all the prime numbers plus 1: ๐‘ = (2ยท3ยท5ยท7ยท11ยท ยท ยท๐‘) + 1 Then ๐‘ > 1, and so, by Theorem (any integer larger than 1 is divisible by a prime number) , ๐‘ is divisible by some prime number q. Because q is prime, q must equal one of the prime numbers 2, 3, 5, 7, 11, , ๐‘. Thus, by definition of divisibility, ๐‘ž divides 2ยท3ยท5ยท7ยท11ยท ยท ยท๐‘, and so, by Proposition 4.7.3, ๐‘ž does not divide (2ยท3ยท5ยท7ยท11ยท ยท ยท๐‘) + 1, which equals ๐‘. Hence N is divisible by q and N is not divisible by q, and we have reached a contradiction. [Therefore, the supposition is false and the theorem is true.]

13 Greatest Common Divisor (GCD)
The greatest common divisor of two integers a and b is the largest integer that divides both ๐‘Ž and ๐‘. Exercise: gcd 72,63 =9, since 72=9โˆ™8 and 63=9โˆ™7 gcd , = 2 20 , since = 2 20 โˆ™ 5 20 and = 2 30 โˆ™ 3 30 Definition Let ๐‘Ž and ๐‘ be integers that are not both zero. The greatest common divisor of ๐‘Ž and ๐‘, denoted gcd(a, b), is that integer ๐‘‘ with the following properties: ๐‘‘ is common divisor of both a and b, in other words, ๐‘‘ | ๐‘Ž, and ๐‘‘ | ๐‘. For all integers ๐‘, if ๐‘ is a common divisor of both ๐‘Ž and ๐‘, then ๐‘ is less than or equal to ๐‘‘. In other words, for all integers ๐‘, if ๐‘ | ๐‘Ž, and ๐‘ |๐‘, then cโ‰ค๐‘‘.

14 Greatest Common Divisor (GCD)
Lemma 4.8.1 If ๐‘Ÿ is a positive integer, then gcdโก(๐‘Ÿ,0) = ๐‘Ÿ. Proof: Suppose ๐‘Ÿ is a positive integer. [We must show that the greatest common divisor of both ๐‘Ÿ and 0 is ๐‘Ÿ.] ๐‘Ÿ is a common divisor of both ๐‘Ÿ and 0 because r divides itself and also ๐‘Ÿ divides 0 (since every positive integer divides 0). No integer larger than ๐‘Ÿ can be a common divisor of ๐‘Ÿ and 0 (since no integer larger than ๐‘Ÿ can divide ๐‘Ÿ). Hence ๐‘Ÿ is the greatest common divisor of ๐‘Ÿ and 0.

15 Greatest Common Divisor (GCD)
Lemma 4.8.2 If ๐‘Ž and ๐‘ are any integers not both zero, and if ๐‘ž and ๐‘Ÿ are any integers such that ๐‘Ž=๐‘๐‘ž+๐‘Ÿ, then gcdโก(๐‘Ž,๐‘)=gcdโก(๐’ƒ,๐‘Ÿ) Proof: [The proof is divided into two sections: (1) proof that gcdโก(๐‘Ž, ๐‘) โ‰ค gcdโก(๐‘, ๐‘Ÿ ), and (2) proof that gcdโก(๐‘, ๐‘Ÿ ) โ‰ค gcdโก(๐‘Ž, ๐‘). Since each gcd is less than or equal to the other, the two must be equal.] gcdโก(๐’‚, ๐’ƒ) โ‰ค gcdโก(๐’ƒ, ๐’“): [We will first show that any common divisor of ๐‘Ž and ๐‘ is also a common divisor of ๐‘ and ๐‘Ÿ.] Let ๐‘Ž and ๐‘ be integers, not both zero, and let ๐‘ be a common divisor of ๐‘Ž and ๐‘. Then ๐‘ | ๐‘Ž and ๐‘ | ๐‘, and so, by definition of divisibility, ๐‘Ž= ๐‘›๐‘ and ๐‘ = ๐‘š๐‘, for some integers ๐‘› and ๐‘š. Now substitute into the equation ๐‘Ž = ๐‘๐‘ž + ๐‘Ÿ to obtain ๐‘›๐‘ = (๐‘š๐‘)๐‘ž + ๐‘Ÿ.

16 Greatest Common Divisor (GCD)
Lemma 4.8.2 If ๐‘Ž and ๐‘ are any integers not both zero, and if ๐‘ž and ๐‘Ÿ are any integers such that ๐‘Ž=๐‘๐‘ž+๐‘Ÿ, then gcdโก(๐‘Ž,๐‘)=gcdโก(๐’ƒ,๐‘Ÿ) Proof (contโ€™): gcdโก(๐’‚, ๐’ƒ) โ‰ค gcdโก(๐’ƒ, ๐’“): [We will first show that any common divisor of ๐‘Ž and ๐‘ is also a common divisor of ๐‘ and ๐‘Ÿ.] ๐‘›๐‘ = (๐‘š๐‘)๐‘ž + ๐‘Ÿ. Then solve for ๐‘Ÿ : ๐‘Ÿ = ๐‘›๐‘ โˆ’ (๐‘š๐‘)๐‘ž = (๐‘› โˆ’ ๐‘š๐‘ž)๐‘. But ๐‘› โˆ’ ๐‘š๐‘ž is an integer, and so, by definition of divisibility, ๐‘ | ๐‘Ÿ . Because we already know that ๐‘ | ๐‘, we can conclude that ๐‘ is a common divisor of ๐‘ and ๐‘Ÿ [as was to be shown].

17 Greatest Common Divisor (GCD)
Lemma 4.8.2 If ๐‘Ž and ๐‘ are any integers not both zero, and if ๐‘ž and ๐‘Ÿ are any integers such that ๐‘Ž=๐‘๐‘ž+๐‘Ÿ, then gcdโก(๐‘Ž,๐‘)=gcdโก(๐’ƒ,๐‘Ÿ) Proof (contโ€™): gcdโก(๐’‚, ๐’ƒ) โ‰ค gcdโก(๐’ƒ, ๐’“): [Next we show that gcdโก(๐‘Ž, ๐‘) โ‰ค gcdโก(๐‘, ๐‘Ÿ).] By part (a), every common divisor of ๐‘Ž and ๐‘ is a common divisor of ๐‘ and ๐‘Ÿ . It follows that the greatest common divisor of ๐‘Ž and ๐‘ is defined because ๐‘Ž and ๐‘ are not both zero, and it is a common divisor of ๐‘ and ๐‘Ÿ . But then gcdโก(๐‘Ž, ๐‘) (being one of the common divisors of ๐‘ and ๐‘Ÿ) is less than or equal to the greatest common divisor of ๐‘ and ๐‘Ÿ : gcdโก(๐‘Ž, ๐‘) โ‰ค gcdโก(๐‘, ๐‘Ÿ ). gcdโก(๐’ƒ, ๐’“) โ‰ค gcdโก(๐’‚, ๐’ƒ): The second part of the proof is very similar to the first part. It is left as an exercise.

18 The Euclidean Algorithm
Problem: Given two integer A and B with ๐ด>๐ตโ‰ฅ0, find gcdโก(๐ด,๐ต) Idea: The Euclidean Algorithm uses the division algorithm repeatedly. If B=0, by Lemma we know gcdโก(๐ด,๐ต) = ๐ด. If B>0, division algorithm can be used to calculate a quotient ๐‘ž and a remainder ๐‘Ÿ: ๐ด=๐ต๐‘ž+๐‘Ÿ where 0โ‰ค๐‘Ÿ<๐ต By Lemma 4.8.2, we have gcdโก(๐ด,๐ต)=gcdโก(๐ต,๐‘Ÿ), where ๐ต and ๐‘Ÿ are smaller numbers than ๐ด and ๐ต. gcdโก(๐ด, ๐ต) = gcdโก(๐ต, ๐‘Ÿ) = โ‹ฏ = gcdโก(๐‘ฅ, 0) = ๐‘ฅ ๐‘Ÿ=๐ด ๐‘š๐‘œ๐‘‘ ๐ต

19 The Euclidean Algorithm - Exercise
Use the Euclidean algorithm to find gcd(330, 156).

20 The Euclidean Algorithm - Exercise
Use the Euclidean algorithm to find gcd(330, 156). Solution: gcd(330,156) = gcd(156, 18) 330 mod 156 = 18 = gcd(18, 12) 156 mod 18 = 12 = gcd(12, 6) 18 mod 12 = 6 = gcd(6, 0) 12 mod 6 = 0 = 6

21 An alternative to Euclidean Algorithm
If ๐‘Žโ‰ฅ ๐‘> 0, then gcdโก(๐‘Ž,๐‘)=gcdโก(๐‘, ๐‘Žโˆ’๐‘)

22 An alternative to Euclidean Algorithm
If ๐‘Žโ‰ฅ ๐‘> 0, then gcdโก(๐‘Ž,๐‘)=gcdโก(๐‘, ๐‘Žโˆ’๐‘) Hint: Part 1: proof gcdโก(๐‘Ž,๐‘)โ‰คgcdโก(๐‘, ๐‘Žโˆ’๐‘) every common divisor of a and b is a common divisor of b and a-b Part 2: proof gcdโก(๐‘Ž,๐‘)โ‰ฅgcdโก(๐‘, ๐‘Žโˆ’๐‘) every common divisor of b and a-b is a common divisor of a and b.

23 Homework #5 Problems Converting decimal to rational numbers.
4.2.2: 4.2.7: โ€ฆ

24 Homework #5 Problems 1. Converting decimal to rational numbers : Solution: = โˆ—10000= : โ€ฆ Solution: let X = x = โ€ฆ. 10x = โ€ฆ x โ€“ 10x = X = / 99990

25 Exercise Prove that for any nonnegative integer ๐‘›, if the sum of the digits of ๐‘› is divisible by 9, then ๐‘› is divisible by 9. Hint: by the definition of decimal representation ๐‘›= ๐‘‘ ๐‘˜ 10 ๐‘˜ + ๐‘‘ ๐‘˜โˆ’1 10 ๐‘˜โˆ’1 +โ‹ฏ+ ๐‘‘ ๐‘‘ 0 where ๐‘˜ is nonnegative integer and all the ๐‘‘ ๐‘– are integers from 0 to 9 inclusive. = ๐‘‘ ๐‘˜ ( 9999โ‹ฏ999 ๐‘˜ 9 โ€ฒ ๐‘  +1)+ ๐‘‘ ๐‘˜โˆ’1 ( 9999โ‹ฏ999 ๐‘˜โˆ’1 9 โ€ฒ ๐‘  +1)+โ‹ฏ+ ๐‘‘ 1 (9+1)+ ๐‘‘ 0 =9 ๐‘‘ ๐‘˜ 11โ‹ฏ11 ๐‘˜ 1 โ€ฒ ๐‘  + ๐‘‘ ๐‘˜โˆ’1 11โ‹ฏ11 ๐‘˜โˆ’1 1 โ€ฒ ๐‘  +โ‹ฏ+ ๐‘‘ ๐‘‘ ๐‘˜ + ๐‘‘ ๐‘˜โˆ’1 +โ‹ฏ+๐‘‘ 1 + ๐‘‘ 0 = an integer divisible by 9 + the sum of the digits of ๐‘›

26 Homework #5 Problems Theorem: The sum of any two even integers equals 4k for some integer k. โ€œProof: Suppose m and n are any two even integers. By definition of even, m = 2k for some integer k and n = 2k for some integer k. By substitution, m + n = 2k + 2k = 4k. This is what was to be shown.โ€ Whatโ€™s the mistakes in this proof?


Download ppt "Quotient-Remainder Theory, Div and Mod"

Similar presentations


Ads by Google