0% found this document useful (0 votes)
35 views35 pages

Set Operations

The document discusses set operations such as union, intersection, difference, symmetric difference, and complement. It provides definitions and examples of how to calculate these operations using set builder notation and logical equivalences. It also covers proving sets are equal using membership tables, containment proofs, set builder notation, and Venn diagrams. Key concepts covered include logical implications for sets, cardinality, identities for set operations, and collections of sets.

Uploaded by

Luke Pearce
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views35 pages

Set Operations

The document discusses set operations such as union, intersection, difference, symmetric difference, and complement. It provides definitions and examples of how to calculate these operations using set builder notation and logical equivalences. It also covers proving sets are equal using membership tables, containment proofs, set builder notation, and Venn diagrams. Key concepts covered include logical implications for sets, cardinality, identities for set operations, and collections of sets.

Uploaded by

Luke Pearce
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 35

Set Operations

When sets are equal

A  B  x[ x  A  x  B ]
A equals B iff for all x, x is in A iff x is in B

A  B  x[( x  A  x  B)  ( x  B  x  A)]

or

A B  A BB A

… and this is what we do to prove sets equal


Note: remember all that stuff about implication?

pq p  q  q  p biconditional
q p converse
p   q inverse
q   p pq contrapositive
Union of two sets

Give me the set of elements, x where x is in A or x is in B

A  B  {x | x  A  x  B}
Example
A  {1,2,3,4,5} B  {4,5,6,7,8}
A membership table
A  B  {1,2,3,4,5,6,7,8}

A B A B
0 0 0
0 1 1
1 0 1
1 1 1 OR
Union of two sets
A  B  {x | x  A  x  B}
Note:
we are using set builder notation and the
laws of logical equivalence (propositional equivalence)
Intersection of two sets

Give me the set of elements, x where x is in A and x is in B

A  B  {x | x  A  x  B}
Example
A  {1,2,3,4,5} B  {4,5,6,7,8}
A  B  {4,5}

A B A B
0 0 0
0 1 0
1 0 0 AND
1 1 1
A  B  {x | x  A  x  B}
Disjoint sets

A  B  {}  disjoint ( A, B)

x[ x  A  x  B ]
Difference of two sets

Give me the set of elements, x


where x is in A and x is not in B
A  B  {x | x  A  x  B}
Example
A  {1,2,3,4,5} B  {4,5,6,7,8}
A  B  {1,2,3} A B  A B

A B A B
0 0 0
0 1 0
1 0 1
1 1 0 A  B
A  B  {x | x  A  x  B}
Note: Compliment of a set

A  {x | x  U  x  A}
Symmetric Difference of two sets

Give me the set of elements, x


where x is in A and x is not in B OR
x is in B and x is not in A

A  B  ( A  B )  ( B  A)
Example
A  {1,2,3,4,5} B  {4,5,6,7,8}
A  B  {1,2,3,6,7,8}

A B A B
0 0 0
0 1 1
1 0 1 XOR
1 1 0
A  B  ( A  B )  ( B  A)
Complement of a set

Give me the set of elements, x where x is not in A

A  {x | x  A}
Example
A  {1,2,3,4,5}
U  {0,1,2,3,4,5,6,7,8,9,10} U is the “universal set”

A U  A

A  {0,6,7,8,9,10}
Not
Cardinality of a Set

In claire

• A = {1,3,5,7}
• B = {2,4,6}
• C = {5,6,7,8}

• |A u B| ?
• |A u C|
• |B u C|
• |A u B u C|
Cardinality of a Set

| A B || A || B|| A B|

The principle of inclusion-exclusion


Cardinality of a Set The principle of inclusion-exclusion

| A B || A || B|| A B|

Potentially counted twice (“over counted”)


Set Identities Note similarity to logical equivalences!

A  {}  A
Identity
A U  A
A U  U Domination
A  {}  {}
A A  A
Indempotent
A A  A
•Think of
• U as true (universal)
• {} as false (empty)
• Union as OR
• Intersection as AND
• Complement as NOT
Set Identities Note similarity to logical equivalences!

A B  B  A
Commutative
A B  B  A
A  ( B  C )  ( A  B)  C
Associative
A  ( B  C )  ( A  B)  C
A  ( B  C )  ( A  B)  ( A  C ) Distributive
A  ( B  C )  ( A  B)  ( A  C )

A B  A  B
De Morgan
A B  A  B
Equivalence Name
p T  p
identity law
p F  p
p T  T
domination law
pF  F
p p  p
indempotent laws
p p  p
(p)  p double negation law
pq  q p
commutative laws
pq  q p
( p  q)  r  p  (q  r )
associative laws
( p  q)  r  p  (q  r )
p  (q  r )  ( p  q)  ( p  r )
distributive law
p  (q  r )  ( p  q)  ( p  r )
( p  q )  p  q
De Morgan's laws
( p  q )  p  q
p  ( p  q)  p
absorption laws
p  ( p  q)  p
p  p  T
negation laws
p  p  F
Four ways to prove two sets A and B equal

• a membership table
• a containment proof
• show that A is a subset of B
• show that B is a subset of A
• set builder notation and logical equivalences
• Venn diagrams
RTP : A  B  A  B

Prove lhs is a subset of rhs

Prove rhs is a subset of lhs


RTP : A  B  A  B

… set builder notation and logical equivalences

{x | x  A  B}
{x | ( x  A  B )} Defn of complement

{x | ( x  A  x  B)} Defn of intersection

De Morgan law
{x | ( x  A)  ( x  B)}
Defn of complement
{x | x  A  x  B }
{x | x  A  B } Defn of union
Class

RTP : A  B  A  B

prove using membership table


Me
RTP : A  B  A  B
A B A B A B A B A B
0 0 0 1 1 1 1
0 1 0 1 1 0 1
1 0 0 1 0 1 1
1 1 1 0 0 0 0

They are the same


Class

RTP : A  B  A  B

prove using set builder and logical equivalence


Me
RTP : A  B  A  B

A  B  {x | x  A  B}
 {x | ( x  A  B)} Defn of 
 {x | ( x  A  x  B} Defn of  (union)
 {x | ( x  A)  ( x  B))} De Morgan law
 {x | ( x  A)  ( x  B)} Defn of 
 {x | ( x  A)  ( x  B)} Defn of complement
 {x | x  A  B} Defn of  (intersection)
 A B Meaning of set builder notation
RTP : A  ( B  A)  {} Prove using set builder and logical equivalences

A  ( B  A)
 {x | x  A  x  ( B  A)}
 {x | x  A  ( x  B  x  A)}
 {x | x  A  x  A  x  B}
 {x | x  {}  x  B}
 {}
A containment proof

See the text book 

That’s a cop out if ever I saw one!


A containment proof Guilt kicks in

To do a containment proof of A = B do as follows

1. Argue that an arbitrary element in A is in B


i.e. that A is an improper subset of B

2. Argue that an arbitrary element in B is in A


i.e. that B is an improper subset of A

3. Conclude by saying that since A is a subset of B, and vice versa


then the two sets must be equal
Collections of sets

A i  A1  A2  ...  An
i 1

A i  A1  A2  ...  An
i 1

You might also like