Lecture 6 CSC510 Sets
Lecture 6 CSC510 Sets
OPERATIONS
SET
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}
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
A
C
B
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)
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
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
U
A
B
Infinite Set
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
Example:
A = {1,2,3,6} B = { 2,4,6,9}
A ∪ B = { 1,2,3,4,6,9 }
Intersection
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)
Example:
A= {1,2,3,5,7} B = {1,5,6,8}
A - B ={2,3,7}
A Proper Subset
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 {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
Examples:
V={1 2 3 4 5}
|V|=5
A={1,2,3,4, …, 20}
|A| =20
|∅|=0
Cartesian Product
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