Composition of Relations is Associative

Theorem
The composition of relations is an associative binary operation:

$$\left({\mathcal{R}_3 \circ \mathcal{R}_2}\right) \circ \mathcal{R}_1 = \mathcal{R}_3 \circ \left({\mathcal{R}_2 \circ \mathcal{R}_1}\right)$$

Proof
First, note that from the definition of composition of relations, the following must be the case before the above expression is even to be defined:


 * $$\mathrm {Dom} \left({\mathcal{R}_2}\right) = \mathrm {Rng} \left({\mathcal{R}_1}\right)$$
 * $$\mathrm {Dom} \left({\mathcal{R}_3}\right) = \mathrm {Rng} \left({\mathcal{R}_2}\right)$$

The two composite relations can be seen to have the same domain, thus:

... and also the same range, thus:

So they are equal iff they have the same value at each point in their common domain, which this shows: