9 minutes read

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.

The map

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 RR over sets AA and BB is a subset of the Cartesian product A×BA \times B.

That means that RR is some set containing pairs with first elements from AA and second elements from BB (but not necessarily all such pairs).

In our first example, AA is the set of all writers in the world and BB the set of all books. In the second example, the role of both AA and BB 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 nn-ary relation, a subset of the Cartesian product A1×A2××AnA_{1} \times A_{2} \times \ldots \times A_{n} (its elements are nn-tuples (a1,a2,,an)(a_{1}, a_{2}, \ldots, a_{n}), where aiAia_{i} \in A_{i}).

An example of a ternary relation is Pythagorean triples, which are triples of elements that satisfy a2+b2=c2a^2+b^2=c^2. So a triple like (3,4,5)(3,4,5) would satisfy such ternary relation.

Often the sets AA and BB for our binary relation coincide. In this case, we say RR is a relation on AA.

A relation where A=BA=B is often called a homogenous relation or an endorelation.

An inverse relation

Suppose we have some relation RR over sets AA and BB. For every pair (a,b)R(a, b) \in R, we may swap its elements, obtaining pair (b,a)(b, a). The set of all such pairs R={(b,a)(a,b)R}R' =\{ (b, a) \mid (a, b) \in R \} is a subset of B×AB \times A and is itself a relation over BB and AA. We call it the inverse relation of the relation RR and sometimes denote by R1R^{-1}.

For example, if A=B=ZA = B = \mathbb{Z} (the set of integers), we may consider a relation "is less than":

R={(a,b)Z×Za<b}R = \{(a, b) \in \mathbb{Z} \times \mathbb{Z} \mid a < b\}In other words, RR is the set of all pairs of integers such that the first integer is less than the second one. The inverse relation is R1={(b,a)Z×Zb>a}R^{-1} = \{(b, a) \in \mathbb{Z} \times \mathbb{Z} \mid b > a\}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 RR on the set AA. A little later, using these properties, we will distinguish two important types among all binary relations: equivalence relations and order relations.

  • RR is called a reflexive relation if for any aAa \in A, (a,a)R(a, a) \in R (so, any element of AA is related to itself).

    As an example of a reflexive relation, we can look no further than equality. If we take any number, say aa, we will have a=aa =a, and so the relation satisfies reflexivity. On the contrary, if we take <<, it would not satisfy reflexivity as for any aa, it does not hold such that a<aa<a.

  • RR is called a symmetric relation if for any a,bAa, b \in A, if (a,b)R(a, b) \in R, then also (b,a)R(b, a) \in R

    If we again compare == to <<, we will quickly see that the former is a symmetric relation, while the latter isn't. As if a=ba=b is true, then b=ab=a is also true. On the other hand, if a<ba<b is true, then b<ab<a is false.

  • RR is an anti-symmetric relation if from (a,b)R(a, b) \in R and (b,a)R(b, a) \in R it follows that a=ba = b

    Looking at a set AA that contains elements x x and yy. We can define an anti-symmetric relation RR requiring yy to be divisible by xx and xx to be divisible by yy. Thus we have that (7,21)R(7, 21)\notin R, as 2121 is divisible by 77, but not the other way around. But if we have (7,7)R(7, 7)\in R, as 77 is divisible by 77 and the other way around, so it must be that a=ba=b.

  • RR is a transitive relation if from (a,b)R(a, b) \in R and (b,c)R(b, c) \in R it follows that (a,c)R(a, c) \in R

    Going back to our beloved inequality sign. It is transitive as if we have that a<ba<b and b<cb<c, it must be true that a<ca<c. 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.

Several people

Let's continue with some real-world examples. Suppose our AA is a set of users in some social network, and a pair of users aa and bb belong to relation RR, if aa can comment on bb'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 aa and bb aren't friends, and they chose different settings for their profiles: only friends can comment on aa's posts, but everyone can comment on bb's posts. Then (a,b)R(a, b) \in R, but (b,a)∉R(b, a) \not \in R, 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 AA 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 a,bAa, b \in A if aa relates to bb, then bb relates to aa.

  • In a transitive relation if there is a relationship between aa and bb and there is a relationship between bb and cc then there will be the same relationship between aa and cc.

5 learners liked this piece of theory. 0 didn't like it. What about you?
Report a typo