1 / 33

CS 173: Discrete Mathematical Structures

CS 173: Discrete Mathematical Structures Cinda Heeren heeren@cs.uiuc.edu Rm 2213 Siebel Center Office Hours: W 9:30-11:30a For breakfast I ate: cereal eggs brew donuts CS 173 Announcements Homework 2… Homework 3 available. Due 02/05, 8a. Midterm 1: 2/23/06, 7-9p, location TBA.

libitha
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 9:30-11:30a

  2. For breakfast I ate: • cereal • eggs • brew • donuts CS 173 Announcements • Homework 2… • Homework 3 available. Due 02/05, 8a. • Midterm 1: 2/23/06, 7-9p, location TBA. • Let’s try the remotes… Cs173 - Spring 2004

  3. Note:   {} CS 173 Set Theory - Definitions and notation A set is an unordered collection of elements. Some examples: {1, 2, 3} is the set containing “1” and “2” and “3.” {1, 1, 2, 3, 3} = {1, 2, 3} since repetition is irrelevant. {1, 2, 3} = {3, 2, 1} since sets are unordered. {1, 2, 3, …} is a way we denote an infinite set (in this case, the natural numbers).  = {} is the empty set, or the set containing no elements. Cs173 - Spring 2004

  4. A Venn Diagram B CS 173 Set Theory - Definitions and notation x  S means “x is an element of set S.” x  S means “x is not an element of set S.” A  B means “A is a subset of B.” or, “B contains A.” or, “every element of A is also in B.” or, x ((x  A)  (x  B)). Cs173 - Spring 2004

  5. CS 173 Set Theory - Definitions and notation A  B means “A is a subset of B.” A  B means “A is a superset of B.” A = B if and only if A and B have exactly the same elements. iff, A  B and B  A iff, A  B and A  B iff, x ((x  A)  (x  B)). So to show equality of sets A and B, show: • A  B • B  A Cs173 - Spring 2004

  6. A B CS 173 Set Theory - Definitions and notation A  B means “A is a proper subset of B.” • A  B, and A  B. • x ((x  A)  (x  B))  x ((x  B)  (x  A)) • x ((x  A)  (x  B))  x ((x  B) v (x  A)) • x ((x  A)  (x  B)) x ((x  B) (x  A)) • x ((x  A)  (x  B)) x ((x  B)  (x  A)) Cs173 - Spring 2004

  7. Vacuously CS 173 Set Theory - Definitions and notation Quick examples: • {1,2,3}  {1,2,3,4,5} • {1,2,3}  {1,2,3,4,5} Is   {1,2,3}? Yes!x (x  )  (x  {1,2,3}) holds, because (x  ) is false. Is   {1,2,3}? No! Is   {,1,2,3}? Yes! Is   {,1,2,3}? Yes! Cs173 - Spring 2004

  8. Yes Yes Yes No CS 173 Set Theory - Definitions and notation Quiz time: Is {x}  {x}? Is {x}  {x,{x}}? Is {x}  {x,{x}}? Is {x}  {x}? Cs173 - Spring 2004

  9. : and | are read “such that” or “where” Primes CS 173 Set Theory - Ways to define sets • Explicitly: {John, Paul, George, Ringo} • Implicitly: {1,2,3,…}, or {2,3,5,7,11,13,17,…} • Set builder: { x : x is prime }, { x | x is odd }. In general { x : P(x) is true }, where P(x) is some description of the set. Ex. Let D(x,y) denote “x is divisible by y.” Give another name for { x : y ((y > 1)  (y < x)) D(x,y) }. Can we use any predicate P to define a set S = { x : P(x) }? Cs173 - Spring 2004

  10. So S must not be in S, right? ARRRGH! No! Who shaves the barber? CS 173 Set Theory - Russell’s Paradox Can we use any predicate P to define a set S = { x : P(x) }? Define S = { x : x is a set where x  x } Then, if S  S, then by defn of S, S  S. But, if S  S, then by defn of S, S  S. There is a town with a barber who shaves all the people (and only the people) who don’t shave themselves. Cs173 - Spring 2004

  11. |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

  12. 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

  13. 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

  14. 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

  15. 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

  16. 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

  17. 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

  18. 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

  19. 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

  20. U A B like “exclusive or” 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

  21. 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

  22. 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

  23. 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

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

  25. 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

  26. (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

  27. 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

  28. (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

  29. (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

  30. (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

  31. (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

  32. 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’) Cs173 - Spring 2004

  33. 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

More Related