0

Consider the following relation on the set $X=\{ 1 , 2 , 3 , 4 \}$: $$R=\{ ( 1 , 3 ) , ( 2 , 4 ) , ( 3 , 1 ) , ( 3 , 3 ) , ( 4 , 1 ) \}.$$ Select all pairs which lie in the transitive closure of $R$.

We recall that the the transitive closure of a binary relation $R$ on a set $X$ is the smallest relation on $X$ that contains $R$ and is transitive, while a relation is transitive if: if $(a,b)\in R$ and $(b,c)\in R$, then so is $(a,c)\in R$.

So out of $(1,1), (1,2) ,(1,3)$ and $(2,3)$, the answers are $(1,2)$ and $(2,3)$?

Arctic Char
  • 16,972
Student
  • 11

2 Answers2

2

I find that many times a beginning student fails to fully appreciate what transitivity is when it is worded like it usually is. In particular, I find that students miss out on the fact that the transitive closure might include more than just what is immediately missing. As such, I recommend thinking of it in the following way.


Imagine a directed multigraph like the following:

enter image description here

Specifically, for your relation, have a vertex like $v_1,v_2,\dots$ for each of the elements in your underlying set and draw an edge with an arrow from one vertex to another if the first element is related to the second element by your relation. If that second element is again related back to the first element, you can choose to draw this as another parallel edge with an arrow in the reverse direction, or if you prefer you might choose to instead draw this as a edge with an arrow pointing in both directions like $\leftrightarrow$. If an element is related to itself, draw an edge with an arrow that leaves the vertex and points right back to the same vertex, what we call a "loop."

The above example is the graphical representation of the relation $$R=\{(1,2),(1,3),(2,1),(3,4),(3,6),(4,5),(5,4),(5,6)\}$$

Now... with these arrows, it becomes easier to imagine "moving around" on the graph. A "directed walk" on this graph can be thought of as some sequence of movements from one vertex to another where we travel along edges in the direction of an arrow. For example, I can start at $v_1$ and travel to $v_2$ then back to $v_1$ again then over to $v_3$ and end at $v_6$ if I so choose, and this sequence of movements I can call a directed walk from $v_1$ to $v_6$.

