380 likes | 545 Views
Original author of the slides: Vadim Bulitko University of Alberta http://www.cs.ualberta.ca/~bulitko/W04 Modified by T. Andrew Yang ( yang@uhcl.edu ). Ch. 3.5, 3.6, 3.7, 3.8. Floor & ceiling Proof by contradiction and contraposition Infinitude of primes Irrationality of sqrt(p).
E N D
Original author of the slides: Vadim Bulitko University of Alberta http://www.cs.ualberta.ca/~bulitko/W04 Modified by T. Andrew Yang (yang@uhcl.edu)
Ch. 3.5, 3.6, 3.7, 3.8 • Floor & ceiling • Proof by contradictionand contraposition • Infinitude of primes • Irrationality of sqrt(p)
Floor & Ceiling • Definitions • Different from the textbook’s • floor(x) = max{nZ st nx} • ceiling(x) = min{nZ st nx} • Examples • floor(5.75) • 5 • floor(-5.75) • -6 • ceiling(5.75) • 6 • ceiling(-5.75) • -5 floor(x) x ceiling(x)
Equivalence to text’s defs and more • Theorem • For any xR-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 • xR [floor(x) x < floor(x)+1] • xR [ceiling(x)-1 < x ceiling(x)]
Lemma Galore… • mZ floor(m)=ceiling(m)=m • x,yR ceiling(x+y)ceiling(x)+ceiling(y) • xR mZ floor(x+m)=floor(x)+m • nZ [floor(n/2)=n/2 iff n is even] and [floor(n/2)=(n-1)/2 iff n is odd]
Types of Proofs • Many interesting statements are of the type: n S(n) • Two primary proof methods: • Direct • Take an arbitrary n, prove S(n), generalize • If S(n) P(n)Q(n) • Then can prove ~Q(n)~P(n) instead • Indirect • Show that n ~S(n) would lead to a contradiction
Contraposition & Contradiction • Suppose the statement to prove is: n [ P(n)Q(n) ] • Direct proof by contraposition: • Take an arbitrary (but generic) n • Show that if ~Q(n) holds for that n then ~P(n) holds • Indirect proof (by contradiction): • Assume P(n) and ~Q(n) hold for some n • Show ~P(n) • Contradiction : cannot have P(n) and ~P(n)
Illustration • If n2 is even then n is even n [ P(n)Q(n) ] P(n) = n2 is even Q(n) = n is even • Direct proof by contraposition: • Assume ~Q(n) : n is not even • n is odd • Then n=2k+1 • n2=4k2+4k+1 • n2is odd : n2is not even : ~P(n)
Illustration • If n2 is even then n is even n [ P(n)Q(n) ] • Indirect proof (by contradiction): • Assume P(n) and ~Q(n) • n2is even • n is not even : n is odd • Then n=2k+1 • n2=4k2+4k+1 • n2is odd : n2is even : contradiction
The third proof • Theorem: n2 is even n is even • How about a direct proof without contraposition? • Proof • Assume n2 is even • 2 | n2 • p|ab p|a v p|b (Euclid’s 1st theorem) • 2|n v 2|n • Then n is even
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…
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 (proved before)
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
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
Proof: Infinitude of Primes • Indirect (i.e., by contradiction) • Suppose not • Then • n m [ prime(n) & (mn v ~prime(m)) ](*) • Thus, denote the only primes as p1, …, pk (that is, pk is n above) • Then consider m=p1*p2* … *pk + 1 • m>pi • m>n=pk • Is prime(m)? • None of the primes pi divides it (by lemma 2) • But there are no other prime numbers (by supposition) • Thus, m is a prime (by lemma 1) • Contradiction with (*) • c.f., the proof on p.183
Irrationality of sqrt(2) • Define sqrt(x)=y such that yR, 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 • n2is even n is even (proved earlier) • Then 2m2=4k2 • Then m2is even and so m is even • Thus, hcf(n,m) is at least 2 • Contradiction
Divisibility • Integers n, d; d0 • d (wholly) divides n • d is a divisor of n • d is a factor of n • n is a multiple of d • n is divisible by d • d | n • iff: • kZ [ n=dk ]
Positive Divisors • If a|b and a,b>0 then ab • prove • prime(n) iff (n>1 &n’s only positive divisors are 1 and n) • prove
Properties • Transitivity: • a|b, b|c a|c • Reflexivity: • a|a • Anti-symmetry (for naturals): • a|b & b|a a=b • Let’s prove this
Quotient-remainder Theorem • For any integer n • For any integer d>0 • There exist unique integers q and r • Such that • n=dq+r • 0r<d • q is the quotient : q=n div d • r is the remainder : r=n mod d
Highest Common Factor • Consider integers a>0, b>0 • Consider set F(a,b)={xZ s.t. x|a & x|b} • xF(a,b) [ xa & xb ] • 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) • Also called gcd (greatest common divisor)
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 x1F(b,r) then x1|a, thusx1F(a,b) • If x2F(a,b) then x2|r, thusx2F(b,r)
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
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
Factoring • Finding divisors (factors) of a number is called factoring • A straightforward but expensive operation (recall the RSA challenges) • Consider 24: • 24=1*24 • 24=(-1)*(-24) • 24=(-1)*4*2*(-3) • … • Is there a “canonical” representation?
Fundamental Theorem Of Arithmetic • Any integer z0 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
Proof (existence) • Let’s prove that for any nZ, 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
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 (E1stT). 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
Further Information • Lecture notes (we reproduced some parts from): • http://www.mat.bham.ac.uk/P.J.Flavell/teaching/Foundation/LectureNotes/ • Some background: • http://mathworld.wolfram.com/EuclidsTheorems.html • How to discover the proof: • http://www.dpmms.cam.ac.uk/~wtg10/FTA.html