Definition:Composition of Relations

Definition
Let $$\mathcal R_1 \subseteq S_1 \times T_1$$ and $$\mathcal R_2 \subseteq S_2 \times T_2$$ be relations.

Then the composite of $$\mathcal R_1$$ and $$\mathcal R_2$$ is defined and denoted as:


 * $$\mathcal R_2 \circ \mathcal R_1 \ \stackrel {\mathbf {def}} {=\!=} \ \left\{{\left({x, z}\right) \in S_1 \times T_2: \exists y \in S_2 \cap T_1: \left({x, y}\right) \in \mathcal R_1 \and \left({y, z}\right) \in \mathcal R_2}\right\}$$

Some authors write $$\mathcal R_2 \circ \mathcal R_1$$ as $$\mathcal R_2 \mathcal R_1$$.

It is clear that the composite relation $$\mathcal R_2 \circ \mathcal R_1$$ can also be defined as:


 * $$\mathcal R_2 \circ \mathcal R_1 \left( {S_1}\right) = \mathcal R_2 \left( {\mathcal R_1 \left({S_1}\right)}\right)$$

Note that:
 * $$\mathcal R_2 \circ \mathcal R_1 \subseteq S_1 \times T_2$$;
 * The domain of $$R_2 \circ \mathcal R_1$$ equals the domain of $$\mathcal R_1$$, that is, $$S_1$$;
 * The codomain of $$R_2 \circ \mathcal R_1$$ equals the codomain of $$\mathcal R_2$$, that is, $$T_2$$.

Also see

 * Image and Preimage of Composition of Relations‎

Illustration
The following is a Venn diagram illustrating the relations between the various entities.


 * CompositionOfRelations.png

In the above:
 * $$\operatorname{Im} \left({\mathcal R}\right)$$ denotes the image of a relation $$\mathcal R$$;
 * $$\operatorname{Im}^{-1} \left({\mathcal R}\right)$$ denotes the preimage of a relation $$\mathcal R$$.