1.6: Combinations and Compositions of Functions
- Page ID
- 131620
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)Focus: Combinations of Functions
We need to develop more types of functions to describe relationships. If the rate of change is not constant, we can't use a linear function. If the relationship does not have two or more distinct pieces, we can't use a piecewise defined function. In this section, we will explore techniques to build new functions from old ones using arithmetic operations on the outputs.
Since the outputs of many functions are real numbers, such as \(f(1) = 3\) and \(g(1) =5\), arithmetic operations, such as addition, subtraction, multiplication, and division can be performed on those outputs. For example, we can add these outputs for a specific input, such as x = 1, \[f(1) + g(2) =3 + 5 = 8\nonumber \] We can subtract outputs \[f(1) - g(1) =3 - 5 = -2\nonumber \]We can multiply outputs \[f(1) \cdot g(1) =3 \cdot 5 = 15\nonumber \] We can divide outputs \[\dfrac{f(1)}{g(1)} = \dfrac{3}{5} = 0.6 \nonumber \]
If we added the outputs of these two functions for a given set of inputs, we can create a new function. For example, for x = 1, \[ f(1) + g(1) =3 + 5 = 8\nonumber \] For x = 2, if \(f(2) = 1\) and \(g(2) =4\), then the sum of outputs \[f(2) + g(2) = 1 + 4 = 5 \nonumber \] For x = 3, if \(f(3) = 2\) and \(g(3) = -1\), then the sum of outputs \[f(3) + g(3) = 2 + -1 = 1 \nonumber \] For x = 4, if \(f(4) = 6\) and \(g(4) =2\), then the sum of outputs \[f(4) + g(4) = 6 + 2 = 8 \nonumber \] For x = 5, if \(f(5) = 0\) and \(g(5) = -2\), then the sum of outputs \[f(5) + g(5) = 0 + -2 = -2 \nonumber \] In general, the formula for this function can be written as \(y= f(x) + g(x)\). We call this function the sum function. For the function name we use the expression \(f+g\) as opposed to a single letter to indicate that it is the function which is the sum of the outputs of \(f\) and \(g\).
Definition: Function Arithmetic
Suppose \(f\) and \(g\) are functions and \(x\) is in both the domain of \(f\) and the domain of \(g\).
- The sum function \(f+g\) adds the outputs of \(f\) and \(g\) and is defined by the formula \[(f+g)(x) = f(x) + g(x) \nonumber \]
- The difference function \(f-g\) subtracts the outputs of \(f\) and \(g\) and is defined by the formula \[(f-g)(x) = f(x) - g(x) \nonumber \]
- The product function \(fg\) multiplies the outputs of \(f\) and \(g\) and is defined by the formula \[(fg)(x) = f(x) \cdot g(x) \nonumber \]
- The quotient function \(\dfrac{f}{g}\) divides the outputs of \(f\) and \(g\) and is defined by the formula \[\left(\dfrac{f}{g}\right)(x) = \dfrac{f(x)}{g(x)}, \qquad \text{ provided } g(x) \neq 0 \nonumber \]
The functions \(f(x)\) and \(g(x)\) are given in the table below. Use the tables to evaluate the following
- \((f+g)(3)\)
- \((f \cdot g)(2)\)
- \(\left(\dfrac{f}{g}\right)(1) \)
- \(\left(\dfrac{f}{g}\right)(4) \)
| x | 1 | 2 | 3 | 4 |
|---|---|---|---|---|
| \(f(x)\) | 4 | 3 | 1 | -1 |
| \(g(x)\) | 2 | 5 | 2 | 0 |
Solution
- Adding the outputs of \(f\) and \(g\) at \(x=3\) we have \[(f+g)(3) = f(3)+g(3) = 1 + 2 = 3 \nonumber \]
- Multiplying the outputs of \(f\) and \(g\) at \(x=2\) we have \[f \cdot g)(2) - (f(2))(g(2)) = (3)(5) = 15 \nonumber\]
- Dividing the outputs of \(f\) and \(g\) at \(x=1\) we have \[\left(\dfrac{f}{g}\right)(1) = \dfrac{f(1)}{g(1)} = \dfrac{4}{2} = 2 \nonumber\]
- Dividing the outputs of \(f\) and \(g\) at \(x=4\)\[\left(\dfrac{f}{g}\right)(4) = \dfrac{f(4)}{g(4)} = \dfrac{-1}{0} \nonumber\] is undefined.
Be careful. We can't input values of x into the quotient function that give a zero in the denominator even though they might be valid inputs of \(f\) and \(g\) in their respective domains.
The functions \(h(x)\) and \(h(x)\) are given in the table below. Use the tables to evaluate the following

