Chapter 4 Properties of the Integers

43
1 Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004 Chapter 4 Properties of the Integers

description

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 . - PowerPoint PPT Presentation

Transcript of Chapter 4 Properties of the Integers

Page 1: Chapter 4 Properties of the Integers

1

Discrete and Combinatorial Mathematics

R. P. Grimaldi, 5th edition, 2004

Chapter 4Properties of the Integers

Page 2: Chapter 4 Properties of the Integers

2

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.

Page 3: Chapter 4 Properties of the Integers

3

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 +.

Page 4: Chapter 4 Properties of the Integers

4

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 +. #

Page 5: Chapter 4 Properties of the Integers

5

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.

Page 6: Chapter 4 Properties of the Integers

6

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) holds for 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.

Page 7: Chapter 4 Properties of the Integers

7

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. #

Page 8: Chapter 4 Properties of the Integers

8

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. #

Page 9: Chapter 4 Properties of the Integers

9

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.

nn

n 2

51

5

1

2

51

5

1F

Page 10: Chapter 4 Properties of the Integers

10

Fibonacci in NatureShape of shells:

Golden ratio:

Perfect shape : total height / navel height = 1.618

Page 11: Chapter 4 Properties of the Integers

11

Property of Fibonacci

Observation.

Conjecture.

11110 2221

20 FF

212110 22222

21

20 FFF

3262110 222223

22

21

20 FFFF

531532110 2222224

23

22

21

20 FFFFF

8540532110 22222225

24

23

22

21

20 FFFFFF

.10

2

nn

n

ii FFF

Page 12: Chapter 4 Properties of the Integers

12

Property of Fibonacci

Proof.

Induction Basis.

Inductive step.

Assume that

for some k+ where k1.

#

21222

120 11110 FFFF

10

2

kk

k

ii FFF

211

21

0

21

0

2

kkkk

k

ii

k

ii FFFFFF

.)( 2111 kkkkk FFFFF

Page 13: Chapter 4 Properties of the Integers

13

Other Sequences

Harmonic sequence:

Lucas sequence:

)1

2

1

1

1(,),

3

1

2

1

1

1(),

2

1

1

1(),

1

1(

k

.,1),1

1(

,1

1

1

nnn

HH

H

nn

,29,18,11,7,4,3,1,2

.,2,

,1,2

21

10

nnLLL

LL

nnn

Page 14: Chapter 4 Properties of the Integers

14

More Sequences

Binomial sequence:

Eulerian sequence:

0,0),(;,0),(;1)0,0(

0),1,(),(),1(

rrnCnrrnCC

rnrnCrnCrnC

.0,0;,0;1

10,)1()(

,,0,0

,11,1,

kamkaa

mkakakma

kmkm

kmkmkm

Page 15: Chapter 4 Properties of the Integers

15

Number SystemBinary 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

Page 16: Chapter 4 Properties of the Integers

16

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

Page 17: Chapter 4 Properties of the Integers

17

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)

Page 18: Chapter 4 Properties of the Integers

18

Adding Binary Numbers

Example: add 1001012 + 1100112

1 1 1 carry ones

1001012

+1100112

10110002

Page 19: Chapter 4 Properties of the Integers

19

Hexadecimal Number System

Decimal system0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0 1 2 3 4 5 6 7 8 9 A B C D E F

Hexadecimal system

Page 20: Chapter 4 Properties of the Integers

20

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

Page 21: Chapter 4 Properties of the Integers

21

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

Page 22: Chapter 4 Properties of the Integers

22

Subtraction

33 - 15

33 = 001000012, 15 = 000011112

-15 = 111100012

001000012

+111100012

(1)000100102 = 18

Page 23: Chapter 4 Properties of the Integers

23

More Subtraction

15 - 33

33 = 001000012, 15 = 000011112

-33 = 110111112

000011112

+110111112

111011102

Two’s complement

000100102 = 18

