Chapter 3 (Discrete Structures)
Chapter 3 (Discrete Structures)
3.1 Introduction
Definition 3.1. A set is an unordered collection of objects.
Often, the objects in a set have a common property. For instance, all the
students in this class make up a set. We denote to a set by uppercase letters like
A, B, C, .. etc.
Definition 3.2. The objects in a set are called the elements, or members, of the
set. A set is said to contain its elements.
Example 3.1.
13
4. The set of positive integers less than 100 can be denoted by {1, 2, 3, · · · , 99}.
Another way to describe a set is to use set builder notation. In this way, we
characterize all those elements in the set by stating the property or properties
they must have to be members. For instance, the set O of all odd positive integers
less than 10 can be written as
We often use this type of notation to describe sets when it is impossible to list
all the elements of the set.
Example 3.2.
1. The set O of all odd integers can be described as
O = {x ∈ Z | x = 2k + 1, k ∈ Z}.
E = {x ∈ Z | x = 2k, k ∈ Z}.
4. The set of positive integers less than 100, {1, 2, 3, · · · , 99} can be described
by
{x ∈ Z+ | x < 100}.
Remark 3.1. These sets, each denoted using a boldface letter, play an important
role in discrete mathematics:
N = {0, 1, 2, 3, · · · } the set of natural numbers
Z = {· · · , −3, −2, −1, 0, 1, 2, 3, · · · } the set of integer numbers
Z+ = {1, 2, 3, · · · } the set of positive integers
p
Q= p ∈ Z, q ∈ Z, q 6= 0 the set of rational numbers
q
0
R = Q ∪ Q the set of real numbers.
14
Definition 3.3. Two sets A and B are equal if and only if they have the same
elements, and we write A = B.
Example 3.3. The sets {1, 3, 5}, {3, 1, 5} and {1, 1, 3, 3, 3, 5, 5, 5, 5} are equal
because they have the same elements.
Example 3.4. The Venn diagram that represents V , the set of vowels in the
English alphabet is as follows.
There is a special set that has no elements. This set is called the empty set,
or null set, and is denoted by φ. The empty set can also be denoted by { }. A
set with one element is called a singleton set.
Definition 3.4. The set A is said to be a subset of B if and only if every element
of A is also an element of B. We use the notation A ⊆ B to indicate that A is a
subset of the set B.
15
U
Example 3.5.
2. Z is a subset of Q.
3. Q is a subset of R.
4. The set of people of Yemen is a subset of the people of Yemen (that is, it
is a subset of itself).
(i) φ ⊆ S.
(ii) S ⊆ S.
16
Actually, to prove that two sets A and B are equal, we must prove that A ⊆ B
and B ⊆ A.
Now, if a set A is a subset of a set B but A 6= B, we write A ⊂ B and say
that A is a proper subset of B.
Definition 3.5. Let S be a set. The cardinality of S denoted by |S| is the
number of distinct elements in S.
Example 3.6.
1. If A = {1, 3, 5, 7, 9}, then |A| = 5.
2. {1, 3, 3, 5, 5} = 3.
3. φ = 0.
Example 3.7. What is the power set of the set S = {0, 1, 2}?
Solution: By Definition 3.6, |P (S)| = 23 = 8. Therefore,
P (S) = φ, {0}, {1}, {2}, {0, 1}, {0, 2}, {1, 2}, S .
Example 3.8. What is the power set of the empty set? What is the power set
of the set {φ}?
Solution: |P (φ)| = 20 = 1. Therefore, P
(φ) = {φ}.
1
|P ({φ})| = 2 = 2. Therefore, P ({φ}) = φ, {φ} .
17
Example 3.9. What is the Cartesian product of A = {1, 2} and
B = {a, b, c}?
Example 3.10. Show that the Cartesian product B × A is not equal to the
Cartesian product A × B, where A and B are as in Example 3.9.
18
Exercises 4
4. Suppose that A = {2, 4, 6}, B = {2, 6}, C = {4, 6} and D = {4, 6, 8}.
Determine which of these sets are subsets of which other of these sets.
19
8. Determine whether each of these statements is true or false.
(i) 0 ∈ φ.
(ii) {0} ⊂ φ.
(iii) φ ∈ φ .
(iv) {φ} ⊂ φ, {φ} .
(v) {φ} ⊂ φ, {φ} .
(vi) φ ∈ φ, {φ} .
(vii) {φ} = {φ}, {φ} .
9. Determine whether each of these sets is the power set of a set, where a and
b are distinct elements.
(i) φ.
(ii) φ, {a} .
(iii) φ, {a}, {φ, a} .
(iv) φ, {a}, {b}, {a, b} .
(i) A × B.
(ii) B × A.
20
3.4 Set Operations
In this section, some operations on sets are presented.
An element x belongs to the union of the sets A and B if and only if x belongs
to A or x belongs to B. Hence,
A ∪ B = x|x ∈ A ∨ x ∈ B .
The Venn diagram shown in Figure 3.3 represents the union of two sets A
and B. The area that represents A ∪ B is the shaded area within either the circle
representing A or the circle representing B.
A B
Example 3.11. The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5};
that is, {1, 3, 5} ∪ {1, 2, 3} = {1, 2, 3, 5}.
21
An element x belongs to the intersection of the sets A and B if and only if x
belongs to A and x belongs to B. Hence,
A ∩ B = x|x ∈ A ∧ x ∈ B .
The Venn diagram shown in Figure 3.4 represents the intersection of two sets
A and B. The shaded area that is within both the circles representing the sets
A and B is the area that represents the intersection of A and B.
A B
A∩B
Example 3.12. The intersection of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 3};
that is, {1, 3, 5} ∩ {1, 2, 3} = {1, 3}.
Definition 3.10. Two sets are called disjoint if their intersection is the empty
set.
We often are interested in finding the cardinality of a union of two finite sets
A and B. Note that |A| + |B| counts each element that is in A but not in B or in
B but not in A exactly once, and each element that is in both A and B exactly
twice. Thus, if the number of elements that are in both A and B is subtracted
from |A| + |B|, elements in A ∩ B will be counted only once. Hence,
22
3.4.3 Difference of two sets
Definition 3.11. Let A and B be two sets. The difference of A and B, denoted
by A − B, is the set containing those elements that are in A but not in B. The
difference of A and B is also called the complement of B with respect to A.
The Venn diagram shown in Figure 3.5 represents the difference of the sets A
and B. The shaded area inside the circle that represents A and outside the circle
that represents B is the area that represents A − B.
A B
A−B
Example 3.14. The difference of the sets {1, 3, 5} and {1, 2, 3} is the set {5};
that is, {1, 3, 5} − {1, 2, 3} = {5}. This is different from the difference of {1, 2, 3}
and {1, 3, 5}, which is the set {2}.
23
In Figure 3.6, the shaded area outside the circle representing A is the area
representing A.
Example 3.15. Let The universal set U be the set of letters of the English
alphabet. Then the complement of the set of vowels A = {a, e, i, o, u} is
A = {b, c, d, f, g, h, j, k, l, m, n, p, q, r, s, t, v, w, x, y, z}.
Example 3.16. Let A be the set of positive integers greater than 10 (where the
universal set U is the set of all positive integers). Then A = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.
24
Identity Name of The Identity
Associative Laws
A ∪ B ∪ C = A ∪ B ∪ C
A∩ B∩C = A∩B ∩C
A ∪ B ∩ C = A ∪ B ∩ A ∪ C Distributive Laws
A∩ B∪C = A∩B ∪ A∩C
A ∪ A ∩ B = A Absorption Laws
A∩ A∪B =A
25
Finally, in the third way we can prove these identities by using a type of
tables is called a membership table. We illustrate the set builder type of proof
by establishing the second of De Morgan’s laws as follows:
Example 3.17. Use the set builder notation and logical equivalences to prove
that:
A ∩ B = A ∪ B.
Solution:
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 ∨ x∈B
=A ∪ B.
Example 3.18 illustrates the second way of proving the set identities.
Solution: Let
x ∈ A ∩ B ∪ C ⇒x ∈ A ∧ x ∈ B ∪ C
⇒x ∈ A ∧ x ∈ B ∨ x ∈ C
⇒ x∈A ∧ x∈ B ∨ x∈A ∧ x∈ C
⇒x ∈ A ∩ B ∨ x ∈ A ∩ C
⇒x ∈ A ∩ B ∪ A ∩ C .
Therefore,
A∩ B∪C ⊆ A∩B ∪ A∩C (1)
Now, let
26
x∈ A∩B ∪ A∩C ⇒x ∈ A ∩ B ∨ x ∈ A ∩ C
⇒ x∈A ∧ x∈ B ∨ x∈A ∧ x∈ C
⇒x ∈ A ∧ x ∈ B ∨ x ∈ C
⇒x ∈ A ∧ x ∈ B ∪ C
⇒x ∈ A ∩ B ∪ C
Thus,
A∩B ∪ A∩C ⊆ A∩ B∪C (2)
A B C B ∪C A∩ B∪C A∩B A∩C A∩B ∪ A∩C
1 1 1 1 1 1 1 1
1 1 0 1 1 1 0 1
1 0 1 1 1 0 1 1
1 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0
Table 3.2: A Membership Table for A ∩ B ∪ C = A ∩ B ∪ A ∩ C
27
Additional set identities can be established using those that we have already
proved. Consider Example 3.20.
Solution:
A ∪ B ∩ C =A ∩ B ∩ C
=A ∩ B ∪ C
=A ∩ C ∪ B
= C ∪ B ∩ A.
U
C
A B
28
U
C
A B
Example 3.21. Let A = {0, 2, 4, 6, 8}, B = {0, 1, 2, 3, 4}, and C = {0, 3, 6, 9}.
What are A ∪ B ∪ C and A ∩ B ∩ C ?
Definition 3.13. The union of a collection of sets is the set that contains those
elements that are members of at least one set in the collection, i.e.
n
[
A1 ∪ A2 ∪ · · · ∪ An = Ai .
i=1
Definition 3.14. The intersection of a collection of sets is the set that contains
those elements that are members of all the sets in the collection, i.e.
n
\
A1 ∩ A2 ∩ · · · ∩ An = Ai .
i=1
29
A1 = {1, 2, 3, · · · }, A2 = {2, 3, 4, · · · }, . . . , An = {n, n + 1, n + 2, · · · }. Hence,
n
[ n
[
Ai = {i, i + 1, i + 2, · · · } = {1, 2, 3, · · · } = A1
i=1 i=1
and n n
\ \
Ai = {i, i + 1, i + 2, · · · } = {n, n + 1, n + 2, · · · } = An
i=1 i=1
and ∞
\
A1 ∩ A2 ∩ · · · ∩ An ∩ · · · = Ai .
i=1
and ∞ ∞
\ \
Ai = {1, 2, 3, · · · , i} = {1} = A1 .
i=1 i=1
30
(i) φ ∈
/ S or ∀ X ∈ S, X =
6 φ .
(ii) ∀ X, Y ∈ S, X ∩ Y = φ.
n
[
(iii) Xi = A, where Xi ∈ S, ∀ i = 1, 2, · · · , n.
i=1
Example 3.24. Suppose A = {1, 2, 3, 4, 5, 6}. Which of the following sets repre-
sent a partition of A.
S1 = {1, 4, 5}, {2}, {3, 6}
S2 = φ, {1, 2}, {3, 4, 5, 6}
S3 = {1, 2, 3, 4}, {4, 5, 6}
S4 = {1, 2}, {4, 5, 6} .
Next, for S2 :
Also, for S3 :
Finally, for S4 :
31
Therefore, S4 is not partition of A.
Solution: Let A denotes to the set of all odd integers in U , B denotes to the set
of all even integers in U and C denotes to the set of integers not exceeding 5 in
U . i.e. A = {1, 3, 5, 7, 9}, B = {2, 4, 6, 8, 10} and C = {1, 2, 3, 4, 5}. Therefore,
A : 1010101010, B : 0101010101, and C : 1111100000
Solution: Using the membership table technique for the corresponding positions
in the bit strings, it can be seen that:
A ∪ B : 1010101010 ∪ 0101010101 = 1111111111 : U .
A ∪ C : 1010101010 ∪ 1111100000 = 1111101010 : {1, 2, 3, 4, 5, 7, 9}.
B ∩ C : 0101010101 ∩ 1111100000 = 0101000000 : {2, 4}.
A − C = A ∩ C : 1010101010 ∩ 0000011111 = 0000001010 : {7, 9},
32
Exercises 5
(i) A ∪ B
(ii) A ∩ B
(iii) A − B
(iv) B − A
4. Prove the first De Morgan law in Table 3.1 by showing that if A and B two
are sets, then A ∪ B = A ∩ B
(i) A ∪ (B ∪ C) = (A ∪ B) ∪ C
(ii) A ∩ (B ∩ C) = (A ∩ B) ∩ C
33
(iii) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C).
(i) A ∩ B ∩ C
(ii) A ∪ B ∪ C
(iii) (A ∪ B) ∩ C
(iv) (A ∩ B) ∪ C
(i) Ai = {i, i + 1, i + 2, · · · }.
(ii) Ai = {0, i}.
(iii) Ai = {−i, i}.
(iv) Ai = {−i, −i + 1, · · · , −1, 0, 1, · · · , i − 1, i}.
12. Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. Express each of these sets with bit
strings
13. In Exercise 12, find by using the bit strings of the sets
(i) A ∩ B.
(ii) A ∪ B.
(iii) B − A.
(iv) C − A.
(v) C − B.
34
14. Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. Find the set specified by each of these
bit strings
(i) 1111001111.
(ii) 0101111000.
(iii) 1000000001.
35