Composition of Mappings is Associative

Theorem
The composition of mappings is an associative binary operation:


 * $\left({f_3 \circ f_2}\right) \circ f_1 = f_3 \circ \left({f_2 \circ f_1}\right)$

Proof
From the definition, we know that a mapping is a relation.

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:


 * $\operatorname{Dom} \left({f_2}\right) = \operatorname{Cdm} \left({f_1}\right)$
 * $\operatorname{Dom} \left({f_3}\right) = \operatorname{Cdm} \left({f_2}\right)$

where $\operatorname{Cdm} \left({f}\right)$ denotes the codomain of the mapping $f$.

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

Also they have the same codomain, as is seen by:

As a mapping is a relation, we can use that the Composition of Relations is Associative‎:


 * $\forall x \in \operatorname{Dom} \left({f_1}\right): \left({f_3 \circ f_2}\right) \circ f_1 \left({x}\right) = f_3 \circ \left({f_2 \circ f_1}\right) \left({x}\right)$

Hence the result.