CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Today’s Topics: Vs Venn Diagrams Proving two sets are equal Power Set and Cross Product
Set notations Union: AB = {x:xA xB} Intersection: AB = {x:xA xB} Complement: Ac= {x:xA} Difference: A-B = {x:xA xB} Empty set:
1. Vs Don’t be confused!
Vs Which one of the following is true? 1 {1,2,3} 1 {1,2,3} {1} {1,2,3} {1} 1,2,3 None/other/more than one
Vs Which one of the following is true? 1 {{1},{2},{3}} 1 {{1},{2},{3}} {1} {{1},{2},{3}} {1} {{1},{2},{3}} None/other/more than one
Vs Which one of the following is true? {,{},{{}}} {,{},{{}}} {} {,{},{{}}} {} {,{},{{}}} None/other/more than one
2. Venn Diagrams
If A, B, and C are subsets of U, then 𝐴−𝐶 ∩ 𝐵−𝐶 ∩ 𝐴−𝐵 =∅ We will prove this using Venn Diagram method First, we need to draw a generic Venn Diagram: U B A C
If A, B, and C are subsets of U, then 𝐴−𝐶 ∩ 𝐵−𝐶 ∩ 𝐴−𝐵 =∅ Which area(s) represent 𝐵−𝐶 ? 1,2 2,5,8 1,2,3,4 3,4 Other/none/more U B A C
If A, B, and C are subsets of U, then 𝐴−𝐶 ∩ 𝐵−𝐶 ∩ 𝐴−𝐵 =∅ Which area(s) represent 𝐴−𝐶 ? 1,4 2,3 8,7 5,6 Other/none/more U B A C
If A, B, and C are subsets of U, then 𝐴−𝐶 ∩ 𝐵−𝐶 ∩ 𝐴−𝐵 =∅ Which area(s) represent 𝐴−𝐵 ? A = 2,3,5,6 B = 3,4,6,7 A – B = 2,5 A-C = 2,3 B-C = 3,4 A-B = 2,5 There is no number that appears in all three lists, so the intersection is empty set U B A C
If A, B, and C are subsets of U, then 𝐴−𝐶 ∩ 𝐵−𝐶 ∩ 𝐴−𝐵 =∅ Algebraic proof: 𝐴−𝐶 ∩ 𝐵−𝐶 ∩ 𝐴−𝐵 =𝐴∩ 𝐶 𝐶 ∩𝐵∩ 𝐶 𝐶 ∩𝐴∩ 𝐵 𝐶 (by definition of set difference, and by associative law –removing parentheses) =𝐴∩ 𝐶 𝐶 ∩ 𝐶 𝐶 ∩𝐴∩ (𝐵 𝐶 ∩𝐵) (by commutative law, and by associative law –adding parentheses) =𝐴∩ 𝐶 𝐶 ∩ 𝐶 𝐶 ∩𝐴∩∅(by complement law) =∅(by universal bound law)
3. Proving two sets are equal
Set equality Given sets X and Y, X = Y means: ∀𝑧, 𝑧∈𝑋 ↔𝑧∈𝑌 ∀𝑧, 𝑧∈𝑋 ↔𝑧∈𝑌 So we can use our proof template for “if and only if” to show that two sets are equal (Your book shows a different way, “chain of iffs”) Recall: 𝑝↔𝑞 is equivalent to 𝑝→𝑞 AND 𝑞→𝑝 “IFF” proof template says do this as two proofs: Prove 𝑝→𝑞 Next, prove 𝑞→𝑝 (Each part uses the “proving implications” template)
Set equality: example X={even numbers} Y={n: n+2 is even} Claim: X=Y Proof: nX n is even n+2 is even nY
Set equality Another take: one way to prove that X=Y is to prove that both X Y Y X
Set equality: another example X={n: 6 divides n} Y={n:2 divides n and 3 divides n} Claim: X=Y XY: Let nX, i.e. n=6k. Hence, n=2(3k),n=3(2k), which means nY. YX: Let nY, i.e. n=2a,n=3b. So, 3b=2a is even. Hence b must be even (need lemma: odd times odd is odd), i.e. b=2c. So, n=6c, hence nX.
Set equality: yet another example Can also prove directly Claim: (AC)C=A Proof: AC={x: x A} (AC)C = {x: x AC} = {x: x A}
4. Power Set and Cross Product
Power Sets For any set A, let P(A) be its power set, which is the set of all its subsets Note that A is itself a member of P(A). Recall: ∅ denotes the empty set. Question: What is P({1,2})? {1, 2, {1,2}} {{1}, {2}, {1,2}, ∅} {1, 2, {1,2}, {2,1}} None/other/more than one
Cross Product For any sets A and B, let A x B = {(x, y); x ∈ A and y ∈ B} Question: What is {1,2} x {1, 2, 3} ? {1, 2, 3} {(1,1), (2,2), (∅ ,3)} {(1,1),(1,2),(1,3),(2,1),(2,2),(2,3)} {(1),(1,2),(1,3),(2),(2,3)} None/other/more than one