## Section1.6Composite Functions

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.

###### Example1.6.1.

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

\begin{equation*} y = (3t-4)^2 - 1\text{,} \end{equation*}

which defines $y$ as a function of $t\text{.}$

When we have a situation such as in Example 1.6.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{.}$

###### Preview Activity1.6.1.

Let $y = p(x) = 3x - 4$ and $x = q(t) = t^2 - 1\text{.}$

1. Let $r(t) = p(q(t))\text{.}$ Determine a formula for $r$ that depends only on $t$ and not on $p$ or $q\text{.}$

2. 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?

3. 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{.}$

4. 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{.}$

### Subsection1.6.1Composing 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{.}$

###### Definition1.6.2.

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

\begin{equation*} h(t) = f(g(t))\text{.} \end{equation*}

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.

###### Activity1.6.2.

Let functions $p$ and $q$ be given by the graphs in Figure 1.6.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 1.6.3.

Compute each of the following quantities or explain why they are not defined.

1. $\displaystyle p(q(0))$

2. $\displaystyle q(p(0))$

3. $\displaystyle (p \circ p)(-1)$
4. $\displaystyle (f \circ g)(2)$

5. $\displaystyle (g \circ f)(3)$

6. $\displaystyle g(f(0))$

7. For what value(s) of $x$ is $f(g(x)) = 4\text{?}$

8. For what value(s) of $x$ is $q(p(x)) = 1\text{?}$

### Subsection1.6.2Composing 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

\begin{equation*} C = G(F) = \frac{5}{9}(F-32)\text{.} \end{equation*}

For instance, a Fahrenheit temperature of $32$ degrees corresponds to $C = G(32) = 0$ degrees Celsius.

###### Activity1.6.3.

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.

1. Determine a formula for the new function $H = (G \circ D)$ that depends only on the variable $N\text{.}$

2. What is the meaning of the function you found in (a)?

3. 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.

4. What is the domain of the function $H = G \circ D\text{?}$ What is its range?

### Subsection1.6.3Function 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

\begin{equation*} AV_{[a,b]} = \frac{f(b) - f(a)}{b-a}\text{.} \end{equation*}

In Figure 1.6.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

\begin{equation*} AV_{[a,a+h]} = \frac{f(a+h) - f(a)}{a+h-a} = \frac{f(a+h) - f(a)}{h} \end{equation*}

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{.}$

###### Example1.6.9.

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

\begin{equation*} AV_{[3,3+h]} = \frac{f(3+h)-f(3)}{h}. \end{equation*}

Using the formula for $f\text{,}$ we see that

\begin{equation*} AV_{[3,3+h]} = \frac{(3+h)^2-(3)^2}{h}. \end{equation*}

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{.}$ 1

Note 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.
###### Activity1.6.4.

Let $f(x) = 2x^2 - 3x + 1$ and $g(x) = \frac{5}{x}\text{.}$

1. Compute $f(1+h)$ and expand and simplify the result as much as possible by combining like terms.

2. 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.

3. Compute $g(1+h)\text{.}$ Is there any valid algebra you can do to write $g(1+h)$ more simply?

4. 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 1.6.4, we see an important setting where algebraic simplification plays a crucial role in calculus. Because the expresssion

\begin{equation*} AV_{[a,a+h]} = \frac{f(a+h) - f(a)}{h} \end{equation*}

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 1.6.4, it's possible to show that for $f(x) = 2x^2 - 3x + 1\text{,}$

\begin{equation*} AV_{[1,1+h]} = 2h + 1\text{,} \end{equation*}

which is a much simpler expression to investigate.

### Subsection1.6.4Summary

• 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

\begin{equation*} AV_{[a,a+h]} = \frac{f(a+h) - f(a)}{h} \end{equation*}

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.

### Exercises1.6.5Exercises

###### 8.

Use the given information about various functions to answer the following questions involving composition.

1. Let functions $f$ and $g$ be given by the graphs in Figure 1.6.10 and 1.6.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{.}$

2. 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?

3. Let functions $r$ and $s$ be defined by Table 1.6.12.

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.

###### 9.

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{.}$

1. Solve the equation $F = 40 + \frac{1}{4}N$ for $N$ in terms of $F\text{.}$

2. 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?

3. 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{?}$

4. 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?

5. 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.

###### 10.

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{.}$

1. $\displaystyle h(x) = (x^2 + 7)^3$

2. $\displaystyle r(x) = \sqrt{5-x^3}$

3. $\displaystyle m(x) = \frac{1}{x^4 + 2x^2 + 1}$

4. $\displaystyle w(x) = 2^{3-x^2}$

###### 11.

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.

1. 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?

2. 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{.}$

3. What are the domain and range of the function $h = p(t)\text{?}$ How is this tied to the dimensions of the tank?

4. 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{.}$

5. What are the domain and range of the function $q\text{?}$ Why?

6. 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.