Composition

Function composition is an operation that takes as input two functions and returns another function. If the two functions are $f, g$, the output is denoted $f\circ g$. Function composition is defined so that $f\circ g(x) = f(g(x))$ for all inputs $x$. Not every possible pair of functions can be composed - the range of $g$ has to be a subset of the domain of $f$. Function composition, wherever it is defined, is always associative, but rarely commutative.

Function composition is generalized to composition of morphisms in category theory.

See also