In Section FunctionArithmetic, we saw how the arithmetic of real numbers carried over into an arithmetic of functions. In this section, we discuss another way to combine functions which is unique to functions and isn’t shared with real numbers - function composition.

To compute \((g \circ f)(x) \), we use the formula given in Defintion functioncompositiondefn: \((g \circ f) (x) = g(f(x))\). However, from a procedural viewpoint, Defintion functioncompositiondefn tells us the output from \(g \circ f\) is found by taking the output from \(f\), \(f(x)\), and then making that the input to \(g\). From this perspective, we see \(g \circ f\) as a two step process taking an input \(x\) and first applying the procedure \(f\) then applying the procedure \(g\). Abstractly, we have:

In the expression \(g(f(x))\), the function \(f\) is often called the ‘inside’ function while \(g\) is often called the ‘outside’ function. When evaluating composite function values we present two methods in the example below: the ‘inside out’ and ‘outside in’ methods.

As previously mentioned, it should be clear from Example functioncompex1 that, in general, \(g \circ f \neq f \circ g\), in other words, function composition is not commutative. However, numbers hogoffirst and fcexformlast demonstrate the associative property of function composition. That is, when composing three (or more) functions, as long as we keep the order the same, it doesn’t matter which two functions we compose first. We summarize the important properties of function composition in the theorem below.

By repeated applications of Definition functioncompositiondefn, we find \((h \circ (g \circ f))(x) = h((g \circ f)(x)) = h(g(f(x)))\). Similarly, \(((h \circ g) \circ f)(x) = (h \circ g)(f(x)) = h(g(f(x)))\). This establishes that the formulas for the two functions are the same. We leave it to the reader to think about why the domains of these two functions are identical, too. These two facts establish the equality \(h \circ (g \circ f) = (h \circ g) \circ f\). A consequence of the associativity of function composition is that there is no need for parentheses when we write \(h \circ g \circ f\). The second property can also be verified using Definition functioncompositiondefn. Recall that the function \(I(x) = x\) is called the identity function and was introduced in Exercise identityexercise in Section ConstantandLinearFunctions. If we compose the function \(I\) with a function \(f\), then we have \((I \circ f)(x) = I(f(x)) = f(x)\), and a similar computation shows \((f\circ I)(x) = f(I(x)) = f(x)\). This establishes that we have an identity for function composition much in the same way the function \(I(x) = 1\) is an identity for function multiplication.

As we know, not all functions are described by formulas, and, moreover, not all functions are described by just one formula. The next example applies the concept of function composition to functions represented in various and sundry ways.

A useful skill in Calculus is to be able to take a complicated function and break it down into a composition of easier functions which our last example illustrates. As with Example funcarithdecompex, we want to avoid trivial decompositions, which, when it comes to function composition, are those involving the identity function \(I(x) = x\) as described in Theorem functioncompprops.

We close this section of a real-world application of function composition.

In Section ??, we studied the difference operator, \(\Delta \) and showed how average rates of change operate with the basic function arithmetic. In this section, we explore how rates of change of composite functions are related to the rates of change of their constituent functions. As in that section, we’ll use the formulation:

\[ \frac {\Delta [f(x)]}{\Delta x} = \frac {f(x+\Delta x)-f(x)}{\Delta x}, \quad \Delta x \neq 0,\]

adjusting the names of functions and independent variables as needed.

As a motivational example, we revisit the scenario in Example 4.

Example 5 verifies a property of rates we formalize below.

If we think of \(u\) as being an ‘intermediary’ variable, Theorem 2 allows us to determine the rate of change of \(f\) with respect to \(x\) by multiplying the rate of change of \(f\) with respect to this ‘intermediary’ \(u\) by the rate of change of the ‘intermediary’ \(u\) with respect to \(x\). That is, we are looking for rate information on how \(f\) depends on \(x\) by decomposing the rate into two rates as visualized below.

We close the section with one last example.

Note that we never needed to know explicitly how the speed, \(v\), directly depended on time in order to answer the question posed in Example 6. All we needed was the rate.