- \((h-k)(2)\)
- \((h \cdot k)(1)\)
- \(\left(\dfrac{k}{h}\right)(4) \)
Solution
- Subtracting the outputs of \(f\) and \(g\) at \(x=2\) we have \[(h-k)(2) = h(2)-k(2) = 5 - 2 = 3 \nonumber \]
- Multiplying the outputs of \(f\) and \(g\) at \(x=1\) we have \[(h \cdot k)(1) - (h(1))(k(1)) = (4)(3) = 12 \nonumber \]
- Dividing the outputs of \(f\) and \(g\) at \(x=4\) we have \[\left(\dfrac{k}{h}\right)(4) = \dfrac{k(4)}{h(4)} = \dfrac{0}{1} = 0 \nonumber \]
Given the functions \(f(x)=x−1\) and \(g(x)=x^2−1\).
- Evaluate \((f+g)(2)\)
- Evaluate \( \left(\dfrac{f}{g}\right) (3)\)
- Find a formula for the sum function \((f+g)(x)\) in terms of x.
- Find a formula for the quotient function \( \left(\dfrac{f}{g}\right)(x)\) in terms of x.
Solution
- Adding the outputs of \(f\) and \(g\) at \(x=2\), we have \[(f+g)(2) = f(2) + g(2) = (2-1) + (2^2-1) = 1 + 3 = 4 \nonumber \]
- Dividing the outputs of \(f\) and \(g\) at \(x=3\), we have \[\left(\dfrac{f}{g}\right)(3) = \dfrac{f(3)}{g(3)} = \dfrac{3-1}{3^2-1} = \dfrac{2}{8} = \dfrac{1}{4} \nonumber \]
- Adding the outputs of \(f\) and \(g\) for a general input \(x\) and collecting like terms, we have \[(f+g)(x) = f(x) + g(x) = (x-1) - (x^2-1) = x-1 - x^2+1 = -x^2+x \nonumber \]
- Dividing the outputs of \(f\) and \(g\)for a general input \(x\), we have \[\left(\dfrac{f}{g}\right)(x) = \dfrac{f(x)}{g(x)} = \dfrac{x-1}{x^2-1} \nonumber \] Then simplifying \[ = \dfrac{(x-1)}{(x-1)(x+1)} = \dfrac{1}{x+1} \nonumber \] provided the the input \(x \ne 1\) and \(x \ne -1\).
In part (c) of the last example, the domain of the sum function is the set of all inputs that are defined inputs of both \(f\) and \(g\). Since the \(f\) and \(g\) are both defined for all real numbers and there is no restriction on adding two numerical outputs, the domain of \((f+g)(x)\) is \( (-\infty,\infty) \).
In part (d) of the last example, the domain of the quotient function is the set of all inputs that are defined inputs of both \(f\) and \(g\) that do not make the denominator zero. Since the \(f\) and \(g\) are both defined for all real numbers, the only restrictions on the input are those which make the denominator zero, \(x \ne 1\) and \(x \ne -1\). Therefore, the domain of \( \left(\dfrac{f}{g}\right) \) is all real numbers where \(x \ne 1\) and \(x \ne -1\). Be careful here. The simplified form of the quotient function by itself is defined at \(x=1\). However, since it is equivalent to the original form of the quotient function, we must have the restriction \(x \ne 1\) also.
Given the functions \( f(x)=2x+1 \) and \(g(x)=x^2+2x \).
- Evaluate \((f-g)(1)\)
- Evaluate \((f \cdot g)(3)\)
- Find a formula for the difference function \((f - g)(x)\) in terms of x.
- Find a formula for the product function \((f \cdot g)(x)\) in terms of x.
- Answer
-
- Subtracting the outputs of \(f\) and \(g\) at \(x=1\), we have \[(f-g)(1) = f(1) - g(1) = 0 \nonumber \]
- Multiplying the outputs of \(f\) and \(g\) at \(x=3\), we have \[(f \cdot g)(3) = f(3) \cdot g(3) = 105 \nonumber \]
- \((f - g)(x) = -x^2-1\)
- \((f \cdot g)(x) = 2x^3+5x^2+2x\)
In some cases it may be easier to build a function to describe a relationship in an application using a combination of two simpler functions as shown in the two examples below.
Suppose a manufacturer uses test market data to determine that the price \(p\) they can charge for an item is related to the number of items \(x\) they can sell by the function \(p = 100 - 0.0001x\). Furthermore, the cost of producing the items is given by the function \(C(x) = 350,000 + 30x\).
- Find a formula for the revenue \(R(x)\) in terms of the number of items sold.
- Find a formula for the profit \(P(x)\) in terms of the number of items sold.
- Find the profit from selling and producing 8000 items.
Solution
- Since revenue typically is regarded as the total sales, we can calculate the revenue from selling \(x\) items at a price \(p\) as follows\[R(x)= (\text{price})(\text{number of items sold}) = px = (100 - 0.0001x)x \nonumber \] \[R(x)= 100x - 0.0001x^2 \nonumber \]
- We can calculate the profit from selling \(x\) items as a price \(p\) using the revenue and cost as follows\[P(x)= (\text{Revenue})-(\text{Cost}) = R(x) - C(x) = (100x - 0.0001x^2) - (350,000+30x) \nonumber \] Then subtracting and simplifying our formula is \[P(x) = 100x - 0.0001x^2 -350,000 -30x \nonumber\] \[ = - 0.0001x^2 + 70x -350,000 \nonumber\]
- \(P(8000) = - 0.0001(8000)^2 + 70(8000) -350,000 = 203,600\)
Notice how much simpler it was to develop the formula for profit from the revenue and cost functions than building the profit function from scratch.
Suppose the population of a country is 2 million and is projected to grow by 4% per year. The population (in millions) \(t\) years can be modeled by the function \(P(t) = 2(1.04)^t\). The number of people the country's agricultural output can feed is 4 million and is projected to grow by 0.5 million people per year as more land is turned into farmland and agricultural techniques are improved. The number of people the country can feed (in millions) \(t\) years can be modeled by the function \(N(t) = 4 + 0.5t\). In order to compare the relative prosperity of two countries with regard to their food supply and population, economists build a prosperity index in t years as the ratio of the number of people the country's agricultural output can feed to the population where \[R(t) = \dfrac{\text{Number of people fed}}{\text{Population}} \nonumber \]
- Find a formula for the prosperity index \(R(t)\) in terms of \(t\).
- Find the prosperity index in 5 years. Interpret the meaning of your result in the context of this application.
Solution
- The prosperity index is a quotient function \[R(t) = \dfrac{N(t)}{P(t)} = \dfrac{4 + 0.5t}{2(1.04)^t} \nonumber \]
- The prosperity in 5 years \[R(5) = \dfrac{2(1.04)^5}{4 + 0.5(5)} \approx 2.67 \nonumber \] Since the prosperity index in five years \(R(5)>1\), the country can feed its population with its agricultural output and export the rest.
Focus: Compositions of Functions
Let's explore another way of building a new function from old ones using a composition of two functions. Since both the inputs and the outputs of many functions are real numbers, we can use the output of one function as the input of another function. For example, with two functions \(f\) and \(g\) where \(g(2) = 5\) and \(f(5) =12\), we can use the output of \(g\) at \(x=2\) as the input of \(f\). \[f(\text{output of g}) = f(g(2)) = f(5) = 12\nonumber \] Suppose that \(g(1) = 3\) and \(f(3) =7\). Then we can use the output of \(g\) at \(x=1\) as the input of \(f\) once again. \[f(\text{output of g}) = f(g(1)) = f(3) = 7\nonumber \] If we use the output of \(g\) at each value of \(x\) in its domain as the input of \(f\), we can create a new function. Suppose the functions \(f\) and \(g\) are given in the tables below
| \(x\) | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| \(g(x)\) | 3 | 5 | 2 | 1 | 4 |
| \(x\) | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| \(f(x)\) | 6 | 1 | 7 | 3 | 12 |
Then using the output of \(g\) at each value of \(x\) in its domain as the input of \(f\)
| \(x\) | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| \(g(x)\) | 3 | 5 | 2 | 1 | 4 |
| \(y = f(g(x))\) | \(f(3)=7\) | \(f(5)=12\) | \(f(2)=1\) | \(f(1)=6\) | \(f(4)=3\) |
This gives us a new function that is different from \(f\) and \(g\) where
| \(x\) | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| \(y\) | 7 | 12 | 1 | 6 | 3 |
We call a function created in this manner a composition of functions.
The composition of two functions \(f\) and \(g\) is a function created using the output of one function \(g\) as the input of another function \(f\). We write the composition of functions \(f(g(x))\), and read this as “\(f\) of \(g\) of \(x\)” or “\(f\) composed with \(g\) at \(x\)”.
We give this function the name \((f \circ g)\) where \((f \circ g)(x) = f(g(x)) \).
Be careful, if we do a multistep process in a different order we may get a different result. For example, in the process of putting on your shoes, there three steps done in this order: (1) Put on your socks (2) Put on your shoes (3) Tie your laces. If you do those steps in a different order, such as (1) Put on your shoes (2) Tie your laces (3) Put on your socks, we get a very different and comical result with our socks covering our shoes.
With a composition of functions, the order of composition matters. If we compose the functions in a different order, we may get a different result. If we use the output of the function \(f\) as the input of the function \(g\) given in the tables above, we create a different function than the first composition \((f \circ g)(x) = f(g(x)) \).
| \(x\) | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| \(f(x)\) | 6 | 1 | 7 | 3 | 12 |
| \(y = g(f(x))\) | \(g(6)\) is not defined | \(g(1)=3\) | \(g(7)\) is not defined | \(g(3) = 2\) | \(g(12)\) is not defined |
This function we give the name \((g \circ f)\) where \((g \circ f)(x) = g(f(x)) \).
The order in which you compose two functions matters. If you compose two functions in a different order, you may get a different function.
Also, notice that some of the outputs of \(f\) are numbers that are not defined as inputs for the function \(g\). Therefore, we must restrict the domain of \((g \circ f)(x) = g(f(x)) \) to the inputs of \(f\) where whose outputs \(f(x)\) are defined inputs of \(g\). In the example above, the domain of \((f \circ g)\) is D = {1,3}.
The domain of the composition \((f \circ g)(x) = f(g(x)) \) must be restricted to the inputs of \(g\) where the outputs \(g(x)\) are defined inputs of \(f\).
Let's build some more functions with compositions.
The functions \(h\) and \(k\) are given in the tables below.
| \(x\) | 1 | 2 | 3 | 4 |
|---|---|---|---|---|
| \(h(x)\) | 3 | 5 | 2 | 7 |
| \(k(x)\) | 6 | 8 | 3 | 1 |
- Evaluate \((k \circ h)(3)\)
- Evaluate \((h \circ k)(4)\)
- Evaluate \((k \circ h)(4)\)
- Build a table that defines the composition \((k \circ h)(x)\)
Solution
- To evaluate \((k \circ h)(3) = k(h(3))\) we start by evaluate the inside expression \(h(3)\) using the table where \(h(3) = 2\). We can then use that result as the input to the \(k\) function, so \[k(h(3))=k(2)=8 \nonumber\]
- To evaluate \( (h \circ k)(4) =h(k(4))\) we first evaluate the inside expression \(k(4)\)using the first table \(k(4) = 1\). Then using the table for \(h\) we can evaluate \[h(k(4))=h(1)=3 \nonumber\]
- To evaluate \((k \circ h)(4) = k(h(4))\) we start by evaluate the inside expression \(h(4)\) using the table where \( h(4) = 7\). However 7 is not a defined input for the \(k\) function, so \(k(h(4))\) is undefined.
- Using the output of \(h\) as the input of \(k\) for each possible
| \(x\) | 1 | 2 | 3 | 4 |
|---|---|---|---|---|
| \(h(x)\) | 3 | 5 | 2 | 7 |
| \(k(h(x))\) | 3 | \(k(5)\) is not defined | 8 | \(k(7)\) is not defined |
The functions \(f\) and \(g\) are given in the graphs below.

