Skip to main content
Logo image

Applied Discrete Structures

Section 6.1 Basic Definitions

In Chapter 1 we introduced the concept of the Cartesian product of sets. Let’s assume that a person owns three shirts and two pairs of slacks. More precisely, let A={blue shirt,tan shirt,mint green shirt} and B={grey slacks,tan slacks}. Then A×B is the set of all six possible combinations of shirts and slacks that the individual could wear. However, an individual may wish to restrict himself or herself to combinations which are color coordinated, or “related.” This may not be all possible pairs in A×B but will certainly be a subset of A×B. For example, one such subset may be
{(blue shirt,grey slacks),(blue shirt,tan slacks),(mint green shirt,tan slacks)}.

Subsection 6.1.1 Relations between two sets

Definition 6.1.1. Relation.

Let A and B be sets. A relation from A into B is any subset of A×B.

Example 6.1.2. A simple example.

Let A={1,2,3} and B={4,5}. Then {(1,4),(2,4),(3,5)} is a relation from A into B. Of course, there are many others we could describe; 64, to be exact.

Example 6.1.3. Divisibility Example.

Let A={2,3,5,6} and define a relation r from A into A by (a,b)r if and only if a divides evenly into b. The set of pairs that qualify for membership is r={(2,2),(3,3),(5,5),(6,6),(2,6),(3,6)}.

Subsection 6.1.2 Relations on a Set

Definition 6.1.4. Relation on a Set.

A relation from a set A into itself is called a relation on A.
The relation “divides” in Example 6.1.3 will appear throughout the book. Here is a general definition on the whole set of integers.

Definition 6.1.5. Divides.

Let a,bZ, a0. We say that a divides b, denoted ab, if and only if there exists an integer k such that ak=b.
Be very careful in writing about the relation “divides.” The vertical line symbol use for this relation, if written carelessly, can look like division. While ab is either true or false, a/b is a number.
Based on the equation ak=b, we can say that a|b is equivalent to k=ba, or a divides evenly into b. In fact the “divides” is short for “divides evenly into.” You might find the equation k=ba initially easier to understand, but in the long run we will find the equation ak=b more convenient.
Sometimes it is helpful to illustrate a relation with a graph. Consider Example 6.1.2. A graph of r can be drawn as in Figure 6.1.6. The arrows indicate that 1 is related to 4 under r. Also, 2 is related to 4 under r, and 3 is related to 5, while the upper arrow denotes that r is a relation from the whole set A into the set B.
The graph of a relation. On the left, there is a set consisting of three points, 1, 2, and 3. On the right a set consisting of two points 4 and 5.  Arrows corresponding to the ordered pairs (1,4), (2,4), and (3,5) connect the points in the two sets.
Figure 6.1.6. The graph of a relation
A typical element in a relation r is an ordered pair (x,y). In some cases, r can be described by actually listing the pairs which are in r, as in the previous examples. This may not be convenient if r is relatively large. Other notations are used with certain well-known relations. Consider the “less than or equal” relation on the real numbers. We could define it as a set of ordered pairs this way:
≤={(x,y)|xy}
However, the notation xy is clear and self-explanatory; it is a more natural, and hence preferred, notation to use than (x,y)∈≤.
Many of the relations we will work with “resemble” the relation , so xsy is a common way to express the fact that x is related to y through the relation s.
Relation Notation Let s be a relation from a set A into a set B. Then the fact that (x,y)s is frequently written xsy.

Subsection 6.1.3 Composition of Relations

With A={2,3,5,8}, B={4,6,16}, and C={1,4,5,7}, let r be the relation “divides,” from A into B, and let s be the relation from B into C. So r={(2,4),(2,6),(2,16),(3,6),(8,16)} and s={(4,4),(4,5),(4,7),(6,7)}.
Notice that in Figure 6.1.8 that we can, for certain elements of A, go through elements in B to results in C. That is:
Table 6.1.7.
2|4 and 44
2|4 and 45
2|4 and 47
2|6 and 67
3|6 and 67
The graphs of two relations being composed.
Figure 6.1.8. Relation Composition - a graphical view
Based on this observation, we can define a new relation, call it rs, from A into C. In order for (a,c) to be in rs, it must be possible to travel along a path in Figure 6.1.8 from a to c. In other words, (a,c)rs if and only if (b)B(arb and bsc). The name rs was chosen because it reminds us that this new relation was formed by the two previous relations r and s. The complete listing of all elements in rs is {(2,4),(2,5),(2,7),(3,7)}. We summarize in a definition.

