Let us learn the composition of three functions based on the composition of two functions.
Consider four sets \(A\), \(B\), \(C\) and \(D\).
Let \(f: A \rightarrow B\), \(g: B \rightarrow C\), \(h: C \rightarrow D\) be three functions.
The composition of the functions \(f\), \(g\) and \(h\) is given by \(f \circ \left(g \circ h\right)\) and \(\left(f \circ g\right) \circ h\).
Here, we observe that three functions are involved in the composition. So, it is obvious that the composition of the functions is not commutative.
But, the composition of three functions is always associative. That is \(f \circ \left(g \circ h\right)\) \(=\)\(\left(f \circ g\right) \circ h\).
The composition of three functions is represented using an arrow diagram as follows: