1 / 25

CS 173: Discrete Mathematical Structures

CS 173: Discrete Mathematical Structures. Cinda Heeren heeren@cs.uiuc.edu Siebel Center, rm 2213 Office Hours: W 9:30-11:30a. CS 173 Announcements. Homework 6 available. Due 02/26, 8a. Midterm 1: 2/23/06, 7-9p, SC 1404. Conflict: 2/24/06, 7-9p, SC 3405 (email me!)

ayala
Download Presentation

CS 173: Discrete Mathematical Structures

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 173:Discrete Mathematical Structures Cinda Heeren heeren@cs.uiuc.edu Siebel Center, rm 2213 Office Hours: W 9:30-11:30a

  2. CS 173 Announcements • Homework 6 available. Due 02/26, 8a. • Midterm 1: 2/23/06, 7-9p, SC 1404. • Conflict: 2/24/06, 7-9p, SC 3405 (email me!) • Sections this week will be exam review. Three additional reviews: • Tues, 2/21, 6-7p, SC 1129 • Thur, 2/23, 9:30-10:45a, SC 1404 • Thur, 2/23, 11:00a-12:15, SC 1214 Cs173 - Spring 2004

  3. CS 173 Mathematical Induction, an example Prove that for all n, Cs173 - Spring 2004

  4. In our proofs, to show P(k+1), our inductive hypothesis assures that ALL of P(0), P(1), … P(k) are true, so we can use ANY of them to make the inference. CS 173 Strong Mathematical Induction If • P(0) and • n0 (P(0)  P(1)  …  P(n))  P(n+1) Then • n0 P(n) Cs173 - Spring 2004

  5. CS 173 Strong Mathematical Induction An example. Given n blue points and n orange points in a plane with no 3 collinear, prove there is a way to match them, blue to orange, so that none of the segments between the pairs intersect. Cs173 - Spring 2004

  6. CS 173 Strong Mathematical Induction Base case (n=1): Assume any matching problem of size less than (k+1) can be solved. Show that we can match (k+1) pairs. Cs173 - Spring 2004

  7. CS 173 Strong Mathematical Induction Show that we can match (k+1) pairs. Suppose there is a line partitioning the group into a smaller one of j blues and j oranges, and another smaller one of (k+1)-j blues and (k+1)-j oranges. OK!! (by IH) OK!! (by IH) Cs173 - Spring 2004

  8. CS 173 Strong Mathematical Induction How do we know such a line always exists? Consider the convex hull of the points: OK!! (by IH) If there is an alternating pair of colors on the hull, we’re done! OK!! (by IH) Cs173 - Spring 2004

  9. There must be a tie along the way CS 173 Strong Mathematical Induction If there is no alternating pair, all points on hull are the same color. Notice that any sweep of the hull hits an orange point first and also last. We sweep on some slope not given by a pair of points. Keep score of # of each color seen. Orange gets the early lead, and then comes from behind to tie at the end. OK!! (by IH) OK!! (by IH) Cs173 - Spring 2004

  10. CS173Strong Induction, another example Prove that every positive integer can be written as a product of primes. Cs173 - Spring 2004

  11. But equivalently, we could define it like this: Inductive (Recursive) Definition Recursive Case Base Case CS173Inductive Definitions We completely understand the function f(n) = n!, right? As a reminder, here’s the definition: n! = 1 · 2 · 3 · … · (n-1) · n, n  1 Cs173 - Spring 2004

  12. Recursive Case Base Cases Is there a non-recursive definition for the Fibonacci Numbers? CS173Inductive Definitions Another VERY common example: Fibonacci Numbers Cs173 - Spring 2004

  13. Recursive Cases Base Case “I LOVE my definition. It’s perfect!” “Oh yeah? Prove it!” CS173Inductive Definitions Our examples so far have been inductively defined functions. Sets can be defined inductively, too. Give an inductive definition of S = {x: x is a multiple of 3} • 3  S • x,y  S  x + y  S • x,y  S  x - y  S • No other numbers are in S. Cs173 - Spring 2004

  14. CS173Inductive Definitions We want to show that my definition of S: • 3  S • x,y  S  x + y  S • x,y  S  x - y  S • No other numbers are in S. Contains the same elements as the set: T = {x: x is a multiple of 3} To prove S = T, show • T  S • S  T Cs173 - Spring 2004

  15. CS173Inductive Definitions We start with T  S. If x  T, then x = 3k for some integer k. We show by induction on |k| that 3k  S. Base Case (k = 0): 0  S since 3  S by rule 1, and 3 - 3  S by rule 3. Assume 3k, -3k  S, show that 3(k+1), -3(k+1) S. Cs173 - Spring 2004

  16. CS173Inductive Definitions We start with T  S. If x  T, then x = 3k for some integer k. We show by induction on |k| that 3k  S. Assume 3k, -3k  S, show that 3(k+1), -3(k+1) S. • 3k  S by inductive hypothesis. • 3  S by rule 1. • 3k + 3 = 3(k+1)  S by rule 2. • 0  S by base case. • 0 - 3(k+1) = -3(k+1)  S by rule 3. Cs173 - Spring 2004

  17. CS173Inductive Definitions Next we show that S  T. That is, if an number x is described by S, then it is a multiple of 3. Observe that by rule 4, all numbers in S are created by a finite number of applications of rules 1,2, and 3. We use the number of rule applications as our induction counter. For example: • 3  S by 1 application of rule 1. • 0  S by 2 rule applications (rules 1 and 3). • 9  S by 3 applications (rule 1 once and rule 2 twice). Cs173 - Spring 2004

  18. CS173Inductive Definitions Next we show that S  T. That is, if an number x is described by S, then it is a multiple of 3. Base Case (k=1): If x  S by 1 rule application, then it must be rule 1 and x = 3, which is clearly a multiple of 3. Cs173 - Spring 2004

  19. The argument is the same if rule 2 is last instead. CS173Inductive Definitions Next we show that S  T. That is, if an number x is described by S, then it is a multiple of 3. Assume any number described by k or fewer applications of the rules in S is a multiple of 3 and prove that any number described by (k+1) applications of the rules is also a multiple of 3. Suppose the (k+1)st rule applied is rule 3, and it results in value x = a + b. Then a and b are multiples of 3 by inductive hypothesis, and thus x is a multiple of 3. Cs173 - Spring 2004

  20. This just describes fully parenthesized propositions. CS173Inductive Definitions Yet another example: Well-Formed Formulas (wffs) • T is a wff • F is a wff • p is a wff for any propositional variable p • If p is a wff, then (p) is a wff • If p and q are wffs, then (p  q) is a wff • If p and q are wffs, then (p  q) is a wff For example, a statement like ((r)  (p  r)) can be proven to be a wff by arguing that (r) and (p  r) are wffs by induction and then applying rule 5. Cs173 - Spring 2004

  21. Countably infinite No. No. CS173Strings and Inductive Definitions Let  be a finite set called an alphabet. The set of strings on , denoted * is defined as: • *, where  denotes the null or empty string. • If x , and w *, then wx *, where wx is the concatenation of string w with symbol x. Example: Let  = {a, b, c}. Then * = {, a, b, c, aa, ab, ac, ba, bb, bc, ca, cb, cc, aaa, aab,…} How big is *? Are there any infinite strings in *? Is there a largest string in *? Cs173 - Spring 2004

  22. I point this out because the length of strings is something we might like to use for an inductive argument. CS173Strings and Inductive Definitions Inductive definition of the length of strings (the length of string w is |w|.): • || = 0 • If x , and w *, then |wx| = |w| + 1 Cs173 - Spring 2004

  23. For example (abc)R = cba x(w)R CS173Strings and Inductive Definitions Inductive definition of the reversal of a string (the reversal of string w is written wR.): • R =  • If x , and w *, then (wx)R = ? For example (abc)R = c(ab)R = cb(a)R = cba()R = cba = cba Cs173 - Spring 2004

  24. FruitLoopsR LoopsRFruitR spooLtiurF This is an example of how an inductive defn can be used in a proof. The thm itself isn’t compelling. CS173Strings and Inductive Definitions A Theorem: x,y  * (xy)R = yRxR Proof (by induction on |y|): Base Case (|y| = 0): If |y| = 0, y = , then (xy)R = (x)R = xR = xR = yRxR. IH: If |y|  n, then x  *, (xy)R = yRxR. Prove: If |y| = n+1, then x  *, (xy)R = yRxR. Cs173 - Spring 2004

  25. CS173Strings and Inductive Definitions IH: If |y|  n, then x  *, (xy)R = yRxR. Prove: If |y| = n+1, then x  *, (xy)R = yRxR. If |y| = n+1, then a  , u  *, so that y = ua, and |u| = n. Then, (xy)R = (x(ua))R by substitution = ((xu)a)R by assoc. of concatenation = a(xu)R by inductive defn of reversal = auRxR by IH = (ua)RxR by inductive defn of reversal = yRxR by substitution Cs173 - Spring 2004

More Related