In this topic, we will learn about the concept of relations, which at a first glance it is hard to see how it is connected to mathematics, but we will learn how it is formalized and applied. Relations are a fundamental mathematical concept and many other concepts are based on them. We will see that many real-world situations such as hierarchy in a company or just a comparison of numbers can be described using the language of relations. Relations are especially useful for database theory.
What is a relation?
In our everyday life, the word "relation" means some sort of connection between people, countries, or any other object. For example, how are writer J. R. R. Tolkien and the book "The Lord of the Rings" connected? The former is the author of the latter. The same relation exists between Leo Tolstoy and "War and Peace". On the other hand, Agatha Christie is not the author of "Alice in Wonderland".
Similarly, we can tell two countries are neighbors if they have a common border. It's a relation, too. Looking at the map, we see that France and Italy are neighbors, but Italy and India are not.
How can we formalize such examples? In both cases, a pair of objects is presented to us and we can (at least theoretically!) say whether they are connected in the way we are interested in. And when we hear the word "pair" in math, we immediately think about the Cartesian product.
Definition. A binary relation over sets and is a subset of the Cartesian product .
That means that is some set containing pairs with first elements from and second elements from (but not necessarily all such pairs).
In our first example, is the set of all writers in the world and the set of all books. In the second example, the role of both and is played by the set of countries.
Note that we defined not just "relations", but "binary relations". This means we consider pairs of objects. If we considered triples, the relation would be called ternary. The general case is an -ary relation, a subset of the Cartesian product (its elements are -tuples , where ).
An example of a ternary relation is Pythagorean triples, which are triples of elements that satisfy . So a triple like would satisfy such ternary relation.
Often the sets and for our binary relation coincide. In this case, we say is a relation on .
A relation where is often called a homogenous relation or an endorelation.
An inverse relation
Suppose we have some relation over sets and . For every pair , we may swap its elements, obtaining pair . The set of all such pairs is a subset of and is itself a relation over and . We call it the inverse relation of the relation and sometimes denote by .
For example, if (the set of integers), we may consider a relation "is less than":
In other words, is the set of all pairs of integers such that the first integer is less than the second one. The inverse relation is Using words instead of formulas, we can say that this inverse relationship is the relation "is greater than".
Properties of relations
Now we will study several important properties of the relation on the set . A little later, using these properties, we will distinguish two important types among all binary relations: equivalence relations and order relations.
-
is called a reflexive relation if for any , (so, any element of is related to itself).
As an example of a reflexive relation, we can look no further than equality. If we take any number, say , we will have , and so the relation satisfies reflexivity. On the contrary, if we take , it would not satisfy reflexivity as for any , it does not hold such that .
-
is called a symmetric relation if for any , if , then also
If we again compare to , we will quickly see that the former is a symmetric relation, while the latter isn't. As if is true, then is also true. On the other hand, if is true, then is false.
-
is an anti-symmetric relation if from and it follows that
Looking at a set that contains elements and . We can define an anti-symmetric relation requiring to be divisible by and to be divisible by . Thus we have that , as is divisible by , but not the other way around. But if we have , as is divisible by and the other way around, so it must be that .
-
is a transitive relation if from and it follows that
Going back to our beloved inequality sign. It is transitive as if we have that and , it must be true that . While a simple example of a non-transitive relation is being someone's child. If Carl has a daughter named Sarah, and Sarah has a son named Bob, it is not true that Carl has a child named Bob, he instead has a grandchild named Bob.
Let's continue with some real-world examples. Suppose our is a set of users in some social network, and a pair of users and belong to relation , if can comment on 's posts. This relation is reflexive (everyone can comment on their own posts), but in a typical network, it's neither a symmetric nor an anti-symmetric one. Suppose and aren't friends, and they chose different settings for their profiles: only friends can comment on 's posts, but everyone can comment on 's posts. Then , but , so the relation can't be symmetric. But obviously, there will be a lot of pairs where each person can comment on each other's posts, so it's not an anti-symmetric relation too. You can easily invent a counter-example for transitivity, too.
There are a lot of examples of symmetric relations in our everyday life. Having the same year of birth or at least one common parent are symmetric relations, but the first one is transitive while the second one is not. Also, you might have already noticed that the word "transitive" resembles the word "transit". It's not a mere coincidence. Suppose is a set of cities and two cities are related if you can travel from one to the other by plane, possibly by connecting flights. Obviously, this relation is transitive.
Conclusion
Now we know about relations and some of their main properties. Now let's quickly go through what we have learned:
-
Relations describe the connection between objects from sets, be it countries, people, or numbers.
-
If there is a relation between elements of sets, for example, "less than" for real numbers, then "greater than" would be an inverse relation.
-
A relation is reflexive if, for any element of a set, this element relates to itself.
-
A relation is symmetric if for any if relates to , then relates to .
-
In a transitive relation if there is a relationship between and and there is a relationship between and then there will be the same relationship between and .