Relations
(Content adapted from Critchlow & Eck)
In the Functions section, we saw that "mother of" is a functional relationship because every person has one and only one mother, but that "child of" is not a functional relationship, because a person can have no children or more than one child. However, the relationship expressed by "child of" is certainly one that we have a right to be interested in and one that we should be able to deal with mathematically.
There are many examples of relationships that are not functional relationships. The relationship that holds between two natural numbers and when is an example in mathematics. The relationship between a person and a book that that person has on loan from the library is another. Some relationships involve more than two entities, such as the relationship that associates a name, an address, and a phone number in an address book or the relationship that holds among three real numbers , , and if . Each of these relationships can be represented mathematically by what is called a "relation."
A relation on two sets, and , is defined to be a subset of . Since a function from to is defined, formally, as a subset of that satisfies certain properties, a function is a relation. However, relations are more general than functions, since any subset of is a relation. We also define a relation among three or more sets to be a subset of the cross product of those sets. In particular, a relation on , , and is a subset of .
For example, if is the set of people and is the set of books owned by a library, then we can define a relation on the sets and to be the set . The fact that a particular is a fact about the world that the library will certainly want to keep track of. When a collection of facts about the world is stored on a computer, it is called a database. We'll see in the next section that relations are the most common means of representing data in databases.
If is a set and is a relation on the sets and (that is, on two copies of ), then is said to be a binary relation on . That is, a binary relation on the set is a subset of . The relation consisting of all ordered pairs of people such that is a child of is a binary relation on the set of people. The set is a binary relation on . Similarly, we define a ternary relation on a set to be a subset of . The set is a ternary relation on . For complete generality, we can define an -ary relation on , for any positive integer , to be a subset of , where occurs times in the cross product.
For the rest of this section, we will be working exclusively with binary relations. Suppose that . That is, suppose that is a binary relation on a set . If , then we say that is related to by . Instead of writing "", we will often write "". This notation is used in analogy to the notation to express the relation that is less than or equal to . Remember that is just an alternative way of writing . In fact, we could consider the relation to be a set of ordered pairs and write in place of the notation .
Properties of Relations
In many applications, attention is restricted to relations that satisfy some property or set of properties. (This is, of course, just what we do when we study functions.) We begin our discussion of binary relations by considering several important properties. In this discussion, let be a set and let be a binary relation on , that is, a subset of .
is said to be reflexive if . That is, a binary relation on a set is reflexive if every element of the set is related to itself. This is true, for example, for the relation on the set , since for every . On the other hand, it is not true for the relation on , since, for example, the statement is false.1
is called transitive if . Transitivity allows us to "chain together" two true statements and , which are "linked" by the that occurs in each statement, to deduce that . For example, suppose is the set of people, and define the relation on such that if and only if is a child of . The relation is not transitive because the child of a child of a person is not a child of that person. Suppose, on the other hand, that we define a relation on such that if and only if is a descendent of . Then is a transitive relation on the set of people, since a descendent of a descendent of a person is a descendent of that person. That is, from the facts that Elizabeth is a descendent of Victoria and Victoria is a descendent of James, we can deduce that Elizabeth is a descendent of James. In the mathematical world, the relations and on the set are both transitive.
is said to be symmetric if . That is, whenever is related to , it follows that is related to . The relation "is a first cousin of" on the set of people is symmetric, since whenever is a first cousin of , we have automatically that is a first cousin of . On the other hand, the "child of" relation is certainly not symmetric. The relation on is not symmetric. From the fact that , we cannot conclude that . It is true for some and in that , but it is not true for all and in .
Finally, is antisymmetric if . The relation is antisymmetric if for any two distinct elements and of , we can't have both and . The relation on is antisymmetric because from the facts that and , we can deduce that . The relation "child of" on the set of people is antisymmetric since it's impossible to have both that is a child of and is a child of .
Ordering Relations
There are a few combinations of properties that define particularly useful types of binary relations. The relation on the set is reflexive, antisymmetric, and transitive. These properties define what is called a partial order: A partial order on a set is a binary relation on that is reflexive, antisymmetric, and transitive.
Another example of a partial order is the subset relation, , on the power set of any set. If is a set, then of course is a set in its own right, and can be considered to be a binary relation on this set. Two elements and of are related by if and only if . This relation is reflexive since every set is a subset of itself. The fact that it is antisymmetric follows from the Set Equality Theorem. The fact that it is transitive was Exercise 11 in the Set Concepts section.
The ordering imposed on by has one important property that the ordering of subsets by does not share. If and are natural numbers, then at least one of the statements and must be true. However, if and are subsets of a set , it is certainly possible that both and are false. A binary relation on a set is said to be a total order if it is a partial order and furthermore for any two elements and of , either or . The relation on the set is a total order. The relation on is not. (Note once again the slightly odd mathematical language: A total order is a kind of partial order—not, as you might expect, the opposite of a partial order.)
For another example of ordering, let be the set of strings that can be made from lowercase letters. contains both English words and nonsense strings such as "sxjja". There is a commonly used total order on the set , namely alphabetical order.
Equivalence Relations and Partitions
We'll approach another important kind of binary relation indirectly, through what might at first appear to be an unrelated idea. Let be a set. A partition of is defined to be a collection of non-empty subsets of such that each pair of distinct subsets in the collection is disjoint and the union of all the subsets in the collection is . A partition of is just a division of all the elements of into non-overlapping subsets. For example, the sets , , , and form a partition of the set . Each element of occurs in exactly one of the sets that make up the partition. As another example, we can partition the set of all people into two sets, the set of those who have taken Foundations and the set of those who have not. Biologists try to partition the set of all organisms into different species. Librarians try to partition books into various categories such as fiction, biography, and poetry. In the real world, classifying things into categories is an essential activity, although the boundaries between categories are not always well-defined. The abstract mathematical notion of a partition of a set models the real-world notion of classification. In the mathematical world, though, the categories are sets and the boundary between two categories is sharp.
In the real world, items are classified in the same category because they are related in some way. This leads us from partitions back to relations. Suppose that we have a partition of a set . We can define a relation on by declaring that for any and in , if and only if and are members of the same subset in the partition. That is, two elements of are related if they are in the same category. It is clear that the relation defined in this way is reflexive, symmetric, and transitive.
An equivalence relation is defined to be a binary relation that is reflexive, symmetric, and transitive. Any relation defined, as above, from a partition is an equivalence relation. Conversely, we can show that any equivalence relation defines a partition. Suppose that is an equivalence relation on a set . Let . We define the equivalence class of under the equivalence relation to be the subset defined as . That is, the equivalence class of is the set of all elements of that are related to . In most cases, we'll assume that the relation in question is understood, and we'll write instead of . Note that each equivalence class is a subset of . The following theorem shows that the collection of equivalence classes form a partition of .
Theorem: Partitions Let be a set and let be an equivalence relation on . Then the collection of all equivalence classes under is a partition of .
Proof: To show that a collection of subsets of is a partition, we must show that each subset is non-empty, that the intersection of two distinct subsets is empty, and that the union of all the subsets is .
If is one of the equivalence classes, it is certainly non-empty, since . (This follows from the fact that is reflexive, and hence .) To show that is the union of all the equivalence classes, we just have to show that each element of is a member of one of the equivalence classes. Again, the fact that for each shows that this is true.
Finally, we have to show that the intersection of two distinct equivalence classes is empty. Suppose that and are elements of and consider the equivalence classes and . We have to show that if , then . Equivalently, we can show the converse: If then . So, assume that . Saying that a set is not empty just means that the set contains some element, so there must be an such that . Since , . Since is symmetric, we also have . Since , . Since is transitive and since , it follows that .
Our object is to deduce that . Since and are sets, they are equal if and only if and . To show that , let be an arbitrary element of . We must show that . Since , we have that . And we have already shown that . From these two facts and the transitivity of , it follows that . By definition, this means that . We have shown that any member of is a member of and therefore that . The fact that can be shown in the same way. We deduce that , which proves the theorem.
The point of this theorem is that if we can find a binary relation that satisfies certain properties, namely the properties of an equivalence relation, then we can classify things into categories, where the categories are the equivalence classes.
For example, suppose that is a possibly infinite set. Define a binary relation on as follows: For and in , if and only if there is a bijective function from the set to the set . In other words, means that and have the same cardinality. Then is an equivalence relation on . (The symbol is often used to denote equivalence relations. It is usually read "is equivalent to.") If , then the equivalence class consists of all the subsets of that have the same cardinality as . We have classified all the subsets of according to their cardinality—even though we have never said what an infinite cardinality is. (We have only said what it means to have the same cardinality.)
You might remember a popular puzzle called Rubik's Cube, a cube made of smaller cubes with colored sides that could be manipulated by twisting layers of little cubes. The object was to manipulate the cube so that the colors of the little cubes formed a certain configuration. Define two configurations of the cube to be equivalent if it's possible to manipulate one configuration into the other by a sequence of twists. This is, in fact, an equivalence relation on the set of possible configurations. (Symmetry follows from the fact that each move is reversible.) It has been shown that this equivalence relation has exactly twelve equivalence classes. The interesting fact is that it has more than one equivalence class: If the configuration that the cube is in and the configuration that you want to achieve are not in the same equivalence class, then you are doomed to failure.
Transitive Closure
Suppose that is a binary relation on a set . Even though might not be transitive, it is always possible to construct a transitive relation from in a natural way. If we think of as meaning that is related by to "in one step," then we consider the relationship that holds between two elements and when is related by to "in one or more steps." This relationship defines a binary relation on that is called the transitive closure of . The transitive closure of is denoted . Formally, is defined as follows: For and in , if there is a sequence of elements of , where and and , such that , , \dots, and .
For example, if , , and , then we would have that . Of course, we would also have that , and .
For a practical example, suppose that is the set of all cities and let be the binary relation on such that for and in , if there is a regularly scheduled airline flight from to . Then the transitive closure has a natural interpretation: if it's possible to get from to by a sequence of one or more regularly scheduled airline flights. You'll find a few more examples of transitive closures in the exercises.
Exercises
For a finite set, it is possible to define a binary relation on the set by listing the elements of the relation, considered as a set of ordered pairs. Let be the set , where , , , and are distinct. Consider each of the following binary relations on . Is the relation reflexive? Symmetric? Antisymmetric? Transitive? Is it a partial order? An equivalence relation?
- .
Answer
Antisymmetric and transitive.
- .
Answer
Reflexive, symmetric, transitive, hence equivalence relation.
- .
Answer
Antisymmetric, symmetric and transitive. It is an equivalence relation on the subset , but not on the full set .
- .
Answer
Antisymmetric and transitive only.
- .
Answer
Symmetric only.
- .
Let be the set . Consider the partition of into the subsets , , and . Write out the associated equivalence relation on as a set of ordered pairs.
Answer
Consider each of the following relations on the set of people. Is the relation reflexive? Symmetric? Transitive? Is it an equivalence relation?
- is related to if and have the same biological parents.
Answer
This is reflexive, symmetric, transitive, and hence an equivalence relation.
- is related to if and have at least one biological parent in common.
Answer
This is reflexive and symmetric, but not transitive (Alice and Bob might share a mother, while Bob and Carla share a father, while Alice and Carla have no parent in common).
- is related to if and were born in the same year.
Answer
This is reflexive, symmetric, transitive, and hence an equivalence relation.
- is related to if is taller than .
Answer
This is transitive only.
- is related to if and have both visited Honolulu.
Answer
This is reflexive, symmetric, transitive, and hence an equivalence relation.
- is related to if and have the same biological parents.
It is possible for a relation to be both symmetric and antisymmetric. For example, the equality relation, , is a relation on any set which is both symmetric and antisymmetric. Suppose that is a set and is a relation on that is both symmetric and antisymmetric. Show that is a subset of (when both relations are considered as sets of ordered pairs). That is, show that for any and in , .
Answer
If we have , then we also know , because is symmetric. However, that can only be true if , because is antisymmetric. The relation may be a proper subset of because there may be some that are not related to anything by . In fact, every subset of is a symmetric and antisymmetric relation, including the empty set.
Let be the relation on , the set of real numbers, such that for and in , if and only if . For example, because the difference, , is , which is an integer. Show that is an equivalence relation. Show that each equivalence class contains exactly one number which satisfies . (Thus, the set of equivalence classes under is in one-to-one correspondence with the half-open interval .)
Answer
- is reflexive because for any , , so .
- is symmetric because if , then for some . But , which is also in , so .
- is transitive because if and , then we know and for some . But , which is also in , so .
Therefore is an equivalence relation.
Given any , we may find an such that and : let be the largest integer less than or equal to (the floor of , often written ), and take . Then (so ), (because ), and (because if not, then , contradicting the choice of as the largest such integer). Therefore has the stated property. If there were another such that , then we would also have , hence . But if and are different, then must be a non-zero integer, and either or , which is a contradiction. Therefore, is unique.
Let and be any sets, and suppose . Define a relation on such that for any and in , if and only if . Show that is an equivalence relation on .
Answer
- For any , obviously , so .
- If , then we know . This is the same as saying , so we also find .
- If and , then and . Therefore , so .
Thus is reflexive, symmetric, and transitive, so it is an equivalence relation.
Let be the set of positive integers . Define a binary relation on such that for and in , if divides evenly into , with no remainder. Equivalently, if is a factor of , that is, if there is a in such that . Show that is a partial order.
Answer
- For any , evenly divides , so .
- If and , then we know that each evenly divides the other. However, if one positive integer evenly divides another, it must be less than or equal to the other. Therefore, we know and , so .
- If and , then we know that there exist such that and . Therefore, , so we also have .
Since is reflexive, antisymmetric, and transitive, it is a partial order.
Consider the set , which consists of all ordered pairs of natural numbers. Since is a set, it is possible to have binary relations on . Such a relation would be a subset of . Define a binary relation on such that for and in , if and only if either or . Which of the following are true?
Answer
True
Answer
False
Answer
True
Answer
True
Show that is a total order on .
Answer
This ordering is known as the lexicographic ordering on , because it is a generalization of the way words are ordered in a dictionary (a "lexicon"). Let us first show that it is a partial order:
- For any , we have , because .
- If and , then it cannot be the case that either or , so we know . Therefore, we know that and , hence and we have .
- If and , then we know that and , so . If it is the case that , then we certainly have , so consider the case when . When we also know and , so we must have and . Therefore , and we again find .
Since is reflexive, antisymmetric, and transitive, it is a partial order. Now suppose that we have two pairs and in . We know that , , or ; in the first two cases, we see that either or . Therefore, consider the case . If also , then , while if , then (and if they are both true). Therefore in every case either or , so is a total order.
Let be the relation defined on such that if and only if . Show that is an equivalence relation.
Answer
- For any , we have , because .
- If , then . But this is equivalent to saying , which means we also have .
- If and , then we know and . Therefore ; subtracting from both sides gives , which is what we need to show .
Therefore is an equivalence relation, because it is reflexive, symmetric, and transitive. Another way to look at this relation is that if , although we have to be careful to perform the subtraction in because it is not always defined in . The equivalence classes of are actually in one-to-one correspondence with the integers (), so this gives us a way to encode the integers using only the natural numbers.
Let be the set of people and let be the "child of" relation. That is means that is a child of . What is the meaning of the transitive closure ? Explain your answer.
Answer
The relation is the "descendant of" relation. That is, holds if there is a chain of people , , …, for some such that , , and for each we have that is a child of .
Let be the binary relation on such that if and only if . Identify the transitive closure . (It is a well-known relation.) Explain your answer.
Answer
If there is a chain of numbers , , …, for some such that for each , then it is easy to check that , so . Therefore, is equivalent to saying for some . This is true exactly when .
Suppose that is a reflexive, symmetric binary relation on a set . Show that the transitive closure is an equivalence relation.
Answer
- Since for every , we also know that (take the chain and ).
- Suppose we have for some . Then there is a chain , , …, for some such that for each . Since is symmetric, this also gives us a chain , , …, where for each . Therefore, .
- If and , then we know there are chains , , …, and , , …, for some , such that and for all and . These chains may be "pasted together" into a single chain establishing that .
Therefore, is reflexive, symmetric, and transitive, so it must be an equivalence relation.
- Note that to show that the relation is not reflexive, you only need to find one such that is false. This follows from the fact that . A similar remark holds for each of the properties of relations that are discussed here.↩