Skip to main content

Precalculus Review Materials

Section 4.1 Function Composition

Suppose \(f\) and \(g\) are functions, and that the domain of \(g\) contains all real numbers in the range of \(f\text{.}\) We can then ‘chain’ the two functions together and get a new function by first evaluating \(f\) at \(x\text{,}\) and then evaluating \(g\) at \(f(x)\text{.}\) This new function is called the composition of \(f\) and \(g\text{,}\) and is denoted by \((g \circ f)\text{.}\) The formal definition is
\begin{equation*} (g \circ f)(x) = g(f(x)) \end{equation*}
As with other functions, the domain of \((g\circ f)\) is taken to be the largest set of real numbers for which the function is defined. This is the set of all \(x\) such that \(x\) is in the domain of \(f\) and \(f(x)\) is in the domain of \(g\) (because first \(f\) is evaluated at \(x\text{,}\) and then \(g\) is evaluated at \(f(x)\)).
Let \(f(x) = 3x -1\) and \(g(x) = x^2 + 1\text{.}\) Then:
  • \(f(2) = 3(2) -1 = 6-1 = 5\) and \(g(2) = 2^2+1 = 4+1 =5\text{.}\)
  • \((g \circ f)(2) = g(f(2)) = g(5) = 26\text{.}\)
  • \((f \circ g)(2) = f(g(2)) = f(5) = 14\text{.}\)
  • Note: the previous two bullet points imply that \((g \circ f)(x)\) is not necessarily equal to \((f \circ g)(x)\text{.}\) The order in which functions are composed matters!
  • \(\displaystyle (g\circ f)(y) = g(f(y)) = g(3y-1) = (3y-1)^2 + 1 = 9y^2-6y + 1 + 1 = 9y^2-6y + 2\)
  • \(\displaystyle (f\circ g)(x) = f(g(x)) = f(x^2 + 1) = 3(x^2 + 1) - 1 = 3x^2 + 3 -1 = 3x^2 +2\)
  • Both \((g \circ f)\) and \((f \circ g)\) have domain equal to the set of all real numbers.
Let: \(f(x)=\sqrt{x+2}\) and \(g(x) = {3-x}\text{.}\) Determine the domain of \((g \circ f)\text{,}\) the domain of \((f \circ g)\) and an expression for each of these functions.
Solution.
First, note that the domain of \(f\) is \([-2,\infty)\text{,}\) and the domain of \(g\) is the set of all real numbers.
The domain of \((g \circ f)\) is the set of all \(x\) such that \(x\) is in the domain of \(f\) and \(f(x)\) is in the domain of \(g\text{.}\) This is \([-2,\infty)\) because \(x\) must belong to the domain of \(f\text{,}\) and since the domain of \(g\) is the set of all real numbers, for any such \(x\) the number \(f(x)\) is in the domain of \(g\text{.}\)
We have
\begin{equation*} \begin{aligned} (g \circ f)(x) &= g(f(x)) \\ &= g(\sqrt{x+2}) \\ &= 3 - \sqrt{x+2} \end{aligned} \end{equation*}
The domain of \((f \circ g)\) is the set of all \(x\) such that \(x\) is in the domain of \(g\) and \(g(x)\) is in the domain of \(g\text{.}\) The domain of \(g\) is the set of all real numbers, so now we need to determine which of these are such that \(g(x) = 3-x\) is in \([-2, \infty)\text{,}\) the domain of \(f\text{.}\) This happens when \(3 - x \geq -2\text{,}\) that is, when \(x \leq 5\text{.}\) Therefore the domain of \((f \circ g)\) is \((-\infty,5]\text{.}\)
We have
\begin{equation*} \begin{aligned} (f\circ g)(x) &= f(g(x)) \\ &= f(3-x) \\ &= \sqrt{(3-x)+2}=\sqrt{5-x} \end{aligned} \end{equation*}
A skill that is useful in calculus is recognizing when a function can be expressed as a composition of two other functions.
Suppose \(h(x) = (x^3-1)^7+2\text{.}\) Find functions \(f\) and \(g\) such that \(h = (g \circ f)\text{.}\)
Solution.
Looking at the expression of \(h(x)\text{,}\) it is an expression raised to the power 7, plus 2. Thus it makes sense to take \(f(x)\) to be that expression, i.e., \(f(x) = x^3 - 1\text{,}\) and \(g(x)\) to be a function that raises its input to the seventh power and then adds two, i.e., \(g(x) = x^7 + 2\text{.}\)
As a check, we can compute
\begin{equation*} \begin{aligned} (g \circ f)(x) &= g(f(x)) \\ &= g(x^3 - 1) \\ &= (x^3-1)^7+2 \\ &= h(x) \end{aligned} \end{equation*}

Exercises Practice Problems

1.

Let \(f(x)=3x+5\text{,}\) \(g(x) = \frac{x^2+1x+2}{x}\) and \(h(x)=\sqrt{x+7}\text{.}\)
  1. Find a formula for \((f\circ g)(x)\text{.}\) What is the domain of \((f\circ g)(x)\text{?}\)
  2. Find a formula for \((g\circ f)(x)\text{.}\) What is the domain of \((g\circ f)(x)\text{?}\)
  3. Find a formula for \((f\circ h)(x)\) .What is the domain of \((f\circ h)(x)\text{?}\)
  4. Find a formula for \((h\circ f)(x)\text{.}\) What is the domain of \((h\circ f)(x)\text{?}\)
  5. Find a formula for \((h\circ g)(x)\text{.}\) What is the domain of \((h\circ g)(x)\text{?}\)
Answer.
  1. \((f\circ g)(x)=\frac{3x^2+8x+6}{x}\text{,}\) Domain: \(\{x:x\neq 0\}\text{.}\)
  2. \((g\circ f)(x)=\frac{9x^2+33x+32}{3x+5}\text{,}\) Domain: \(\{x:x\neq -\frac{5}{3}\}\text{.}\)
  3. \((f\circ h)(x)=3\sqrt{x+7}+5\text{,}\) Domain: \(\{x:x\geq-7\}\text{.}\)
  4. \((h\circ f)(x)=\sqrt{3x+12}\text{,}\) Domain: \(\{x:x\geq-4\}\text{.}\)
  5. \((h\circ g)(x)=\sqrt{\frac{x^2+1x+2}{x}+7}\text{,}\) Domain: \(\{x:-4-\sqrt{14}\leq x\leq\sqrt{14}-4\) or \(x>0\}\text{.}\)

2.

Let \(f(x)=\sqrt{x}\) and \(g(x)=x^2\text{.}\)
  1. Find a formula for \((f\circ g)(x)\text{.}\) What us the domain of \((f\circ g)(x)\text{?}\)
  2. Find a formula for \((g\circ f)(x)\text{.}\) What us the domain of \((g\circ f)(x)\text{.}\)
  3. Do the functions in (a) and (b) have the same domain? What does this tell you?
Answer.
  1. \((f\circ g)(x)=\sqrt{x^2}\text{,}\) Domain:\((-\infty,\infty)\text{.}\)
  2. \((g\circ f)(x)=(\sqrt{x})^2\text{,}\) Domain:\([0,\infty)\text{.}\)
  3. They are not the same, and therefore the two functions are not the same.

3.

Find functions \(f(x)\) and \(g(x)\) so that \((g \circ f)(x) = 3e^{2x-4} + x\text{.}\)
Answer.
\(f(x) = 2x-4\) and \(g(x) = 3e^x + \frac{x+4}{2}\text{.}\)