You are on page 1of 30

Discrete Mathematics

LECTURE 14, 15
Set Operations

Course Instructor:
1 Rida Memon
Set Operations: Union

AUB
U

A B

2
Set Operations: Union

 Formal definition for the union of two sets:


A U B = { x | x  A or x  B }

 Further examples
 {1, 2, 3} U {3, 4, 5} = {1, 2, 3, 4, 5}

 {New York, Washington} U {3, 4} = {New York, Washington,


3, 4}

 {1, 2} U  = {1, 2}

3
Set Operations: Union

 Properties of the union operation


 AU=A Identity law
 AUU=U Domination law
 AUA=A Idempotent law
 AUB=BUA Commutative law
 A U (B U C) = (A U B) U C Associative law

4
Set Operations: Intersection

A∩B
U

A B

5
Set Operations: Intersection
 Formal definition for the intersection of two sets: A ∩ B =
{ x | x  A and x  B }

 Further examples
 {1, 2, 3} ∩ {3, 4, 5} = {3}

 {New York, Washington} ∩ {3, 4} = 


 No elements in common

 {1, 2} ∩  = 
 Any set intersection with the empty set yields the empty set

6
Set Operations: Intersection

 Properties of the intersection operation


 A∩U=A Identity law
 A∩= Domination law
 A∩A=A Idempotent law
 A∩B=B∩A Commutative law
 A ∩ (B ∩ C) = (A ∩ B) ∩ C Associative law

7
Disjoint Sets
• Two sets are disjoint if the have NO elements in common

• Formally, two sets are disjoint if their intersection is the


empty set

• Another example: the set of the even numbers and the set
of the odd numbers

8
Disjoint Sets
U

A B

Overlapping Sets
U

A B
9
Disjoint Sets

 Further examples
 {1, 2, 3} and {3, 4, 5} are not disjoint

 {New York, Washington} and {3, 4} are disjoint

 {1, 2} and  are disjoint


 Their intersection is the empty set

  and  are disjoint!


 Their intersection is the empty set

10
Set Operations: Difference
• A difference of two sets is the elements in one set that are
NOT in the other.

• Difference symbol is a minus sign


• Example:
C=M-P
• Also visa-versa:

C=P-M

11
Set Operations: Difference

A-B

A B
Set Operations: Difference
 Formal definition for the difference of two sets:
_
A - B = { x | x  A and x  B }
A-B=A∩B  Important!

 Further examples
 {1, 2, 3} - {3, 4, 5} = {1, 2}

 {New York, Washington} - {3, 4} = {New York, Washington}

 {1, 2} -  = {1, 2}
 The difference of any set S with the empty set will be the set S

13
Set Operations: Symmetric Difference

• A symmetric difference of the sets contains all the elements


in either set but NOT both.

• Symmetric diff. symbol is a 


• Example:
C=MP

14
Set Operations: Symmetric Difference
 Formal definition for the symmetric difference of two
sets:
A  B = { x | (x  A or x  B) and x  A ∩ B}
A  B = (A U B) – (A ∩ B)  Important!

 Further examples
 {1, 2, 3}  {3, 4, 5} = {1, 2, 4, 5}
 {New York, Washington}  {3, 4} = {New York, Washington, 3, 4}
 {1, 2}   = {1, 2}
 The symmetric difference of any set S with the empty set will be the set
S
15
Complement of Sets
• A complement of a set is all the elements that are NOT
in the set

• Difference symbol is a bar above the set name: or

16
Complement of Sets
_
A
U

A B
A

17
Complement of Sets
_
B
U

A B

18
Complement of Sets

 Formal definition for the complement of a set: A = { x | x  A }


 Or U – A, where U is the universal set

 Further examples (assuming U = Z)


 {1, 2, 3} = { …, -2, -1, 0, 4, 5, 6, … }

19
Complement of Sets

 Properties of complement sets

 ¯
¯A = A Complementation law
 AU¯
A=U Complement law
 A ∩¯
A= Complement law

20
Set Identities

 Set identities are basic laws on how set operations work


 Many have already been introduced on previous slides
 Just like logical equivalences!
 Replace U with 
 Replace ∩ with 
 Replace  with F
 Replace U with T

21
Set Identities: De-Morgan
Again
 These should look
very familiar…

A B  A B
A B  A B

22
How to Prove a Set Identity

 For example: A∩B=B-(B-A)


 Five methods:
 Use Venn Diagram
 Use the basic set identities
 Use membership tables
 Prove each set is a subset of each other
 This is like proving that two numbers are equal by showing
that each is less than or equal to the other
 Use set builder notation and logical equivalences

23
Use Venn Diagrams
A∩B=B-(B-A)

A B

B-(B-A)
A∩B B-A

24
Proof by using basic set identities
 Prove that A∩B=B-(B-A)
A  B  B-(B  A ) Definition of difference
 B (B  A ) Definition of difference
 B (B  A ) DeMorgan’s law
 B (B  A) Complementation law
 (B  B ) (B  A) Distributive law
  (B  A) Complement law
 (B  A) Identity law
 A B Commutative law 25
Membership Table

• Membership tables show all the combinations of


sets an element can belong to
– 1 means the element belongs, 0 means it does not
• Consider the following membership table:
A B AUB A∩B A-B
1 1 1 1 0
1 0 1 0 1
0 1 1 0 0
0 0 0 0 0
• The top
bottom
third
second
row
row
row
row
isisall
all
isiselements
all
elements
allelements
elements
that
that
that
that
belong
belong
belong
belong
to
to both
to
set
toneither
B
set
sets
but
AAnot
but
set
not
set
A
and
orA
set
BsetBB

 Thus, these elements
Thus, these elements are
are in
neither
in the
the union
union,
the union,
union and
but difference,
and not
thethe
intersection,
intersection
intersection,butbut
not not
nor
the
or
intersection
difference
the difference 26
Proof by Membership Tables

 Thefollowing membership table shows that


A∩B=B-(B-A)
A B A∩B B-A B-(B-A)
1 1 1 0 1
1 0 0 0 0
0 1 0 1 0
0 0 0 0 0

• Because the two indicated columns have the


same values, the two expressions are identical
• This is similar to Boolean logic!
27
Reading Assignment

 Chapter 2

 Section 2.2
 Page 127 – 132
 Page 134 – 135
 Page 138

28
Practice Questions

 Chapter 2

 Section 2.2
 All related Questions
 Problem 63 - 65

29
Thanks

 End of Lecture
 Q/A

30

You might also like