1 / 39

CS 173: Discrete Mathematical Structures

CS 173: Discrete Mathematical Structures. Cinda Heeren heeren@cs.uiuc.edu Rm 2213 Siebel Center Office Hours: W 12:30-2:30p. What homework? I’ve read it. 25% done 50% done 75% done. CS 173 Announcements. Homework 2 returned this week. Homework 3 available. Due 09/16.

lara
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 Rm 2213 Siebel Center Office Hours: W 12:30-2:30p

  2. What homework? • I’ve read it. • 25% done • 50% done • 75% done CS 173 Announcements • Homework 2 returned this week. • Homework 3 available. Due 09/16. • LaTex workshop Th, 9/15, at 6:30p in SC 2405. • The following reflects my status on hwk #3… Cs173 - Spring 2004

  3. |S| = 3. |S| = 1. |S| = 0. |S| = 3. CS 173 Set Theory - Cardinality If S is finite, then the cardinality of S, |S|, is the number of distinct elements in S. If S = {1,2,3}, If S = {3,3,3,3,3}, If S = , If S = { , {}, {,{}} }, If S = {0,1,2,3,…}, |S| is infinite. (more on this later) Cs173 - Spring 2004

  4. aka P(S) We say, “P(S) is the set of all subsets of S.” 2S = {, {a}}. 2S = {, {a}, {b}, {a,b}}. 2S = {}. 2S = {, {}, {{}}, {,{}}}. CS 173 Set Theory - Power sets If S is a set, then the power set of S is 2S = { x : x  S }. If S = {a}, If S = {a,b}, If S = , If S = {,{}}, Fact: if S is finite, |2S| = 2|S|. (if |S| = n, |2S| = 2n) Cs173 - Spring 2004

  5. A,B finite  |AxB| = ? We’ll use these special sets soon! AxB |A|+|B| |A+B| |A||B| CS 173 Set Theory - Cartesian Product The Cartesian Product of two sets A and B is: A x B = { <a,b> : a  A  b  B} If A = {Charlie, Lucy, Linus}, and B = {Brown, VanPelt}, then A x B = {<Charlie, Brown>, <Lucy, Brown>, <Linus, Brown>, <Charlie, VanPelt>, <Lucy, VanPelt>, <Linus, VanPelt>} A1 x A2 x … x An = {<a1, a2,…, an>: a1  A1, a2  A2, …, an  An} Cs173 - Spring 2004

  6. B A CS 173 Set Theory - Operators The union of two sets A and B is: A  B = { x : x  A v x  B} If A = {Charlie, Lucy, Linus}, and B = {Lucy, Desi}, then A  B = {Charlie, Lucy, Linus, Desi} Cs173 - Spring 2004

  7. B A CS 173 Set Theory - Operators The intersection of two sets A and B is: A  B = { x : x  A  x  B} If A = {Charlie, Lucy, Linus}, and B = {Lucy, Desi}, then A  B = {Lucy} Cs173 - Spring 2004

  8. CS 173 Set Theory - Operators The intersection of two sets A and B is: A  B = { x : x  A  x  B} If A = {x : x is a US president}, and B = {x : x is deceased}, then A  B = {x : x is a deceased US president} B A Cs173 - Spring 2004

  9. B A Sets whose intersection is empty are called disjoint sets CS 173 Set Theory - Operators The intersection of two sets A and B is: A  B = { x : x  A  x  B} If A = {x : x is a US president}, and B = {x : x is in this room}, then A  B = {x : x is a US president in this room} =  Cs173 - Spring 2004

  10. A • = U and U =  CS 173 Set Theory - Operators The complement of a set A is: A = { x : x  A} If A = {x : x is bored}, then A = {x : x is not bored} =  U Cs173 - Spring 2004

  11. U A B CS 173 Set Theory - Operators The set difference, A - B, is: A - B = { x : x  A  x  B } A - B = A  B Cs173 - Spring 2004

  12. U A B CS 173 Set Theory - Operators The symmetric difference, A  B, is: A  B = { x : (x  A  x  B) v (x  B  x  A)} = (A - B) U (B - A) Cs173 - Spring 2004

  13. CS 173 Set Theory - Operators A  B = { x : (x  A  x  B) v (x  B  x  A)} = (A - B) U (B - A) Proof: { x : (x  A  x  B) v (x  B  x  A)} = { x : (x  A - B) v (x  B - A)} = { x : x  ((A - B) U (B - A))} = (A - B) U (B - A) Cs173 - Spring 2004

  14. Don’t memorize them, understand them! They’re in Rosen, p89. CS 173 Set Theory - Famous Identities • Two pages of (almost) obvious. • One page of HS algebra. • One page of new. Cs173 - Spring 2004

  15. A  U = A A U U = U A U A = A A U  = A A  = A A A = A (Lazy) CS 173 Set Theory - Famous Identities • Identity • Domination • Idempotent Cs173 - Spring 2004

  16. A U A = U A = A A A= CS 173 Set Theory - Famous Identities • Excluded Middle • Uniqueness • Double complement Cs173 - Spring 2004

  17. B U A B  A A U (B U C) A U (B C) = A  (B C) A  (B U C) = CS 173 Set Theory - Famous Identities • Commutativity • Associativity • Distributivity A U B = A  B = (A U B)U C = (A  B) C = (A U B)  (A U C) (A  B) U (A  C) Cs173 - Spring 2004

  18. (A UB)= A  B (A  B)= A U B Hand waving is good for intuition, but we aim for a more formal proof. CS 173 Set Theory - Famous Identities • DeMorgan’s I • DeMorgan’s II p q Cs173 - Spring 2004

  19. New & important Like truth tables Like  Not hard, a little tedious CS 173 Set Theory - 4 Ways to prove identities • Show that A  B and that A  B. • Use a membership table. • Use previously proven identities. • Use logical equivalences to prove equivalent set definitions. Cs173 - Spring 2004

  20. (A UB)= A  B CS 173 Set Theory - 4 Ways to prove identities Prove that • () (x  A U B)  (x  A U B)  (x  A and x  B)  (x  A  B) 2. () (x  A  B)  (x  A and x  B)  (x  A U B)  (x  A U B) Cs173 - Spring 2004

  21. (A UB)= A  B Haven’t we seen this before? CS 173 Set Theory - 4 Ways to prove identities Prove that using a membership table. 0 : x is not in the specified set 1 : otherwise Cs173 - Spring 2004

  22. (A UB)= A  B (A UB)= A U B = A  B = A  B CS 173 Set Theory - 4 Ways to prove identities Prove that using identities. Cs173 - Spring 2004

  23. (A UB)= A  B (A UB)= {x : (x  A v x  B)} = A  B = {x : (x  A)  (x  B)} CS 173 Set Theory - 4 Ways to prove identities Prove that using logically equivalent set definitions. = {x : (x  A)  (x  B)} Cs173 - Spring 2004

  24. CS 173 Set Theory - A proof for us to do together. X  (Y - Z) = (X  Y) - (X  Z). True or False? Prove your response. (X  Y) - (X  Z) = (X  Y)  (X  Z)’ = (X  Y)  (X’ U Z’) = (X  Y  X’) U (X  Y  Z’) =  U (X  Y  Z’) = (X  Y  Z’) = X  (Y - Z) Cs173 - Spring 2004

  25. A U B =  A = B A  B =  A-B = B-A =  Trying to pv p --> q Assume p and not q, and find a contradiction. Our contradiction was that sets weren’t equal. CS 173 Set Theory - A proof for us to do together. Pv that if (A - B) U (B - A) = (A U B) then ______ A  B =  Suppose to the contrary, that A  B  , and that x  A  B. Then x cannot be in A-B and x cannot be in B-A. DeMorgan’s!! Then x is not in (A - B) U (B - A). Do you see the contradiction yet? But x is in A U B since (A  B)  (A U B). Thus, A  B = . Cs173 - Spring 2004

  26. CS 173 Set Theory - Generalized Union Ex. Let U = N, and define: A1 = {2,3,4,…} A2 = {2,4,6,…} A3 = {3,6,9,…} Cs173 - Spring 2004

  27. Primes Composites  N I have no clue. primes CS 173 Set Theory - Generalized Union Ex. Let U = N, and define: Then Cs173 - Spring 2004

  28. CS 173 Set Theory - Generalized Intersection Ex. Let U = N, and define: A1 = {1,2,3,4,…} A2 = {2,4,6,…} A3 = {3,6,9,…} Cs173 - Spring 2004

  29. Multiples of LCM(1,…,n) CS 173 Set Theory - Generalized Intersection Ex. Let U = N, and define: Then Cs173 - Spring 2004

  30. B A Wrong. CS 173 Set Theory - Inclusion/Exclusion Example: How many people are wearing a watch? How many people are wearing sneakers? How many people are wearing a watch OR sneakers? What’s wrong? |A  B| = |A| + |B| - |A  B| Cs173 - Spring 2004

  31. 125 173 217 - (157 + 145 - 98) = 13 CS 173 Set Theory - Inclusion/Exclusion Example: There are 217 cs majors. 157 are taking cs125. 145 are taking cs173. 98 are taking both. How many are taking neither? Cs173 - Spring 2004

  32. Now let’s do it for 4 sets! kidding. CS 173 Set Theory - Generalized Inclusion/Exclusion Suppose we have: B A C And I want to know |A U B U C| |A U B U C| = |A| + |B| + |C| - |A  B| - |A  C| - |B  C| + |A  B  C| Cs173 - Spring 2004

  33. CS 173 Set Theory - Inclusion/Exclusion Example: How many people are wearing a watch? How many people are wearing sneakers? How many people are wearing a watch AND sneakers? How many people are wearing a watch OR sneakers? Cs173 - Spring 2004

  34. CS 173 Set Theory - Generalized Inclusion/Exclusion For sets A1, A2,…An we have: Cs173 - Spring 2004

  35. (101011) CS 173 Set Theory - Sets as bit strings Let U = {x1, x2,…, xn}, and let A  U. Then the characteristic vector of A is the n-vector whose elements, xi, are 1 if xi A, and 0 otherwise. Ex. If U = {x1, x2, x3, x4, x5, x6}, and A = {x1, x3, x5, x6}, then the characteristic vector of A is Cs173 - Spring 2004

  36. Bit-wise OR Bit-wise AND CS 173 Set Theory - Sets as bit strings Ex. If U = {x1, x2, x3, x4, x5, x6}, A = {x1, x3, x5, x6}, and B = {x2, x3, x6}, Then we have a quick way of finding the characteristic vectors of A  B and A  B. Cs173 - Spring 2004

  37. f(x) = -(1/2)x - 25 domain co-domain CS 173 Functions Suppose we have: And I ask you to describe the yellow function. What’s a function? Notation: f: RR, f(x) = -(1/2)x - 25 Cs173 - Spring 2004

  38. CS 173 Functions Definition: a function f : A  B is a subset of AxB where  a  A, ! b  B and <a,b>  f. Cs173 - Spring 2004

  39. B A A point! A collection of points! CS 173 Functions Definition: a function f : A  B is a subset of AxB where  a  A, ! b  B and <a,b>  f. B A Cs173 - Spring 2004

More Related