You are about to erase your work on this activity. Are you sure you want to do this?
Updated Version Available
There is an updated version of this activity. If you update to the most recent version of this activity, then your current progress on this activity will be erased. Regardless, your record of completion will remain. How would you like to proceed?
Mathematical Expression Editor
We discuss compositions of functions.
Given two functions, we can compose them. Let’s give an example in a “real
context.”
Let
\[ g(m) = \text {the amount of gas one can buy with $m$ dollars,} \]
and let
\[ f(g) = \text {how far one can drive with $g$ gallons of gas.} \]
What does \(f(g(m))\) represent in this setting?
With \(f(g(m))\) we first relate how far one
can drive with \(\answer [given]{g}\) gallons of gas, and this in turn is determined by how much
money \(\answer [given]{m}\) one has. Hence \(f(g(m))\) represents how far one can drive with \(\answer [given]{m}\) dollars.
Composition of functions can be thought of as putting one function inside another.
We use the notation
\[ (f\circ g)(x) = f(g(x)). \]
The composition \(f\circ g\) only makes sense if
\[ \{\text {the range of $g$}\} \text { is contained in or equal to } \{\text {the domain of $f$}\} \]
The range of \(g\) is \(-\infty < x< \infty \), which is equal to the domain of \(f\). This
means the domain of \(f\circ g\) is \(-\infty < x< \infty \). Next, we substitute \(x+7\) for each instance of \(\answer [given]{x}\) found in
\[ f(x)={{x}^{2}}+5x+4 \]
and so
\begin{align*} f(g(x)) &=f(x+7)\\ &=\answer [given]{{{(x+7)}^{2}}+5(x+7)+4}. \end{align*}
Now let’s try an example with a more restricted domain.
The domain of \(g\) is \(0\le x< \infty \). From this we can see that the range
of \(g\) is \(\answer [given]{0}\le x< \infty \). This is contained in the domain of \(f\).
This means that the domain of \(f\circ g\) is \(0\le x< \infty \). Next, we substitute \(\answer [given]{\sqrt {x}}\) for each instance of \(x\) found
in
\[ f(x)={{x}^{2}} \]
and so \begin{align*} f(g(x))&=f(\sqrt {x})\\ &=\left (\sqrt {x}\right )^2. \end{align*}
We can summarize our results as a piecewise function, which looks somewhat
interesting:
\[ (f\circ g)(x) = \begin{cases} x & \text {if $0\le x < \infty $}\\ \text {undefined} &\text {otherwise}. \end{cases} \]
While the domain of \(g\) is \(-\infty < x< \infty \), its range is only \(0 \le x<\infty \). This is
exactly the domain of \(f\). This means that the domain of \(f\circ g\) is \(-\infty < x< \infty \). Now we may substitute \(\answer [given]{x^2}\)
for each instance of \(\answer [given]{x}\) found in
\[ f(x)=\sqrt {x} \]
and so \begin{align*} f(g(x))&=f(x^2)\\ &=\sqrt {x^2},\\ &=|x|. \end{align*}
Compare and contrast the previous two examples. We used the same functions for
each example, but composed them in different ways. The resulting compositions are
not only different, they have different domains!