# 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

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:

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

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

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

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

 $\displaystyle \Cdm {f_3 \circ \paren {f_2 \circ f_1} }$ $=$ $\displaystyle \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$