# Composition of Mappings is Associative

## Theorem

$\paren {f_3 \circ f_2} \circ f_1 = f_3 \circ \paren {f_2 \circ f_1}$

where $f_1, f_2, f_3$ are arbitrary mappings which fulfil the conditions for the relevant compositions to be defined.

## Proof

$\begin{xy}\[email protected] + 2mu@ + 1em { E \ar[ddd]^*{f} \ar[rrr]^*{g \circ f} \ar@{..>}[drdrdr]_*{h \circ g \circ f} & & & G \ar[ddd]^*{h} \\ \\ \\ F \ar[rrr]^*{h \circ g} \ar[rururu]_*{g} & & & H }\end{xy}$

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:

$(1): \quad \Dom {f_2} = \Cdm {f_1}$
$(2): \quad \Dom {f_3} = \Cdm {f_2}$

where $\Cdm f$ denotes the codomain of the mapping $f$.

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

 $\ds \Dom {\paren {f_3 \circ f_2} \circ f_1}$ $=$ $\ds \Dom {f_1}$ Domain of Composite Relation

 $\ds \Dom {f_3 \circ \paren {f_2 \circ f_1} }$ $=$ $\ds \Dom {f_2 \circ f_1}$ Domain of Composite Relation $\ds$ $=$ $\ds \Dom {f_1}$ Domain of Composite Relation

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

 $\ds \Cdm {\paren {f_3 \circ f_2} \circ f_1}$ $=$ $\ds \Cdm {f_3 \circ f_2}$ Codomain of Composite Relation $\ds$ $=$ $\ds \Cdm {f_3}$ Codomain of Composite Relation

 $\ds \Cdm {f_3 \circ \paren {f_2 \circ f_1} }$ $=$ $\ds \Cdm {f_3}$ Codomain of Composite Relation

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

$\forall x \in \Dom {f_1}: \map {\paren {f_3 \circ f_2} \circ f_1} x = \map {f_3 \circ \paren {f_2 \circ f_1} } x$

Hence the result.

$\blacksquare$