Download presentation
Presentation is loading. Please wait.
1
Discrete Structures Chapter 3 Set Theory Nurul Amelina Nasharuddin Multimedia Department
2
Basics of Set Theory Sets are used to group objects together Set notation: {1, 2, 3}, {{1, 2}, {3}, {1, 2, 3}}, {1, 2, 3, …}, , {x R | -3 < x < 6} Set A is called a subset of set B, written as A B, when x, x A x B (A is contained in B and B contains A) is a subset for every set Any set is a subset of itself Visual representation of the sets Distinction between and
3
Basics of Set Theory A is a proper subset of B, written as A B, when A is a subset of B and x B and x A (every element A is in B but there is at least one element B not in A) When A is a proper subset of B, A B Eg: The set of all men is a proper subset of the set of all people. {1, 3} {1, 2, 3, 4} {1, 2, 3, 4} {1, 2, 3, 4}
4
Example Let U = {1, 2, 3, 4, 5, 6, x, y, {1, 2}, {1, 2, 3}, {1, 2, 3, 4}} Then |U| = 11. (a)If A = {1, 2, 3, 4} then |A| = 4 and A U A U A U {A} U {A} U{A} U (b) Let B = {5, 6, x, y, A} = {5, 6, x, y, {1, 2, 3, 4}}. Then |B| = 5, not 8. And A B {A} B {A} B {A} B A B (that is, A is not a subset of B) A B (that is, A is not a proper subset of B).
5
Cardinality of Sets If A is a finite set, then cardinality of A, denoted by n(A) or |A|, the number of elements A contains Eg: A = {x, y, z}. n(A) = 3 Eg: Let S be the set of odd positive integers less than 10 Then |S| = 5 We see that A B |A| |B|, and A B |A| |B|.
6
Example For U = {1, 2, 3, 4, 5}, A = {1, 2}, and B = {1, 2}, we see that A is a subset of B (that is, A B), but it is not a proper subset of B (or, A B). A B |A| |B|, 2 2 so it is true that A B A B |A| |B|, 2 2 false so it is false that A B.
7
Set Operations Set A equals set B, written A = B, iff every element of set A is in set B and vice versa (A B and B A) Proof technique for showing sets equality Eg: Let A = {n Z | n = 2p, for some integer p}, B = {k Z | k = 3r + 1, for some integer r}. Is A = B? Ans: No. 2 A since 2 = 2(1); but 2 B. 3r + 1= 2 3r = 1 r= 1/3 (not an integer), so 2 B There is an element in A that not in B, A B.
8
Set Operations Union of two sets (A B) is a set of all elements that belong to at least one of the sets Intersection of two sets (A B) is a set of all elements that belong to both sets Difference of two sets (B – A) is a set of elements in one set, but not the other Complement of a set (A c or ) is a difference between universal set and a given set Symmetric difference of two sets (A B) is the set that contains the elements which is in A but not in B and in B but not in A
9
Set Operations Symbolically: A B = {x U | x A or x B} A B = {x U | x A and x B} B – A = {x U | x B and x A} A c = {x U | x A} A B = {x | x A B but x A B} Eg: Let U = {a, b, c, d, e, f, g}, A = {a, c, e, g}, B = {d, e, f, g} A B = A c = A B =A B = {a, c, d, f} B – A =
10
Venn Diagrams Union Intersection Difference ( A – B)Complement Difference
11
Empty Set Empty set (null set) is the set containing no elements Denoted by or {} Eg: {1, 3} {2, 5} = Eg: Describe the set D = {x R | 3 x 2} D = Empty set is a subset of any set There is exactly one empty set
12
Disjoint Set Two sets are disjoint, iff they have no elements in common A and B are disjoint, A B = Eg: Are A = {1, 3, 5} and B = {2, 4, 6} disjoint? Yes. {1, 3, 5} {2, 4, 6} = Sets A 1, A 2, …, A n are mutually disjoint, iff no two sets A i and A j with distinct subscripts have any elements in common A i A j = whenever i j Eg: Are B 1 = {2, 4, 6}, B 2 = {3, 7}, B 3 = {4, 5} mutually disjoint? No. B 1 and B 3 both contain 4.
13
Power Set Power set of A, denoted by P(A), is the set of all subsets of A Theorem: If A B, then P(A) P(B) Theorem: If set X has n elements, then P(X) has 2 n elements Eg: P({x, y}) = { , {x}, {y}, {x, y}}
14
Power Set Eg: Let C = {1, 2, 3, 4}. What is the power set of C? P(C) = { , {1}, {2}, {3}, {4}, {1, 2}, {1, 3}, {1, 4}, {2, 3}, {2, 4}, {3, 4}, {1, 2, 3}, {1, 2, 4}, {1, 3, 4},{2, 3, 4}, C}
15
Cartesian Products Ordered n-tuple is a set of ordered n elements Two ordered n-tuples (x 1, x 2, …, x n ) and (y 1, y 2, …, y n ) are equal iff x 1 = y 1, x 2 = y 2, …, x n = y n Eg: Is (1, 2) = (2, 1)? No. By definition of equality of ordered pair, (1, 2) = (2, 1) 1 = 2 and 2 = 1 Cartesian product of A and B, denoted by A x B, is the set of all ordered pairs (a, b) where a is in A and b is in B. A x B = {(a, b) | a A and b B} Eg: Let A = {x, y} and B = {1, 2, 3} A x B = {(x, 1), (x, 2), (x, 3), (y, 1), (y, 2), (y, 3)}
16
Set Properties and Laws of Set Theory Inclusion of Intersection: A B A and A B B Inclusion in Union: A A B and B A B Transitivity of Inclusion: (A B B C) A C Set Definitions: i.x X Y x X or x Y ii.x X Y x X and x Y iii.x X – Y x X and x Y iv.x X c x X v.(x, y) X Y x X and y Y
17
RulesName of rule A B = A B A B = B A Commutative Laws (A B) C = A (B C) (A B) C = A (B C) Associative Laws A (B C) = (A B) (A C) A (B C) = (A B) (A C) Distributive Laws A U = A A = A Identity Law A A c = A A c = U Complement Law (A c ) c = ADouble Complement Law A A = A A A = A Idempotent Laws A = A U = U Universal Bound Laws (A B) c = A c B c (A B) c = A c B c De Morgan’s Laws A (A B) = A A (A B) = A Absorption Laws A – B = A B c Set Difference Law U c = c = U Complements of U and If A B, then A B = A and A B = B Intersection and Union with a subset
18
Formal Proving for Set Identities Basic method for proving that sets are equal: Let sets X and Y be given. To prove that X = Y: 1.Prove that X Y 2.Prove that Y X.
19
Proving: Distributive Law Proof by cases Prove that A (B C) = (A B) (A C) We must show that A (B C) (A B) (A C) and (A B) (A C) A (B C) For A (B C) (A B) (A C): Suppose that x A (B C). Then x A or x (B C) Case 1: (x A) Since x A, then x A B and also x A C by definition of union Hence x (A B) (A C) by definition of intersection
20
Case 2: (x B C) Since (x B C), then x B and x C Since x B, then x A B and since x C, then x A C by definition of union Hence x (A B) (A C) In both cases, x (A B) (A C) Hence A (B C) (A B) (A C) by definition of subset Do for (A B) (A C) A (B C)! Proving: Distributive Law Proof by cases
21
Prove that A (B C) = (A B) (A C) A (B C) = {x | (x A) (x (B C))} = {x | (x A) (x B x C)} = {x | ((x A) (x B)) ((x A) (x C))} = {x | (x A B) (x A C)} = (A B) (A C) Proving: Distributive Law Proof by cases
22
Prove that (A B) c = A c B c (A B) c = {x | x (A B)} = {x | ~ (x A x B)} = {x | ~ (x A) ~ (x B)} = {x | x A x B} = {x | x A c x B c } = {x | x (A c B c )} = A c B c Proving: De Morgan’s Law Proof by cases
23
Algebraic Proofs of Set Identities Can use set identities to derive new set identities or to simplify a complicated set expression, eg. (A B) c A c B c Eg: Prove that (A B) – C = (A – C) (B – C) (A B)–C= (A B) C c by the set difference law = C c (A B) by the comm. law = (C c A) (C c B) by the distributive law = (A C c ) (B C c ) comm. law = (A - C) (B - C) by the set difference law
24
Example of Simplification Using laws of set theory, simplify the expression: De Morgan’s Law Double Complement Law Associative Law Commutative Law Associative Law Absorption Law
25
Membership table To establish set equalities We observe that for sets A, B U, an element x U satisfies exactly one of the following four situations: a)x A, x B b)x A, x B c)x A, x B d)x A, x B When x is an element of a given set, we write a 1(T); when x is not in the set, we enter a 0 (F). 3 rd row of the table shows that x A, but x B. So, x A B but x is in A B. ABAcAc A BA B 00100 01101 10001 11011
26
Membership Table Using membership table, prove the A (B C) = (A B) (A C) ABC B CA (B C)A BA C(A B) (A C) 00000000 00100010 01000100 01111111 10001111 10101111 11001111 11111111 Since these columns are identical, A (B C) = (A B) (A C)
27
Duality The dual of s, denoted s d is obtained from a statement, s by replacing – by U and U by and – by and by Eg: s: s d :
28
Counting and Venn Diagrams By using Venn diagrams, show that For example, Set = regions 1, 3, 4, 6; while set = regions 1, 2, 4, 7. Therefore, = regions 1, 4. Set C = regions 4, 6, 7, 8; therefore set = regions 1, 2, 3, 5. = regions 1, 2, 3, 4, 5. ?
29
Counting and Venn Diagrams If A and B are finite sets, then n(A B) = n(A) + n(B) - n(A B). In particular, if A and B are disjoint then n(A B) = n(A) + n(B). If A and B are finite sets, then n(AB) = n(A)*n(B)
30
Example In a class of 50 college freshmen, 30 are studying C++, 25 are studying Java, and 10 are studying both languages. How many freshmen are studying either computer language? We let U be the class of 50 freshmen, A is the subset of those students studying C++, and B is the subset of those studying Java. n(A) = 30, n(B) = 25, n(A B) = 10 n(A B) = n(A) + n(B) - n(A B) = 30 + 25 – 10 = 45
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.