Upcoming SlideShare
×

# Set theory

370 views

Published on

Set theory - Unitedworld School of Business

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
370
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
44
0
Likes
0
Embeds 0
No embeds

No notes for slide
• Discrete Mathematics and its Applications 07/03/13 (c)2001-2002, Michael P. Frank Read {a, b, c} as “the set whose elements are a, b, and c” or just “the set a, b, c”.
• Discrete Mathematics and its Applications 07/03/13 (c)2001-2002, Michael P. Frank With Venn diagrams, you can see that one set is a subset of another just by seeing that you can draw an enclosure around its members that fits completely inside an enclosure drawn around the larger set’s members.
• Discrete Mathematics and its Applications 07/03/13 (c)2001-2002, Michael P. Frank Note also that FORALL x P(x)-&gt;Q(x) can also be understood as meaning “{x|P(x)} is a subset of {x|Q{x}}”. This can help you understand the meaning of implication. For example, if I say, “if a student has a drivers license, then he is over 16,” this is the same as saying “the set of students with drivers licenses is a subset of the set of students who are over 16”, or “every student with a drivers license is over 16.” If no students in the universe of discourse have drivers licenses, then the antecedent is always false, or in other words the set of students with drivers licenses is just the empty set, which is of course a member of every set, and so the statement is vacuously true. Alternatively, if every student in the universe of discourse is over 16, then the consequent is always true, that is, the set of students who are over 16 is the entire universe of discourse, and so every set of students in the u.d. is necessarily a subset of the set of students who are over 16, and so the statement is trivially true. The statement is only false if there exists a student with a drivers license in the u.d. who is under 16 (perhaps the license is fake or from a foreign country), in which case, the set of students with drivers licenses is *not* a subset of the under-16 students.
• Discrete Mathematics and its Applications 07/03/13 (c)2001-2002, Michael P. Frank We may also say, “S is a strict subset of T”, or “S is strictly a subset of T” to mean the same thing.
• Discrete Mathematics and its Applications 07/03/13 (c)2001-2002, Michael P. Frank In general, any kind of object or structure, whether simple or complex, can be a member of a set. In particular, sets themselves (being structures) can be members of sets. If you don’t understand the distinction between 1, {1}, {{1}}, you’ll make endless silly mistakes. 1 is a number, the number one. {1} is NOT A NUMBER AT ALL! It is a COMPLETELY DIFFERENT TYPE OF OBJECT! Namely, it is a set. What kind of set? It is a singleton set, by which we mean a set that contains exactly one element. In this case, its element happens to be the number 1. Now, what is {{1}}? It is also a set, and also a singleton set, but it is a COMPLETELY DIFFERENT TYPE of singleton set. To see this, notice that {1} is a set of numbers, whereas {{1}} is not a set of numbers at all! It is a SET OF SETS. Its single element is not a number at all, but is a SET. Namely, the set {1}. In other words, {{1}} is the singleton set whose member is the singleton set whose member is 1. Whereas, {1} is just the singleton set whose member is 1. And, 1 is just 1. All of these are distinct objects and you’ve got to learn to keep them separate! Otherwise, you’ll never have a chance of understanding data types in programming languages. For example, in most languages, we can have an array of numbers, or an array of arrays of numbers, etc. These are all completely different types of objects and can never be compatible with each other.
• Discrete Mathematics and its Applications 07/03/13 (c)2001-2002, Michael P. Frank We’ll get to different sizes of infinite sets later, in the module on functions.
• Discrete Mathematics and its Applications 07/03/13 (c)2001-2002, Michael P. Frank Sometimes people also define “bags”, which are unordered collections in which duplicates matter. If you have a bag of coins, they are in no particular order, but it matters how many coins of each type you have.
• Discrete Mathematics and its Applications 07/03/13 (c)2001-2002, Michael P. Frank Usually AxBxC is defined as {(a,b,c) | a is in A and b is in B and c is in C}.
• Discrete Mathematics and its Applications 07/03/13 (c)2001-2002, Michael P. Frank We will see this basic counting principle again when we talk about combinatorics.
• Discrete Mathematics and its Applications 07/03/13 (c)2001-2002, Michael P. Frank NOT (x in A -&gt; x in B) = NOT (x not in A or x in B) (defn. of implies) = x in A AND x not in B (DeMorgan’s law).
• Discrete Mathematics and its Applications 07/03/13 (c)2001-2002, Michael P. Frank Note that set difference and complement do not relate to each other like arithmetic difference and negative. In arithmetic, we know that a-b = -(b-a). But in sets, A-B is not generally the same as the complement of B-A.
• Discrete Mathematics and its Applications 07/03/13 (c)2001-2002, Michael P. Frank A membership table is like a truth table.
• ### Set theory

