Theorem 2.13

Statement:

(Associativity of Composition)

Let $S$ be a set and let $f,\ g,$ and $h$ be functions mapping $S$ into $S$. Then $f \circ (g \circ h) = (f \circ g) \circ h$.

Proof:

To show these two functions are equal, we must show that they give the same assignment to each $x \in S$. Computing we find that

(1)
\begin{align} (f \circ (g \circ h))(x) = f((g \circ h)(x)) = f(g(h(x))) \end{align}
(2)
\begin{align} ((f \circ g) \circ h)(x) = (f \circ g)(h(x)) = f(g(h(x))) \end{align}

so the same element $f(g(h(x)))$ of $S$ is indeed obtained.