Composition of Relations is Associative

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

The two composite relations can be seen to have the same domain and range, that is:

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

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

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

$$\forall x \in S_1: \left({\left({\mathcal{R}_3 \circ \mathcal{R}_2}\right) \circ \mathcal{R}_1}\right) \left({x}\right)$$

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

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

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

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