Discrete Mathematics
Discrete Mathematics
Relations
2.1 INTRODUCTION
The reader is familiar with many relations such as “less than,” “is parallel to,” “is a subset of,” and so on.
In a certain sense, these relations consider the existence or nonexistence of a certain connection between pairs
of objects taken in a definite order. Formally, we define a relation in terms of these “ordered pairs.”
An ordered pair of elements a and b, where a is designated as the first element and b as the second element,
is denoted by (a, b). In particular,
(a, b) = (c, d)
if and only if a = c and b = d. Thus (a, b) = (b, a) unless a = b. This contrasts with sets where the order of
elements is irrelevant; for example, {3, 5} = {5, 3}.
A × B = {(a, b) | a ∈ A and b ∈ B}
One frequently writes A2 instead of A × A.
EXAMPLE 2.1 R denotes the set of real numbers and so R2 = R × R is the set of ordered pairs of real numbers.
The reader is familiar with the geometrical representation of R2 as points in the plane as in Fig. 2-1. Here each
point P represents an ordered pair (a, b) of real numbers and vice versa; the vertical line through P meets the
x-axis at a, and the horizontal line through P meets the y-axis at b. R2 is frequently called the Cartesian plane.
A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}
B × A = {(a, 1), (b, 1), (c, 1), (a, 2), (b, 2), (c, 2)}
23
24 RELATIONS [CHAP. 2
Fig. 2-1
There are two things worth noting in the above examples. First of all A × B = B × A. The Cartesian product
deals with ordered pairs, so naturally the order in which the sets are considered is important. Secondly, using
n(S) for the number of elements in a set S, we have:
In fact, n(A × B) = n(A)n(B) for any finite sets A and B. This follows from the observation that, for an ordered
pair (a, b) in A × B, there are n(A) possibilities for a, and for each of these there are n(B) possibilities for b.
The idea of a product of sets can be extended to any finite number of sets. For any sets A1 , A2 , . . . , An , the
set of all ordered n-tuples (a1 , a2 , . . . , an ) where a1 ∈ A1 , a2 ∈ A2 , . . . , an ∈ An is called the product of the sets
A1 , . . . , An and is denoted by
n
A1 × A2 × · · · × An or A1
i=1
Just as we write A2 instead of A × A, so we write An instead of A × A × · · · × A, where there are n factors all
equal to A. For example, R3 = R × R × R denotes the usual three-dimensional space.
2.3 RELATIONS
Definition 2.1: Let A and B be sets. A binary relation or, simply, relation from A to B is a subset of A × B.
Suppose R is a relation from A to B. Then R is a set of ordered pairs where each first element comes from
A and each second element comes from B. That is, for each pair a ∈ A and b ∈ B, exactly one of the following
is true:
If R is a relation from a set A to itself, that is, if R is a subset of A2 = A × A, then we say that R is a relation on A.
The domain of a relation R is the set of all first elements of the ordered pairs which belong to R, and the
range is the set of second elements.
Although n-ary relations, which involve ordered n-tuples, are introduced in Section 2.10, the term relation
shall then mean binary relation unless otherwise stated or implied.
CHAP. 2] RELATIONS 25
EXAMPLE 2.3
(a) A = (1, 2, 3) and B = {x, y, z}, and let R = {(1, y), (1, z), (3, y)}. Then R is a relation from A to B since R
is a subset of A × B. With respect to this relation,
1Ry, 1Rz, 3Ry, but 1Rx, 2Rx, 2Ry, 2Rz, 3Rx, 3Rz
(b) Set inclusion ⊆ is a relation on any collection of sets. For, given any pair of set A and B, either A ⊆ B
or A ⊆ B.
(c) A familiar relation on the set Z of integers is “m divides n.” A common notation for this relation is to write
m | n when m divides n. Thus 6 | 30 but 7 | 25.
(d) Consider the set L of lines in the plane. Perpendicularity, written “⊥,” is a relation on L. That is, given any
pair of lines a and b, either a ⊥ b or a ⊥ b. Similarly, “is parallel to,” written “||,” is a relation on L since
either a b or a b.
(f) Let A be any set. Then A × A and ∅ are subsets of A × A and hence are relations on A called the universal
relation and empty relation, respectively.
Inverse Relation
Let R be any relation from a set A to a set B. The inverse of R, denoted by R −1 , is the relation from B to A
which consists of those ordered pairs which, when reversed, belong to R; that is,
R −1 = {(b, a) | (a, b) ∈ R}
For example, let A = {1, 2, 3} and B = {x, y, z}. Then the inverse of
R = {(1, y), (1, z), (3, y)} is R −1 = {(y, 1), (z, 1), (y, 3)}
Clearly, if R is any relation, then (R −1 )−1 = R. Also, the domain and range of R −1 are equal, respectively, to
the range and domain of R. Moreover, if R is a relation on A, then R −1 is also a relation on A.
Fig. 2-2
R = {(1, 2), (2, 2), (2, 4), (3, 2), (3, 4), (4, 1), (4, 3)}
(i) Form a rectangular array (matrix) whose rows are labeled by the elements of A and whose columns are
labeled by the elements of B. Put a 1 or 0 in each position of the array according as a ∈ A is or is not
related to b ∈ B. This array is called the matrix of the relation.
(ii) Write down the elements of A and the elements of B in two disjoint disks, and then draw an arrow from
a ∈ A to b ∈ B whenever a is related to b. This picture will be called the arrow diagram of the relation.
Figure 2-3 pictures the relation R in Example 2.3(a) by the above two ways.
Fig. 2-3
CHAP. 2] RELATIONS 27
EXAMPLE 2.4 Let A = {1, 2, 3, 4}, B = {a, b, c, d}, C = {x, y, z} and let
R = {(1, a), (2, d), (3, a), (3, b), (3, d)} and S = {(b, x), (b, z), (c, y), (d, z)}
Consider the arrow diagrams of R and S as in Fig. 2-4. Observe that there is an arrow from 2 to d which is followed
by an arrow from d to z. We can view these two arrows as a “path” which “connects” the element 2 ∈ A to the
element z ∈ C. Thus:
2(R ◦ S)z since 2Rd and dSz
Similarly there is a path from 3 to x and a path from 3 to z. Hence
(R ◦ S) ◦ T = R ◦ (S ◦ T )
Fig. 2-4
28 RELATIONS [CHAP. 2
a b c d x y z
1 1 0 0 0 a 0 0 0
MR = 2
0 0 0 1 and
MS = b
1 0 1
3 1 1 0 1 c 0 1 0
4 0 0 0 0 d 0 0 1
Multiplying MR and MS we obtain the matrix
x y z
1 0 0 0
2
0 0 1
M = MR MS =
3 1 0 2
4 0 0 0
The nonzero entries in this matrix tell us which elements are related by R◦S. Thus M = MR MS and MR◦S have
the same nonzero entries.
Reflexive Relations
A relation R on a set A is reflexive if aRa for every a ∈ A, that is, if (a, a) ∈ R for every a ∈ A. Thus R is
not reflexive if there exists a ∈ A such that (a, a) ∈/ R.
EXAMPLE 2.5 Consider the following five relations on the set A = {1, 2, 3, 4}:
R1 = {(1, 1), (1, 2), (2, 3), (1, 3), (4, 4)}
R2 = {(1, 1)(1, 2), (2, 1), (2, 2), (3, 3), (4, 4)}
R3 = {(1, 3), (2, 1)}
R4 = ∅, the empty relation
R5 = A × A, the universal relation
Determine which of the relations are reflexive.
Since A contains the four elements 1, 2, 3, and 4, a relation R on A is reflexive if it contains the four pairs
(1, 1), (2, 2), (3, 3), and (4, 4). Thus only R2 and the universal relation R5 = A × A are reflexive. Note that
R1 , R3 , and R4 are not reflexive since, for example, (2, 2) does not belong to any of them.