Skip to main content

Section 10.5 Closure Operations on Relations

In Section 10.1, we studied relations and one important operation on relations, namely composition. This operation enables us to generate new relations from previously known relations. In Section 10.3, we discussed some key properties of relations. We now wish to consider the situation of constructing a new relation \(R^+\) from an existing relation \(R\) where, first, \(R^+\) contains \(R\) and, second, \(R^{+ }\) satisfies the transitive property.

Subsection 10.5.1 Transitive Closure

Consider a telephone network in which the main office \(a\) is connected to, and can communicate to, individuals \(b\) and \(c\text{.}\) Both \(b\) and \(c\) can communicate to another person, \(d\text{;}\) however, the main office cannot communicate with \(d\text{.}\) Assume communication is only one way, as indicated. This situation can be described by the relation \(R = \{(a, b), (a, c), (b, d), (c, d)\}\text{.}\) We would like to change the system so that the main office \(a\) can communicate with person \(d\) and still maintain the previous system. We, of course, want the most economical system.

This can be rephrased as follows; Find the smallest relation \(R^{+ }\) which contains \(R\) as a subset and which is transitive; \(R^+ =\{(a, b), (a, c), (b, d), (c, d), (a, d)\}\text{.}\)

Definition 10.5.1. Transitive Closure.

Let \(A\) be a set and \(R\) be a relation on \(A\text{.}\) The transitive closure of \(R\text{,}\) denoted by \(R^+\text{,}\) is the smallest transitive relation that contains \(R\) as a subset.

Let \(A = \{1, 2, 3, 4\}\text{,}\) and let \(\mathcal{S} = \{(1, 2), (2, 3), (3, 4)\}\) be a relation on \(A\text{.}\) This relation is called the successor relation on \(A\) since each element is related to its successor. How do we compute \(\mathcal{S}^+\text{?}\) By inspection we note that \((1, 3)\) must be in \(\mathcal{S}^+\) . Let's analyze why. This is so because \((1,2) \in \mathcal{S}\) and \((2, 3) \in \mathcal{S}\text{,}\) and the transitive property forces \((1,3)\) to be in \(\mathcal{S}^+\text{.}\)

In general, it follows that if \((a, b) \in \mathcal{S}\) and \((b, c) \in S,\) then \((a, c) \in \mathcal{S}^+ \text{.}\) This condition is exactly the membership requirement for the pair \((a, c)\) to be in the composition \(\mathcal{S}\mathcal{S} = \mathcal{S}^2\text{.}\) So every element in \(\mathcal{S}^2\) must be an element in \(\mathcal{S}^+\) . So we now know that, \(\mathcal{S}^+\) contains at least \(\mathcal{S} \cup \mathcal{S}^2\) . In particular, for this example, since \(\mathcal{S} = \{(1, 2), (2, 3), (3, 4)\}\) and \(\mathcal{S}^2 = \{(1, 3), (2, 4)\}\text{,}\) we have

\begin{equation*} \mathcal{S} \cup \mathcal{S}^2 =\{(1, 2), (2, 3), (3, 4), (1, 3), (2, 4)\} \end{equation*}

Is the relation \(\mathcal{S} \cup \mathcal{S}^2\) transitive? Again, by inspection, \((1, 4)\) is not an element of \(\mathcal{S} \cup \mathcal{S}^2\text{,}\) but \((1,3) \in \mathcal{S}^2\) and \((3, 4) \in \mathcal{S}\text{.}\) Therefore, the composition \(\mathcal{S}^2 \mathcal{S} = \mathcal{S}^3\) produces \((1, 4)\text{,}\) and it must be an element of \(\mathcal{S}^+\) since \((1,3)\) and \((3, 4)\) are required to be in \(\mathcal{S}^+\text{.}\) This shows that \(\mathcal{S}^3 \subseteq \mathcal{S}^+\text{.}\) This process must be continued until the resulting relation is transitive. If \(A\) is finite, as is true in this example, the transitive closure will be obtained in a finite number of steps. For this example,

\begin{equation*} \mathcal{S}^+ =\mathcal{S}\cup \mathcal{S} ^2\cup \mathcal{S} ^3=\{(1, 2), (2, 3), (3, 4),(1, 3),(2, 4),(1,4)\} \end{equation*}