1. 1. 2 Set Theory
2. 2. 3 Introduction to Set Theory • AA setset is a structure, representing anis a structure, representing an unorderedunordered collection (group, plurality) ofcollection (group, plurality) of zero or morezero or more distinctdistinct (different) objects.(different) objects. • Set theory deals with operations between,Set theory deals with operations between, relations among, and statements about sets.relations among, and statements about sets.
3. 3. 4 Basic notations for sets • For sets, we’ll use variablesFor sets, we’ll use variables SS,, TT,, UU, …, … • We can denote a setWe can denote a set SS in writing by listing all ofin writing by listing all of its elements in curly braces:its elements in curly braces: – {a, b, c} is the set of whatever 3 objects are denoted by{a, b, c} is the set of whatever 3 objects are denoted by a, b, c.a, b, c. • SetSet builder notationbuilder notation: For any proposition: For any proposition PP((xx)) over any universe of discourse, {over any universe of discourse, {xx||PP((xx)} is)} is the setthe set of all x such that P(x).of all x such that P(x). e.g., {e.g., {xx || xx is an integer whereis an integer where xx>0 and>0 and xx<5 }<5 }
4. 4. 5 Basic properties of sets • Sets are inherentlySets are inherently unorderedunordered:: – No matter what objects a, b, and c denote,No matter what objects a, b, and c denote, {a, b, c} = {a, c, b} = {b, a, c} ={a, b, c} = {a, c, b} = {b, a, c} = {b, c, a} = {c, a, b} = {c, b, a}.{b, c, a} = {c, a, b} = {c, b, a}. • All elements areAll elements are distinctdistinct (unequal);(unequal); multiple listings make no difference!multiple listings make no difference! – {a, b, c} = {a, a, b, a, b, c, c, c, c}.{a, b, c} = {a, a, b, a, b, c, c, c, c}. – This set contains at most 3 elements!This set contains at most 3 elements!
5. 5. 6 Definition of Set Equality • Two sets are declared to be equalTwo sets are declared to be equal if and only ifif and only if they containthey contain exactly the sameexactly the same elements.elements. • In particular, it does not matterIn particular, it does not matter how the set ishow the set is defined or denoted.defined or denoted. • For example: The set {1, 2, 3, 4} =For example: The set {1, 2, 3, 4} = {{xx || xx is an integer whereis an integer where xx>0 and>0 and xx<5 } =<5 } = {{xx || xx is a positive integer whose squareis a positive integer whose square is >0 and <25}is >0 and <25}
6. 6. 7 Infinite Sets • Conceptually, sets may beConceptually, sets may be infiniteinfinite ((i.e.,i.e., notnot finitefinite, without end, unending)., without end, unending). • Symbols for some special infinite sets:Symbols for some special infinite sets: NN = {0, 1, 2, …} The= {0, 1, 2, …} The nnatural numbers.atural numbers. ZZ = {…, -2, -1, 0, 1, 2, …} The= {…, -2, -1, 0, 1, 2, …} The iintegers.ntegers. RR = The “= The “rreal” numbers, such aseal” numbers, such as 374.1828471929498181917281943125…374.1828471929498181917281943125… • Infinite sets come in different sizes!Infinite sets come in different sizes!
7. 7. 8 Venn Diagrams
8. 8. 9 Basic Set Relations: Member of • xx∈∈SS (“(“xx is inis in SS”)”) is the proposition that objectis the proposition that object xx isis anan ∈∈lementlement oror membermember of setof set SS.. – e.g.e.g. 33∈∈NN,, “a”“a”∈∈{{xx || xx is a letter of the alphabet}is a letter of the alphabet} • Can defineCan define set equalityset equality in terms ofin terms of ∈∈ relation:relation: ∀∀SS,,TT:: SS==TT ↔↔ ((∀∀xx:: xx∈∈SS ↔↔ xx∈∈TT)) “Two sets are equal“Two sets are equal iffiff they have all the samethey have all the same members.”members.” • xx∉∉SS ::≡≡ ¬¬((xx∈∈SS) “) “xx is not inis not in SS””
9. 9. 10 The Empty Set ∀ ∅∅ (“null”, “the empty set”) is the unique set(“null”, “the empty set”) is the unique set that contains no elements whatsoever.that contains no elements whatsoever. ∀ ∅∅ = {} = {= {} = {x|x|FalseFalse}} • No matter the domain of discourse,No matter the domain of discourse, we have the axiomwe have the axiom ¬∃¬∃xx:: xx∈∅∈∅..
10. 10. 11 Subset and Superset Relations • SS⊆⊆TT (“(“SS is a subset ofis a subset of TT”) means that every”) means that every element ofelement of SS is also an element ofis also an element of TT.. • SS⊆⊆TT ⇔⇔ ∀∀xx ((xx∈∈SS →→ xx∈∈TT)) ∀ ∅⊆∅⊆SS,, SS⊆⊆S.S. • SS⊇⊇TT (“(“SS is a superset ofis a superset of TT”) means”) means TT⊆⊆SS.. • NoteNote S=TS=T ⇔⇔ SS⊆⊆TT∧∧ SS⊇⊇T.T. • meansmeans ¬¬((SS⊆⊆TT),), i.e.i.e. ∃∃xx((xx∈∈SS ∧∧ xx∉∉TT)) TS /⊆
11. 11. 12 Proper (Strict) Subsets & Supersets • SS⊂⊂TT (“(“SS is a proper subset ofis a proper subset of TT”) means that”) means that SS⊆⊆TT butbut .. Similar forSimilar for SS⊃⊃T.T. ST /⊆ S T Venn Diagram equivalent of S⊂T Example: {1,2} ⊂ {1,2,3}
12. 12. 13 Sets Are Objects, Too! • The objects that are elements of a set mayThe objects that are elements of a set may themselvesthemselves be sets.be sets. • E.g.E.g. letlet SS={={xx || xx ⊆⊆ {1,2,3}}{1,2,3}} thenthen SS={={∅∅,, {1}, {2}, {3},{1}, {2}, {3}, {1,2}, {1,3}, {2,3},{1,2}, {1,3}, {2,3}, {1,2,3}}{1,2,3}} • Note that 1Note that 1 ≠≠ {1}{1} ≠≠ {{1}} !!!!{{1}} !!!!
13. 13. 14 Cardinality and Finiteness • ||SS| (read “the| (read “the cardinalitycardinality ofof SS”) is a measure”) is a measure of how many different elementsof how many different elements SS has.has. • E.g.E.g., |, |∅∅|=0, |{1,2,3}| = 3, |{a,b}| = 2,|=0, |{1,2,3}| = 3, |{a,b}| = 2, |{{1,2,3},{4,5}}| = ____|{{1,2,3},{4,5}}| = ____ • We sayWe say SS isis infiniteinfinite if it is notif it is not finitefinite.. • What are some infinite sets we’ve seen?What are some infinite sets we’ve seen?
14. 14. 15 The Power Set Operation • TheThe power setpower set P(P(SS) of a set) of a set SS is the set of allis the set of all subsets ofsubsets of SS. P(. P(SS) = {) = {xx || xx⊆⊆SS}.}. • EE..g.g. P({a,b}) = {P({a,b}) = {∅∅, {a}, {b}, {a,b}}., {a}, {b}, {a,b}}. • Sometimes P(Sometimes P(SS) is written) is written 22SS .. Note that for finiteNote that for finite SS, |P(, |P(SS)| = 2)| = 2||SS|| .. • It turns out that |P(It turns out that |P(NN)| > |)| > |NN|.|. There are different sizes of infinite setsThere are different sizes of infinite sets!!
15. 15. 16 Ordered n-tuples • ForFor nn∈∈NN, an, an ordered n-tupleordered n-tuple or aor a sequencesequence ofof length nlength n is written (is written (aa11,, aa22, …,, …, aann). The). The firstfirst element iselement is aa11,, etc.etc. • These are like sets, except that duplicatesThese are like sets, except that duplicates matter, and the order makes a difference.matter, and the order makes a difference. • Note (1, 2)Note (1, 2) ≠≠ (2, 1)(2, 1) ≠≠ (2, 1, 1).(2, 1, 1). • Empty sequence, singlets, pairs, triples,Empty sequence, singlets, pairs, triples, quadruples, quinquadruples, quintuplestuples, …,, …, nn-tuples.-tuples.
16. 16. 17 Cartesian Products of Sets • For setsFor sets AA,, BB, their, their Cartesian productCartesian product AA××BB ::≡≡ {({(aa,, bb) |) | aa∈∈AA ∧∧ bb∈∈BB }.}. • E.g.E.g. {a,b}{a,b}××{1,2} = {(a,1),(a,2),(b,1),(b,2)}{1,2} = {(a,1),(a,2),(b,1),(b,2)} • Note that for finiteNote that for finite AA,, BB, |, |AA××BB|=||=|AA||||BB|.|. • Note that the Cartesian product isNote that the Cartesian product is notnot commutative:commutative: ¬∀¬∀ABAB:: AA××BB ==BB××AA.. • Extends toExtends to AA11 ×× AA22 ×× …… ×× AAnn......
17. 17. 18 The Union Operator • For setsFor sets AA,, BB, their, their unionunion AA∪∪BB is the setis the set containing all elements that are either incontaining all elements that are either in AA,, oror (“(“∨∨”) in”) in BB (or, of course, in both).(or, of course, in both). • Formally,Formally, ∀∀AA,,BB:: AA∪∪BB = {= {xx || xx∈∈AA ∨∨ xx∈∈BB}.}. • Note thatNote that AA∪∪BB contains all the elements ofcontains all the elements of AA andand it contains all the elements ofit contains all the elements of BB:: ∀∀AA,, BB: (: (AA∪∪BB ⊇⊇ AA)) ∧∧ ((AA∪∪BB ⊇⊇ BB))
18. 18. 19 • {a,b,c}{a,b,c}∪∪{2,3} = {a,b,c,2,3}{2,3} = {a,b,c,2,3} • {2,3,5}{2,3,5}∪∪{3,5,7}{3,5,7} = {= {2,3,52,3,5,,3,5,73,5,7} =} ={2,3,5,7}{2,3,5,7} Union Examples
19. 19. 20 The Intersection Operator • For setsFor sets AA,, BB, their, their intersectionintersection AA∩∩BB is theis the set containing all elements that areset containing all elements that are simultaneously insimultaneously in AA andand (“(“∧∧”) in”) in BB.. • Formally,Formally, ∀∀AA,,BB:: AA∩∩BB≡≡{{xx || xx∈∈AA ∧∧ xx∈∈BB}.}. • Note thatNote that AA∩∩BB is a subset ofis a subset of AA andand it is ait is a subset ofsubset of BB:: ∀∀AA,, BB: (: (AA∩∩BB ⊆⊆ AA)) ∧∧ ((AA∩∩BB ⊆⊆ BB))
20. 20. 21 • {a,b,c}{a,b,c}∩∩{2,3} = ___{2,3} = ___ • {2,4,6}{2,4,6}∩∩{3,4,5}{3,4,5} = ______= ______ Intersection Examples ∅ {4}
21. 21. 22 Disjointedness • Two setsTwo sets AA,, BB are calledare called disjointdisjoint ((i.e.i.e., unjoined), unjoined) iff their intersection isiff their intersection is empty. (empty. (AA∩∩BB==∅∅)) • Example: the set of evenExample: the set of even integers is disjoint withintegers is disjoint with the set of odd integers.the set of odd integers. Help, I’ve been disjointed!
22. 22. 23 Inclusion-Exclusion Principle • How many elements are inHow many elements are in AA∪∪BB?? ||AA∪∪BB|| = |A|= |A| ++ |B||B| −− ||AA∩∩BB|| • Example:Example: {2,3,5}{2,3,5}∪∪{3,5,7}{3,5,7} = {= {2,3,52,3,5,,3,5,73,5,7} =} ={2,3,5,7}{2,3,5,7}
23. 23. 24 Set Difference • For setsFor sets AA,, BB, the, the differencedifference of A and Bof A and B,, writtenwritten AA−−BB, is the set of all elements that, is the set of all elements that are inare in AA but notbut not BB.. • AA −− BB ::≡≡ {{xx || xx∈∈AA ∧∧ xx∉∉BB}} == {{xx || ¬(¬( xx∈∈AA →→ xx∈∈BB )) }} • Also called:Also called: TheThe complementcomplement ofof BB with respect towith respect to AA..
24. 24. 25 Set Difference Examples • {1,2,3,4,5,6}{1,2,3,4,5,6} −− {2,3,5,7,9,11} ={2,3,5,7,9,11} = ______________________ • ZZ −− NN == {… , -1, 0, 1, 2, … }{… , -1, 0, 1, 2, … } −− {0, 1, … }{0, 1, … } = {= {xx || xx is an integer but not a nat. #}is an integer but not a nat. #} = {= {xx || xx is a negative integer}is a negative integer} = {… , -3, -2, -1}= {… , -3, -2, -1} {1,4,6}
25. 25. 26 Set Difference - Venn Diagram • AA--BB is what’s left afteris what’s left after BB “takes a bite out of“takes a bite out of AA”” Set A Set B Set A−B Chomp!
26. 26. 27 Set Complements • TheThe universe of discourseuniverse of discourse can itself becan itself be considered a set, call itconsidered a set, call it UU.. • TheThe complementcomplement ofof AA, written , is the, written , is the complement ofcomplement of AA w.r.t.w.r.t. UU,, i.e.i.e.,, it isit is UU−−A.A. • E.g.,E.g., IfIf UU==NN,, A ,...}7,6,4,2,1,0{}5,3{ =
27. 27. 28 More on Set Complements • An equivalent definition, whenAn equivalent definition, when UU is clear:is clear: }|{ AxxA ∉= A U A
28. 28. 29 Set Identities • Identity:Identity: AA∪∅∪∅==AA AA∩∩UU==AA • Domination:Domination: AA∪∪U=U AU=U A∩∅∩∅==∅∅ • Idempotent:Idempotent: AA∪∪AA == A =A = AA∩∩AA • Double complement:Double complement: • Commutative:Commutative: AA∪∪B=BB=B∪∪A AA A∩∩B=BB=B∩∩AA • Associative:Associative: AA∪∪((BB∪∪CC)=()=(AA∪∪BB))∪∪CC AA∩∩((BB∩∩CC)=()=(AA∩∩BB))∩∩CC AA =)(
29. 29. 30 DeMorgan’s Law for Sets • Exactly analogous to (and derivable from)Exactly analogous to (and derivable from) DeMorgan’s Law for propositions.DeMorgan’s Law for propositions. BABA BABA ∪=∩ ∩=∪
30. 30. 31 Proving Set Identities To prove statements about sets, of the formTo prove statements about sets, of the form EE11 == EE22 (where(where EEs are set expressions), heres are set expressions), here are three useful techniques:are three useful techniques: • ProveProve EE11 ⊆⊆ EE22 andandEE22 ⊆⊆ EE11 separately.separately. • Use logical equivalences.Use logical equivalences. • Use aUse a membership tablemembership table..
31. 31. 32 Method 1: Mutual subsets Example: ShowExample: Show AA∩∩((BB∪∪CC)=()=(AA∩∩BB))∪∪((AA∩∩CC).). • ShowShow AA∩∩((BB∪∪CC))⊆⊆((AA∩∩BB))∪∪((AA∩∩CC).). – AssumeAssume xx∈∈AA∩∩((BB∪∪CC), & show), & show xx∈∈((AA∩∩BB))∪∪((AA∩∩CC).). – We know thatWe know that xx∈∈AA, and either, and either xx∈∈BB oror xx∈∈C.C. • Case 1:Case 1: xx∈∈BB. Then. Then xx∈∈AA∩∩BB, so, so xx∈∈((AA∩∩BB))∪∪((AA∩∩CC).). • Case 2:Case 2: xx∈∈C.C. ThenThen xx∈∈AA∩∩CC , so, so xx∈∈((AA∩∩BB))∪∪((AA∩∩CC).). – Therefore,Therefore, xx∈∈((AA∩∩BB))∪∪((AA∩∩CC).). – Therefore,Therefore, AA∩∩((BB∪∪CC))⊆⊆((AA∩∩BB))∪∪((AA∩∩CC).). • Show (Show (AA∩∩BB))∪∪((AA∩∩CC)) ⊆⊆ AA∩∩((BB∪∪CC). …). …
32. 32. 33 Method 3: Membership Tables • Just like truth tables for propositional logic.Just like truth tables for propositional logic. • Columns for different set expressions.Columns for different set expressions. • Rows for all combinations of membershipsRows for all combinations of memberships in constituent sets.in constituent sets. • Use “1” to indicate membership in theUse “1” to indicate membership in the derived set, “0” for non-membership.derived set, “0” for non-membership. • Prove equivalence with identical columns.Prove equivalence with identical columns.
33. 33. 34 Membership Table Example Prove (Prove (AA∪∪BB))−−B = AB = A−−BB.. AA BB AA∪∪BB ((AA∪∪BB))−−BB AA−−BB 0 0 0 0 0 0 1 1 0 0 1 0 1 1 1 1 1 1 0 0
34. 34. 35 Membership Table Exercise Prove (Prove (AA∪∪BB))−−CC = (= (AA−−CC))∪∪((BB−−CC).). A B C AA∪∪BB ((AA∪∪BB))−−CC AA−−CC BB−−CC ((AA−−CC))∪∪((BB−−CC)) 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1
35. 35. 36 Generalized Union • Binary union operator:Binary union operator: AA∪∪BB • nn-ary union:-ary union: AA∪∪AA22∪∪……∪∪AAnn ::≡≡ ((…((((…((AA11∪∪ AA22))∪∪…)…)∪∪ AAnn)) (grouping & order is irrelevant)(grouping & order is irrelevant) • ““Big U” notation:Big U” notation: • Or for infinite sets of sets:Or for infinite sets of sets:  n i iA 1= XA A ∈
36. 36. 37 Generalized Intersection • Binary intersection operator:Binary intersection operator: AA∩∩BB • nn-ary intersection:-ary intersection: AA∩∩AA22∩∩……∩∩AAnn≡≡((…((((…((AA11∩∩AA22))∩∩…)…)∩∩AAnn)) (grouping & order is irrelevant)(grouping & order is irrelevant) • ““Big Arch” notation:Big Arch” notation: • Or for infinite sets of sets:Or for infinite sets of sets:  n i iA 1= XA A ∈
37. 37. Campus Overview 907/A Uvarshad, Gandhinagar Highway, Ahmedabad – 382422. Ahmedabad Kolkata Infinity Benchmark, 10th Floor, Plot G1, Block EP & GP, Sector V, Salt-Lake, Kolkata – 700091. Mumbai Goldline Business Centre Linkway Estate, Next to Chincholi Fire Brigade, Malad (West), Mumbai – 400 064.
38. 38. Thank You