15 – 33 = -18.

Page 24: Chapter 4 Properties of the Integers

24

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.

Page 25: Chapter 4 Properties of the Integers

25

Division Properties

For all a,b,c,x,y,z Z:

a) 1|a and a|0

b) [(a|b) and (b|a)] a = ±b

c) [(a|b) and (b|c)] a|c

d) a|b a|bx for all x

e) x = y + z, a|x and a|y a|z, a|y and a|z a|x

f) [(a|b) and (a|c)] a|(bx+cy) bx+cy is a linear combination of b and c.

g) a|ci, cjZ, for 1 ≤ i ≤ n

a|(c1x1+c2x2 + … + cnxn) for all xjZ.

Page 26: Chapter 4 Properties of the Integers

26

Proof of (f)

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). #

Page 27: Chapter 4 Properties of the Integers

27

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.

Page 28: Chapter 4 Properties of the Integers

28

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,…}.

Page 29: Chapter 4 Properties of the Integers

29

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. #

Page 30: Chapter 4 Properties of the Integers

30

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. #

Page 31: Chapter 4 Properties of the Integers

31

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 . #

np

nn 1 nn 2

.1 nn

np

Page 32: Chapter 4 Properties of the Integers

32

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.

Page 33: Chapter 4 Properties of the Integers

33

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)) #

Page 34: Chapter 4 Properties of the Integers

34

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.

Page 35: Chapter 4 Properties of the Integers

35

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

Page 36: Chapter 4 Properties of the Integers

36

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 = qnrn rn|rn-1

rn|rn-1 and rn-2 = qn-1rn-1 + rn rn|rn-2

… rn|r1 and rn|r0. #

Page 37: Chapter 4 Properties of the Integers

37

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).

Page 38: Chapter 4 Properties of the Integers

38

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 = bp|p and p|ab p|b. #

If ai+ for all 1 i n. If p is a prime and p|a1a2…an, then p|ai for some 1 i n.

Page 39: Chapter 4 Properties of the Integers

39

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|aLet a = 2c. 2b2 = a2 = 4c2

b2 = 2c2

2|b gcd(a,b) 2. Thus, is irrational. #

2

2

2

Page 40: Chapter 4 Properties of the Integers

40

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 31lcm(m,n) = 23 3 52 7 17 312.

Page 41: Chapter 4 Properties of the Integers

41

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.

Page 42: Chapter 4 Properties of the Integers

42

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. #

rk tr

ttsk

ss qqqpppn 2121

2121 rk qqqppp 2121 ,

rtr

tt qqq 21

21

nqqqppppnn rk tr

ttsk

ss 2121

21

121

111 /

Page 43: Chapter 4 Properties of the Integers

43

Brainstorm題目源自 1981年柏林「德國邏輯思考學院」的考題改編, 98%的

測試者無法解題,國內某家半導體設計公司曾以此題目招考員工, 題目如下 : 有五位小姐排成一列 ; 所有的小姐穿的衣服顏色都不一樣 ; 所有的小姐姓也不同 ; 所有的小姐都養不同的寵物 ,喝不同的飲料 , 吃不同的水果 .

錢小姐穿紅色的衣服 ; 翁小姐養了一隻狗 ; 陳小姐喝茶 ;穿綠衣服的站在穿白衣服的左邊 ; 穿綠衣服的小姐喝咖啡 ;吃西瓜的小姐養鳥 ; 穿黃衣服的小姐吃柳丁 ; 站在中間的小姐喝牛奶 ; 趙小姐站在最左邊 ; 吃橘子的小姐站在養貓的隔壁 ; 養魚的小姐隔壁吃柳丁 ; 吃蘋果的小姐喝香檳 ; 江小姐吃香蕉 ; 趙小姐站在穿藍衣服的隔壁 ; 只喝開水的小姐站在吃橘子的隔壁。問題:請問那位小姐養蛇 ?