Let's now consider the matrix analogue of the transitive closure.

Consider the relation

\begin{equation*} R = \{(1, 4), (2, 1), (2, 2), (2, 3),(3, 2), (4, 3), (4, 5), (5, 1)\} \end{equation*}

on the set \(A = \{1,2, 3, 4, 5\}\text{.}\) The matrix of \(R\) is

\begin{equation*} M=\left( \begin{array}{ccccc} 0 & 0 & 0 & 1 & 0 \\ 1 & 1 & 1 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 \\ 1 & 0 & 0 & 0 & 0 \\ \end{array} \right) \end{equation*}

Recall that \(R^2, R^3, \ldots\) can be determined through computing the matrix powers \(M^2, M^3, \ldots\text{.}\) For our example,

\(M^2=\left( \begin{array}{ccccc} 0 & 0 & 1 & 0 & 1 \\ 1 & 1 & 1 & 1 & 0 \\ 1 & 1 & 1 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 \\ \end{array} \right)\) \(M^3=\left( \begin{array}{ccccc} 1 & 1 & 0 & 0 & 0 \\ 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 0 \\ 1 & 1 & 1 & 1 & 0 \\ 0 & 0 & 1 & 0 & 1 \\ \end{array} \right)\)
\(M^4=\left( \begin{array}{ccccc} 1 & 1 & 1 & 1 & 0 \\ 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 0 & 0 & 0 \\ \end{array} \right)\) \(M^5=\left( \begin{array}{ccccc} 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 0 \\ \end{array} \right)\)
Table 10.5.3.

How do we relate \(\underset{i=1}{\overset{5}{\cup }}R^i\) to the powers of \(M\text{?}\)

