1.6: Composite Functions
- How does the process of function composition produce a new function from two other functions?
- In the composite function \(h(x) = f(g(x))\text{,}\) what do we mean by the “inner” and “outer” function? What role do the domain and codomain of \(f\) and \(g\) play in determining the domain and codomain of \(h\text{?}\)
- How does the expression for \(AV_{[a,a+h]}\) involve a composite function?
Recall that a function, by definition, is a process that takes a collection of inputs and produces a corresponding collection of outputs in such a way that the process produces one and only one output value for any single input value. Because every function is a process, it makes sense to think that it may be possible to take two function processes and do one of the processes first, and then apply the second process to the result.
Suppose we know that \(y\) is a function of \(x\) according to the process defined by \(y = f(x) = x^2 - 1\) and, in turn, \(x\) is a function of \(t\) via \(x = g(t) = 3t-4\text{.}\) Is it possible to combine these processes to generate a new function so that \(y\) is a function of \(t\text{?}\)
- Solution
-
Since \(y\) depends on \(x\) and \(x\) depends on \(t\text{,}\) it follows that we can also think of \(y\) depending directly on \(t\text{.}\) We can use substitution and the notation of functions to determine this relationship.
First, it's important to realize what the rule for \(f\) tells us. In words, \(f\) says “to generate the output that corresponds to an input, take the input and square it, and then subtract \(1\text{.}\)” In symbols, we might express \(f\) more generally by writing “\(f(\Box) = \Box^2 - 1\text{.}\)”
Now, observing that \(y = f(x) = x^2 - 1\) and that \(x = g(t) = 3t - 4\text{,}\) we can substitute the expression \(g(t)\) for \(x\) in \(f\text{.}\) Doing so,
\begin{align*} y &= f(x)\\ &= f(g(t))\\ &= f(3t-4)\text{.} \end{align*}Applying the process defined by the function \(f\) to the input \(3t-4\text{,}\) we see that
\[ y = (3t-4)^2 - 1\text{,} \nonumber \]which defines \(y\) as a function of \(t\text{.}\)
When we have a situation such as in Example \(\PageIndex{1}\) where we use the output of one function as the input of another, we often say that we have “composed two functions”. In addition, we use the notation \(h(t) = f(g(t))\) to denote that a new function, \(h\text{,}\) results from composing the two functions \(f\) and \(g\text{.}\)
Let \(y = p(x) = 3x - 4\) and \(x = q(t) = t^2 - 1\text{.}\)
- Let \(r(t) = p(q(t))\text{.}\) Determine a formula for \(r\) that depends only on \(t\) and not on \(p\) or \(q\text{.}\)
- Recall Example 1.6.1, which involved functions similar to \(p\) and \(q\text{.}\) What is the biggest difference between your work in (a) above and in Example 1.6.1?
- Let \(t = s(z) = \frac{1}{z+4}\) and recall that \(x = q(t) = t^2 - 1\text{.}\) Determine a formula for \(x = q(s(z))\) that depends only on \(z\text{.}\)
- Suppose that \(h(t) = \sqrt{2t^2 + 5}\text{.}\) Determine formulas for two related functions, \(y = f(x)\) and \(x = g(t)\text{,}\) so that \(h(t) = f(g(t))\text{.}\)
Composing two functions
Whenever we have two functions, say \(g : A \to B\) and \(f : B \to C\text{,}\) where the codomain of \(g\) matches the domain of \(f\text{,}\) it is possible to link the two processes together to create a new process that we call the composition of \(f\) and \(g\text{.}\)
If \(f\) and \(g\) are functions such that \(g : A \to B\) and \(f : B \to C\text{,}\) we define the composition of \(f\) and \(g\) to be the new function \(h: A \to C\) given by
We also sometimes use the notation \(h = f \circ g\text{,}\) where \(f \circ g\) is the single function defined by \((f \circ g)(t) = f(g(t))\text{.}\)
We sometimes call \(g\) the “inner function” and \(f\) the “outer function”. It is important to note that the inner function is actually the first function that gets applied to a given input, and then outer function is applied to the output of the inner function. In addition, in order for a composite function to make sense, we need to ensure that the range of the inner function lies within the domain of the outer function so that the resulting composite function is defined at every possible input.
In addition to the possibility that functions are given by formulas, functions can be given by tables or graphs. We can think about composite functions in these settings as well, and the following activities prompt us to consider functions given in this way.
Let functions \(p\) and \(q\) be given by the graphs in Figure \(\PageIndex{4}\) (which are each piecewise linear - that is, parts that look like straight lines are straight lines) and let \(f\) and \(g\) be given by Table \(\PageIndex{3}\)
| \(x\) | 0 | 1 | 2 | 3 | 4 |
| \(f(x)\) | 6 | 4 | 3 | 4 | 6 |
| \(g(x)\) | 1 | 3 | 0 | 4 | 2 |
-
Compute each of the following quantities or explain why they are not defined.
- \(\displaystyle p(q(0))\)
- \(\displaystyle q(p(0))\)
- \(\displaystyle (p \circ p)(-1)\)
- \(\displaystyle (f \circ g)(2)\)
- \(\displaystyle (g \circ f)(3)\)
- \(\displaystyle g(f(0))\)
- For what value(s) of \(x\) is \(f(g(x)) = 4\text{?}\)
- For what value(s) of \(x\) is \(q(p(x)) = 1\text{?}\)
Composing functions in context
Recall Dolbear's function, \(T = D(N) = 40 + 0.25N\text{,}\) that relates the number of chirps per minute from a snowy cricket to the Fahrenheit temperature, \(T\text{.}\) We earlier established that \(D\) has a domain of \([40,160]\) and a corresponding range of \([50,85]\text{.}\) In what follows, we replace \(T\) with \(F\) to emphasize that temperature is measured in Fahrenheit degrees.
The Celsius and Fahrenheit temperature scales are connected by a linear function. Indeed, the function that converts Fahrenheit to Celsius is
For instance, a Fahrenheit temperature of \(32\) degrees corresponds to \(C = G(32) = 0\) degrees Celsius.
Let \(F = D(N) = 40 + 0.25N\) be Dolbear's function that converts an input of number of chirps per minute to degrees Fahrenheit, and let \(C = G(F) = \frac{5}{9}(F-32)\) be the function that converts an input of degrees Fahrenheit to an output of degrees Celsius.
- Determine a formula for the new function \(H = (G \circ D)\) that depends only on the variable \(N\text{.}\)
- What is the meaning of the function you found in (a)?
- How does a plot of the function \(H = (G \circ D)\) compare to that of Dolbear's function? Sketch a plot of \(y = H(N) = (G \circ D)(N)\) on the blank axes to the right of the plot of Dolbear's function, and discuss the similarities and differences between them. Be sure to label the vertical scale on your axes.
What is the domain of the function \(H = G \circ D\text{?}\) What is its range?
Function composition and average rate of change
Recall that the average rate of change of a function \(f\) on the interval \([a,b]\) is given by
In Figure \(\PageIndex{7}\) , we see the familiar representation of \(AV_{[a,b]}\) as the slope of the line joining the points \((a,f(a))\) and \((b,f(b))\) on the graph of \(f\text{.}\) In the study of calculus, we progress from the average rate of change on an interval to the instantaneous rate of change of a function at a single value ; the core idea that allows us to move from an average rate to an instantaneous one is letting the interval \([a,b]\) shrink in size.
To think about the interval \([a,b]\) shrinking while \(a\) stays fixed, we often change our perspective and think of \(b\) as \(b = a + h\text{,}\) where \(h\) measures the horizontal difference from \(b\) to \(a\text{.}\) This allows us to eventually think about \(h\) getting closer and closer to \(0\text{,}\) and in that context we consider the equivalent expression
for the average rate of change of \(f\) on \([a,a+h]\text{.}\)
In this most recent expression for \(AV_{[a,a+h]}\text{,}\) we see the important role that the composite function “\(f(a+h)\)” plays. In particular, to understand the expression for \(AV_{[a,a+h]}\) we need to evaluate \(f\) at the quantity \((a+h)\text{.}\)
Suppose that \(f(x) = x^2\text{.}\) Determine the simplest possible expression you can find for \(AV_{[3,3+h]}\text{,}\) the average rate of change of \(f\) on the interval \([3,3+h]\text{.}\)
- Solution
-
By definition, we know that
\[ AV_{[3,3+h]} = \frac{f(3+h)-f(3)}{h}. \nonumber \]
Using the formula for \(f\text{,}\) we see that\[ AV_{[3,3+h]} = \frac{(3+h)^2-(3)^2}{h}. \nonumber \]
Expanding the numerator and combining like terms, it follows that\begin{align*} AV_{[3,3+h]} &= \frac{(9+6h+h^2)-9}{h}\\ &= \frac{6h + h^2}{h}\text{.} \end{align*}
Removing a factor of \(h\) in the numerator and observing that \(h \ne 0\text{,}\) we can simplify and find that\begin{align*} AV_{[3,3+h]} &= \frac{h(6 + h)}{h}\\ &= 6+h\text{.} \end{align*}
Hence, \(AV_{[3,3+h]} = 6+h\text{,}\) which is the average rate of change of \(f(x) = x^2\) on the interval \([3,3+h]\text{.}\) 1Note that \(6 + h\) is a linear function of \(h\text{.}\) This computation is connected to the observation we made in Table 1.5.9 regarding how there's a linear aspect to how the average rate of change of a quadratic function changes as we modify the interval.
Let \(f(x) = 2x^2 - 3x + 1\) and \(g(x) = \frac{5}{x}\text{.}\)
- Compute \(f(1+h)\) and expand and simplify the result as much as possible by combining like terms.
- Determine the most simplified expression you can for the average rate of change of \(f\) on the interval \([1,1+h]\text{.}\) That is, determine \(AV_{[1,1+h]}\) for \(f\) and simplify the result as much as possible.
- Compute \(g(1+h)\text{.}\) Is there any valid algebra you can do to write \(g(1+h)\) more simply?
- Determine the most simplified expression you can for the average rate of change of \(g\) on the interval \([1,1+h]\text{.}\) That is, determine \(AV_{[1,1+h]}\) for \(g\) and simplify the result.
In Activity \(\PageIndex{4}\) , we see an important setting where algebraic simplification plays a crucial role in calculus. Because the expresssion
always begins with an \(h\) in the denominator, in order to precisely understand how this quantity behaves when \(h\) gets close to \(0\text{,}\) a simplified version of this expression is needed. For instance, as we found in part (b) of Activity \(\PageIndex{4}\) , it's possible to show that for \(f(x) = 2x^2 - 3x + 1\text{,}\)
which is a much simpler expression to investigate.
Summary
- When defined, the composition of two functions \(f\) and \(g\) produces a single new function \(f \circ g\) according to the rule \((f \circ g)(x) = f(g(x))\text{.}\) We note that \(g\) is applied first to the input \(x\text{,}\) and then \(f\) is applied to the output \(g(x)\) that results from \(g\text{.}\)
- In the composite function \(h(x) = f(g(x))\text{,}\) the “inner” function is \(g\) and the “outer” function is \(f\text{.}\) Note that the inner function gets applied to \(x\) first, even though the outer function appears first when we read from left to right. The composite function is only defined provided that the codomain of \(g\) matches the domain of \(f\text{:}\) that is, we need any possible outputs of \(g\) to be among the allowed inputs for \(f\text{.}\) In particular, we can say that if \(g : A \to B\) and \(f : B \to C\text{,}\) then \(f \circ g : A \to C\text{.}\) Thus, the domain of the composite function is the domain of the inner function, and the codomain of the composite function is the codomain of the outer function.
-
Because the expression \(AV_{[a,a+h]}\) is defined by
\[ AV_{[a,a+h]} = \frac{f(a+h) - f(a)}{h} \nonumber \]
and this includes the quantity \(f(a+h)\text{,}\) the average rate of change of a function on the interval \([a,a+h]\) always involves the evaluation of a composite function expression. This idea plays a crucial role in the study of calculus.
Exercises
Use the given information about various functions to answer the following questions involving composition.
- Let functions \(f\) and \(g\) be given by the graphs in Figure \(\PageIndex{10}\) and Figure \(\PageIndex{11}\) An open circle means there is not a point at that location on the graph. For instance, \(f(-1) = 1\text{,}\) but \(f(3)\) is not defined.
- Determine \(f(g(1))\) and \(g(f(-2))\text{.}\)
- Again using the functions given in (a), can you determine a value of \(x\) for which \(g(f(x))\) is not defined? Why or why not?
- Let functions \(r\) and \(s\) be defined by Table \(\PageIndex{12}\)
| \(t\) | \(-4\) | \(-3\) | \(-2\) | \(-1\) | \(0\) | \(1\) | \(2\) | \(3\) | \(4\) |
| \(r(t)\) | \(4\) | \(1\) | \(2\) | \(3\) | \(0\) | \(-3\) | \(2\) | \(-1\) | \(-4\) |
| \(s(t)\) | \(-5\) | \(-6\) | \(-7\) | \(-8\) | \(0\) | \(8\) | \(7\) | \(6\) | \(5\) |
Determine \((s \circ r)(3)\text{,}\) \((s \circ r)(-4)\text{,}\) and \((s \circ r)(a)\) for one additional value of \(a\) of your choice.
4. For the functions \(r\) and \(s\) defined in (c), state the domain and range of each function. For how many different values of \(b\) is it possible to determine \((r \circ s)(b)\text{?}\) Explain.
5. Let \(m(u) = u^3 + 4u^2 - 5u + 1\text{.}\) Determine expressions for \(m(x^2)\text{,}\) \(m(2+h)\text{,}\) and \(m(a+h)\text{.}\)
6. For the function \(F(x) = 4 - 3x - x^2\text{,}\) determine the most simplified expression you can find for \(AV_{[2,2+h]}\text{.}\) Show your algebraic work and thinking fully.
Recall Dolbear's function that defines temperature, \(F\text{,}\) in Fahrenheit degrees, as a function of the number of chirps per minute, \(N\text{,}\) is \(F = D(N) = 40 + \frac{1}{4}N\text{.}\)
- Solve the equation \(F = 40 + \frac{1}{4}N\) for \(N\) in terms of \(F\text{.}\)
- Say that \(N = g(F)\) is the function you just found in (a). What is the meaning of this function? What does it take as inputs and what does it produce as outputs?
- How many chirps per minute do we expect when the outsidet temperature is \(82\) degrees F? How can we express this in the notation of the function \(g\text{?}\)
- Recall that the function that converts Fahrenheit to Celsius is \(C = G(F) = \frac{5}{9}(F-32)\text{.}\) Solve the equation \(C = \frac{5}{9}(F-32)\) for \(F\) in terms of \(C\text{.}\) Call the resulting function \(F = p(C)\text{.}\) What is the meaning of this function?
- Is it possible to write the chirp-rate \(N\) as a function of temperature \(C\) in Celsius? That is, can we produce a function whose input is in degrees Celsius and whose output is the number of chirps per minute? If yes, do so and explain your thinking. If not, explain why it's not possible.
For each of the following functions, find two simpler functions \(f\) and \(g\) such that the given function can be written as the composite function \(g \circ f\text{.}\)
- \(\displaystyle h(x) = (x^2 + 7)^3\)
- \(\displaystyle r(x) = \sqrt{5-x^3}\)
- \(\displaystyle m(x) = \frac{1}{x^4 + 2x^2 + 1}\)
- \(\displaystyle w(x) = 2^{3-x^2}\)
A spherical tank has radius \(4\) feet. The tank is initially empty and then begins to be filled in such a way that the height of the water rises at a constant rate of \(0.4\) feet per minute. Let \(V\) be the volume of water in the tank at a given instant, and \(h\) the depth of the water at the same instant; let \(t\) denote the time elapsed in minutes since the tank started being filled.
-
Calculus can be used to show that the volume, \(V\text{,}\) is a function of the depth, \(h\text{,}\) of the water in the tank according to the function
\[ V = f(h) = \frac{\pi}{3} h^2(12-h)\text{.}\label{E-ez-composite-spherical-tank-V-h}\tag{1.6.1} \]
What is the domain of this model? Why? What is the corresponding range?
- We are given the fact that the tank is being filled in such a way that the height of the water rises at a constant rate of \(0.4\) feet per minute. Said differently, \(h\) is a function of \(t\) whose average rate of change is constant. What kind of function does this make \(h = p(t)\text{?}\) Determine a formula for \(p(t)\text{.}\)
- What are the domain and range of the function \(h = p(t)\text{?}\) How is this tied to the dimensions of the tank?
- In (a) we observed that \(V\) is a function of \(h\text{,}\) and in (b) we found that \(h\) is a function of \(t\text{.}\) Use these two facts and function composition appropriately to write \(V\) as a function of \(t\text{.}\) Call the resulting function \(V = q(t)\text{.}\)
- What are the domain and range of the function \(q\text{?}\) Why?
- On the provided axes, sketch accurate graphs of \(h = p(t)\) and \(V = q(t)\text{,}\) labeling the vertical and horizontal scale on each graph appropriately. Make your graphs as precise as you can; use a computing device to assist as needed
Why do each of the two graphs have their respective shapes? Write at least one sentence to explain each graph; refer explicitly to the shape of the tank and other information given in the problem.