- Evaluate \((f \circ g)(1)\)
- Evaluate \((f \circ g)(3)\)
- Evaluate \((g \circ f)(1)\)
Solution
- To evaluate \((f \circ g)(1) = f(g(1))\), we start by using the graph of \(g\) to identify \(g(1)\), where we have \(g(1) = 3\). Using that result as the input to the \(f\) function, the graph of \(f\) gives us \[f(g(1))=f(3)=6 \nonumber\]
- To evaluate \( (f \circ g)(4) =f(g(4))\), we start by using the graph of \(g\) to identify \(g(4)\), where we have \(g(4) = 0\). Using that result as the input to the \(f\) function, the graph of \(f\) gives us \[f(g(4))=f(0)=-3 \nonumber\]
- To evaluate \((g \circ f)(4) = g(f(4))\), we start by using the graph of \(f\) to identify \(f(4)\), where we have \(f(4) = 5\). Using that result as the input to the \(g\) function, the graph of \(g\) gives us \[g(f(4))=g(5)=3 \nonumber\]
The functions \(m\) and \(n\) are given by the set of ordered pairs \((x,y)\) with inputs \(x\) and corresponding outputs \(y\) below.
\(m\) = {(1,2),(2,4),(3,0),(4,1),(5,3)} and \(n\) = {(1,4),(2,5),(3,1),(4,2),(5,11)}
- Evaluate \((m \circ n)(1)\)
- Evaluate \((m \circ n)(2)\)
- Evaluate \((n \circ m)(2)\)
- Build a set of ordered pairs that defines the composition \((n \circ m)\)
- Answer
-
- \((m \circ n)(1) = m(n(1))\) = m(4) = 1
- \((m \circ n)(2) = m(n(2))\) = m(5) = 3
- \((n \circ m)(2) = n(m(2))\) = n(4) = 2
- \((n \circ m) \) = {(1,5),(2,2),(4,4),(5,1)}
Compositions of Functions Using Formulas
We can also build a composition of functions using function given by formulas. When evaluating a composition of functions given by formulas, the concept of working from the inside out remains the same. First, we evaluate the inside function using the input value provided, then use the resulting output as the input to the outside function
Let \(f(x)=2x+1\) and \(g(x)=x^2 + 3\)
- Evaluate \((f \circ g)(2)\)
- Evaluate \((g \circ f)(1)\)
- Evaluate \((f \circ g)(3)\)
- Find a formula for the composition \(f \circ g\) in terms of \(x\).
- Find a formula for the composition \(g \circ f\) in terms of \(x\).
Solution
- To evaluate \((f \circ g)(2)\) = \((f(g(2))\), we start by evaluating the inside function \(g(2)\) using the formula where \(g(2) = 2^2+3 = 7\). We can then use that result as the input to the outside function \(f\), so \[f(g(2))=f(7)=2(7)+1 = 15 \nonumber\]
- To evaluate \((g \circ f)(1)\) = \((g(f(1))\), we start by evaluating the inside function \(f(1) = 2(1)+1 = 3\). Then using this result as the input of the outside function \(g\), so \[g(f(1))=g(3)=3^2+3 = 12 \nonumber\]
- To evaluate \((f \circ g)(3)\) = \((f(g(3))\), we evaluate the inside function \(g(3) = 3^2+3 = 12\). Then using this result as the input of the outside function \(f\), so \[f(g(3))=f(12)=2(12)+1 = 25 \nonumber\]
- To find a formula for the composition \((f \circ g)(x)\) = \((f(g(x))\), we use the output of the inside function \(g(x)=x^2+3\) as the input of the outside function \(f\), so \[f(g(x))=f(x^2+3)=2(x^2+3)+1 = 2x^2+6+1 = 2x^2+7 \nonumber\]
- To find a formula for the composition \((g \circ f)(x)\) = \((g(f(x))\), we use the output of the inside function \(f(x)=2x+1\) as the input of the outside function \(g\), so \[g(f(x))=g(2x+3)=(2x+3)^2+3 = (2x+3)(2x+3) + 3 = 4x^2 +6x+6x+9+7 = 4x^2+12x+16 \nonumber\]
Let \(k(x)=x^{2}\) and \(h(x)=\dfrac{1}{x} -2x\).
- Evaluate \((k \circ h)(1)\)
- Find a formula for the composition \(k \circ h\) in terms of \(x\).
- Find a formula for the composition \(h \circ k\) in terms of \(x\).
Solution
- To evaluate \((k \circ h)(1)\) = \((k(h(1))\), we evaluate the inside function \(h(1) = \dfrac{1}{1} -2(1)= 1-2 = -1\). Then using this result as the input of the outside function \(k\), so \[k(h(1))=k(-1)=(-1)^2 = 1 \nonumber\]
- To find a formula for the composition \((k \circ h)(x)\) = \((k(h(x))\), we use the output of the inside function \(h(x)=\dfrac{1}{x} -2x\) as the input of the outside function \(k\), so \[k(h(x))=k(\dfrac{1}{x} -2x)=(\dfrac{1}{x} -2x)^2 \nonumber\]
- To find a formula for the composition \((h \circ k)(x)\) = \((h(k(x))\), we use the output of the inside function \(k(x)=x^2\) as the input of the outside function \(h\), so \[h(k(x))=h(x^2)=\dfrac{1}{x^{2} } -2x^{2} \nonumber\]
Let \(f(x) = x^{3} +3x\) and \(g(x)=\sqrt{x}\).
- Find a formula for the composition \(f \circ g\) in terms of \(x\).
- Find a formula for the composition \(g \circ f\) in terms of \(x\).
Solution
- Using the output of \(g\) as the input of \(f\) we have \[f(g(x) = f(\sqrt{x}) = (\sqrt{x})^3 + 3(\sqrt{x}) = \sqrt{x^3} + 3\sqrt{x} \nonumber\]
- Using the output of \(f\) as the input of \(g\) we have \[g(f(x) = g(x^3 + 3x) = \sqrt{x^3 + 3x} \nonumber \]
Let \(f(x)=x^2−x\) and \(g(x)=3x+2\), evaluate
- Evaluate \((f \circ g)(2)\)
- Evaluate \((g \circ f)(1)\)
- Find a formula for the composition \(f \circ g\) in terms of \(x\).
- Find a formula for the composition \(g \circ f\) in terms of \(x\).
- Answers:
-
- \((f \circ g)(2)\) = \((f(g(2))=f(3(2)+2) = f(8) = 8^2-8 = 56\)
- \((g \circ f)(1)\) = \((g(f(1)) = g(1^2 - 1) = g(0) = 3(0) + 2 = 2\)
- \((f \circ g)(x)\) = \((f(g(x)) = f(3x+2) = (3x+2)^2-(3x + 2) = 9x^2+12x+4 - 3x - 2 = 9x^2 + 9x + 2\)
- \((g \circ f)(x)\) = \((g(f(x)) = g( x^2 - x) = 2(x^2 - x) + 2 = 2x^2 - 2x + 2\)
Decomposing Functions
In some cases, it is desirable to view a function as a composition of two simpler functions.
For example, if we let \(y = h(x)= \sqrt{x-3} \). Notice the order of operations done to an input into \(h\):
- Subtract 3
- Take the square root.
If we let function \(g\) perform the first operation of subtracting three from its input, then \(g(x)= x -3 \). If we let function \(f\) perform the second operation by taking the square root of its input, then \(f(x)= \sqrt{x} \). Then the composition of f and g is our function \(h\) \[y = (f \circ g)(x)=f(g(x)) = f(x -3) = \sqrt{x-3} \nonumber \]Typically, we refer to the function on the inside of the parenthesis that performs the first set of operations as the "inside function". The inside function would be function \(g\) in this example. We refer to the function on the outside of the parenthesis that performs the last set of operations as the "outside function". The outside function would be function \(f\) in this example.
Write \(f(x)=(5 - 3x)^{2} \) as the composition of two functions \(h\) and \(g\).
Solution
The inside function is represented by the operations that are done first to the input \(x\). In this case, the first operations are those inside the square \(5 - 3x\). A formula for the inside function would be \[h(x)=5-3x\nonumber \] Secondly, the outside function is represented by the square which is the operation that is done last in function \(f\). So a formula for the outside function would be \[g(x)=x^2 \nonumber \]
We can check our answer by recomposing the functions:
\[g(h(x)) = g(5 - 3x)= (5 - 3x)^{2} \nonumber \]
Be aware that this is not the only solution to the problem. Another non-trivial decomposition would be to let the inside function be \[h(x) = -3x \nonumber \] and the outside function be \[g(x) = (5 - x)^2 \nonumber \] Notice that both compositions do the same three operations on x in the same order.
Write \(f(x)=\dfrac{2}{x^2-3}\) as the composition of two functions \(k\) and \(m\).
Solution
The inside function is represented by the operations that are done first to the input \(x\). The operations in the denominator \(x^2-3\) are done first. A formula for the inside function would be \[m(x)=x^2-3\nonumber \] The next operation is putting that output in the denominator of the fraction. So a formula for the outside function would be \[k(x)=\dfrac{2}{x} \nonumber \]
We can check our answer by recomposing the functions:
\[k(m(x)) = k(x^2-3)=\dfrac{2}{x^2-3} \nonumber \]
Write \(f(x)=\dfrac{4}{3−\sqrt{4+x^2}}\) as the composition of two functions \(h\) and \(g\).
- Answer
-
Possible answers:
The inside function is \(g(x)=\sqrt{4+x^2}\)
The outside function is \(h(x)=\dfrac{4}{3−x}\)
where \(f=h{\circ}g\)Alternatively, we could have
The inside function is \(g(x)=4+x^2\)
The outside function is \(h(x)=\dfrac{4}{3−\sqrt{x}}\)
where \(f=h{\circ}g\)
This technique of decomposing a function into the composition of two simpler functions is critical for use later in Calculus and calculating the rate of change of a composition of functions.
Applications of Composite Functions
In some cases, it may be easier to build a function modeling an application using a composition of two simpler functions.
Suppose we wanted to calculate how much it costs to heat a house on a particular day of the year. The cost to heat a house depends on the average daily temperature and the average daily temperature depends on the particular day of the year. Notice how we have just defined two relationships: The temperature depends on the day and the cost depends on the temperature.
The first function, \(C=g(T)\), gives the cost \(C\) of heating a house when the average daily temperature is \(T\) degrees Fahrenheit, and the second, \(T=f(d)\), gives the average daily temperature on day \(d\) of the year in some city. If we wanted to determine the cost of heating the house on the 5 \({}^{th}\) day of the year, we could form the composition of functions \(C=f(g(d))\) \[d \rightarrow T \rightarrow C\nonumber \] We could evaluate function \(g\) at \(d=5\) to determine the average daily temperature on the 5 \({}^{th}\) day of the year. We could then use that temperature as the input to function \(f\) to find the cost to heat the house on the 5 \({}^{th}\) day of the year. In other words, we could evaluate \(f(g(5))\).
If a patient has an initial heart rate of 60 bpm and each additional milligram of a medication causes an increase in their heart rate of 0.2 bpm (beats per minute), a formula for the heart rate \(R\) in terms of the level of medication \(L\) is given by \(R = f(L)= 60 + 0.2L\).
If the patient is given an injection of 250 mg of the medication and the level of medication \(L\) will decrease by 20% each hour as the body metabolizes the medication, the function \(L = g(t) = 250(0.80)^{t}\) is a formula for the medication level in terms of the hours \(t\) since the medication was injected. Find a formula for the heart rate \(R\) in terms of the the time \(t\).
Solution
If first use function \(g\) to relate the time \(t\) to the medication level \(L\), then use the function \(f\) to relate the medication level \(L\) to the heart rate \(R\), \[t \rightarrow L \rightarrow R\nonumber \] then we can use the composition \(R = f(g(t))\) as a formula for the heart rate \(R\) in terms of the the time \(t\). So \[ R = f(g(t)) = f(250(0.80)^{t}) = 60 + 0.2(250(0.80)^{t}) = 60 + 50(0.80)^{t} \nonumber \]
Note that it is essential when using a composition in an application that the quantity and their corresponding units of the output of the inside function match that of the input to the outside function.
A city manager determines that the tax revenue, \(R\), in millions of dollars collected on a population of \(p\) thousand people is given by the formula \(R=r(p) = 0.03p + \sqrt{p}\), and that the city’s population, in thousands, is predicted to follow the formula \(P=p(t) = 60 + 2t + 0.3t^{2}\) where t is measured in years after 2010. Find a formula for the tax revenue as a function of the year.
- Answer
-
\[ R = r(p(t)) = r(60 + 2t + 0.3t^{2} ) = 0.03(60+2t+0.3t^{2}) + \sqrt{60 + 2t + 0.3t^{2} } = 1.8+0.06t+0.009t^{2} + \sqrt{60 + 2t + 0.3t^{2} } \nonumber \]
Notice, the composition is this example gives us a single formula which can be used to predict the tax revenue during a given year, without needing to find the intermediary population value.
For example, to predict the tax revenue in 2017, when t = 7 (because t is measured in years after 2010),
\[R(p(7))=0.03(60 + 2(7) + 0.3(7)^{2})+ \sqrt{60 + 2(7) + 0.3(7)^{2} } \approx 12.079\text{ million dollars}\nonumber \]
Important Topics in This Section
- Combinations of Functions
- Compositions of Functions
- Decomposition of Functions

