4. 4
Set operations: Union
• Formal definition for the union of two sets:
• Further examples
{ }A B x x A x B∪ = ∈ ∈∨
{ }orA B x x A x B∪ = ∈ ∈
3 5 7 3 5 7{2, , , ,11,13} {1, , , ,9} {1,2, , , ,9,113 5 7 ,13}∪ =
{2,3,5,7,11,13} {2,3,5,7,11,13}∅ =∪
5. 5
Set operations: Union
• Properties of the union operation
Identity law
Domination law
Idempotent law
Commutative law
Associative law
A A∪ ∅ =
Empty set=∅ Universal setU =
A U U∪ =
A A A∪ =
A B B A∪ = ∪
( ) ( )A B C A B C∪ ∪ = ∪ ∪
7. 7
Set operations: Intersection
• Formal definition for the intersection of two
sets:
• Further examples
{ }A B x x A x B∩ = ∈ ∈∧
{2, , , ,11,13} {1, , , ,9}3 5 7 3 5 7 7{ }3,5,=∩
{2,3,5,7,11,13}∩ ∅ = ∅
{ }andA B x x A x B∩ = ∈ ∈
8. 8
Set operations: Intersection 4
• Properties of the intersection operation
Identity law
Domination law
Idempotent law
Commutative law
Associative law
A U A∩ =
A∩ ∅ = ∅
A A A∩ =
A B B A∩ = ∩
( ) ( )A B C A B C∩ ∩ = ∩ ∩
10. 10
Disjoint sets
• Formal definition for disjoint sets: two sets
are disjoint if their intersection is the empty
set.
• i.e.
• Further examples
{1, 2, 3} and {3, 4, 5} are not disjoint
{1, 2} and ∅ are disjoint
• Their intersection is the empty set
∅ and ∅ are disjoint!
• Their intersection is the empty set
A B∩ = ∅
12. 12
• Formal definition for the difference of two
sets:
• Further examples
Set operations: Difference
{ }A B x x A x B− = ∈ ∉∧
{ , , , , , } {1,3 5 7 3 5 7, , ,9}2 11 13 2 11 3{ , , }1− =
{ }andA B x x A x B− = ∈ ∉
c
A B A B− = ∩
c
A A A U A′= = = −
13. 13
• Formal definition for the symmetric difference of
two sets:
Further examples
Set operations: Symmetric
Difference
{ }A B x x A B x A B⊕ = ∈ ∪ ∉ ∩∧
( ) ( )A B A B A B⊕ = ∪ − ∩
( ) ( )A B A B B A⊕ = − ∪ −
{2, , , ,11,13} { , , , , } {2,13 5 7 3 5 1,13,7 9}1 9 1,⊕ =
16. 16
Complement sets
• Formal definition for the complement of a
set c
A A U A′= = −
1,2,3,... 0{ },1U =
,3,2 }7{ 5,A =
,4, ,6,8 }0{2 5 ,1B =
1, , ,4, ,6, ,8,9,10{ , , ,2 3 5 7 2 3 5} }7{c
A U A −= − =
1,4,6,8,9 1{ }, 0c
A =
18. 18
De Morgan Laws
• For any
we have
( ) ,c c c
A B A B= ∩∪
,A B U⊆ ≠ ∅
( )c c c
A B A B= ∪∩
19. Q:
19
1,2,3,... 0{ },1U =
,3,2 }7{ 5,A =
,4, ,6,8 }0{2 5 ,1B =
2 5,3,4, ,6,7,8 1{ }, 0A B∪ =
{ 5, }2A B∩ =
1,4,6,8,9,10{ }c
A U A= − =
1,3,7,9{ }c
B U B= − =
Verify De Morgan’s Laws
20. 20
( ) ,9( ) 1{ }c
U A BA B ∪= − =∪
1,3,4,6,7,8,9,1{( ( ) 0})c
A U A BB ∩∩ = − =
1,3,4,6,7,8,9,10{ }c c
A B∪ =
{1 },9c c
A B =∩
( )c c c
A B A B=∪ ∩
( )c c c
A B A B=∩ ∪
22. 22
A B A B A B= + −∪ ∩
Exp.: ,3,2 }7{ 5,A =
,4, ,6,8 }0{2 5 ,1B =
2 5,3,4, ,6,7,8 1{ }, 0A B∪ =
U
B
A B∩
A B∪
A
2
5
3
7
4
6
8
10
8 4 6 2= + −
23. Q:
Each student in a class of 45 students can
speak either Urdu or English. If 25 of the
students can speak Urdu and 15 can speak
both, find, analytically, the number of those
who can speak
(i) English, (ii) English only, (iii) Urdu only?
23
27. 27
( ) 25, ( ) 15, ( ) 45.n U n U E n U E= ∩ = ∪ =
( ) ( ) ( ) ( )n U E n U n E n U E∪ = + ∩-
( ) ( ) ( ) ( ) 45 25 15 35n E n U E n U n U E= ∪ + ∩ = + =- -
( ) ( ) 35 15 20,n E n U E∩ = − =-
( ) ( ) 20 15 5.n U n U E∩ = − =-