In this explainer, we will learn how to form a composite function by composing two or more functions.
Let us begin by recalling the definition of a function and a domain, along with some notation we will be using in this explainer.
Definition: Functions and Domains
A function is a relation that sends elements from the domain to the codomain . The domain is defined to be the set of all possible inputs of the function such that is defined.
Now, to help explain composite functions, let us consider the following analogy. Suppose a cyclist is traveling along a mountainous path. As they go up and down the mountain, their altitude (in metres above sea level) varies with respect to the time since they started cycling (in minutes). Let us suppose this altitude is given by the function .
Let us also suppose that in the region that the cyclist is traveling, the temperature (in degrees Celsius) depends only on the altitude. So no matter where exactly they are, their altitude determines their temperature. In other words, the temperature is a function of altitude .
Thus, since the temperature can be calculated from the altitude, and the altitude can be calculated from the time elapsed, the temperature can be calculated from the time elapsed, as follows:
For instance, if after 12 minutes the cyclist is at an altitude of 335 m, and it is known that the temperature at 335 m is , it follows that the temperature they experience after 12 minutes is .
This process is known as function composition. The new function we have created, is a composite function. We can formally define composite functions as follows.
Definition: Composite Functions
Let and be functions. Then, the composite function is defined by
Note that the order of (pronounced “ of ”) is important; this applies to first, followed by . The precise domain of is slightly tricky to figure out; hence, we will return to it later on in the explainer.
For now, let us consider a concrete example of calculating composite functions. Suppose we have the functions
Then, to calculate , we substitute every occurrence of in with , as follows:
Another way to think of this is that we substitute the innermost values first (in this case ) and work outward.
Alternatively, we could compose them in the opposite order. We would have
It is important to note that . In fact, generally speaking, it may not always be possible to compose functions in the opposite order, depending on the domains and ranges. This leads to the following rule.
Rule: Commutativity of the Composition of Functions
The composition of functions is not commutative. This means that for two functions and , is not the same as . The two operations are only equal under specific circumstances (e.g., ).
We have now been introduced to function composition and some of the properties it has. Let us test our knowledge with the following example.
Example 1: Finding the Expression of a Composite Function
If and , what is ?
Answer
Recall that, from the definition of a composite function,
To evaluate a composite function, we substitute in the expressions for and , starting from the inside and going outward. The innermost expression is ; therefore, substituting in , we have
Now we can substitute in . This just means that we take and replace the argument with . This gives us
In conclusion, we have .
We have now seen a couple of basic examples of how function composition works. Sometimes, we may be asked to evaluate composite functions at a specific point. As we will see in the next example, this is actually easier than computing the entire function.
Example 2: Evaluating Composite Functions at a Given Value
Given and , find .
Answer
Recall, from the definition, that we have
In this question, we have to evaluate the above expression at ; that is,
We begin by substituting in the expression for and evaluating it at 2, as follows:
Now we simply substitute in and evaluate it at 5:
Thus, .
Note
We did not have to work out the full expression for here to evaluate it at a certain value. If it had been necessary, we could have calculated first and evaluated it at 2 to get 14.
Evaluation of composite functions can be done using the expressions of the component functions, as we saw in the previous example. Equally, we can evaluate them using graphs of the component functions, which we will show in the next example.
Example 3: Evaluating Composite Functions at a Given Value from Their Graphs
In the given figure, the red graph represents , while the blue represents .
What is ?
Answer
To calculate , we start from the inside of the expression and calculate and then substitute this value into .
To find from the graph, we draw a line segment from the -axis at to the curve for (the blue curve) and project it onto the -axis. We show this below.
This gives us . Thus, we have . To calculate , we return to the diagram and follow the same procedure; we draw a line from the -axis at to the line for (the red curve) and follow it to the -axis, as shown below.
So, . Overall, this gives us .
Up until now, we have only seen a function composed with one other function at a time, but we can extend this to composing multiple functions together by simply using the definition of function composition multiple times. For instance,
In the next example, we will see how this works if we compose the same function with itself multiple times.
Example 4: Evaluating the Composite of a Function with Itself Multiple Times at a Given Value
Set , , and so on such that , , and so on. Suppose . Find .
Answer
Using the logic above, we are being asked to calculate
This might look tricky at first, but note that we do not actually have to calculate . We simply need to calculate and then apply to the result multiple times. Let us do this below:
So, in conclusion, we have .
Earlier, we said we would return to the issue of the domain of a composite function, so let us explore that concept now.
The general method for finding the domain of a composite function is fairly complicated, but in some cases, if we try substituting the inner function into the outer function, it may simplify into a form in which we can directly determine the domain. Let us present a short example of this. Suppose we have and we want to find the domain of . If we substitute into , we get
From here, we can figure out the domain of the function by noting that the input of a square root must always be positive. This means that
That is to say, the domain of is equal to .
Let us attempt another example of this, where this time the resulting composite function is a rational function.
Example 5: Determining the Domain of a Composite Function
If the function , where , and the function , determine the domain of .
Answer
To determine the domain of a function composition, one method is to evaluate as a function by substituting into and finding the domain of the resulting function. Doing this, we get
As this is a rational function, we can determine its domain directly. Recall that the domain of a rational function is determined by the restriction that its denominator has to be nonzero for all (since we cannot divide by zero). That is,
So, the domain is every real value of except for 41, or in other words, the domain is .
Let us further consider the domain and range of the composite function in the previous example and how they differ from the domains and ranges of the original functions. We note that, originally, and have domains and ranges as follows:
For , since it is a rational function, we recall that its domain is all of , except for the point where its denominator is zero (i.e., at ), and its range is all of , except for zero, since can never be zero. For , since it is a linear function, it has both a domain and range of .
In comparison, has a domain and range given by
Since it is a rational function, the domain and range are found similarly to those of ; the only difference is the domain, which we calculated previously. If we plot the two rational functions, we have the following.
In other words, they take the exact same shape, except that the composite function has been shifted to the right by 41 units.
Let us finish by recapping the main things we have learned in this explainer.
Key Points
- Let and be functions. Then, the composite function is defined by
- We can compute by replacing each instance of in by .
- The composition of functions is not commutative. This means that for two functions and , is not the same as .
- We can determine the domain of by substituting into and finding the domain of the resulting function .