Skip to main content
Mathematics LibreTexts

4.9: Function Composition

  • Page ID
    45171
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\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}}\)

    The following graphic is once again from the OER textbook Business Calculus by Calaway, Hoffman and Lippman, 2013 and is used with permission (Creative Commons Attribution 3.0 United States License).

    clipboard_ef44f8b2a672a0c527c65c7dcb7f25b19.png
    Figure 4.9.1

    The notation \(f(g(x))\) and \(g(f(x))\) may be easier to understand than using the composition operator. For \(f(g(x))\), think of wrapping a package. The gift is put into the box (the gift is \(g(x)\), the box is \(f(x)\)) and the wrapped present, \(f(x)\), contains the gift \(g(x)\).

    Example 4.9.1

    If \(f(x) = x^2 − 2\) and \(g(x) =\sqrt{x}\), find:

    1. \(f(g(x))\) and the domain of the composite function
    2. \(g(f(x))\) and the domain of the composite function
    Solution
    1. The composition of functions, \(f(g(x))\) is:

    \(\begin{aligned} f(g(x)) &&\text{ Function composition, }f \text{ of }g\text{ of }x \\ f(\sqrt{x}) &&\text{ Replace } g(x)\text{ with }\sqrt{x} \\ ( \sqrt{x})^2 − 2 && \text{ In the function } f(x)\text{, every }x \text{ is replaced with } g(x) =\sqrt{x} \\ x − 2 && f(g(x))\text{, answer simplified.} \end{aligned}\)

    The domain of the composite function contains the restrictions of the domain of the inner function, as well as the restrictions of the composite function.

    The domain of the inner function, \(g(x) = \sqrt{x}\) is that \(x\) must be nonnegative, or in interval notation \([0, \infty )\)

    The domain of the composite function, \(x − 2\) is all real numbers, \((−\infty , \infty )\)

    Therefore, the domain of \(f(g(x))\) is \([0, \infty )\).

    1. The composition of functions, \(g(f(x))\) is:

    \(\begin{aligned} g(f(x)) &&\text{ Function composition, }g \text{ of } f \text{ of } x \\ g(x^2 − 2)&& \text{ Replace }f(x)\text{ with } x^2 − 2 \\ \sqrt{x^2 − 2} &&\text{ In the function } g(x)\text{, every }x \text{ is replaced with } f(x) = x^2−2 \\ x^2 − 2 && g(f(x))\text{, answer simplified. }\end{aligned}\)

    The domain of the composite function contains the restrictions of the domain of the inner function, as well as the composite function.

    The domain of the inner function, \(f(x) = x^2 − 2\) is all real numbers, or in interval notation \((−\infty , \infty )\)

    The domain of the composite function, \(\sqrt{x^2} − 2\) is that the quantity \(x^2 −2\) must be nonnegative, or \(x^2 −2 \geq 0\).

    Solving \(x^2 − 2 \geq 0\) for \(x\), \(x \geq 2\) and \(x \leq −2\). In interval notation, \((−\infty , −2] \cup [2, \infty )\)

    Therefore, the domain of the composite function, g(f(x)) is the more restrictive domain, \((−\infty , −2] \cup [2, \infty )\).

    Example 4.9.2

    If \(f(x) = \dfrac{1 }{x − 4}\) and \(g(x) = \dfrac{5 }{x} + 4\), find:

    1. \(f(g(x))\) and the domain of the composite function
    2. \(g(f(x))\) and the domain of the composite function
    Solution
    1. The composition of functions, \(f(g(x))\) is:

    \(\begin{aligned} f(g(x)) \text{ Function composition, } f\text{ of }g \text{ of }x\\ f\left( \dfrac{5}{ x} + 4\right) && \text{ Replace }g(x)\text{ with }\dfrac{5 }{x} + 4 \\ \dfrac{1 }{\left(5 x + 4\right)− 4} && \text{ In the function } f(x)\text{, every x is replaced with } g(x) = \dfrac{5}{ x} + 4 \\ \dfrac{1 }{\dfrac{5 }{x}}&&\text{ Simplify} \\ \dfrac{x }{5} && f(g(x))\text{, answer simplified. }\end{aligned}\)

    The domain of the composite function contains the restrictions of the domain of the inner function, as well as the restrictions of the composite function.

    The domain of the inner function, \(g(x) = 5 x + 4\) is all values of \(x\) such that \(x\) must not be 0, or in interval notation \((−\infty , 0) \cup (0, \infty )\)

    The domain of the composite function, \(\dfrac{x }{5}\) is all real numbers, \((−\infty , \infty )\) Therefore, the domain of \(f(g(x))\) is \((−\infty , 0) \cup (0, \infty )\)

    1. The composition of functions, \(g(f(x))\) is

    \(\begin{aligned} g(f(x))&&\text{Function composition, } g \text{ of } f\text{ of }x \\ g\left( \dfrac{1 }{x −4}\right) &&\text{Replace } f(x) \text{ with }\dfrac{1}{ x − 4}\\ \dfrac{5 }{\dfrac{1 }{x − 4}} + 4 &&\text{In the function } g(x)\text{, every x is replaced with } f(x) = \dfrac{1 }{x − 4}\\ 5(x − 4) + 4 && \text{ Simplify the fraction} \\ 5x − 20 + 4 &&\text{ Simplify more}\\ 5x − 16 && g(f(x))\text{, answer simplified.} \end{aligned}\)

    The domain of the composite function contains the restrictions of the domain of the inner function, as well as the composite function.

    The domain of the inner function, \(f(x) = \dfrac{1}{ x − 4 }\) is that \(x\neq 4\), or in interval notation \((−\infty , 4) \cup (4, \infty )\)

    The domain of the composite function, \(5x − 16\) is all real numbers, \((−\infty , \infty )\).

    Therefore, the domain of the composite function, \(g(f(x))\) is the more restrictive domain, \((−\infty , 4) \cup (4, \infty)\).

    Exercise 4.9.1

    For the given functions, find both \(f(g(x))\) and \(g(f(x))\), and find the domain of the composite function.

    1. \(f(x) = 3x^ 2 + x − 10\), \(g(x) = 1 − 20x\)
    2. \(f(x) = 3x − 2\), \(g(x) = \dfrac{1}{ 3} x + \dfrac{2 }{3}\)
    3. \(f(x) = 4x − 1\), \(g(x) = \sqrt{6 + 7x}\)
    4. \(f(x) = 5x + 2\), \(g(x) = x^2 − 14x\)
    5. \(f(x) = x^ 2 − 2x + 1\), \(g(x) = 8 − 3x ^2\)
    6. \(f(x) = x ^2 + 3\), \(g(x) = \sqrt{5 + x^2} \)

    This page titled 4.9: Function Composition is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Victoria Dominguez, Cristian Martinez, & Sanaa Saykali (ASCCC Open Educational Resources Initiative) .