450 likes | 585 Views
Discrete and Combinatorial Mathematics R. P. Grimaldi , 5 th edition, 2004. Chapter 4 Properties of the Integers. Well-Ordering Principle ( 良序原理 ). Every nonempty subset A of + = {1,2,…} contains a smallest element. Note: A can be finite or infinite .
E N D
Discrete and Combinatorial MathematicsR. P. Grimaldi,5th edition, 2004 Chapter 4 Properties of the Integers
Well-Ordering Principle (良序原理) Every nonempty subset A of + = {1,2,…} contains a smallest element. Note: A can be finite or infinite. Some sets are not well-ordered: : A= , : A=(0,1) It is the basis of a prove technique -- Mathematical Induction.
Principal of Mathematical Induction Let S(n) denote an open mathematical statement that involves one or more occurrences of the variable n +. (a) If S(1) is true; and (b) If S(k) is true for some particular k +, then S(k+1) is true; then S(n) is true for all n +.
Proof of Theorem 4.1 Proof by contradiction: Define the set F = { m | S(m) does not hold} +. If F is non-empty, then F must have a smallest element m (well-ordering of +), with S(m). Because we know that S(1), it must hold that m>1. Because m is the smallest value, it must hold that S(m–1), which contradicts our proof for all k +: S(k)S(k+1). Thus F has to be empty. Therefore, S holds for all +. #
Principal of Strong Form Mathematical Induction Let S(n) denote an open mathematical statement that involves one or more occurrences of the variable n +. Let n0, n1 + with n0 n1. (a) If S(n0), S(n0+1), S(n0+2), …, S(n1-1), and S(n1) are true; and (b) If whenever S(n0), S(n0+1), …, S(k-1),and S(k) are true for some particular k +, where k n1, then the statement S(k+1) is also true; Then S(n) is true for all n n0.
Mathematical Induction If we want to prove a property P(n) for all n+, we can do that in the following inductive way: Basis step:Prove it for n=1: does P(1) hold? Inductive step:Assuming that P(1), P(2), …, P(k) holdsfor some k+, prove P(k+1). By the structure of +, this proves it for all n: P(1) holds, hence P(2), hence P(3), et cetera.
Example of Induction Show that n! 2n-1, for n+. Proof. Induction Basis.n = 1 1! 21-1 = 1. Inductive step. Assume that i! 2i-1, for i = 1, 2, …, k. (k+1)! = (k+1)k!. Then (k+1)! = (k+1)k! (k+1) 2k-1 2 2k-1 = 2k. Therefore, the assertion is true. #
More Example of Induction For every n+ where n14, prove S(n) : n can be written as a sum of 3’s and/or 8’s. Proof. Induction Basis.n = 14 n = 3 + 3 + 8. n = 15 n = 3 + 3 + 3 + 3 + 3. n = 16 n = 8 + 8. Inductive step. Assume that S(14), S(15), …, S(k) are true for some k+ where k16. k+1 = (k-2) + 3. S(k+1) is true. Thus, S(n) is true for all n14. #
Recursive Definition Fibonacci sequence: 0,1,1,2,3,5,8,13,21,… It is sequence number A000045 in The On-Line Encyclopedia of Integer Sequences at http://www.research.att.com/~njas/sequences/index.html Recursive base. F0 = 0, F1 = 1. Recursive process. Fn = Fn-1 + Fn-2, n 2. Explicit formula: For large n, it grows like Fn ≈ 0.447214 1.61803n. This (1+√5)/2 ≈ 1.61803 is the Golden Ratio.
Fibonacci in Nature Shape of shells: Golden ratio: Perfect shape : total height / navel height = 1.618
Property of Fibonacci Observation. Conjecture.
Property of Fibonacci Proof. Induction Basis. Inductive step. Assume that for some k+ where k1. #
Other Sequences Harmonic sequence: Lucas sequence:
More Sequences Binomial sequence: Eulerian sequence:
Number System Binary digits: 0 and 1, called bits. Review of decimal system: • Example: 45,238 is equal to 8 ones 8 x 1 = 8 3 tens 3 x 10 = 30 2 hundreds 2 x 100 = 200 5 thousands 5 x 1000 = 5000 4 ten thousands 4 x 10000 = 40000
From Binary to Decimal The number 1101011 is equivalent to • 1 one 1 x20 = 1 • 1 two 1x21 = 2 • 0 four 0x22 = 0 • 1 eight 1x23 = 8 • 0 sixteen 0x24 = 0 • 1 thirty-two 1x25 = 32 • 1 sixty-four 1x26 = 64 107 in decimal base
From Decimal to Binary The number 7310 is equivalent to • 73 = 2 x 36 + remainder 1 • 36 = 2 x 18 + remainder 0 • 18 = 2 x 9 + remainder 0 • 9 = 2 x 4 + remainder 1 • 4 = 2 x 2 + remainder 0 • 2 = 2 x 1 + remainder 0 7310 = 10010012 (write the remainders in reverse order preceded by the quotient 1)
Adding Binary Numbers Example: add 1001012 + 1100112 1 1 1 carry ones 1001012 +1100112 10110002
Hexadecimal to Decimal The hexadecimal number 3A0B16 is 11 x 160 = 11 0 x 161 = 0 10 x 162 = 2560 3 x 163 = 12288 1485910
Two’s Complement One’s complement: Replace each 0(1) in the binary representation by 1(0). 100101 011010 Two’s complement: Add 1 to one’s complement. 011010 + 1 011011
Subtraction 33 - 15 33 = 001000012, 15 = 000011112 -15 = 111100012 001000012 +111100012 (1)000100102 = 18
More Subtraction 15 - 33 33 = 001000012, 15 = 000011112 -33 = 110111112 000011112 +110111112 111011102 Two’s complement 000100102 = 18 15 – 33 = -18.
Divisibility of Integers Let x,yZ and y0, x is a multiple of y if and only if there exist and integer mZ such that x = ym. We also say y divides x or y is a divisor of x. Notation: y|x.
Division Properties For all a,b,c,x,y,z Z: • 1|a and a|0 • [(a|b) and (b|a)] a = ±b • [(a|b) and (b|c)] a|c • a|b a|bx for all x • x = y + z, a|x and a|y a|z, a|y and a|z a|x • [(a|b) and (a|c)] a|(bx+cy) bx+cy is a linear combination of b and c. • a|ci, cjZ, for 1 ≤ i ≤ n a|(c1x1+c2x2 + … + cnxn) for all xjZ.
Proof of (f) • [(a|b) and (a|c)] a|(bx+cy). Proof. a|b Let b = ma for some m Z. a|c Let c = na for some n Z. bx+cy = xma+yna = a(xm+yn) a| (bx+cy). #
Division Algorithm Let a,bZ and b>0, there exist unique q,rZ with 0≤r<b, such that a = qb + r. We call a the dividend, b the divisor, q the quotient, and r the remainder.
Primes An integer p>1 is prime if and only if its two positive divisors are 1 and p. An integer n>1 that is not prime is composite. The first primes are: 2,3,5,7,11,… Euclid: there are infinitely many primes. Prime factorization is unique for each n{2,3,4,…}.
Property of Composite Integers Lemma 4.1 If n Z+ is composite, then there is a prime p such that p|n. Proof. Let S be the set of all composite integers that have no prime divisors. Assume S is not empty. Let m be the least member of S. m is composite m1,m2 [m = m1 m2]. p [p|m1], where p is prime. p| m1 m2 p|m. #
Infinitely Many Primes Theorem 4.4 There is an infinite number of primes. Proof. Assume there are finite primes p1, p2, …,pk. Consider N = p1 p2 … pk + 1. N must be a composite. By Lemma 4.1, pi [pi | N]. However piN for 1 i k. #
Property of Composite Integers If n Z+ is composite, then there is a prime p such that p|n and . Proof. n is composite n1,n2 Z+[n = n1 n2]. Assume and . n1 n2 > n. Without loss of generality, we assume By Lemma 4.1, a prime p [p | n1]. p|n and . #
Common Divisor For a,b, a positive integer c is said to be a common divisor of a and b if c|a and c|b. The greatest common divisor c, denoted by gcd(a,b), is the common divisor of a and b such that for any common divisor d of a and b satisfies d|c. Examples: gcd(121,33) = 11; gcd(6,35)=1, gcd(8,16)=8.
Uniqueness of GCD For all a,bZ+, there exists a unique cZ+ that is the greatest common divisor of a and b. Proof. Given a,bZ+, let S = {as+bt | s,t, as+bt>0}. We claim that the smallest element cS is gcd(a,b). cS x,yZ [c = ax + by]. Assume ca. a = qc + r, qN,rZ+, 1 r < c. r = a – qc = a – q(ax+by) = (1-qx)a – (qy)b. rS contradicts to that c is the smallest in S. Thus, c|a. Similarly, c|b. If dZ and d|a and d|b, then d|c. (Rule (f)) #
Properties of GCD For all a,b+, gcd(a,b) is the smallest positive integer we can write as a linear combination of a and b. Integers a and b are called relatively prime when gcd(a,b) = 1. That is, x,y [ax + by = 1]. Examples: gcd(42,70) = 14 x,y [42x + 70y = 14] x,y [3x + 5y = 1] x = 2-5k, y = -1+3k. (Infinite solutions.) Theorem 4.8 If a,b,c+, the Diophantine equation ax+by=c has an integer solution iff gcd(a,b)|c.
Euclidean Algorithm Let a,b+. gcd(a,b) is calculated by setting r0 = a, r1 = b, and applying the division algorithm n times as follows: r0 = q1r1 + r2, 0<r2<r1 r1 = q2r2 + r3, 0<r3<r2 … ri = qi+1ri+1 + ri+2, 0<ri+2<ri+1 … rn-2 = qn-1rn-1 + rn, 0<rn<rn-1 rn–1 = qnrn. gcd(a,b)=rn
Correctness of Euclidean Alg. Goal: gcd(a,b) = rn. step 1. c [c|a and c|b] c|rn. step 2. rn|a and rn|b. Proof. Let c be a positive integer such that c|r0 and c|r1. r0 = q1r1 + r2 c|r2 c|r1 and c|r2 and r1 = q2r2 + r3 c|r3 … c|rn-2 and c|rn-1 and rn-2 = qn-1rn-1 + rn c|rn. rn–1 = qnrnrn|rn-1 rn|rn-1 and rn-2 = qn-1rn-1 + rn rn|rn-2 … rn|r1 and rn|r0. #
Least Common Multiple For a,b,c+, c is a common multiple of a and b if a|c and b|c. Furthermore, c is the least common multiple of a,b, denotd by lcm(a,b), is the smallest of all common multiples of a and b. The lcm(a,b) always exists and it is unique. For any common multiple d of a and b, lcm(a,b)|d. For all a,b+, ab=gcd(a,b)lcm(a,b).
Prime Divisor If a,b+ and p is a prime, then p|ab p|a or p|b. Proof. p|a finished. pa gcd(p,a) = 1 (p is a prime) x,y [px + ay = 1] (p)bx + (ab)y = b p|p and p|ab p|b. # If ai+ for all 1 i n. If p is a prime and p|a1a2…an, then p|aifor some 1 i n.
Irrrational Number is irrational. Proof. (Aristotle,384-322 B.C.) Assume = a / b, for some a,b+ and gcd(a,b)=1. 2 = a2 / b2 2b2 = a2 2|a2 2|a Let a = 2c. 2b2 = a2 = 4c2 b2 = 2c2 2|b gcd(a,b) 2. Thus, is irrational. #
Prime Factoring Prime factoring of 980220 is 22 3 5 17 312. The number of positive divisors of 980220 is (2+1)(1+1)(1+1)(1+1)(2+1) = 72. Let m = 22 3 5 17 312, n = 23 7 52 31. gcd(m,n) = 22 5 31 lcm(m,n) = 23 3 52 7 17 312.
Uniqueness of Prime Factoring Every integer n > 1 can be written as a product of primes uniquely. (The Fundamental Theorem of Arithmetic) Proof. • Existence. Assume m is the smallest integer not expressible as a product of primes. m is not a prime m1,m2+[m = m1 m2] m1,m2 < m m1 and m2 can be written as products of primes m can be written as a product of primes.
Uniqueness of Prime Factoring • Uniquness. Basis step: n= 2 can be uniquely written as a product of primes. Inductive step: Assuming that 2, 3, …, n-1 can be uniquely written as products of primes. Suppose , where p1 | n p1 | p1 | qj for some 1 j r p1 = q1 by contradiction. (p1 < pe = q1 < qj = p1) By induction, n can be uniquely written as a product of primes. #
Brainstorm 題目源自1981年柏林「德國邏輯思考學院」的考題改編,98%的測試者無法解題,國內某家半導體設計公司曾以此題目招考員工, 題目如下:有五位小姐排成一列;所有的小姐穿的衣服顏色都不一樣;所有的小姐姓也不同;所有的小姐都養不同的寵物,喝不同的飲料,吃不同的水果. 錢小姐穿紅色的衣服;翁小姐養了一隻狗;陳小姐喝茶; 穿綠衣服的站在穿白衣服的左邊;穿綠衣服的小姐喝咖啡; 吃西瓜的小姐養鳥;穿黃衣服的小姐吃柳丁;站在中間的小姐喝 牛奶;趙小姐站在最左邊;吃橘子的小姐站在養貓的隔壁;養魚的 小姐隔壁吃柳丁;吃蘋果的小姐喝香檳;江小姐吃香蕉;趙小姐站 在穿藍衣服的隔壁;只喝開水的小姐站在吃橘子的隔壁。 問題:請問那位小姐養蛇?