A store takes 20 percent off everything, and you also hold a coupon for 10 dollars off. On a 50 dollar item, taking the percentage first leaves 30 dollars, while using the coupon first leaves 32 dollars. Each discount is a function, and the price you pay comes from running one after the other. Chaining functions like this is called composition, and as the two prices show, the order matters.
Key terms
Composition
Definition Let and be functions. The composition of with is the function , read as ” composed with ”, given by
Its domain is the set of all in the domain of for which lies in the domain of . The small circle is not multiplication, and is in general different from the product .
In plain words Put into , then put the result into . Think of two machines linked so that the output of the first is the input of the second.
Example Let and . Replacing the input of by the whole expression gives
At the inner step gives and the outer step gives , and the formula agrees, since . The product would give something else, .
Inner and outer functions
Definition In the composition , the function is the inner function and is the outer function. The inner function acts first, on itself. The outer function acts second, on the output . In a formula, the inner function is the expression that fills the input slot of the outer one, and it helps to give the outer function its own letter for its input, as in with .
In plain words The inner function is the first machine and the outer function is the second. In the inner one is written inside the parentheses, even though it is the one you use first.
Example The function has inner function and outer function . At the inner function gives , and the outer function turns that into . So , as direct substitution confirms.
Ordered evaluation
Definition To evaluate at an input in the domain of , first compute , check that is in the domain of , and then compute . A composite of three functions is evaluated from the innermost function outward,
Composition is associative, , so this triple composite needs no extra parentheses. The order of the letters, however, cannot be changed.
In plain words Work from the inside out, one step at a time, and write down each number along the way. The function written farthest to the right is the one you use first.
Example Let , and . Then
Starting from the outside instead and computing first gives a wrong answer.
Noncommutativity
Definition Composition is not commutative. For most pairs of functions, and are different functions, either because they differ at some input or because they have different domains. Some pairs do agree in both orders, for example and , which give either way, but equality must never be assumed.
In plain words Doing and then is usually not the same as doing and then , just as socks and then shoes is not the same as shoes and then socks.
Example Let and . Then
At the first gives and the second gives . The discounts from the opening behave the same way. With for the sale and for the coupon, a price of dollars becomes
so using the coupon first always costs 2 dollars more.
Composite domain
Definition The domain of is
An input must pass two checks. It must be accepted by , and its output must be accepted by . The domain comes from these two conditions on the original functions, not from the simplified formula of the composite.
In plain words Check the first machine, then check that what it hands over fits the second machine. An input that fails either check is out.
Example Let and . The inner function needs . The outer function needs , that is , so . Therefore
Simplifying can hide a condition. With and the composite simplifies to , yet its domain is only , because is not a real number.
Decomposing a function
Definition To decompose a function means to find functions and with , that is, has the same domain as and for every in it. A decomposition is never unique. The trivial choices or always work and say nothing, so a useful decomposition takes as the inner function a part of the formula that is computed first, such as the expression under a root, inside a power or in a denominator.
In plain words Ask what you would compute first on a calculator. That first part is the inner function, and whatever you then do to its result is the outer function.
Example The function is with inner function and outer function . Another valid choice is with . Both give , as they must. The first split, with a plain power outside, is the one that the chain rule works with most easily.
Check yourself
- Let and . Find and .
Show the answer
Work from the inside out. For the first, and , so . For the second, and , so .
- Let and . Find the domain of .
Show the answer
The inner function needs . The outer function needs , that is
which holds exactly for . The domain is . For example fails, since .
- Find an inner function and an outer function with for the following function.
Show the answer
One choice is and . Since , the outer function never meets , so both and have domain . As a check, and . Other splits, such as and , are also correct.