170 likes | 780 Views
Basics of Set Theory. 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 a proper subset of B, when A is a subset of B and x B and x A.
E N D
Basics of Set Theory • 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 a proper subset of B, when A is a subset of B and x B and x A. • Visual representation sets: Venn diagrams. • Note the distinction between (set containment) and (set membership).
Set Operations Let A and B be subsets of a universal set U. • Union of two sets A B = {x U | x A or x B } • Intersection of two sets A B = {x U | x A and x B } • Difference of two sets B ─ A = {x U | x B and x A } • Complement of a set Ac = {x U | x A } • Equality of two sets A = B A B and B A
Cartesian Products • The Ordered n-tuple, (x1, x2, …, xn), consists of elements x1, x2, …, xn ordered positionally. • Equality of n-tuples? • The Cartesian product of n sets, A1 x A2 x …x An, is a set of n-tuples, where each element in the n-tuple belongs to the respective set participating in the product.
Power Set • The power set of A, denoted P (A), is the set of all subsets of A. • Theorem: If A B, then P (A) P (B). • Theorem: If set A has n elements, then P (A) has 2n elements.
Set Partitioning • Two sets are called disjoint if they have no elements in common. • Theorem: A – B and B are disjoint. • A collection of sets A1, A2, …, An is called mutually disjoint when any pair of sets from this collection is disjoint. • A collection of non-empty sets {A1, A2, …, An} is called a partition of a set A when the union of these sets is A and this collection consists of mutually disjoint sets.
More on Empty Set • S = {x R | x2 = -1}. • X = {1, 3}, Y = {2, 4}, C = X Y. • Empty set has no element. • Empty set is a subset of any set. • Theorem: There is exactly one empty set. • Properties of empty set: • A = A, A = • A Ac = , A Ac = U • Uc = , c = U
More on Set Properties • 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: Let X, Y be subsets of a universal set U and x, y be elements of U. • x X Y x X x Y • x X Y x X x Y • x X – Y x X x Y • x Xc x X • (x, y) X Y x X y Y
Set Identities • Commutative Laws: A B = B A and A B = B A • Associative Laws: (A B) C = A (B C) and (A B) C = A (B C) • Distributive Laws: A (B C) = (A B) (A C) and A (B C) = (A B) (A C) • Intersection and Union with universal set: A U = A and A U = U • Double Complement Law: (Ac)c = A • Idempotent Laws: A A = A and A A = A • De Morgan’s Laws: (A B)c = Ac Bc and(A B)c = Ac Bc • Absorption Laws: A (A B) = A and A (A B) = A • Alternate Representation for Difference: A – B = A Bc • Intersection and Union with a subset: if A B, then A B = A and A B = B
Subset Check Algorithm • Let two sets be represented as arrays A and B m = size of A, n = size of B i = 1, answer = “yes”; while (i m && answer == “yes”) { j = 1, found = “no”; while (j n && found == “no”) { if (a[i] == b[j]) found = “yes”; j++; } if (found == “no”) answer = “no”; i++; }
Exercises • Is is true that (A – B) (B – C) = A – C? • Show that (A B) – C = (A – C) (B – C) • Is it true that A – (B – C) = (A – B) – C? • Is it true that (A – B) (A B) = A?
Exercises • Simplify: A ((B Ac) Bc) (P291, Q.34) • Symmetric Difference: A B = (A – B) (B – A) • Show that symmetric difference is associative. (P292, Q.45) • Are A – B and B – C necessarily disjoint? (P291, Q.33) • Are A – B and C – B necessarily disjoint? (P291,Q.7) • Let S = {2, 3, …, n}. For each nonempty Si S, let Pi be the product of elements in Si. Show that: Pi = (n + 1)! / 2 – 1 (P291, Q.22)
Boolean Algebra • Boolean Algebra is a set B together with two operations denoted as + and *, such that for all a and b in B both a+b and a*b are in B and the following properties hold: • a + b = b + a, a * b = b * a • (a + b) + c = a + (b + c), (a * b) *c = a * (b * c) • a + (b * c) = (a + b) * (a + c), a * (b + c) = (a * b) + (a * c) • a + 0 = a, a * 1 = a (for distinct and unique elements 0 and 1) • a + ã = 1, a * ã = 0 (ã is the complement of a)