For three non-empty sets \(A\), \(B\) and \(C\), if \(f : A \to B\) and \(g : B \to C\) are two functions, then the composition of \(f\) and \(g\) is a function \(g \circ f : A \to C\) will be defined as \((g \circ f)(x) = g(f(x))\) for all \(x \in A\).
If \(f\) and \(g\) are any two functions, then in general, \(f \circ g \neq g \circ f\).
If \(f\), \(g\) and \(h\) are any three functions, then \(f \circ (g \circ h) = (f \circ g) \circ h\).