Definition 6.1.9. Composition of Relations.

Let r be a relation from a set A into a set B, and let s be a relation from B into a set C. The composition of r with s, written rs, is the set of pairs of the form (a,c)A×C, where (a,c)rs if and only if there exists bB such that (a,b)r and (b,c)s.
Remark: A word of warning to those readers familiar with composition of functions. (For those who are not, disregard this remark. It will be repeated at an appropriate place in the next chapter.) As indicated above, the traditional way of describing a composition of two relations is rs where r is the first relation and s the second. However, function composition is traditionally expressed in the opposite order: sr, where r is the first function and s is the second.

Exercises 6.1.4 Exercises

1.

For each of the following relations r defined on P, determine which of the given ordered pairs belong to r
  1. xry iff x|y; (2, 3), (2, 4), (2, 8), (2, 17)
  2. xry iff xy; (2, 3), (3, 2), (2, 4), (5, 8)
  3. xry iff y=x2 ; (1,1), (2, 3), (2, 4), (2, 6)
Answer.
  1. (2,4),(2,8)
  2. (2,3),(2,4),(5,8)
  3. (1,1),(2,4)

2.

The following relations are on P={0,1,2,8,9}. Let
A={(9,8),(9,7),(6,5),(6,4),(3,2),(3,1)}
and
B={((8,6),(7,6),(5,3),(4,3),(2,0),(1,0)}.
  1. List all elements in AB.
  2. List all elements in BA.
  3. Illustrate AB and BA via a diagraph.
  4. In one version of the game of nim players A and B take turns removing one or two stones from a pile. The player who manages to remove the last stone wins. Explain how these two relations describe the winning moves for B if A plays first with nine stones in the pile at the start of the game.

3.

Let A={1,2,3,4,5} and define r on A by xry iff x+1=y. We define r2=rr and r3=r2r. Find:
  1. r
  2. r2
  3. r3
Answer.
  1. r={(1,2),(2,3),(3,4),(4,5)}
  2. r2={(1,3),(2,4),(3,5)}={(x,y):y=x+2,x,yA}
  3. r3={(1,4),(2,5)}={(x,y):y=x+3,x,yA}

4.

Given s and t, relations on Z, s={(1,n):nZ} and t={(n,1):nZ}, what are st and ts? Hint: Even when a relation involves infinite sets, you can often get insights into them by drawing partial graphs.

5.

Let ρ be the relation on the power set, P(S), of a finite set S of cardinality n defined ρ by (A,B)ρ iff AB=.
  1. Consider the specific case n=3, and determine the cardinality of the set ρ.
  2. What is the cardinality of ρ for an arbitrary n? Express your answer in terms of n. (Hint: There are three places that each element of S can go in building an element of ρ.)
Answer.
  1. When n=3, there are 27 pairs in the relation.
  2. Imagine building a pair of disjoint subsets of S. For each element of S there are three places that it can go: into the first set of the ordered pair, into the second set, or into neither set. Therefore the number of pairs in the relation is 3n, by the product rule.

6.

Consider the two relations on people: M, where aMb if a’s mother is b; and S, where aSb if a and b are siblings. Describe, in words, the two relations MS and SM in simple English terms.

7.

Let r1, r2, and r3 be relations on any set A. Prove that if r1r2 then r1r3r2r3.
Solution.
Assume (x,y)r1r3. This implies that there exist zA such that (x,z)r1 and (z,y)r3. We are given that r1r2, which implies that (x,z)r2. Combining this with (z,y)r3 implies that (x,y)r2r3, which proves that r1r3r2r3.
You have attempted 1 of 1 activities on this page.