Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
SETS and SET
OPERATIONS
SET
 Definition: A set is a (unordered) collection of objects.
These objects are sometimes called elements or members
of the set. (Cantor's naive definition)
Examples:
 Vowels in the English alphabet
V = { a, e, i, o, u }
 First seven prime numbers.
X = { 2, 3, 5, 7, 11, 13, 17 }
SET
Representing a set:
1) Listing the members.
2) Definition by property, using set builder notation
{x| x has property P}
3) Venn Diagram
Example:
Even integers between 50 and 63.
1) E = {50, 52, 54, 56, 58, 60, 62}
2) E = {x | 50 <= x < 63, x is an even integer}
If enumeration of the members is hard we often use ellipses.
Example: a set of positive integers between less than 100
1) A= {1,2,3 …, 99}
2) A = {x ∈ Z+ | x is odd and x < 100}
Sets in Discrete Math
 Natural numbers:
N = {0,1,2,3, …}
 Integers
Z = {…, -2,-1,0,1,2, …}
 Positive integers
Z+ = {1,2, 3.…}
 Rational numbers
Q = {p/q | p ∈ Z, q ∈ Z, q ≠ 0, the set of rational numbers}
 Real numbers
R
Special Sets
 The universal set is denoted by U: the set
of all objects under the consideration.
 The empty set is denoted as ∅ or { }.
Venn Diagram
 A set can be visualized using Venn Diagrams:
V={ A, B, C }
A
B
C
U
Comparing Sets
Subsets
Superset
Equal sets
Disjoint sets
Infinite sets
Subset
 Definition: A set A is said to be a subset of B if and only if every element of
A is also an element of B. We use A ⊆ B to indicate A is a subset of B.
 Alternate way to define A is a subset of B:
∀x (x ∈ A) → (x ∈ B)
A
B
Subset Properties
 Theorem ∅ ⊆ S
Empty set is a subset of any set.
 Theorem: S ⊆ S
Any set S is a subset of itself
Superset
 Definition: A set B is a superset of another set A if all
elements of the set A are elements of the set B.
 A⊃B
Equal Sets
 Definition: Two sets are equal if and only if they have the
same elements.
Example:
 {1,2,3} = {3,1,2} = {1,2,1,3,2} – listed more than one,
they have the same elements
Note: Duplicates don't contribute anything new to a set, so
remove them. The order of the elements in a set doesn't
contribute anything new.
Disjoint Sets
 Two sets are called disjoint if their intersection is the empty set.
Example
A = {1, 3, 5, 7, 9} and B = {2, 4, 6, 8, 10}. A ∩ B = ∅, A and B are disjoint
A
B
U
Infinite Set
 Definition: A set is infinite if it is not finite.
Examples:
 The set of natural numbers is an infinite set.
N = {0, 1, 2, 3, ... }
 The set of real numbers is an infinite set.
Set Operators
 Union, ∪
 Intersection, ∩
 Complement,
 Difference, -
 Proper Subset, ⊂
 Powerset, P
 Cardinality, |..|
 Cartesian Product, x
Union
 Definition: Let A and B be sets. The union of A and B,
denoted by A ∪ B, is the set that contains those elements
that are either in A or in B, or in both.
 Alternate: A ∪ B = { x | x ∈ A ∨ x ∈ B }
Example:
A = {1,2,3,6} B = { 2,4,6,9}
A ∪ B = { 1,2,3,4,6,9 }
Intersection
 Definition: Let A and B be sets. The intersection of A and
B, denoted by A ∩ B, is the set that contains those
elements that are in both A and B.
 Alternate: A ∩ B = { x | x ∈ A ∧ x ∈ B }
Example:
A = {1,2,3,6} B = { 2, 4, 6, 9}
A ∩B = { 2, 6 }
Complement
 Let U be the universal set. The complement of the set A, denoted by A, is the
complement of A with respect to U. Therefore, the complement of the set A is
U − A.
A = {x ∈ U | x /∈ A}.
Example
A = {a, e, i, o, u} (where the universal set is the set of
letters of the English alphabet)
A = {b, c, d, f, g, h, j, k, l,m, n, p, q, r, s, t, v,w, x, y, z}.
Difference
 Definition: Let A and B be sets. The difference of A and
B, denoted by A - B, is the set containing those elements
that are in A but not in B. The difference of A and B is also
called the complement of B with respect to A.
 A - B = { x | x ∈ A ∧ x ∉ B }.
Example:
A= {1,2,3,5,7} B = {1,5,6,8}
A - B ={2,3,7}
A Proper Subset
 Definition: A set A is said to be a proper subset of B if
and only if A ⊆ B and A ≠ B. We denote that A is a proper
subset of B with the notation
A ⊂ B.
A
B
A Proper Subset
Example:
A={1,2,3} B ={1,2,3,4,5}
Is: A ⊂ B ? Yes.
Power Set
 Definition: Given a set S, the power set of S is the set of all subsets of S.
