2.7 - Composition of Functions
Overview
Composing functions means feeding the output of one function into another. It lets you build new functions out of simpler ones, connect quantities that aren't directly related by one formula, and break complicated functions into pieces. Composition also sets up inverse functions in Topic 2.8.
What composition means
If and are functions, the composite function (read “ composed with ” or “ of ”) is defined by
Work from the inside out: acts first, and its output becomes the input of .

The domain of a composite function
For to exist, two things must be true:
- is in the domain of .
- is in the domain of .
So the domain of is restricted to the inputs of whose outputs can accept.
For example, let and . Then . The function accepts any , but only accepts inputs that are at least 0, so we need . The domain of is .
Evaluating composite functions
You can find values of from any representation of and : equations, tables, graphs, or words. The process is always the same: find the output of , then use it as the input of .
Example 1: From equations
Let and . Find and .
First composition. Start inside, with :
Second composition. Now goes first:
Answer: and . Same two functions, same input, different order, different answers.
Example 2: From a table
Use the table to find each value.
0 | 1 | 2 | 3 | 4 | |
2 | 4 | 1 | 6 | 0 | |
3 | 0 | 4 | 1 | 2 |
(a) : the table gives , so .
(b) : the table gives , so .
(c) : the table gives , so .
(d) : the table gives , but 6 isn't an input in the table for . So can't be found from this table. This is the domain rule in action: the output of the inside function has to be an input the outside function accepts.
Example 3: From graphs
The graphs of and are shown. Find , , and .

(a) From the graph of , . From the graph of , . So .
(b) From the graph of , . From the graph of , . So .
(c) From the graph of , . From the graph of , . So .
Order matters
Composition is not commutative: and are usually different functions, so and usually give different values. Example 1 showed this ( versus ). Compare the formulas for and :
The first adds 3 and then squares. The second squares and then adds 3. At , they give and .
The identity function
The function is the identity function: it returns whatever you give it. Composing any function with the identity changes nothing:
The identity function plays the same role for composition that 0 plays for addition () and 1 plays for multiplication (). This idea is the heart of inverse functions in Topic 2.8: a function and its inverse compose to give the identity.
Building composite functions
Substituting one formula into another
To write as a formula, replace every in with the whole expression . Use parentheses so nothing gets lost.
Example 4: Writing a composite formula
Let and . Write in standard form.
Answer: . Quick check at : and , and the formula gives . It matches.
Tables and graphs of a composite function
Without formulas, you can still build a table or graph of : for each input , find and record the pair . Using the graphs from Example 3:
0 | 1 | 2 | 3 | 4 | 5 | 6 | |
5 | 4 | 3 | 2 | 3 | 4 | 1 | |
2 | 4 | 5 | 6 | 5 | 4 | 4 |
Plotting the points gives a graph of .
Connecting quantities through a middle quantity
Composition is useful when two quantities aren't linked by one formula but are both linked to a third quantity. If depends on and depends on , composing gives in terms of .
Example 5: Factory costs over time (AP-style)
A factory produces items in hours. The cost of producing items is dollars.
(a) Write the cost as a function of time. (b) Find and interpret . (c) Does make sense?
Part (a). Substitute into :
Part (b).
In 5 hours the factory makes items, and producing them costs $2,900.
Part (c). No. The output of is a cost in dollars, but expects an input in hours. The output of the inside function has to be the kind of input the outside function uses. This is another reason order matters.
Decomposing functions
Going the other way, a complicated function can often be written as a composition of simpler ones. Find the “inside” expression that is being plugged into something and call it . The operation done to it becomes . When a function is properly decomposed, the variable of replaces every copy of .
Inside: | Outside: | |
The last row shows the rule: both copies of become in . Decompositions aren't unique. For example, is also with and . Any pair that works is correct unless a question asks for a specific form.
Transformations as compositions
The transformations from Unit 1 are compositions with simple linear functions:
- An additive transformation (a translation) is a composition with .
- A multiplicative transformation (a dilation) is a composition with .
Whether goes inside or outside decides the direction:
Composition | Result | Effect on the graph of |
with | Horizontal translation by | |
with | Vertical translation by | |
with | Horizontal dilation by a factor of | |
with | Vertical dilation by a factor of |
If , the dilations also reflect the graph: over the -axis for and over the -axis for . The pattern to remember: inside changes are horizontal, outside changes are vertical.
Example 6: A transformation as a chain of compositions
Write as a composition of with simple linear functions.
Follow what happens to , in order:
- Subtract 1: . This shifts the graph right 1.
- Apply : .
- Multiply by 5: . This stretches the graph vertically by a factor of 5.
- Add 4: . This shifts the graph up 4.
Common mistakes
- Working outside in. In , goes first.
- Treating composition as multiplication. is not .
- Dropping parentheses. With and , , not .
- Ignoring the domain. The output of the inside function must be in the domain of the outside function.
- Assuming order doesn't matter. and are usually different.