Sometimes it is useful to apply one function, and then apply a second function to the result. For example, suppose and . First, takes the input value and outputs . Then, is input into which gives a new output, . This idea can be used to create a new function, called the composition of g and f.
Let and be two functions. The composition of the functions and , written ("g composed with f "), is defined by
The domain of the function is the set of all numbers in the domain of for which is in the domain of .