if n is even
play

if n is even Suppose p is false n 2 = n + 1 if n is odd Show - PowerPoint PPT Presentation

Floor and Ceiling CSE 20 Discrete Math Ceiling(x): ! x " The least-integer greater than or equal to x Formal definition: the unique integer n such that n -1 < x n Floor(x): # x $ The greatest-integer less than or equal to


  1. Floor and Ceiling CSE 20— Discrete Math Ceiling(x): ! x " � The least-integer greater than or equal to x � Formal definition: the unique integer n such that n -1 < x � n Floor(x): # x $ � The greatest-integer less than or equal to x � Formal definition: the unique integer n such that n � x < n+1 Summer, 2006 Graph: July 13 (Day 4) Methods of Proof Number Theory Instructor: Neil Rhodes 2 Floor and Ceiling Usage ! x " = x ↔ x is an integer ↔ # x $ = x You’re guessing a number between 1 and 1000 � Each answer is “too high”, “too low”, or “you got it” � What is the maximum number of guesses required to guess the number? For real x, integer n: # x $ = n ↔ x-1 < n � x � ! x " = n ↔ x � n < x+1 � ! x+n " = ! x " +n � # x $ = - ! - x " � ! x " = - # -x $ � 3 4

  2. Proof of Ceiling/Floor Properties Disproof of Ceiling/Floor Properties ! x " = n ↔ x � n < x+1 # x+y $ = # x $ + # y $ # x $ = - ! - x " 5 6 Theorems with Ceiling Proof by Contradiction To Prove p � n if n is even � Suppose p is false � n � 2 � … = n + 1 if n is odd � Show a contradiction: q and ~q 2 2 � Therefore, our assumption (that p was false) is false, and hence that p is true. 7 8

  3. Proof by Contradiction Proof by Contradiction Every integer is either odd or even, but not both The product of an irrational and a non-zero rational is irrational. 9 10 Proof by Contraposition Differences between the Two To prove ∀ x ∈ D, P(x) � Q(x) Proof by contraposition � Any such proof can be rewritten as a proof by contradiction � Rewrite (mentally) as ∀ x ∈ D, ~Q(x) � ~P(x) – Assume P(x) and ~Q(x). Show ~P(x), a contradiction � Prove contrapositive directly (use generalizing from generic particular) – Suppose x is an element of D such that Q(x) is false – Show that P(x) is false Proof by contradiction � More powerful. Can’t necessarily be rewritten as a proof by contraposition Example: If the square of an integer, n, is even, then n is even � Can show any contradiction 11 12

  4. Proof by Contradiction There are an Infinite Number of Primes � 2 is irrational. Proof: � Proof: � Suppose the set of primes is finite. � Suppose that � 2 is rational List all the primes in this finite set: P1, P2…,Pn. Construct the number m=p1•p2•…•Pn + 1. Since m is bigger than any pi, m is not prime remainder of m/pi is 1 (by QRT), so pi doesn’t divide m for any i. But, due to Prime Factorization theorem, m has prime factors (since m > 1). So m has some prime factor not equal to any pi, so the finite set of primes is missing a prime. � But that’s a contradiction. � But that is a contradiction. 13 14 gcd, lcm Computing GCD Greatest Common Divisor (GCD) Calculating GCD of 24 120 � GCD(m, n) is the largest integer k that divides integers m and n � Prime factorization – k | m and k | n � GCD(m, n) is a linear combination (with integer coefficients) of m and n – ∃ i, j ∈ Z: gcd(m, n) = im + jn � Euclid’s algorithm � To calculate GCD(m, n) 134 % 24 = 14 134 = 5•24 + 14 – Compute prime factorization of m and n – gcd(m, n) = common prime factors (and powers) of m and n 24 % 14 = 10 24 = 1•14 + 10 � Euclid’s algorithm – int gcd(m, n) 14 % 10 = 4 14 = 1•10 + 4 – if (n == 0) return m 10 % 4 = 2 10 = 2•4 + 2 else return gcd(n, m mod n) Least Common Multiple (LCM) 4 % 2 = 0 4 = 2•2 + 0 � LCM(m, n) is the smallest integer k such that integers m and n divide k gcd = 2 – m | k and n | k � To calculate LCM(m , n) – Compute prime factorizations of m and n – lcm(m, n) = union of prime factors (and powers) of m and n 15 16

  5. GCD as Linear Combination Why does Euclid’s Algorithm Work? Given m, n, GCD(m, n), find integer i, j such that GCD(r, 0) = r (r a positive integer) � GCD(m, n) = im + jn � Use Euclid’s algorithm 134 % 24 = 14 134 = 5•24 + 14 24 % 14 = 10 24 = 1•14 + 10 14 % 10 = 4 14 = 1•10 + 4 10 % 4 = 2 10 = 2•4 + 2 4 % 2 = 0 4 = 2•2 + 0 � Go backwards 2 = 10-2•4 2 = 10-2•(14-10) = 3•10-2•14 2 = 3•(24-1•14) - 2•14 = -5•14 + 3•24 2 = -5(134-5•24) +3•24 = 28•24-5•134 17 18 Why does Euclid’s Algorithm Work? GCD(m, n) = GCD(n, m mod n) � Prove GCD(m, n) � GCD(n, m mod n) � Prove GCD(m, n) � GCD(n, m mod n) 19

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend