Skip to main content
Logo image

Precalculus JumpStart

Section 6.6 Composition of Functions

Two functions may be combined in a fundamentally different way through composition. To perform a composition, we “chain” the output of one function into the input of the other. Visually,
For this to make any sense, we require that \(x\) is in the domain of \(g\) (so that the first link in the chain is defined) and \(g(x)\) is in the domain of \(f\) (so that the second link in the chain is sensible). The resulting function which assigns \(x\) to \(f(g(x))\) is called a composition and is denoted by \(f\circ g\text{.}\)

Definition 6.27.

Suppose \(f\) and \(g\) are functions. The composition of \(f\) with \(g\) is a new function denoted by \(f\circ g\) whose value at \(x\) is given by
\begin{equation*} (f\circ g)(x) = f(g(x)), \end{equation*}
provided \(x\) is in the domain of \(g\) and \(g(x)\) is in the domain of \(f\text{.}\)
Observe that the order of the composition matters: \(g \circ f\) would interchange the order of the functions being applied:

Example 6.28. Evaluating compositions.

Let \(f(x) = \sqrt{x+1}\) and \(g(x) = x^2-1\text{.}\) To evaluate \(f\circ g\) at \(x=4\text{,}\) work from the inside of the expression first
\begin{align*} (f\circ g)(4) &= f(g(4))\\ &=f(4^2-1)\\ &=f(15)\\ &=\sqrt{15+1}\\ &=\sqrt{16}\\ &=4 \end{align*}
To evaluate \(g\circ f\) at \(x=3\text{,}\)
\begin{align*} (g\circ f)(3) &= g(f(3))\\ &= g(\sqrt{3+1})\\ &= g(\sqrt{4})\\ &= g(2)\\ &= 2^2-1\\ &= 3 \end{align*}

Example 6.29.

Let \(f(x) = \frac{1}{x}\text{,}\) \(g(x) = \frac{x+2}{1-x}\text{.}\) Find a formula for \(f\circ g\text{,}\) \(g\circ f\text{,}\) and \(f\circ f\text{.}\) State the domain of each.
Solution.
First,
\begin{equation*} (f\circ g)(x) = f\left(\frac{x+2}{1-x}\right) = \frac{1}{\frac{x+2}{1-x}} \end{equation*}
which is defined provided:
  1. \(g(x) = \frac{x+2}{1-x}\) is defined. This requires \(x\neq 1\text{.}\)
  2. \(\frac{x+2}{1-x} \neq 0\text{.}\) This requires \(x\neq -2\text{.}\)
Thus,
\begin{equation*} (f\circ g)(x) = \frac{1-x}{x+2}, \quad x\neq -2,1. \end{equation*}
It’s important to add these final conditions, because it would not be clear this is the domain from the final simplified expression.
Next,
\begin{equation*} (g\circ f)(x) = g\left(\frac{1}{x}\right) = \frac{\frac{1}{x}+2}{1-\frac{1}{x}} \end{equation*}
which is defined provided:
  1. \(f(x) = 1/x\) is defined. This requires \(x\neq 0\text{.}\)
  2. \(1-\frac{1}{x} \neq 0\text{.}\) This requires \(x\neq 1\text{.}\)
Simplifying,
\begin{equation*} (g\circ f)(x) = \frac{\frac{1}{x}+2}{1-\frac{1}{x}} \cdot \frac{x}{x} = \frac{1+2x}{x-1} \quad x\neq 0,1. \end{equation*}
Finally, \((f\circ f)(x) = f\left(\frac{1}{x}\right) = \frac{1}{1/x}\) which is defined provided:
  1. \(f(x) = 1/x\) is defined. This requires \(x\neq 0\text{.}\)
  2. \(\frac{1}{x} \neq 0\text{.}\) This never happens.
Thus,
\begin{equation*} (f\circ f)(x) = \frac{1}{1/x} = x, \quad x\neq 0. \end{equation*}
Again, its essential to add the additional requirement \(x\neq 0\text{.}\)