Using this theorem, we find \(M^+\) is the \(5\times 5\) matrix consisting of all \(1's\text{,}\) thus, \(R^+\) is all of \(A \times A\text{.}\)

Subsection 10.5.2 Algorithms for computing transitive closure

Let \(R\) be a relation on the set \(\{1, 2, \dots , n\}\) with relation matrix \(M\text{.}\) The matrix of the transitive closure \(M^+\text{,}\) can be computed by the equation \(M^+ = M + M ^2 + \cdots + M^n\text{.}\) By using ordinary polynomial evaluation methods, you can compute \(M^+\) with \(n -1\) matrix multiplications:

\begin{equation*} M^+ = M(I + M(I +( \cdots M(I+ M) \cdots ))) \end{equation*}

For example, if \(n = 3\text{,}\) \(M^+ = M(I + M(I + M))\text{.}\)

We can make use of the fact that if \(T\) is a relation matrix, \(T + T = T\) due to the fact that \(1 + 1 = 1\) in Boolean arithmetic. Let \(S_k = M + M^2 + \cdots + M^k\text{.}\) Then

\begin{equation*} \begin{split} M &= S_1\\ S_1(I+S_1)&=M(I+M)=M+M^2 = S_2 \\ S_2(I+S_2)&=(M+M^2)(I+M+M^2) \\ &=(M+M^2)+(M^2+M^3)+(M^3+M^4) \\ &=M+M^2+M^3+M^4 = S_4 \end{split}\text{.} \end{equation*}

Similarly,

\begin{equation*} S_4(I+S_4)=S_8 \end{equation*}

and by induction we can prove

\begin{equation*} S_{2^k}(I+S_{2^k})=S_{2^{k+1}} \end{equation*}

Notice how each matrix multiplication doubles the number of terms that have been added to the sum that you currently have computed. In algorithmic form, we can compute \(M^+\) as follows.

Note 10.5.7.
  • Often the higher-powered terms in \(S_n\) do not contribute anything to \(M^+\text{.}\) When the condition \(T = S\) becomes true in Step 3, this is an indication that no higher-powered terms are needed.

  • To compute \(M^+\) using this algorithm, you need to perform no more than \(\lceil \log_2 n \rceil\) matrix multiplications, where \(\lceil x \rceil\) is the least integer that is greater than or equal to \(x\text{.}\) For example, if \(R\) is a relation on 25 elements, no more than \(\lceil \log_2 25 \rceil = 5\) matrix multiplications are needed.

A second algorithm, Warshall's Algorithm, reduces computation time to the time that it takes to multiply two square matrices with the same order as the relation matrix in question.

Exercises 10.5.3 Exercises

1.

Let \(A =\{0, 1, 2, 3, 4\}\) and \(\mathcal{S}=\{(0, 1), (1, 3), (2, 3), (3, 4), (4, 1)\}\text{.}\) Compute \(\mathcal{S}^+\) using the matrix representation of \(\mathcal{S}\text{.}\) Verify your results by checking against the result obtained directly from the definition of transitive closure.

2.

Let \(A=\{1,2,3,4,6,12\}\) and \(T=\{(a,b)\mid b/a \textrm{ is a prime number}\}\text{.}\) Determine \(T^+\) by any means. Represent your answer as a matrix.

3.
  1. Draw digraphs of the relations \(\mathcal{S}\text{,}\) \(\mathcal{S}^2\text{,}\) \(\mathcal{S}^3\) , and \(\mathcal{S}^+\) where \(\mathcal{S}\) is defined in the first exercise above.

  2. Verify that in terms of the graph of \(\mathcal{S}\text{,}\) \(a \mathcal{S}^+ b\) if and only if \(b\) is reachable from \(a\) along a path of any finite nonzero length.
Answer
  1. See graphs below.

  2. For example, \(0\mathcal{S}^+ 4\) and using \(\mathcal{S}\) one can go from 0 to 4 using a path of length 3.

digraph of S
Figure 10.5.10. Digraph of \(\mathcal{S}\)
Figure 10.5.11. Digraph of \(\mathcal{S}^2\)
Figure 10.5.12. Digraph of \(\mathcal{S}^3\)
Figure 10.5.13. Digraph of \(\mathcal{S}^+\)
4.

Let \(R\) be the relation represented by the following digraph.

  1. Find \(R^+\) using the definition based on order pairs.

  2. Determine the digraph of \(R^+\) directly from the digraph of \(R\text{.}\)

  3. Verify your result in part (b) by computing the digraph from your result in part (a).

Graph for exercise 4 of Section 10.5
Figure 10.5.14. Digraph of \(R\) in exercise 4.
5.
  1. Define reflexive closure and symmetric closure by imitating the definition of transitive closure.

  2. Use your definitions to compute the reflexive and symmetric closures of examples in the text.

  3. What are the transitive reflexive closures of these examples?

  4. Convince yourself that the reflexive closure of the relation \(<\) on the set of positive integers \(\mathbb{P}\) is \(\leq\text{.}\)

Answer

Definition: Reflexive Closure. Let \(R\) be a relation on \(A\text{.}\) The reflexive closure of \(R\) is the smallest reflexive relation that contains \(R\text{.}\)

Theorem: The reflexive closure of \(R\) is the union of \(R\) with \(\{(x, x) : x\in A\}\)

6.

What common relations on \(\mathbb{Z}\) are the transitive closures of the following relations?

  1. \(a S b\) if and only if \(a + 1 = b\text{.}\)

  2. \(a R b\) if and only if \(| a - b | = 2\text{.}\)

7.
  1. Let \(A\) be any set and \(R\) a relation on \(A\text{,}\) prove that \(\left(R^+\right)^+=R^+\text{.}\)

  2. Is the transitive closure of a symmetric relation always both symmetric and reflexive? Explain.

Answer
  1. By the definition of transitive closure, \(R^+\) is the smallest relation which contains \(R\text{;}\) therefore, it is transitive. The transitive closure of \(R^+\text{,}\) \(\left(R^+\right)^+\) , is the smallest transitive relation that contains \(R^+\text{.}\) Since \(R^+\) is transitive, \(\left(R^+\right)^+=R^+\text{.}\)

  2. The transitive closure of a symmetric relation is symmetric, but it may not be reflexive. If one element is not related to any elements, then the transitive closure will not relate that element to others.

8.

The definition of the Transitive Closure of \(R\) refers to the “smallest transitive relation that contains \(R\) as a subset.” Show that the intersection of all transitive relations on \(A\) containing \(R\) is a transitive relation containing \(R\) and is precisely \(R^+\text{.}\)