Page 4.1: Introduction to Function Composition
Let \(A = \{a, b, c, d\}\), \(B = \{p, q, r\}\), and \(C = \{s, t, u, v\}\). The arrow diagram in Figure 6.6 shows two functions: \(f: A \to B\) and \(g: B \to C\). Notice that if \(x \in A\), then \(f(x) \in B\). Since \(f(x) \in B\), we can apply the function \(g\) to \(f(x)\), and we obtain \(g(f(x))\), which is an element of \(C\).
Using this process, determine \(g(f(a))\), \(g(f(b))\), \(g(f(c))\), and \(g(f(d))\). Then explain how we can use this information to define a function from \(A\) to \(C\).
Figure 6.6: Arrow Diagram Showing Two Functions
The outputs of most real functions we have studied in previous mathematics courses have been determined by mathematical expressions. In many cases, it is possible to use these expressions to give step-by-step verbal descriptions of how to compute the outputs. For example, if
\(f: \mathbb{R} \to \mathbb{R}\) is defined by \(f(x) = (3x + 2)^3\),
we could describe how to compute the outputs as follows:
| Step | Verbal Description | Symbolic Result |
|---|---|---|
| 1 | Choose an input. | \(x\) |
| 2 | Multiply by 3. | \(3x\) |
| 3 | Add 2. | \(3x + 2\) |
| 4 | Cube the result. | \((3x + 3)^3\) |
Complete step-by-step verbal descriptions for each of the following functions.
- \(f: \mathbb{R} \to \mathbb{R}\) by \(f(x) = \sqrt{3x^2 + 2}\), for each \(x \in \mathbb{R}\).
- \(g: \mathbb{R} \to \mathbb{R}\) by \(g(x) = \sin(3x^2 + 2)\), for each \(x \in \mathbb{R}\).
- \(h: \mathbb{R} \to \mathbb{R}\) by \(h(x) = e^{3x^2 + 2}\), for each \(x \in \mathbb{R}\).
- \(G: \mathbb{R} \to \mathbb{R}\) by \(G(x) = \ln(x^4 + 3)\), for each \(x \in \mathbb{R}\).
- \(k: \mathbb{R} \to \mathbb{R}\) by \(k(x) = \sqrt[3] {\dfrac{\sin(4x + 3)}{x^2 + 1}}\), for each \(x \in \mathbb{R}\).
Composition of Functions
There are several ways to combine two existing functions to create a new function. For example, in calculus, we learned how to form the product and quotient of two functions and then how to use the product rule to determine the derivative of a product of two functions and the quotient rule to determine the derivative of the quotient of two functions. The chain rule in calculus was used to determine the derivative of the composition of two functions, and in this section, we will focus only on the composition of two functions. We will then consider some results about the compositions of injections and surjections.
The basic idea of function composition is that when possible, the output of a function \(f\) is used as the input of a function \(g\). This can be referred to as “\(f\) followed by \(g\)” and is called the composition of \(f\) and \(g\). In previous mathematics courses, we used this idea to determine a formula for the composition of two real functions.
For example, if
\(f(x) = 3x^2 + 2\) and \(g(x) = sin x\)
then we can compute \(g(f(x))\) as follows:
\[\begin{array} {rcl} {g(f(x))} &= & {g(3x^2 + 2)}\\ {} &= & {sin(3x^2 + 2).} \end{array}\]
In this case, \(f(x)\), the output of the function \(f\), was used as the input for the function \(g\). We now give the formal definition of the composition of two functions.
Let \(A\), \(B\), and \(C\) be nonempty sets, and let \(f: A \to B\) and \(g: B \to C\) be functions. The composition of \(f\) and \(g\) is the function \(g \circ f: A \to C\) defined by
\((g \circ f)(x) = g(f(x))\)
for all \(x \in A\). We often refer to the function \(g \circ f\) as a composite function .
It is helpful to think of composite function \(g \circ f\) as " \(f\) followed by \(g\) ". We then refer to \(f\) as the inner function and \(g\) as the outer function .
Composition and Arrow Diagrams
The concept of the composition of two functions can be illustrated with arrow diagrams when the domain and codomain of the functions are small, finite sets. Although the term “composition” was not used then, this was done in Preview Activity \(\PageIndex{1}\), and another example is given here.
Let \(A = \{a, b, c, d\}\), \(B = \{p, q, r\}\), and \(C = \{s, t, u, v\}\). The arrow diagram in Figure 6.7 shows two functions: \(f: A \to B\) and \(g: B \to C\).
If we follow the arrows from the set \(A\) to the set \(C\), we will use the outputs of \(f\) as inputs of \(g\), and get the arrow diagram from \(A\) to \(C\) shown in Figure 6.8. This diagram represents the composition of \(f\) followed by \(g\).