Document Sample

```					Module #3 - Sets

Sections 2.1 & 2.2: Sets &
Set Operations

10/6/2009            (c)2001-2003, Michael P. Frank   1
Module #3 - Sets

Introduction
• A set is an unordered collection of objects
(elements, members) of the set .

10/6/2009              (c)2001-2003, Michael P. Frank   2
Module #3 - Sets

Basic notations for sets
• (1) listing all of its elements in curly braces:
Examples:
Finite sets   V= {a, e, i ,o ,u }
S= {1, 2, 3,…,99}
infinite sets:
N = {0, 1, 2, …} The Natural numbers.
Z = {…, -2, -1, 0, 1, 2, …} The set of integers.
Z+ = {1,2,3, …} The set of positive integers.
R = The set of “Real” numbers

10/6/2009                     (c)2001-2003, Michael P. Frank     3
Module #3 - Sets

Basic notations for sets
• (2) Set builder notation: For any
proposition P(x) over any universe of
discourse, {x|P(x)} is the set of all x such
that P(x).
Example
“Set of all odd positive integers less than 10”
O= {x | x is an odd positive integer less than 10}

10/6/2009                    (c)2001-2003, Michael P. Frank      4
Module #3 - Sets

Basic notations for sets

• (3) Venn Diagrams                            U: universal set

John Venn
1834-1923

10/6/2009                (c)2001-2003, Michael P. Frank                  5
Module #3 - Sets

Definition of Set Equality
• Two sets are declared to be equal if and
only if they contain exactly the same
elements.
• Example:( order and repition do not
matter)
{1 ,3 , 5} = {3, 5, 1} = {1, 3, 3, 3, 5, 5, 5}

10/6/2009               (c)2001-2003, Michael P. Frank     6
Module #3 - Sets

Membership in sets
• x∈S : x is an ∈lement or member of set S.
– e.g. 3∈N, “a”∈{x | x is a letter of the alphabet}
• x∉S :≡ ¬(x∈S)               “x is not in S”

– Set equality can be defined in terms of ∈
relation:
S=T ↔ (∀x: x∈S ↔ x∈T)

10/6/2009                  (c)2001-2003, Michael P. Frank         7
Module #3 - Sets

The Empty Set
• ∅ (“null”, “the empty set”) is the unique set
that contains no elements.
• ∅ = {}

• Empty set ∅ does not equal the singleton set {∅}
∅ ≠ {∅}

10/6/2009               (c)2001-2003, Michael P. Frank      8
Module #3 - Sets

Subset Relation
• S⊆T (“S is a subset of T”) means that every
element of S is also an element of T.
• S⊆T ⇔ ∀x (x∈S → x∈T)
• ∅⊆S, S⊆S.
If ( S ⊆ T) is true and ( T ⊆ S) is true then S = T
∀x( x∈S ↔ x∈T)
• S ⊆ T means ¬(S⊆T), i.e. ∃x(x∈S ∧ x∉T)
/

10/6/2009                (c)2001-2003, Michael P. Frank       9
Module #3 - Sets

Proper Subset
• S⊂T (“S is a proper subset of T”) means
every element of S is also an element of T,
but S ≠ T.                    Example:
{1,2} ⊂{1,2,3}

S
T
Venn Diagram equivalent of S⊂T

10/6/2009                   (c)2001-2003, Michael P. Frank   10
Module #3 - Sets

Sets Are Objects, Too!
• The objects that are elements of a set may
themselves be sets.
• E.g. let S={x | x ⊆ {1,2,3}}
then S={∅,
{1}, {2}, {3},
{1,2}, {1,3}, {2,3},
{1,2,3}}
• Note that 1 ≠ {1} ≠ {{1}} !!!!
10/6/2009                (c)2001-2003, Michael P. Frank   11
Module #3 - Sets

Cardinality and Finiteness
• |S| (read “the cardinality of S”) is a measure
of how many different elements S has.
• E.g. |∅|=0
|{1,2,3}| = 3
|{a,b}| = 2
|{{1,2,3},{4,5}}| = 2

10/6/2009              (c)2001-2003, Michael P. Frank     12
Module #3 - Sets

The Power Set Operation
• The power set P(S) of a set S is the set of all subsets of S.
• E.g.
P( {a, b}) = {∅, {a}, {b}, {a, b}}.
P( {a}) = {∅,{a})
P({∅})= {∅,{∅}}
P(∅) = {∅}

Note:
if a set has n elements then P(S) has 2n elements.

10/6/2009                    (c)2001-2003, Michael P. Frank              13
Module #3 - Sets

Ordered n- tuples
• These are like sets, except that duplicates
matter, and the order makes a difference.

• Note that (1, 2) ≠ (2, 1) ≠ (2, 1, 1).

• Note: 2- tuples are called ordered pairs

10/6/2009               (c)2001-2003, Michael P. Frank   14
Module #3 - Sets

Cartesian Products of Sets
• For sets A, B, their Cartesian product
A×B :≡ {(a, b) | a∈A ∧ b∈B }.
• E.g. {a,b}×{1,2} = {(a,1),(a,2),(b,1),(b,2)}
• Note that for finite A, B, |A×B|=|A||B|.
• Note that the Cartesian product is not
commutative: A×B≠B×A.
• E.g. {1,2}×{a,b} = {(1,a),(1,b),(2,a),(2,b)}

10/6/2009              (c)2001-2003, Michael P. Frank   15
Module #3 - Sets

Section 1.7:Set Operations
The Union Operator ∪
• For sets A, B, the A∪B is the set containing
all elements that are either in A, or in B or
in both.
• Formally:
A∪B = {x | x∈A ∨ x∈B}.

10/6/2009              (c)2001-2003, Michael P. Frank    16
Module #3 - Sets

Union Example
{2,3,5}∪{3,5,7} = {2,3,5,3,5,7} ={2,3,5,7}

10/6/2009             (c)2001-2003, Michael P. Frank   17
Module #3 - Sets

The Intersection Operator ∩
• For sets A, B, their intersection A∩B is the
set containing all elements that are in both
A and in B.
• Formally:
A∩B={x | x∈A ∧ x∈B}.

10/6/2009              (c)2001-2003, Michael P. Frank   18
Module #3 - Sets

Intersection Examples
• {a,b,c}∩{2,3} = ∅     disjoint
• {2,4,6}∩{3,4,5} = {4}

10/6/2009               (c)2001-2003, Michael P. Frank   19
Module #3 - Sets

Inclusion-Exclusion Principle
• How many elements are in A∪B?
|A∪B| = |A| + |B| − |A∩B|
• Example:
{1,2,3} ∪ {2,3,4,5} = {1,2,3,4,5}
{1,2,3} ∩ {2,3,4,5} = {2,3}
| {1,2,3,4,5}| = 3+4-2=5

10/6/2009            (c)2001-2003, Michael P. Frank   20
Module #3 - Sets

Set Difference
• For sets A, B, the difference of A and B,
written A−B, is the set of all elements that
are in A but not in B.
A − B :≡ {x | x∈A ∧ x∉B}
= {x | ¬(x∈A → x∈B) }
called: complement of B with respect to A.
Ex: {1,2,3,4,5,6}-{2,3,5,7,9,11}={1,4,6 }

10/6/2009              (c)2001-2003, Michael P. Frank   21
Module #3 - Sets

Set Difference - Venn Diagram

Set
A−B

Set A              Set B
10/6/2009                (c)2001-2003, Michael P. Frank   22
Module #3 - Sets

Set Complements
• U: universe of discourse
• A : For any set A⊆U, the complement of A,
i.e., it is U−A.
•
A = {x | x ∉ A}               A
A
• E.g., If U=N,
U
{3,5} ={0,1,2,4,6,7,...}

10/6/2009                    (c)2001-2003, Michael P. Frank       23
Module #3 - Sets

Set Identities
•    Identity:    A∪∅ = A = A∩U
•    Domination: A∪U = U , A∩∅ = ∅
•    Idempotent:   A∪A = A = A∩A
•    Double complement: ( A ) = A
•    Commutative: A∪B = B∪A , A∩B = B∩A
•    Associative: A∪(B∪C)=(A∪B)∪C ,
A∩(B∩C)=(A∩B)∩C

10/6/2009             (c)2001-2003, Michael P. Frank   24
Module #3 - Sets

DeMorgan’s Law for Sets

A∪ B = A ∩ B
A∩ B = A ∪ B

10/6/2009            (c)2001-2003, Michael P. Frank   25
Module #3 - Sets

Proving Set Identities
To prove statements about sets, of the form
E1 = E2 (where the Es are set expressions),
here are three useful techniques:
1. Prove E1 ⊆ E2 and E2 ⊆ E1 separately.
2. Use set builder notation &
logical equivalences.
3. Using set identities

10/6/2009               (c)2001-2003, Michael P. Frank   26
Module #3 - Sets

Example: Show A∩B= A∪ B
method1: Prove E1 ⊆ E2 and E2 ⊆ E1
• Part 1: Show A∩B ⊆ A ∪ B
• Assume x∈ A∩B then :
– x ∉ A∩B by the definition of the complement
– ~((x ∈ A) ∧ (x ∈ B)) by the definition of intersection
– ~(x ∈A) ∨ ~ ( x ∈B) by DeMorgan’s law
– x∉A∨ x∉B                by the definition of negation
– x ∈ A ∨ x ∈ B by the definition of the complement
– x∈A∪B             by the definition of union
This shows that : A∩B ⊆ A ∪ B
• Part 2: Show A ∪ B ⊆ A ∩B

10/6/2009                        (c)2001-2003, Michael P. Frank         27
Module #3 - Sets

Method2: set builder notation
• Show A∩B = A ∪ B
• A∩B= {x | x ∉ A∩B}
= {x | ~( x ∈ (A∩B))}
= {x | ~( x ∈ A ∧ x ∈B)}
= {x | x ∉ A ∨ x ∉ B}
= {x | x ∈ A ∨ x ∈ B)}
= {x | x ∈ A ∪ B } = A ∪ B

10/6/2009            (c)2001-2003, Michael P. Frank   28
A ∪ (B ∩ C)
Module #3 - Sets

Method3 : using set identities
• Ex: prove that using set identities:
• A ∪ (B ∩ C)      = ( C ∪ B) ∩ A

10/6/2009                        (c)2001-2003, Michael P. Frank   29

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 25 posted: 12/16/2009 language: English pages: 29