6

I am trying to understand how to calculate the transitive closure of a set and I have read several times the definition of the transitive closure but I still cannot understand some answers I see when doing questions.

From my definition, the transitive closure of a set $ R^+ $ is the smallest set that is transitive and contains R.

In this question I am doing , I am required to calculate the transitive closure of this set:

$ R = \{ (1,2),(2,3),(3,4),(4,1) \} $

My approach was to start with one pair and keep on adding the missing transitive pairs until I could find no more. This proved to be somewhat exhausting as I think I had written down about 15+ pairs before I thought that I must be doing something wrong. So I check the answer and it is given like this:

$ R o \{ (1,3),(2,4),(3,1),(4,2) \} o \{ (1,4),(2,1),(3,2),(4,3) \} o \{ (1,1),(2,2),(3,3),(4,4) \} $

The answer does not explain how they arrived at this answer which extremely unhelpful to me. I only managed to understand that the last composition is the reflexive set of { 1,2,3,4} but I don't know where the rest is coming from?

I also worked out the final composition which turned out to be $R^+ = \{ (1,3),(2,4),(3,1),(4,2) \}$ however I don't see how this contains R? Maybe my understanding is incorrect but does R have to be a subset of $R^+$?

Finally I drew the graph but that did not help me understand any better as there were more questions arising from this too.

Can someone please explain to me how we calculate the transitive closure of this set (and in general any set given like this) with a simple approach?

Asaf Karagila
  • 393,674
Nubcake
  • 426
  • 1
  • 6
  • 17

2 Answers2

3

Lets recall the definition of transitivity. A relation $R \subseteq A \times A$ on $A$ is called transitive, if we have $$(a,b),(b,c) \in R \Rightarrow (a,c)$$ for all $a,b,c \in A$.

Your initial set is $R = \{(1,2),(2,3),(3,4),(4,1)\}$. The way you described your approach is basically the way to go. Just go through the set and if you find some $(a,b),(b,c)$ in it, add $(a,c)$.

The way the answer is given is a little bit confusing because it already tries to be explanatory :) The thing is, that they mean unions $\cup$ instead of compositions $\circ$. BUT they are writing it as a union to emphasize the steps taken in order to arrive at the solution:

  1. Step: Look at $R$. Since $(1,2),(2,3) \in R$, we need to add $(1,3)$ to the set. Analogously we have to add $(2,4),(3,1)$ and $(4,2)$. Lets call this new set $R_1$.
  2. Step: Now we have $R \subset R_1$, but $R_1$ is not yet transitive because $(1,3),(3,4) \in R_1$ but $(1,4)\notin R_1$. Hence, we have to add $(1,4)$ to $R_1$ and so on...

If we keep going we end up with the complete relation $R^+ = A \times A$ where $A = \{1,2,3,4\}$, i.e. $R^+$ contains ALL possible pairs of $1,2,3,4$.

By the way: I really like the idea to visualize the relation as a graph.

j4GGy
  • 3,721
  • So what is the quickest way to compute the transitive closure , I am still unsure approaching this even though I've read your answer. Yes I also saw in notes before that the maximum possible number of pairs would we have to possibly add would be the cardinality of the set. I think I am confusing myself now; is {(1,3),(2,4),(3,1),(4,2)} transitive? We are missing (1,1) and (2,2)... – Nubcake Apr 30 '15 at 12:37
  • Unfortunately there is no very efficient way other than to add pairs iteratively. However, your example is very nice. The set ${(1,3),(2,4),(3,1),(4,2)}$ is not relative because it is missing $(1,1),(2,2)$. However, if we add those pairs, we arrive at the transitive closure ${(1,3),(2,4),(3,1),(4,2),(1,1),(2,2)}$ – j4GGy Apr 30 '15 at 12:47
  • @GenericNickname You meant to say "is not reflexive" – drhab Apr 30 '15 at 12:51
  • @drhab actually I meant "is not transitive" - seems my mind wandered off for a sec there :) – j4GGy Apr 30 '15 at 12:52
  • But if I keep on adding pairs like I was doing before, I would end up with a set containing all possible pairs of A x A? That wouldn't be the transitive closure of the set then would it? Also , (3,3) is also missing right? Why didn't the answer given the "transitive closure" then? Sorry but I'm still confused , why is R+ transitive? We are missing quite a lot of pairs. It's turning out like we need to add all possible pairs to make it transitive. – Nubcake Apr 30 '15 at 12:55
  • For the example in your question it actually is the set of all possible pairs (as stated in my answer). For the set you mentioned in the comments, it is not the set of all pairs and the process of adding pairs will stop after you added $(1,1)$ and $(2,2)$. – j4GGy Apr 30 '15 at 12:57
  • {(1,3),(2,4),(3,1),(4,2)} is the answer I got after computing all the compositions that the answer provided me with. So which answer is wrong? Why is {(1,3),(2,4),(3,1),(4,2),(1,1),(2,2)} the transitive closure? This set is not transitive. – Nubcake Apr 30 '15 at 13:01
  • @Nubcake You're right - we're still missing $(3,3)$ and $(4,4)$, my bad. So for $R = {(1,3),(3,1),(2,4),(4,2)}$ the transitive closure is $R^+ = {(1,1),(2,2),(3,3),(4,4), (1,3),(3,1),(2,4),(4,2)}$. Sorry, if my mistake confused you. However, to comment on your earlier question: There should be no compositions $\circ$ in the answer given in your book/exercise. They are meant to be unions $\cup$. – j4GGy Apr 30 '15 at 13:05
  • Ok I think I understand it now, just wondering how I managed to arrive with more than 10 pairs when computing the transitive closure? How did you manage to work it out ? It seems for this case that it is just the reflexive set of R union with R. – Nubcake Apr 30 '15 at 13:11
  • One thing to take away from this is that transitivity is quite a strong property. That means that "making a set transitive" usually makes it much "bigger". A nice way to work out the transitive closure is using graphs as you stated. Just draw a vertex for each element of the "basis set" (here: $1,2,3,4$) and draw an arrow from $a$ to $b$ if $(a,b) \in R$. Now, whenever you see an arrow from $a$ to $b$ and from $b$ to $c$, just add an arrow from $a$ to $c$. This way you eventually get the transitive closure. – j4GGy Apr 30 '15 at 13:14
0

It can be shown that the transitive closure of a relation R on A which is a finite set is union of iteration R on itself |A| times. Hence the matrix representation of transitive closure is joining all powers of the matrix representation of R from 1 to |A|. In this example computing Powers of A from 1 to 4 and joining them together successively ,produces a matrix which has 1 at each entry. So the transitive closure is the full relation on A given by A x A.