Now... a relation (and it's graph) is considered "Transitive" iff for any directed walk that I can do there is a shortcut using only a single edge in total.

That is... with the way transitivity is normally worded we have for instance $(1,3)\in R$ and $(3,6)\in R$ so if the above relation were in fact transitive, then I would need for $(1,6)$ to be in $R$ as well. It is not, so the above relation happens to not be transitive.

Something which I feel is particularly lacking in the usual way transitivity is described that my above description does better at is in reinforcing the idea that the directed walk can be of any length, not just a directed walk of length two using two edges. In the above, we also have $(1,3),(3,4),(4,5)$ so since there is a directed walk from $1$ to $5$, for the relation to be transitive we would need $(1,5)$ too! Further, we can have a walk that starts and ends in the same place! In the usual way of writing it, we have it written as $a$'s, $b$'s and $c$'s... but we do not require that $a,b,c$ all be distinct vertices! They can repeat values.

Now... the transitive closure of a relation is the relation which includes all missing necessary "shortcuts" for all currently possible directed walks. That is to say, it is the smallest relation which is transitive and contains the original relation as a subset.


For your relation, it is a much smaller example. Try drawing it out. There are four vertices, $v_1,v_2,v_3,v_4$, and the corresponding graph will start with $5$ edges (one of which is a loop from $3$ to itself). What shortcuts are missing for directed walks that we can perform?

We can do a walk from $1$ to $3$ and from $3$ back to $1$ again, so we need a shortcut from $1$ to $1$ so we are missing $(1,1)$ in the transitive closure. What else?

$~$

We can't actually travel from $1$ to $2$. Remember, we can't travel backwards along an edge... you should see that once you are at $1$ you can only stay at $1$ or go to $3$ or travel back and forth between $1$ and $3$. So, we don't need a shortcut from $1$ to $2$ since there weren't any directed walks we could take from $1$ to $2$ to begin with.


As an additional aside, many of the usual properties we are interested in for relations can be described quite easily using the language of graph theory.

  • Reflexivity: All vertices have a loop. (Originally: for all $x\in X$ we have $(x,x)\in R$)

  • Symmetry: All arrows (not loops) if any exist are double-sided. That is, if you can go from $a$ to $b$ in a single step, then you can go from $b$ to $a$ in a single step. (Originally: if $(a,b)\in R$ then $(b,a)\in R$).

  • Antisymmetry: All arrows (not loops) if any exist are single-sided. That is, if you can go from $a$ to $b$ (with $b$ different than $a$) in a single step, then you can not go from $b$ to $a$ in a single step. (Originally: if $(a,b)\in R$ and $(b,a)\in R$ then $a=b$)

JMoravitz
  • 80,908
0

To augment JMoravitz's answer, we can also borrow a tool from graph theory known as adjacency matrices. Let's first represent the relation as a table: $$\begin{array}{|c|c|} \hline & \color{red}1 & \color{red}{2} & \color{red}{3} & \color{red}4 \\ \hline \color{red}1 \\ \hline \color{red}2 \\ \hline \color{red}3 \\ \hline \color{red}4 \\ \hline \end{array}.$$

What I want to do is fill in the table with a $1$ if $\color{red}a$ is related to $\color{red}b$, in the $\color{red}a$ row and $\color{red}b$ column. Otherwise, I want to put a $0$ there. For example, $(\color{red}1, \color{red}3)$ is in your relation, so we'd put

$$\begin{array}{|c|c|} \hline & \color{red}1 & \color{red}{2} & \color{red}{3} & \color{red}4 \\ \hline \color{red}1 & & & 1 \\ \hline \color{red}2 \\ \hline \color{red}3 \\ \hline \color{red}4 \\ \hline \end{array}.$$

Filling out the rest of the table, we get

$$\begin{array}{|c|c|} \hline & \color{red}1 & \color{red}{2} & \color{red}{3} & \color{red}4 \\ \hline \color{red}1 & 0 & 0 & 1 & 0 \\ \hline \color{red}2 & 0 & 0 & 0 & 1 \\ \hline \color{red}3 & 1 & 0 & 1 & 0 \\ \hline \color{red}4 & 1 & 0 & 0 & 0 \\ \hline \end{array}.$$

Now, let's reject the leading row and column of the table to obtain the adjacency matrix:

$$A = \begin{pmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 1 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \end{pmatrix}.$$

Now, here's the cool bit: if we compute $A^2 + A$, we can easily find the transitive closure. Check it out:

\begin{align*} A^2 + A &= \begin{pmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 1 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \end{pmatrix} \begin{pmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 1 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \end{pmatrix} + \begin{pmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 1 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \end{pmatrix} \\ &= \begin{pmatrix} 1 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \\ 1 & 0 & 2 & 0 \\ 0 & 0 & 1 & 0 \end{pmatrix} + \begin{pmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 1 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \end{pmatrix} \\ &= \begin{pmatrix} 1 & 0 & 2 & 0 \\ 1 & 0 & 0 & 1 \\ 2 & 0 & 3 & 0 \\ 1 & 0 & 1 & 0 \end{pmatrix}. \end{align*}

What we do now is "flatten" the result, i.e. replace any integers greater than $0$ with $1$:

$$\begin{pmatrix} 1 & 0 & 1 & 0 \\ 1 & 0 & 0 & 1 \\ 1 & 0 & 1 & 0 \\ 1 & 0 & 1 & 0 \end{pmatrix}.$$

The result is the adjacency matrix for the transitive closure. For example, because there is a $1$ in the $\color{red}4$th row and $\color{red}3$rd column, it means $(4, 3)$ lies in the transitive closure. On the other hand, because there is a $0$ in the $\color{red}3$rd row and $\color{red}4$th column, $(3, 4)$ does not lie in the transitive closure.

  • Nice! Question: can you clarify why did you do A*A+A? – adhg May 07 '20 at 12:43
  • Well... $A^2$ will effectively encode all length-2 directed walks that are possible (the entries may grow larger than $1$ if there are multiple possible walks that go between the corresponding points). Adding this to $A$ which encoded all the length-1 directed walks makes it so that the result has all length-2 or length-1 directed walks. This is... sadly... an incomplete approach however. This does not represent the transitive closure, it only represents the way to travel along length $1$ or $2$ directed walks and it does not help for walks that are distance $3$ or greater. – JMoravitz May 07 '20 at 12:48
  • To correct this... really, we'd need to continue this process... doing $A+A^2+A^3+A^4+\dots$, treating zeroes as proper zeroes while letting any positive number be treated as $1$'s. For a finite graph, you can certainly stop by $n$ steps where $n$ is the number of vertices... and an argument could probably be made that would allow you to stop sooner, e.g. using the diameter of the graph instead... but that is getting into topics that you might not be ready for. One can check using the relation example I gave and this technique that you miss $(1,5)$ in the closure if using only $A+A^2$. – JMoravitz May 07 '20 at 12:54
  • In the example that the OP was interested in as well, this technique failed to identify $(2,3)$ as needing to be added. We have $(2,4),(4,1),(1,3)$ all in the original relation, so we have a directed walk from $2$ to $3$ and so needed to add $(2,3)$ as well. – JMoravitz May 07 '20 at 12:58