The power set is denoted by P(S).
Examples:
Assume an empty set ∅
 What is the power set of ∅ ? P(∅) = { ∅ }
 What is the cardinality of P(∅) ? |P(∅)| = 1
Assume set {1}
 P( {1} ) = { ∅, {1} }
 |P({1})| = 2
Power Set
Assume {1,2}
 P( {1,2} ) = { ∅, {1}, {2}, {1,2} }
 |P({1,2} )| =4
Assume {1,2,3}
 P({1,2,3}) = {∅, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} }
 |P({1,2,3} | = 8
 If S is a set with |S| = n then | P(S) | = 2n..
Cardinality
 Definition: Let S be a set. If there are exactly n distinct elements in S, where n is
a nonnegative integer, we say S is a finite set and that n is the cardinality of S.
The cardinality of S is denoted by | S |.
Examples:
 V={1 2 3 4 5}
| V | = 5
 A={1,2,3,4, …, 20}
|A| =20
 | ∅ | = 0
Cartesian Product
 Definition: Let S and T be sets. The Cartesian product of S and T, denoted
by S x T, is the set of all ordered pairs (s,t), where s∈ S and t ∈ T. Hence,
S x T = { (s,t) | s ∈ S ∧ t ∈ T}.
Examples:
 S = {1,2} and T = {a,b,c}
 S x T = { (1,a), (1,b), (1,c), (2,a), (2,b), (2,c) }
 T x S = { (a,1), (a, 2), (b,1), (b,2), (c,1), (c,2) }
 Note: S x T ≠ T x S !!!!
Cardinality of Cartesian Product
 |S x T| = |S| * |T|
Example:
 A= {John, Peter, Mike}
 B ={Jane, Ann, Laura}
 A x B= {(John, Jane), (John, Ann) , (John, Laura), (Peter, Jane), (Peter, Ann) ,
(Peter, Laura) , (Mike, Jane) , (Mike, Ann) , (Mike, Laura)}
 |A x B| = 9
 |A|=3, |B|=3 -> |A||B|= 9
Definition: A subset of the Cartesian product A x B is called a relation from the set A
to the set B.
Set
Identities
Set Identities
 Set identities can be proved using membership tables.
 List each combination of sets that an element can belong to.
 Then show that for each such a combination the element either belongs or
does not belong to both sets in the identity.
Example
Prove: (A ∩ B) = A ∪ B
A B A B A ∩ B A ∪ B
1 1 0 0 0 0
1 0 0 1 1 1
0 1 1 0 1 1
0 0 1 1 1 1

More Related Content

Set and Set operations, UITM KPPIM DUNGUN

  • 2. SET  Definition: A set is a (unordered) collection of objects. These objects are sometimes called elements or members of the set. (Cantor's naive definition) Examples:  Vowels in the English alphabet V = { a, e, i, o, u }  First seven prime numbers. X = { 2, 3, 5, 7, 11, 13, 17 }
  • 3. SET Representing a set: 1) Listing the members. 2) Definition by property, using set builder notation {x| x has property P} 3) Venn Diagram Example: Even integers between 50 and 63. 1) E = {50, 52, 54, 56, 58, 60, 62} 2) E = {x | 50 <= x < 63, x is an even integer} If enumeration of the members is hard we often use ellipses. Example: a set of positive integers between less than 100 1) A= {1,2,3 …, 99} 2) A = {x ∈ Z+ | x is odd and x < 100}
  • 4. Sets in Discrete Math  Natural numbers: N = {0,1,2,3, …}  Integers Z = {…, -2,-1,0,1,2, …}  Positive integers Z+ = {1,2, 3.…}  Rational numbers Q = {p/q | p ∈ Z, q ∈ Z, q ≠ 0, the set of rational numbers}  Real numbers R
  • 5. Special Sets  The universal set is denoted by U: the set of all objects under the consideration.  The empty set is denoted as ∅ or { }.
  • 6. Venn Diagram  A set can be visualized using Venn Diagrams: V={ A, B, C } A B C U
  • 8. Subset  Definition: A set A is said to be a subset of B if and only if every element of A is also an element of B. We use A ⊆ B to indicate A is a subset of B.  Alternate way to define A is a subset of B: ∀x (x ∈ A) → (x ∈ B) A B
  • 9. Subset Properties  Theorem ∅ ⊆ S Empty set is a subset of any set.  Theorem: S ⊆ S Any set S is a subset of itself
  • 10. Superset  Definition: A set B is a superset of another set A if all elements of the set A are elements of the set B.  A⊃B
  • 11. Equal Sets  Definition: Two sets are equal if and only if they have the same elements. Example:  {1,2,3} = {3,1,2} = {1,2,1,3,2} – listed more than one, they have the same elements Note: Duplicates don't contribute anything new to a set, so remove them. The order of the elements in a set doesn't contribute anything new.
  • 12. Disjoint Sets  Two sets are called disjoint if their intersection is the empty set. Example A = {1, 3, 5, 7, 9} and B = {2, 4, 6, 8, 10}. A ∩ B = ∅, A and B are disjoint A B U
  • 13. Infinite Set  Definition: A set is infinite if it is not finite. Examples:  The set of natural numbers is an infinite set. N = {0, 1, 2, 3, ... }  The set of real numbers is an infinite set.
  • 14. Set Operators  Union, ∪  Intersection, ∩  Complement,  Difference, -  Proper Subset, ⊂  Powerset, P  Cardinality, |..|  Cartesian Product, x
  • 15. Union  Definition: Let A and B be sets. The union of A and B, denoted by A ∪ B, is the set that contains those elements that are either in A or in B, or in both.  Alternate: A ∪ B = { x | x ∈ A ∨ x ∈ B } Example: A = {1,2,3,6} B = { 2,4,6,9} A ∪ B = { 1,2,3,4,6,9 }
  • 16. Intersection  Definition: Let A and B be sets. The intersection of A and B, denoted by A ∩ B, is the set that contains those elements that are in both A and B.  Alternate: A ∩ B = { x | x ∈ A ∧ x ∈ B } Example: A = {1,2,3,6} B = { 2, 4, 6, 9} A ∩B = { 2, 6 }
  • 17. Complement  Let U be the universal set. The complement of the set A, denoted by A, is the complement of A with respect to U. Therefore, the complement of the set A is U − A. A = {x ∈ U | x /∈ A}. Example A = {a, e, i, o, u} (where the universal set is the set of letters of the English alphabet) A = {b, c, d, f, g, h, j, k, l,m, n, p, q, r, s, t, v,w, x, y, z}.
  • 18. Difference  Definition: Let A and B be sets. The difference of A and B, denoted by A - B, is the set containing those elements that are in A but not in B. The difference of A and B is also called the complement of B with respect to A.  A - B = { x | x ∈ A ∧ x ∉ B }. Example: A= {1,2,3,5,7} B = {1,5,6,8} A - B ={2,3,7}
  • 19. A Proper Subset  Definition: A set A is said to be a proper subset of B if and only if A ⊆ B and A ≠ B. We denote that A is a proper subset of B with the notation A ⊂ B. A B
  • 20. A Proper Subset Example: A={1,2,3} B ={1,2,3,4,5} Is: A ⊂ B ? Yes.
  • 21. Power Set  Definition: Given a set S, the power set of S is the set of all subsets of S. The power set is denoted by P(S). Examples: Assume an empty set ∅  What is the power set of ∅ ? P(∅) = { ∅ }  What is the cardinality of P(∅) ? |P(∅)| = 1 Assume set {1}  P( {1} ) = { ∅, {1} }  |P({1})| = 2
  • 22. Power Set Assume {1,2}  P( {1,2} ) = { ∅, {1}, {2}, {1,2} }  |P({1,2} )| =4 Assume {1,2,3}  P({1,2,3}) = {∅, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} }  |P({1,2,3} | = 8  If S is a set with |S| = n then | P(S) | = 2n..
  • 23. Cardinality  Definition: Let S be a set. If there are exactly n distinct elements in S, where n is a nonnegative integer, we say S is a finite set and that n is the cardinality of S. The cardinality of S is denoted by | S |. Examples:  V={1 2 3 4 5} | V | = 5  A={1,2,3,4, …, 20} |A| =20  | ∅ | = 0
  • 24. Cartesian Product  Definition: Let S and T be sets. The Cartesian product of S and T, denoted by S x T, is the set of all ordered pairs (s,t), where s∈ S and t ∈ T. Hence, S x T = { (s,t) | s ∈ S ∧ t ∈ T}. Examples:  S = {1,2} and T = {a,b,c}  S x T = { (1,a), (1,b), (1,c), (2,a), (2,b), (2,c) }  T x S = { (a,1), (a, 2), (b,1), (b,2), (c,1), (c,2) }  Note: S x T ≠ T x S !!!!
  • 25. Cardinality of Cartesian Product  |S x T| = |S| * |T| Example:  A= {John, Peter, Mike}  B ={Jane, Ann, Laura}  A x B= {(John, Jane), (John, Ann) , (John, Laura), (Peter, Jane), (Peter, Ann) , (Peter, Laura) , (Mike, Jane) , (Mike, Ann) , (Mike, Laura)}  |A x B| = 9  |A|=3, |B|=3 -> |A||B|= 9 Definition: A subset of the Cartesian product A x B is called a relation from the set A to the set B.
  • 27. Set Identities  Set identities can be proved using membership tables.  List each combination of sets that an element can belong to.  Then show that for each such a combination the element either belongs or does not belong to both sets in the identity. Example Prove: (A ∩ B) = A ∪ B A B A B A ∩ B A ∪ B 1 1 0 0 0 0 1 0 0 1 1 1 0 1 1 0 1 1 0 0 1 1 1 1