Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CSE 240 Logic and Discrete Math Lecture notes 8 Weixiong Zhang Washington University in St. Louis http://www.cse.wustl.edu/~zhang/teaching /cse240/Spring10/index.html 1 Today Chapter 3.3 Divisibility Chapter 3.4 Quotient-remainder theorem Chapter 3.5 Floor & ceiling Chapter 3.7 Infinitude of primes Irrationality of sqrt(p) 2 Rational / Irrational For more information see: http://mathworld.wolfram.com/ http://mathworld.wolfram.com/IrrationalNumber.html http://mathworld.wolfram.com/Pi.html http://mathworld.wolfram.com/e.html 3 Divisibility Integers n, d; d≠0 d d d n n d (wholly) divides n is a divisor of n is a factor of n is a multiple of d is divisible by d |n iff: ∃k∈Z [ n=dk ] 4 Positive Divisors If a|b and a,b>0 then a≤b Proof ? Use definition b = a*k, k integer and k≥1 prime(n) iff (n>1 & n’s only positive divisors are 1 and n) Proof ? Use definition b|n -> n = b*k. 5 Properties Transitivity: a|b, b|c a|c Reflexivity: a|a Anti-symmetry (for naturals): a|b & b|a a=b Proof ? 6 Quotient-remainder Theorem For any integer n For any integer d>0 There exist unique integers q and r Such that n=dq+r 0≤r<d q is the quotient : q=n div d r is the remainder : r=n mod d 7 Proof Section 4.4 of the text We will (hopefully) do it later in class 8 Connection to odd/even Suppose d=2, then 0 ≤ r < 2 Then for any integer n: r=0 r=1 n=2q n=2q+1 n is even n is odd So every number is odd or even integer 9 Factors Recall that if x|a and a>0,x>0 then x≤a Consider set F(a)={x∈Z s.t. x|a} ∀x∈F(a) [ x≤a ] So F(a) is upper bounded thus has a maximum element (by the well-ordering principle) Call max F(a) highest factor Example? Give me a number …. 10 Highest Common Factor Consider integers a>0, b>0 Consider set F(a,b)={x∈Z s.t. x|a & x|b} ∀x∈F(a,b) [ x≤a & x≤b ] So F(a,b) is upper bounded thus has a maximum element (by the well-ordering principle) Call max F(a,b) highest common factor: hcf(a,b) 11 Example 12 Euclid’s Algorithm Idea Works fine for small numbers What about hcf(4453,1314) ? Here is an idea: Lemma. a>b, a=qb+r then hcf(a,b)=hcf(b,r) Proof. Consider F(a,b)={x st x|a & x|b} Consider F(b,r)={x st x|r & x|b} If x1∈F(b,r) then x1|a, thus x1∈F(a,b) If x2∈F(a,b) then x2|r, thus x2∈F(b,r) What’s the implication? 13 Euclid’s Algorithm 14 Euclid’s Algorithm 15 16 Flow Chart Correctness The algorithm is correct: For any valid inputs It terminates in a finite amount of time And produces a correct output Challenge: Prove this at home Must be your original proof 17 Another Example 18 Going Back 19 Going Back 20 Corollary For any integer p,q (one of them is not 0) If h=hcf(p,q) then there exist integers x,y s.t. xp+qy=h 21 Factoring Finding divisors (factors) of a number is called factoring or factorization Consider 24: 24=1*24 24=(-1)*(-24) 24=1*2*12 24=(-1)*(-2)*12 24=(-1)*2*(-12) 24=(-1)*4*2*(-3) … Is there a “canonical” representation? 22 Fundamental Theorem Of Arithmetic Any integer z≠0 can be represented as: z = (-1)k p1k1 p2k2 … pnkn where: p1<…<pn are prime numbers k is 0 or 1 k1,…,kn are natural >0 This factorization is unique Examples: 24=(-1)0 23 31 -7=(-1)1 71 23 Proof (existence) Let’s prove that for any n∈Z, n>0 such a representation exists Steps: Lemma 0. There are n integers between 1 and n Lemma 1. Non-trivial factors of a natural n are strictly less than n Lemma 2. Every integer n>1 is divisible by a prime number Corollary: can get exclusively prime factors for n>1 24 Proof (uniqueness) Let’s prove that such representation is unique Steps: Lemma 3. If h=hcf(p,q) then there exist integers x,y s.t. xp+qy=h Lemma 4. If p|ab and prime(p) then p|a or p|b Proof: Suppose not. Then two different factorizations exist Then arrive at a contradiction 25 Further Information Some background: http://mathworld.wolfram.com/EuclidsTheorems.html How to discover the proof: http://www.dpmms.cam.ac.uk/~wtg10/FTA.html 26 Next 27 Floor & Ceiling Definitions Different from the textbook’s floor(x) = max{n∈Z st n≤x} ceiling(x) = min{n∈Z st n≥x} Examples floor(5.75) 5 floor(-5.75) -6 ceiling(5.75) 6 ceiling(-5.75) -5 floor(x) x ceiling(x) 28 Equivalence to text’s defs and more Theorem For any x∈R\Z, floor(x) and ceiling(x) are defined, unique, and ceiling(x)=floor(x)+1 Proof Part 1: existence Part 2: uniqueness Part 3: relationship Corollary ∀x∈R [floor(x) ≤ x < floor(x)+1] ∀x∈R [ceiling(x)-1 < x ≤ ceiling(x)] 29 Lemma ∀m∈Z floor(m)=ceiling(m)=m ∃x,y∈R ceiling(x+y)≠ceiling(x)+ceiling(y) Example? 30 Lemma ∀x∈R ∀m∈Z floor(x+m)=floor(x)+m Proof? Take floor(x) ≤ x, Then floor(x)+m ≤ x+m ∀n∈Z floor(n/2)=n/2 iff n is even and floor(n/2)=(n-1)/2 iff n is odd Proof? 31 Infinitude of Primes There is no greatest prime: ∀n ∃m [ prime(n) m>n & prime(m) ] Theorem 3.7.4 in the book Will prove three lemmas first… 32 Lemma 0 If p|a and p|a+1 then p=1 v p=-1 Proof direct p|a a=pn p|a+1 a+1=pm p(m-n)=1 p=+1 v p=-1 33 Lemma 1 For any integer a and a prime p if p|a then ~(p|a+1) Proof indirect Suppose such prime p exists p|a and p|a+1 Then by Lemma 0: p=+1 or p=-1 p cannot be prime contradiction 34 Lemma 2 A natural n>1 is not prime iff there is a prime p<n such that p|n Proof (direct): If n is not prime then it has non-trivial divisors (proved before) Then one of them has a prime factor p (proved before) Know that p<n and p|n Then p is a non-trivial factor of n Thus n is not prime 35 Proof: Infinitude of Primes Indirect (i.e., by contradiction) Suppose not Then ∃n ∀m [ prime(n) & (m≤n v ~prime(m)) ] (*) Thus, denote the only primes as p1, …, pk=n Then consider m=p1 * … pk + 1, m not prime (supposition) m>pi m>n=pk Is prime(m)? None of the primes pi divides it (by lemma 1) But there are no other prime numbers (by supposition) Thus, m is a prime (by lemma 2) Contradiction with (*) 36 Irrationality of sqrt(2) - Lemma If q∈Q then there exist n,m∈Z such that q=n/m and hcf(n,m)=1 Proof Suppose we have n/m=q and hcf(n,m)>1 Then compute n’, m’ : n’=n/hcf(n,m) m’=m/hcf(n,m) q=n’/m’ and n’,m’ are less than n and m Either hcf(n’,m’)=1 : then done Or hcf(n’,m’)>1 : then repeat the process again Must terminate since n’ and m’ are decreasing 37 Another proof ? How about another constructive proof? Hint: Fundamental theorem of arithmetic 38 Irrationality of sqrt(2) Define sqrt(x)=y such that ∃y∈R, y*y=x Let’s prove that sqrt(2) is irrational Proof Indirect (by contradiction) Suppose not: sqrt(2)=n/m and hcf(n,m)=1 Then 2=n2/m2, 2m2=n2 n2 is even n is even (proved earlier) Then 2m2=4k2 Then m2 is even and so m is even Thus, hcf(n,m) is at least 2 Contradiction 39