126. Composition of relations

126.1 Definition: composition of relations

Let $\alpha$ be a relation from $A$ to $B$ and $\beta$ be a relation from $B$ to $C$. The composite $\alpha\circ\beta$ is a relation from $A$ to $C$, defined this way: For all $a\in A$ and $c\in C$,

$$a(\alpha\circ\beta)c\Leftrightarrow \exists b\in B(a\,\alpha\, b\wedge b\,\beta\, c)$$

126.1.1 Example Let $A=\{1,2,3,4,5\}$, $B=\{3,5,7,9\}$ and $C=\{1,2,3,4,5,6\}$, with

$$\alpha=\left\{\langle 1,3\rangle,\langle 1,5\rangle,\langle 2,7\rangle,\langle 3,5\rangle,\langle 3,9\rangle,\langle 5,7\rangle\right\}$$

and

$$\beta=\left\{\langle 3,1\rangle,\langle 3,2\rangle,\langle 3,3\rangle,\langle 7,4\rangle,\langle 9,4\rangle,\langle 9,5\rangle,\langle 9,6\rangle\right\}$$

Then

$$\alpha\circ\beta=\left\{\langle 1,1\rangle,\langle 1,2\rangle,\langle 1,3\rangle,\langle 2,4\rangle,\langle 3,4\rangle,\langle 3,5\rangle,\langle 3,6\rangle,\langle 5,4\rangle\right\}$$

126.1.2 Usage As you can see, although functions are composed from right to left, relations are composed from left to right. It is not hard to see that if $F:A\to B$ and $G:B\to C$ are functions, then

$$\Gamma(G\circ F)=\Gamma(F)\circ\Gamma(G)$$

126.1.3 Exercise Let $A=\{2,3,4,5\}$, $B=\{6,7,8,9\}$, $C=\{a,b,c,d,e\}$, and $\alpha\in\mathrm{Rel}(A,B)$, $\beta\in\mathrm{Rel}(B,C)$ be defined as follows. Give the ordered pairs in $\alpha\circ\beta$.

a) $\alpha$ is “divides”, $\beta$ is $\left\{\langle 6,a\rangle,\langle 6,c\rangle,\langle 7,b\rangle,\langle 9,d\rangle\right\}$.

b) $\alpha$ is “divides”, $\beta$ is $\left\{\langle 7,a\rangle,\langle 7,b\rangle,\langle 7,c\rangle\right\}$.

c) $\alpha=\left\{\langle 2,7\rangle,\langle 2,8\rangle,\langle 3,7\rangle,\langle 3,9\rangle,\langle 4,8\rangle,\langle 4,9\rangle\right\}$ and $\beta=\left\{\langle 6,a\rangle,\langle 6,b\rangle,\langle 7,c\rangle,\langle 8,c\rangle,\langle 9,c\rangle,\langle 9,d\rangle,\langle 9,e\rangle\right\}$ (Answer on page 250.)

126.2 Theorem

Composition of relations is associative: if $\alpha\in\mathrm{Rel}(A,B)$, $\beta\in\mathrm{Rel}(B,C)$, and $\gamma\in\mathrm{Rel}(C,D)$, then

$$(\alpha\circ\beta)\circ\gamma=\alpha\circ(\beta\circ\gamma)\in\mathrm{Rel}(A,D)$$

Proof Left as Problem 126.3.4.

126.3 Definition: composition powers

The composition powers of a relation $\alpha$ on a set $A$ are $\alpha^0=\Delta_A$ (the equals relation), $\alpha^1=\alpha$, $\alpha^2=\alpha\circ\alpha$, and in general $\alpha^n=\alpha\circ\alpha^{n-1}$.

126.3.1 Exercise For each relation $\mathrm{R}$ in Exercise 52.1.3, page 75, determine whether $1\mathrm{R}^2 3$, $1\mathrm{R}^3 3$, and $3\mathrm{R}^2 1$. (Answer on page 250.)

126.3.2 Exercise Prove that if $F:A\to B$ and $G:B\to C$ are functions, then $\Gamma(G\circ F)=\Gamma(F)\circ\Gamma(G)$.

126.3.3 Exercise Let $A=\{1,2,3,4\}$.

a) Construct a nonempty relation $\alpha$ on $A$ for which $\alpha^2$ is empty.

b) Construct a relation $\alpha\neq A\times A$ on $A$ for which $\alpha^2=A\times A$.

126.3.4 Exercise Prove that composition of relations is associative.

126.3.5 Exercise Show that the composite of functional relations is a functional relation.

126.3.6 Exercise Let $\alpha$ be a relation on a set $A$. Prove that $\alpha$ is transitive if and only if $\alpha\circ\alpha\subseteq\alpha$.

126.3.7 Exercise A relation $\alpha$ on a set $A$ is interpolative if $\alpha\subseteq\alpha\circ\alpha$. Show that $<$, as a relation on $\mathrm{R}$, is interpolative, but as a relation on $\mathrm{Z}$, it is not interpolative.

Pages 195–196 of the book (PDF).