That is, the union of sets A and B, written A ∪ B, is a set that contains
everything in A, or in B, or in both.
A B
x x A
x B
∪ =
∈
∈
{ :
}
or
Example: A = {1, 3, 9}
B = {3, 5}
Therefore,
A B
∪ = { , , , }
1 3 5 9
(b) Inter sec tion
The “intersection” of sets A and B, written A ∩ B, is a set that contains exactly
those elements that are in both A and B.
A B
x x A
x B
∩ =
∈
∈
{ :
}
and
Exam ple: Given A = {1, 3, 9}, B = {3, 5}, C = {a, b, c}
A ∩ B = {3}
A ∩ C = { }
(c) Set Dif fer ence
The “set difference” of set A and set B, written as A–B, is the set that contains
everything that is in A but not in B.
A B
x x A
x B
− =
∈
∉
{ :
}
and
Given A
B
=
=
{ , , },
{ , }
1 3 9
3 5
A B
− = { , }
1 9
(d) Com ple ment
The “complement” of set A, written as A is the set containing everything that is
not in A.
Prop erties of set oper a tions
Some of the properties of the set operations follow from their definitions. The
following laws hold for the three given sets A, B and C.
Idempotency
:
A A A
A A A
∪ =
∩ =
Commutativity
:
A B B A
A B B A
∪ = ∪
∩ = ∩
Asso cia tiv ity
: (
)
(
)
(
)
(
)
A B
C A
B C
A B
C A
B C
∪
∪ = ∪
∪
∩
∩ = ∩
∩
2
Theory of Automata, Formal Languages and Computation
everything in A, or in B, or in both.
A B
x x A
x B
∪ =
∈
∈
{ :
}
or
Example: A = {1, 3, 9}
B = {3, 5}
Therefore,
A B
∪ = { , , , }
1 3 5 9
(b) Inter sec tion
The “intersection” of sets A and B, written A ∩ B, is a set that contains exactly
those elements that are in both A and B.
A B
x x A
x B
∩ =
∈
∈
{ :
}
and
Exam ple: Given A = {1, 3, 9}, B = {3, 5}, C = {a, b, c}
A ∩ B = {3}
A ∩ C = { }
(c) Set Dif fer ence
The “set difference” of set A and set B, written as A–B, is the set that contains
everything that is in A but not in B.
A B
x x A
x B
− =
∈
∉
{ :
}
and
Given A
B
=
=
{ , , },
{ , }
1 3 9
3 5
A B
− = { , }
1 9
(d) Com ple ment
The “complement” of set A, written as A is the set containing everything that is
not in A.
Prop erties of set oper a tions
Some of the properties of the set operations follow from their definitions. The
following laws hold for the three given sets A, B and C.
Idempotency
:
A A A
A A A
∪ =
∩ =
Commutativity
:
A B B A
A B B A
∪ = ∪
∩ = ∩
Asso cia tiv ity
: (
)
(
)
(
)
(
)
A B
C A
B C
A B
C A
B C
∪
∪ = ∪
∪
∩
∩ = ∩
∩
2
Theory of Automata, Formal Languages and Computation
