Skip to main content
Mathematics LibreTexts

5.1: Function Composition

  • Page ID
  • \( \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}}\)

    \( \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{\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}\)

    Before we embark upon any further adventures with functions, we need to take some time to gather our thoughts and gain some perspective. Chapter 1 first introduced us to functions in Section 1.3. At that time, functions were specific kinds of relations - sets of points in the plane which passed the Vertical Line Test, Theorem 1.1. In Section 1.4, we developed the idea that functions are processes - rules which match inputs to outputs - and this gave rise to the concepts of domain and range. We spoke about how functions could be combined in Section 1.5 using the four basic arithmetic operations, took a more detailed look at their graphs in Section 1.6 and studied how their graphs behaved under certain classes of transformations in Section 1.7. In Chapter 2, we took a closer look at three families of functions: linear functions (Section 2.1), absolute value functions1 (Section 2.2), and quadratic functions (Section 2.3). Linear and quadratic functions were special cases of polynomial functions, which we studied in generality in Chapter 3. Chapter 3 culminated with the Real Factorization Theorem, Theorem 3.16, which says that all polynomial functions with real coefficients can be thought of as products of linear and quadratic functions. Our next step was to enlarge our field2 of study to rational functions in Chapter 4. Being quotients of polynomials, we can ultimately view this family of functions as being built up of linear and quadratic functions as well. So in some sense, Chapters 2, 3, and 4 can be thought of as an exhaustive study of linear and quadratic3 functions and their arithmetic combinations as described in Section 1.5. We now wish to study other algebraic functions, such as \(f(x) = \sqrt{x}\) and \(g(x) = x^{2/3}\), and the purpose of the first two sections of this chapter is to see how these kinds of functions arise from polynomial and rational functions. To that end, we first study a new way to combine functions as defined below.

    Definition 5.1.

    Suppose \(f\) and \(g\) are two functions. The composite of \(g\) with \(f\), denoted \(g \circ f\), is defined by the formula \((g \circ f) (x) = g(f(x))\), provided \(x\) is an element of the domain of \(f\) and \(f(x)\) is an element of the domain of \(g\).

    The quantity \(g \circ f\) is also read ‘\(g\) composed with \(f\)’ or, more simply ‘\(g\) of \(f\).’ At its most basic level, Definition 5.1 tells us to obtain the formula for \(\left(g \circ f\right)(x)\), we replace every occurrence of \(x\) in the formula for \(g(x)\) with the formula we have for \(f(x)\). If we take a step back and look at this from a procedural, ‘inputs and outputs’ perspective, Definition 5.1 tells us the output from \(g \circ f\) is found by taking the output from \(f\), \(f(x)\), and then making that the input to \(g\). The result, \(g(f(x))\), is the output from \(g \circ f\). From this perspective, we see \(g \circ f\) as a two step process taking an input \(x\) and first applying the procedure \(f\) then applying the procedure \(g\). Abstractly, we have

    Screen Shot 2022-04-01 at 3.05.17 AM.png

    In the expression \(g(f(x))\), the function \(f\) is often called the ‘inside’ function while \(g\) is often called the ‘outside’ function. There are two ways to go about evaluating composite functions - ‘inside out’ and ‘outside in’ - depending on which function we replace with its formula first. Both ways are demonstrated in the following example.

    Example 5.1.1

    Let \(f(x) = x^2-4x\), \(g(x) = 2-\sqrt{x+3}\), and \(h(x) = \dfrac{2x}{x+1}\).

    In numbers 1 - 3, find the indicated function value.

    1. \((g \circ f)(1)\)
    2. \((f \circ g)(1)\)
    3. \((g \circ g)(6)\)

    In numbers 4 - 10, find and simplify the indicated composite functions. State the domain of each.

    1. \((g \circ f)(x)\)
    2. \((f \circ g)(x)\)
    3. \((g \circ h)(x)\)
    4. \((h \circ g)(x)\)
    5. \((h \circ h)(x)\)
    6. \((h \circ (g \circ f))(x)\)
    7. \(((h \circ g) \circ f)(x)\)


    1. Using Definition 5.1, \((g \circ f)(1) = g(f(1))\). We find \(f(1) = -3\), so \[(g \circ f)(1) = g(f(1)) = g(-3) = 2\nonumber\]
    2. As before, we use Definition 5.1 to write \((f \circ g)(1) = f(g(1))\). We find \(g(1) = 0\), so \[(f \circ g)(1) = f(g(1)) = f(0) = 0\nonumber\]
    3. Once more, Definition 5.1 tells us \((g \circ g)(6) = g(g(6))\). That is, we evaluate \(g\) at \(6\), then plug that result back into \(g\). Since \(g(6) = -1\), \[(g \circ g)(6) = g(g(6)) = g(-1) = 2-\sqrt{2}\nonumber\]
    4. By definition, \((g \circ f)(x) = g(f(x))\). We now illustrate two ways to approach this problem.
      • inside out: We insert the expression \(f(x)\) into \(g\) first to get \[(g \circ f)(x) = g(f(x)) = g\left(x^2-4x\right) = 2 - \sqrt{\left(x^2-4x\right)+3} = 2 - \sqrt{x^2-4x+3}\nonumber\] Hence, \((g \circ f)(x) = 2 - \sqrt{x^2-4x+3}\).
      • outside in: We use the formula for \(g\) first to get \[(g \circ f)(x) = g(f(x)) = 2 - \sqrt{f(x)+3} = 2 - \sqrt{\left(x^2-4x\right)+3} = 2 - \sqrt{x^2-4x+3}\nonumber\] We get the same answer as before, \((g \circ f)(x) = 2 - \sqrt{x^2-4x+3}\).

      To find the domain of \(g \circ f\), we need to find the elements in the domain of \(f\) whose outputs \(f(x)\) are in the domain of \(g\). We accomplish this by following the rule set forth in Section 1.4, that is, we find the domain before we simplify. To that end, we examine \((g \circ f)(x) = 2 - \sqrt{\left(x^2-4x\right)+3}\). To keep the square root happy, we solve the inequality \(x^2-4x+3 \geq 0\) by creating a sign diagram. If we let \(r(x) = x^2-4x+3\), we find the zeros of \(r\) to be \(x = 1\) and \(x = 3\). We obtain

      Screen Shot 2022-04-01 at 3.10.55 AM.png

      Our solution to \(x^2-4x+3 \geq 0\), and hence the domain of \(g \circ f\), is \((-\infty, 1] \cup [3,\infty)\).

    5. To find \((f \circ g)(x)\), we find \(f(g(x))\).
      • inside out: We insert the expression \(g(x)\) into \(f\) first to get

        (f \circ g)(x) &=f(g(x))=f(2-\sqrt{x+3}) \\
        &=(2-\sqrt{x+3})^{2}-4(2-\sqrt{x+3}) \\
        &=4-4 \sqrt{x+3}+(\sqrt{x+3})^{2}-8+4 \sqrt{x+3} \\
        &=4+x+3-8 \\

      • outside in: We use the formula for \(f(x)\) first to get

        (f \circ g)(x) &=f(g(x))=(g(x))^{2}-4(g(x)) \\
        &=(2-\sqrt{x+3})^{2}-4(2-\sqrt{x+3}) \\
        &=x-1 \quad\quad\quad\quad\quad\quad\text{same algebra as before}

      Thus we get \((f \circ g)(x) = x-1\). To find the domain of \((f \circ g)\), we look to the step before we did any simplification and find \((f \circ g)(x) = \left(2-\sqrt{x+3}\right)^2 - 4\left(2-\sqrt{x+3}\right)\). To keep the square root happy, we set \(x+3 \geq 0\) and find our domain to be \([-3, \infty)\).

    6. To find \((g \circ h)(x)\), we compute \(g(h(x))\).
      • inside out: We insert the expression \(h(x)\) into \(g\) first to get

        (g \circ h)(x) &=g(h(x))=g\left(\frac{2 x}{x+1}\right) \\
        &=2-\sqrt{\left(\frac{2 x}{x+1}\right)+3} \\
        &=2-\sqrt{\frac{2 x}{x+1}+\frac{3(x+1)}{x+1}} \quad\quad\quad\quad \text{
        get common denominators} \\
        &=2-\sqrt{\frac{5 x+3}{x+1}}

      • outside in: We use the formula for \(g(x)\) first to get

        (g \circ h)(x) &=g(h(x))=2-\sqrt{h(x)+3} \\
        &=2-\sqrt{\left(\frac{2 x}{x+1}\right)+3} \\
        &=2-\sqrt{\frac{5 x+3}{x+1}} \quad\quad\quad\quad\text{
        get common denominators as before}

      To find the domain of \((g \circ h)\), we look to the step before we began to simplify: \[(g \circ h)(x) = 2 - \sqrt{\left(\frac{2x}{x+1}\right)+3}\nonumber\] To avoid division by zero, we need \(x \neq -1\). To keep the radical happy, we need to solve \[\frac{2x}{x+1} +3 = \frac{5x+3}{x+1}\geq 0\nonumber\] Defining \(r(x) = \frac{5x+3}{x+1}\), we see \(r\) is undefined at \(x=-1\) and \(r(x) = 0\) at \(x = -\frac{3}{5}\). We get

      Screen Shot 2022-04-01 at 3.25.21 AM.png

      Our domain is \((-\infty, -1) \cup \left[-\frac{3}{5}, \infty\right)\).

    7. We find \((h \circ g)(x)\) by finding \(h(g(x))\).
      • inside out: We insert the expression \(g(x)\) into \(h\) first to get

        (h \circ g)(x) &=h(g(x))=h(2-\sqrt{x+3}) \\
        &=\frac{2(2-\sqrt{x+3})}{(2-\sqrt{x+3})+1} \\
        &=\frac{4-2 \sqrt{x+3}}{3-\sqrt{x+3}}

      • outside in: We use the formula for \(h(x)\) first to get

        (h \circ g)(x) &=h(g(x))=\frac{2(g(x))}{(g(x))+1} \\
        &=\frac{2(2-\sqrt{x+3})}{(2-\sqrt{x+3})+1} \\
        &=\frac{4-2 \sqrt{x+3}}{3-\sqrt{x+3}}

      To find the domain of \(h \circ g\), we look to the step before any simplification: \[(h \circ g)(x) = \frac{2 \left(2-\sqrt{x+3} \right)}{\left(2-\sqrt{x+3}\right)+1}\nonumber\] To keep the square root happy, we require \(x+3 \geq 0\) or \(x \geq -3\). Setting the denominator equal to zero gives \(\left(2-\sqrt{x+3}\right)+1=0\) or \(\sqrt{x+3} = 3\). Squaring both sides gives us \(x+3=9\), or \(x=6\). Since \(x=6\) checks in the original equation, \(\left(2-\sqrt{x+3}\right)+1=0\), we know \(x=6\) is the only zero of the denominator. Hence, the domain of \(h \circ g\) is \([-3,6) \cup (6, \infty)\).

    8. To find \((h \circ h)(x)\), we substitute the function \(h\) into itself, \(h(h(x))\).
      • inside out: We insert the expression \(h(x)\) into \(h\) to get

        (h\circ h)(x)&=h(h(x))=h\left(\frac{2x}{x+1} \right)\\
        &=\frac{2\left(\frac{2 x}{x+1}\right)}{\left(\frac{2 x}{x+1}\right)+1}\\
        &=\frac{\frac{4 x}{x+1}}{\frac{2 x}{x+1}+1} \cdot \frac{(x+1)}{(x+1)}\\
        &=\frac{\frac{4 x}{x+1} \cdot(x+1)}{\left(\frac{2 x}{x+1}\right) \cdot(x+1)+1 \cdot(x+1)}\\
        &=\frac{\frac{4 x}{\cancelto{1}{(x+1)}} i\cancel{(x+1)}}{\frac{2 x}{\cancelto{1}{(x+1)}} \cdot\cancel{(x+1)}+x+1}\\
        &=\frac{4 x}{3 x+1}

      • outside in: This approach yields

        (h \circ h)(x) &=h(h(x))=\frac{2(h(x))}{h(x)+1} \\
        &=\frac{2\left(\frac{2 x}{x+1}\right)}{\left(\frac{2 x}{x+1}\right)+1} \\
        &=\frac{4 x}{3 x+1}\quad\quad\quad\quad\text{same algebra as before}

      To find the domain of \(h \circ h\), we analyze \[(h \circ h)(x) = \dfrac{2\left(\dfrac{2x}{x+1}\right)}{\left(\dfrac{2x}{x+1}\right)+1}\nonumber\] To keep the denominator \(x+1\) happy, we need \(x \neq -1\). Setting the denominator \[\frac{2x}{x+1}+1 = 0\nonumber\] gives \(x = -\frac{1}{3}\). Our domain is \((-\infty, -1) \cup \left(-1, -\frac{1}{3}\right) \cup \left(-\frac{1}{3}, \infty\right)\).

    9. The expression \((h \circ (g \circ f))(x)\) indicates that we first find the composite, \(g \circ f\) and compose the function \(h\) with the result. We know from number 1 that \((g \circ f)(x) = 2 - \sqrt{x^2-4x+3}\). We now proceed as usual.
      • inside out: We insert the expression \((g \circ f)(x)\) into \(h\) first to get

        (h \circ(g \circ f))(x) &=h((g \circ f)(x))=h\left(2-\sqrt{x^{2}-4 x+3}\right) \\
        &=\frac{2\left(2-\sqrt{x^{2}-4 x+3}\right)}{\left(2-\sqrt{x^{2}-4 x+3}\right)+1} \\
        &=\frac{4-2 \sqrt{x^{2}-4 x+3}}{3-\sqrt{x^{2}-4 x+3}}

      • outside in: We use the formula for \(h(x)\) first to get

        (h \circ(g \circ f))(x) &=h((g \circ f)(x))=\frac{2((g \circ f)(x))}{((g \circ f)(x))+1} \\
        &=\frac{2\left(2-\sqrt{x^{2}-4 x+3}\right)}{\left(2-\sqrt{x^{2}-4 x+3}\right)+1} \\
        &=\frac{4-2 \sqrt{x^{2}-4 x+3}}{3-\sqrt{x^{2}-4 x+3}}

      To find the domain of \((h \circ (g \circ f))\), we look at the step before we began to simplify, \[(h \circ (g \circ f))(x) = \frac{2 \left(2 - \sqrt{x^2-4x+3}\right)}{\left(2 - \sqrt{x^2-4x+3}\right)+1}\nonumber\] For the square root, we need \(x^2-4x+3 \geq 0\), which we determined in number 1 to be \((-\infty, 1] \cup [3,\infty)\). Next, we set the denominator to zero and solve: \(\left(2 - \sqrt{x^2-4x+3}\right)+1 = 0\). We get \(\sqrt{x^2-4x+3} = 3\), and, after squaring both sides, we have \(x^2-4x+3 = 9\). To solve \(x^2-4x-6 = 0\), we use the quadratic formula and get \(x = 2 \pm \sqrt{10}\). The reader is encouraged to check that both of these numbers satisfy the original equation, \(\left(2 - \sqrt{x^2-4x+3}\right)+1 = 0\). Hence we must exclude these numbers from the domain of \(h \circ (g \circ f)\). Our final domain for \(h \circ (f \circ g)\) is \((-\infty, 2 -\sqrt{10}) \cup (2 - \sqrt{10}, 1] \cup \left[3, 2 + \sqrt{10}\right) \cup \left(2+\sqrt{10}, \infty\right)\).

    10. The expression \(((h \circ g) \circ f)(x)\) indicates that we first find the composite \(h \circ g\) and then compose that with \(f\). From number 4, we have \[(h \circ g)(x) = \frac{4-2\sqrt{x+3}}{3-\sqrt{x+3}}\nonumber\] We now proceed as before.
      • inside out: We insert the expression \(f(x)\) into \(h \circ g\) first to get

        ((h \circ g) \circ f)(x) &=(h \circ g)(f(x))=(h \circ g)\left(x^{2}-4 x\right) \\
        &=\frac{4-2 \sqrt{\left(x^{2}-4 x\right)+3}}{3-\sqrt{\left(x^{2}-4 x\right)+3}} \\
        &=\frac{4-2 \sqrt{x^{2}-4 x+3}}{3-\sqrt{x^{2}-4 x+3}}

      • outside in: We use the formula for \((h \circ g)(x)\) first to get

        ((h \circ g) \circ f)(x) &=(h \circ g)(f(x))=\frac{4-2 \sqrt{(f(x))+3}}{3-\sqrt{f(x))+3}} \\
        &=\frac{4-2 \sqrt{\left(x^{2}-4 x\right)+3}}{3-\sqrt{\left(x^{2}-4 x\right)+3}} \\
        &=\frac{4-2 \sqrt{x^{2}-4 x+3}}{3-\sqrt{x^{2}-4 x+3}}

      We note that the formula for \(((h \circ g) \circ f)(x)\) before simplification is identical to that of \((h \circ (g \circ f))(x)\) before we simplified it. Hence, the two functions have the same domain, \(h \circ (f \circ g)\) is \((-\infty, 2 -\sqrt{10}) \cup (2 - \sqrt{10}, 1] \cup \left[3, 2 + \sqrt{10}\right) \cup \left(2+\sqrt{10}, \infty\right)\).

    It should be clear from Example 5.1.1 that, in general, when you compose two functions, such as \(f\) and \(g\) above, the order matters.4 We found that the functions \(f \circ g\) and \(g \circ f\) were different as were \(g \circ h\) and \(h \circ g\). Thinking of functions as processes, this isn’t all that surprising. If we think of one process as putting on our socks, and the other as putting on our shoes, the order in which we do these two tasks does matter.5 Also note the importance of finding the domain of the composite function before simplifying. For instance, the domain of \(f \circ g\) is much different than its simplified formula would indicate. Composing a function with itself, as in the case of finding \((g\circ g)(6)\) and \((h \circ h)(x)\), may seem odd. Looking at this from a procedural perspective, however, this merely indicates performing a task \(h\) and then doing it again - like setting the washing machine to do a ‘double rinse’. Composing a function with itself is called ‘iterating’ the function, and we could easily spend an entire course on just that. The last two problems in Example 5.1.1 serve to demonstrate the associative property of functions. That is, when composing three (or more) functions, as long as we keep the order the same, it doesn’t matter which two functions we compose first. This property as well as another important property are listed in the theorem below.

    Theorem 5.1. Properties of Function Composition

    Suppose \(f\), \(g\), and \(h\) are functions.

    • \(h \circ (g \circ f) = (h \circ g) \circ f\), provided the composite functions are defined.
    • If \(I\) is defined as \(I(x) = x\) for all real numbers \(x\), then \(I \circ f = f \circ I =f\).

    By repeated applications of Definition 5.1, we find \((h \circ (g \circ f))(x) = h((g \circ f)(x)) = h(g(f(x)))\). Similarly, \(((h \circ g) \circ f)(x) = (h \circ g)(f(x)) = h(g(f(x)))\). This establishes that the formulas for the two functions are the same. We leave it to the reader to think about why the domains of these two functions are identical, too. These two facts establish the equality \(h \circ (g \circ f) = (h \circ g) \circ f\). A consequence of the associativity of function composition is that there is no need for parentheses when we write \(h \circ g \circ f\). The second property can also be verified using Definition 5.1. Recall that the function \(I(x) = x\) is called the identity function and was introduced in Exercise 73 in Section 2.1. If we compose the function \(I\) with a function \(f\), then we have \((I \circ f)(x) = I(f(x)) = f(x)\), and a similar computation shows \((f\circ I)(x) = f(x)\). This establishes that we have an identity for function composition much in the same way the real number \(1\) is an identity for real number multiplication. That is, just as for any real number \(x\), \(1 \cdot x = x \cdot 1 = x\), we have for any function \(f\), \(I \circ f = f \circ I =f\). We shall see the concept of an identity take on great significance in the next section. Out in the wild, function composition is often used to relate two quantities which may not be directly related, but have a variable in common, as illustrated in our next example.

    Example 5.1.2

    The surface area \(S\) of a sphere is a function of its radius \(r\) and is given by the formula \(S(r) = 4 \pi r^2\). Suppose the sphere is being inflated so that the radius of the sphere is increasing according to the formula \(r(t) = 3t^2\), where \(t\) is measured in seconds, \(t \geq 0\), and \(r\) is measured in inches. Find and interpret \((S \circ r)(t)\).


    If we look at the functions \(S(r)\) and \(r(t)\) individually, we see the former gives the surface area of a sphere of a given radius while the latter gives the radius at a given time. So, given a specific time, \(t\), we could find the radius at that time, \(r(t)\) and feed that into \(S(r)\) to find the surface area at that time. From this we see that the surface area \(S\) is ultimately a function of time \(t\) and we find \((S \circ r)(t) = S(r(t)) = 4 \pi (r(t))^2 = 4 \pi \left(3t^2\right)^2 = 36 \pi t^{4}\). This formula allows us to compute the surface area directly given the time without going through the ‘middle man’ \(r\).

    A useful skill in Calculus is to be able to take a complicated function and break it down into a composition of easier functions which our last example illustrates.

    Example 5.1.3

    Write each of the following functions as a composition of two or more (non-identity) functions. Check your answer by performing the function composition.

    1. \(F(x) = |3x-1|\)
    2. \(G(x) = \dfrac{2}{x^2+1}\)
    3. \(H(x) = \dfrac{\sqrt{x}+1}{\sqrt{x}-1}\)

    Solution. There are many approaches to this kind of problem, and we showcase a different methodology in each of the solutions below.

    1. Our goal is to express the function \(F\) as \(F = g \circ f\) for functions \(g\) and \(f\). From Definition 5.1, we know \(F(x) = g(f(x))\), and we can think of \(f(x)\) as being the ‘inside’ function and \(g\) as being the ‘outside’ function. Looking at \(F(x) = |3x-1|\) from an ‘inside versus outside’ perspective, we can think of \(3x-1\) being inside the absolute value symbols. Taking this cue, we define \(f(x) = 3x-1\). At this point, we have \(F(x) = |f(x)|\). What is the outside function? The function which takes the absolute value of its input, \(g(x) = |x|\). Sure enough, \((g \circ f)(x) = g(f(x)) = |f(x)| = |3x-1| = F(x)\), so we are done.
    2. We attack deconstructing \(G\) from an operational approach. Given an input \(x\), the first step is to square \(x\), then add \(1\), then divide the result into \(2\). We will assign each of these steps a function so as to write \(G\) as a composite of three functions: \(f\), \(g\) and \(h\). Our first function, \(f\), is the function that squares its input, \(f(x) = x^2\). The next function is the function that adds \(1\) to its input, \(g(x) = x+1\). Our last function takes its input and divides it into \(2\), \(h(x) = \frac{2}{x}\). The claim is that \(G = h \circ g \circ f\). We find \[(h \circ g \circ f)(x) = h(g(f(x))) = h(g\left(x^2\right)) = h\left(x^2+1\right)= \frac{2}{x^2+1} = G(x),\nonumber\] so we are done.
    3. If we look \(H(x) = \frac{\sqrt{x}+1}{\sqrt{x}-1}\) with an eye towards building a complicated function from simpler functions, we see the expression \(\sqrt{x}\) is a simple piece of the larger function. If we define \(f(x) = \sqrt{x}\), we have \(H(x) = \frac{f(x)+1}{f(x)-1}\). If we want to decompose \(H = g \circ f\), then we can glean the formula for \(g(x)\) by looking at what is being done to \(f(x)\). We take \(g(x) = \frac{x+1}{x-1}\), so \[(g \circ f)(x) = g(f(x)) = \frac{f(x)+1}{f(x)-1} = \frac{\sqrt{x}+1}{\sqrt{x}-1} = H(x),\nonumber\] as required.

    5.1.1 Exercises

    In Exercises 1 - 12, use the given pair of functions to find the following values if they exist.

    • \((g\circ f)(0)\)
    • \((f\circ g)(-1)\)
    • \((f \circ f)(2)\)
    • \((g\circ f)(-3)\)
    • \((f\circ g)\left(\frac{1}{2}\right)\)
    • \((f \circ f)(-2)\)
    1. \(f(x) = x^2\), \(g(x) = 2x+1\)
    2. \(f(x) = 4-x\), \(g(x) = 1-x^2\)
    3. \(f(x) = 4-3x\), \(g(x) = |x|\)
    4. \(f(x) = |x-1|\), \(g(x) = x^2-5\)
    5. \(f(x) = 4x+5\), \(g(x) = \sqrt{x}\)
    6. \(f(x) = \sqrt{3-x}\), \(g(x) = x^2+1\)
    7. \(f(x) = 6-x-x^2\), \(g(x) = x\sqrt{x+10}\)
    8. \(f(x) = \sqrt[3]{x+1}\), \(g(x) = 4x^2-x\)
    9. \(f(x) = \dfrac{3}{1-x}\), \(g(x) = \dfrac{4x}{x^2+1}\)
    10. \(f(x) = \dfrac{x}{x+5}\), \(g(x) = \dfrac{2}{7-x^2}\)
    11. \(f(x) = \dfrac{2x}{5-x^2}\), \(g(x) = \sqrt{4x+1}\)
    12. \(f(x) =\sqrt{2x+5}\), \(g(x) = \dfrac{10x}{x^2+1}\)

    In Exercises 13 - 24, use the given pair of functions to find and simplify expressions for the following functions and state the domain of each using interval notation.

    • \((g \circ f)(x)\)
    • \((f \circ g)(x)\)
    • \((f \circ f)(x)\)
    1. \(f(x) = 2x+3\), \(g(x) = x^2-9\)
    2. \(f(x) = x^2 -x+1\), \(g(x) = 3x-5\)
    3. \(f(x) = x^2-4\), \(g(x) = |x|\)
    4. \(f(x) = 3x-5\), \(g(x) = \sqrt{x}\)
    5. \(f(x) = |x+1|\), \(g(x) = \sqrt{x}\)
    6. \(f(x) = 3-x^2\), \(g(x) = \sqrt{x+1}\)
    7. \(f(x) = |x|\), \(g(x) = \sqrt{4-x}\)
    8. \(f(x) = x^2-x-1\), \(g(x) = \sqrt{x-5}\)
    9. \(f(x) = 3x-1\), \(g(x) = \dfrac{1}{x+3}\)
    10. \(f(x) = \dfrac{3x}{x-1}\), \(g(x) =\dfrac{x}{x-3}\)
    11. \(f(x) = \dfrac{x}{2x+1}\), \(g(x) = \dfrac{2x+1}{x}\)
    12. \(f(x) = \dfrac{2x}{x^2-4}\), \(g(x) =\sqrt{1-x}\)

    In Exercises 25 - 30, use \(f(x) = -2x\), \(g(x) = \sqrt{x}\) and \(h(x) = |x|\) to find and simplify expressions for the following functions and state the domain of each using interval notation.

    1. \((h\circ g \circ f)(x)\)
    2. \((h\circ f \circ g)(x)\)
    3. \((g\circ f \circ h)(x)\)
    4. \((g\circ h \circ f)(x)\)
    5. \((f\circ h \circ g)(x)\)
    6. \((f\circ g \circ h)(x)\)

    In Exercises 31 - 40, write the given function as a composition of two or more non-identity functions. (There are several correct answers, so check your answer using function composition.)

    1. \(p(x) = (2x+3)^3\)
    2. \(P(x) = \left(x^2-x+1\right)^5\)
    3. \(h(x) = \sqrt{2x-1}\)
    4. \(H(x) = |7-3x|\)
    5. \(r(x) = \dfrac{2}{5x+1}\)
    6. \(R(x) = \dfrac{7}{x^2-1}\)
    7. \(q(x) = \dfrac{|x|+1}{|x|-1}\)
    8. \(Q(x) = \dfrac{2x^3+1}{x^3-1}\)
    9. \(v(x) = \dfrac{2x+1}{3-4x}\)
    10. \(w(x) = \dfrac{x^2}{x^4+1}\)
    11. Write the function \(F(x) = \sqrt{\dfrac{x^{3} + 6}{x^{3} - 9}}\) as a composition of three or more non-identity functions.
    12. Let \(g(x) = -x, \, h(x) = x + 2, \, j(x) = 3x\) and \(k(x) = x - 4\). In what order must these functions be composed with \(f(x) = \sqrt{x}\) to create \(F(x) = 3\sqrt{-x + 2} - 4\)?
    13. What linear functions could be used to transform \(f(x) = x^{3}\) into \(F(x) = -\frac{1}{2}(2x - 7)^{3} + 1\)? What is the proper order of composition?

    In Exercises 44 - 55, let \(f\) be the function defined by \[f = \{(-3, 4), (-2, 2), (-1, 0), (0, 1), (1, 3), (2, 4), (3, -1)\}\nonumber\] and let \(g\) be the function defined \[g = \{(-3, -2), (-2, 0), (-1, -4), (0, 0), (1, -3), (2, 1), (3, 2)\}\nonumber\]. Find the value if it exists.

    1. \((f \circ g)(3)\)
    2. \(f(g(-1))\)
    3. \((f \circ f)(0)\)
    4. \((f \circ g)(-3)\)
    5. \((g \circ f)(3)\)
    6. \(g(f(-3))\)
    7. \((g \circ g)(-2)\)
    8. \((g \circ f)(-2)\)
    9. \(g(f(g(0)))\)
    10. \(f(f(f(-1)))\)
    11. \(f(f(f(f(f(1)))))\)
    12. \(\underbrace{(g \circ g \circ \cdots \circ g)}_{n \text { times }}(0)\)

    In Exercises 56 - 61, use the graphs of \(y=f(x)\) and \(y=g(x)\) below to find the function value.

    Screen Shot 2022-04-01 at 4.06.52 AM.png

    1. \((g\circ f)(1)\)
    2. \((f \circ g)(3)\)
    3. \((g\circ f)(2)\)
    4. \((f\circ g)(0)\)
    5. \((f\circ f)(1)\)
    6. \((g \circ g)(1)\)
    7. The volume \(V\) of a cube is a function of its side length \(x\). Let’s assume that \(x = t + 1\) is also a function of time \(t\), where \(x\) is measured in inches and \(t\) is measured in minutes. Find a formula for \(V\) as a function of \(t\).
    8. Suppose a local vendor charges \(\$2\) per hot dog and that the number of hot dogs sold per hour \(x\) is given by \(x(t) = -4t^2+20t+92\), where \(t\) is the number of hours since \(10\) AM, \(0 \leq t \leq 4\).
      1. Find an expression for the revenue per hour \(R\) as a function of \(x\).
      2. Find and simplify \(\left(R \circ x\right)(t)\). What does this represent?
      3. What is the revenue per hour at noon?
    9. Discuss with your classmates how ‘real-world’ processes such as filling out federal income tax forms or computing your final course grade could be viewed as a use of function composition. Find a process for which composition with itself (iteration) makes sense.


    1. For \(f(x) = x^2\) and \(g(x) = 2x+1\),
      • \((g\circ f)(0) = 1\)
      • \((f\circ g)(-1) = 1\)
      • \((f \circ f)(2) = 16\)
      • \((g\circ f)(-3) = 19\)
      • \((f\circ g)\left(\frac{1}{2}\right) = 4\)
      • \((f \circ f)(-2) = 16\)
    2. For \(f(x) = 4-x\) and \(g(x) = 1-x^2\),
      • \((g\circ f)(0) = -15\)
      • \((f\circ g)(-1) = 4\)
      • \((f \circ f)(2) = 2\)
      • \((g\circ f)(-3) = -48\)
      • \((f\circ g)\left(\frac{1}{2}\right) = \frac{13}{4}\)
      • \((f \circ f)(-2) = -2\)
    3. For \(f(x) = 4-3x\) and \(g(x) = |x|\),
      • \((g\circ f)(0) = 4\)
      • \((f\circ g)(-1) = 1\)
      • \((f \circ f)(2) = 10\)
      • \((g\circ f)(-3) = 13\)
      • \((f\circ g)\left(\frac{1}{2}\right) = \frac{5}{2}\)
      • \((f \circ f)(-2) = -26\)
    4. For \(f(x) = |x-1|\) and \(g(x) = x^2-5\),
      • \((g\circ f)(0) = -4\)
      • \((f\circ g)(-1) = 5\)
      • \((f \circ f)(2) = 0\)
      • \((g\circ f)(-3) = 11\)
      • \((f\circ g)\left(\frac{1}{2}\right) = \frac{23}{4}\)
      • \((f \circ f)(-2) = 2\)
    5. For \(f(x) = 4x+5\) and \(g(x) = \sqrt{x}\),
      • \((g\circ f)(0) = \sqrt{5}\)
      • \((f\circ g)(-1)\) is not real
      • \((f \circ f)(2) = 57\)
      • \((g\circ f)(-3)\) is not real
      • \((f\circ g)\left(\frac{1}{2}\right) = 5+2\sqrt{2}\)
      • \((f \circ f)(-2) = -7\)
    6. For \(f(x) = \sqrt{3-x}\) and \(g(x) = x^2+1\),
      • \((g\circ f)(0) = 4\)
      • \((f\circ g)(-1) = 1\)
      • \((f \circ f)(2) = \sqrt{2}\)
      • \((g\circ f)(-3) = 7\)
      • \((f\circ g)\left(\frac{1}{2}\right) = \frac{\sqrt{7}}{2}\)
      • \((f \circ f)(-2) = \sqrt{3 - \sqrt{5}}\)
    7. For \(f(x) = 6-x-x^2\) and \(g(x) = x\sqrt{x+10}\),
      • \((g\circ f)(0) = 24\)
      • \((f\circ g)(-1) = 0\)
      • \((f \circ f)(2) = 6\)
      • \((g\circ f)(-3) = 0\)
      • \((f\circ g)\left(\frac{1}{2}\right) = \frac{27-2\sqrt{42}}{8}\)
      • \((f \circ f)(-2) = -14\)
    8. For \(f(x) = \sqrt[3]{x+1}\) and \(g(x) = 4x^2-x\),
      • \((g\circ f)(0) = 3\)
      • \((f\circ g)(-1) = \sqrt[3]{6}\)
      • \((f \circ f)(2) = \sqrt[3]{\sqrt[3]{3}+1}\)
      • \((g\circ f)(-3) = 4\sqrt[3]{4}+\sqrt[3]{2}\)
      • \((f\circ g)\left(\frac{1}{2}\right) = \frac{\sqrt[3]{12}}{2}\)
      • \((f \circ f)(-2) = 0\)
    9. For \(f(x) = \frac{3}{1-x}\) and \(g(x) = \frac{4x}{x^2+1}\),
      • \((g\circ f)(0) = \frac{6}{5}\)
      • \((f\circ g)(-1) = 1\)
      • \((f \circ f)(2) = \frac{3}{4}\)
      • \((g\circ f)(-3) = \frac{48}{25}\)
      • \((f\circ g)\left(\frac{1}{2}\right) = -5\)
      • \((f \circ f)(-2)\) is undefined
    10. For \(f(x) = \frac{x}{x+5}\) and \(g(x) = \frac{2}{7-x^2}\),
      • \((g\circ f)(0) = \frac{2}{7}\)
      • \((f\circ g)(-1) = \frac{1}{16}\)
      • \((f \circ f)(2) = \frac{2}{37}\)
      • \((g\circ f)(-3) = \frac{8}{19}\)
      • \((f\circ g)\left(\frac{1}{2}\right) = \frac{8}{143}\)
      • \((f \circ f)(-2) = -\frac{2}{13}\)
    11. For \(f(x) = \frac{2x}{5-x^2}\) and \(g(x) = \sqrt{4x+1}\),
      • \((g\circ f)(0) = 1\)
      • \((f\circ g)(-1)\) is not real
      • \((f \circ f)(2) = -\frac{8}{11}\)
      • \((g\circ f)(-3) = \sqrt{7}\)
      • \((f\circ g)\left(\frac{1}{2}\right) = \sqrt{3}\)
      • \((f \circ f)(-2) = \frac{8}{11}\)
    12. For \(f(x) =\sqrt{2x+5}\) and \(g(x) = \frac{10x}{x^2+1}\),
      • \((g\circ f)(0) = \frac{5\sqrt{5}}{3}\)
      • \((f\circ g)(-1)\) is not real
      • \((f \circ f)(2) = \sqrt{11}\)
      • \((g\circ f)(-3)\) is not real
      • \((f\circ g)\left(\frac{1}{2}\right) = \sqrt{13}\)
      • \((f \circ f)(-2) = \sqrt{7}\)
    13. For \(f(x) = 2x+3\) and \(g(x) = x^2-9\)
      • \((g \circ f)(x) = 4x^2+12x\), domain: \((-\infty, \infty)\)
      • \((f \circ g)(x) = 2x^2-15\), domain: \((-\infty, \infty)\)
      • \((f \circ f)(x) = 4x+9\), domain: \((-\infty, \infty)\)
    14. For \(f(x) = x^2 -x+1\) and \(g(x) = 3x-5\)
      • \((g \circ f)(x) = 3x^2-3x-2\), domain: \((-\infty, \infty)\)
      • \((f \circ g)(x) =9x^2-33x+31\), domain: \((-\infty, \infty)\)
      • \((f \circ f)(x) = x^4-2x^3+2x^2-x+1\), domain: \((-\infty, \infty)\)
    15. For \(f(x) = x^2-4\) and \(g(x) = |x|\)
      • \((g \circ f)(x) = |x^2-4|\), domain: \((-\infty, \infty)\)
      • \((f \circ g)(x) =|x|^2-4 = x^2-4\), domain: \((-\infty, \infty)\)
      • \((f \circ f)(x) =x^4-8x^2+12\), domain: \((-\infty, \infty)\)
    16. For \(f(x) = 3x-5\) and \(g(x) = \sqrt{x}\)
      • \((g \circ f)(x) = \sqrt{3x-5}\), domain: \(\left[ \frac{5}{3}, \infty \right)\)
      • \((f \circ g)(x) = 3\sqrt{x}-5\), domain: \([0,\infty)\)
      • \((f \circ f)(x) = 9x-20\), domain: \((-\infty, \infty)\)
    17. For \(f(x) = |x+1|\) and \(g(x) = \sqrt{x}\)
      • \((g \circ f)(x) = \sqrt{|x+1|}\), domain: \((-\infty, \infty)\)
      • \((f \circ g)(x) = |\sqrt{x}+1| = \sqrt{x}+1\), domain: \([0,\infty)\)
      • \((f \circ f)(x) = ||x+1|+1| = |x+1|+1\), domain: \((-\infty, \infty)\)
    18. For \(f(x) = 3-x^2\) and \(g(x) = \sqrt{x+1}\)
      • \((g \circ f)(x) = \sqrt{4-x^2}\), domain: \([-2,2]\)
      • \((f \circ g)(x) =2-x\), domain: \([-1, \infty)\)
      • \((f \circ f)(x) = -x^4+6x^2-6\), domain: \((-\infty, \infty)\)
    19. For \(f(x) = |x|\) and \(g(x) = \sqrt{4-x}\)
      • \((g \circ f)(x) = \sqrt{4-|x|}\), domain: \([-4,4]\)
      • \((f \circ g)(x) =|\sqrt{4-x}| = \sqrt{4-x}\), domain: \((-\infty, 4]\)
      • \((f \circ f)(x) = | |x| | = |x|\), domain: \((-\infty, \infty)\)
    20. For \(f(x) = x^2-x-1\) and \(g(x) = \sqrt{x-5}\)
      • \((g \circ f)(x) = \sqrt{x^2-x-6}\), domain: \((-\infty, -2] \cup [3,\infty)\)
      • \((f \circ g)(x) =x-6-\sqrt{x-5}\), domain: \([5,\infty)\)
      • \((f \circ f)(x) =x^4-2x^3-2x^2+3x+1\), domain: \((-\infty, \infty)\)
    21. For \(f(x) = 3x-1\) and \(g(x) = \frac{1}{x+3}\)
      • \((g \circ f)(x) = \frac{1}{3x+2}\), domain: \(\left(-\infty, -\frac{2}{3}\right) \cup \left(-\frac{2}{3}, \infty\right)\)
      • \((f \circ g)(x) = -\frac{x}{x+3}\), domain: \(\left(-\infty, -3\right) \cup \left(-3, \infty\right)\)
      • \((f \circ f)(x) = 9x-4\), domain: \((-\infty, \infty)\)
    22. For \(f(x) = \frac{3x}{x-1}\) and \(g(x) =\frac{x}{x-3}\)
      • \((g \circ f)(x) =x\), domain: \(\left(-\infty, 1\right) \cup (1, \infty)\)
      • \((f \circ g)(x) =x\), domain: \(\left(-\infty, 3\right) \cup (3,\infty)\)
      • \((f \circ f)(x) = \frac{9x}{2x+1}\), domain: \(\left(-\infty, -\frac{1}{2}\right) \cup \left(-\frac{1}{2}, 1 \right) \cup \left(1,\infty \right)\)
    23. For \(f(x) = \frac{x}{2x+1}\) and \(g(x) = \frac{2x+1}{x}\)
      • \((g \circ f)(x) = \frac{4x+1}{x}\), domain: \(\left(-\infty, -\frac{1}{2}\right) \cup \left(-\frac{1}{2}, 0), \cup (0, \infty\right)\)
      • \((f \circ g)(x) = \frac{2x+1}{5x+2}\), domain: \(\left(-\infty, -\frac{2}{5}\right) \cup \left(-\frac{2}{5}, 0\right) \cup (0,\infty)\)
      • \((f \circ f)(x) = \frac{x}{4x+1}\), domain: \(\left(-\infty, -\frac{1}{2}\right) \cup \left(-\frac{1}{2}, -\frac{1}{4} \right) \cup \left(-\frac{1}{4},\infty\right)\)
    24. For \(f(x) = \frac{2x}{x^2-4}\) and \(g(x) =\sqrt{1-x}\)
      • \((g \circ f)(x) =\sqrt{\frac{x^2-2x-4}{x^2-4}}\), domain: \(\left(-\infty, -2\right) \cup \left[1-\sqrt{5}, 2\right) \cup \left[1+\sqrt{5}, \infty\right)\)
      • \((f \circ g)(x) = -\frac{2\sqrt{1-x}}{x+3}\), domain: \(\left(-\infty, -3\right) \cup \left(-3, 1\right]\)
      • \((f \circ f)(x) = \frac{4x-x^3}{x^4-9x^2+16}\), domain: \(\left(-\infty, -\frac{1+\sqrt{17}}{2}\right) \cup \left(-\frac{1+\sqrt{17}}{2}, -2\right) \cup \left(-2, \frac{1-\sqrt{17}}{2}\right) \cup \left(\frac{1-\sqrt{17}}{2}, \frac{-1+\sqrt{17}}{2}\right) \cup \left(\frac{-1+\sqrt{17}}{2}, 2\right) \cup \left(2, \frac{1+\sqrt{17}}{2} \right) \cup \left(\frac{1+\sqrt{17}}{2}, \infty\right)\)
    25. \((h\circ g \circ f)(x)= |\sqrt{-2x}|= \sqrt{-2x}\), domain: \((-\infty, 0]\)
    26. \((h\circ f \circ g)(x) = |-2\sqrt{x}|= 2\sqrt{x}\), domain: \([0,\infty)\)
    27. \((g\circ f \circ h)(x) = \sqrt{-2|x|}\), domain: \(\{0\}\)
    28. \((g\circ h \circ f)(x) = \sqrt{|-2x|} = \sqrt{2|x|}\), domain: \((-\infty, \infty)\)
    29. \((f\circ h \circ g)(x) = -2|\sqrt{x}| = -2\sqrt{x}\), domain: \([0,\infty)\)
    30. \((f\circ g \circ h)(x) = -2\sqrt{|x|}\), , domain: \((-\infty,\infty)\)
    31. Let \(f(x) = 2x+3\) and \(g(x) = x^3\), then \(p(x) = (g\circ f)(x)\).
    32. Let \(f(x) = x^2-x+1\) and \(g(x) = x^5\), \(P(x) =(g\circ f)(x)\).
    33. Let \(f(x) = 2x-1\) and \(g(x) = \sqrt{x}\), then \(h(x) = (g\circ f)(x)\).
    34. Let \(f(x) = 7-3x\) and \(g(x) = |x|\), then \(H(x) = (g\circ f)(x)\).
    35. Let \(f(x) = 5x+1\) and \(g(x) = \frac{2}{x}\), then \(r(x) =(g\circ f)(x)\).
    36. Let \(f(x) = x^2-1\) and \(g(x) = \frac{7}{x}\), then \(R(x) =(g\circ f)(x)\).
    37. Let \(f(x) = |x|\) and \(g(x) = \frac{x+1}{x-1}\), then \(q(x) =(g\circ f)(x)\).
    38. Let \(f(x) = x^3\) and \(g(x)= \frac{2x+1}{x-1}\), then \(Q(x) =(g\circ f)(x)\).
    39. Let \(f(x) =2x\) and \(g(x) = \frac{x+1}{3-2x}\), then \(v(x) =(g\circ f)(x)\).
    40. Let \(f(x) = x^2\) and \(g(x) = \frac{x}{x^2+1}\), then \(w(x) =(g\circ f)(x)\).
    41. \(F(x) = \sqrt{\frac{x^{3} + 6}{x^{3} - 9}} = (h(g(f(x)))\) where \(f(x) = x^{3}, \, g(x) = \frac{x + 6}{x - 9}\) and \(h(x) = \sqrt{x}\).
    42. \(F(x) = 3\sqrt{-x + 2} - 4 = k(j(f(h(g(x)))))\)
    43. One possible solution is \(F(x) = -\frac{1}{2}(2x - 7)^{3} + 1 = k(j(f(h(g(x)))))\) where \(g(x) = 2x, \, h(x) = x - 7, \, j(x) = -\frac{1}{2}x\) and \(k(x) = x + 1\). You could also have \(F(x) = H(f(G(x)))\) where \(G(x) = 2x - 7\) and \(H(x) = -\frac{1}{2}x + 1\).
    44. \((f \circ g)(3)= f(g(3)) = f(2) = 4\)
    45. \(f(g(-1)) = f(-4)\) which is undefined
    46. \((f \circ f)(0) = f(f(0)) = f(1) = 3\)
    47. \((f \circ g)(-3) = f(g(-3)) = f(-2) = 2\)
    48. \((g \circ f)(3) = g(f(3)) = g(-1) = -4\)
    49. \(g(f(-3)) = g(4)\) which is undefined
    50. \((g \circ g)(-2) = g(g(-2)) = g(0) = 0\)
    51. \((g \circ f)(-2) = g(f(-2)) = g(2) = 1\)
    52. \(g(f(g(0))) = g(f(0)) = g(1) = -3\)
    53. \(f(f(f(-1))) = f(f(0)) = f(1) = 3\)
    54. \(f(f(f(f(f(1))))) = f(f(f(f(3)))) =\\ f(f(f(-1))) = f(f(0)) = f(1) = 3\)
    55. \(\underbrace{(g \circ g \circ \cdots \circ g)}_{n \text { times }}(0)=0\)
    56. \((g\circ f)(1) = 3\)
    57. \((f \circ g)(3) = 4\)
    58. \((g\circ f)(2) = 0\)
    59. \((f\circ g)(0) = 4\)
    60. \((f\circ f)(1) = 3\)
    61. \((g \circ g)(1) = 0\)
    62. \(V(x) = x^{3}\) so \(V(x(t)) = (t + 1)^{3}\)
      1. \(R(x) = 2x\)
      2. \(\left(R \circ x \right)(t) = -8t^2+40t+184\), \(0 \leq t \leq 4\). This gives the revenue per hour as a function of time.
      3. Noon corresponds to \(t=2\), so \(\left(R \circ x \right)(2) = 232\). The hourly revenue at noon is \(\$232\) per hour.


    1 These were introduced, as you may recall, as piecewise-defined linear functions.

    2 This is a really bad math pun.

    3 If we broaden our concept of functions to allow for complex valued coefficients, the Complex Factorization Theorem, Theorem 3.14, tells us every function we have studied thus far is a combination of linear functions.

    4 This shows us function composition isn’t commutative. An example of an operation we perform on two functions which is commutative is function addition, which we defined in Section 1.5. In other words, the functions \(f + g\) and \(g + f\) are always equal. Which of the remaining operations on functions we have discussed are commutative?

    5 A more mathematical example in which the order of two processes matters can be found in Section 1.7. In fact, all of the transformations in that section can be viewed in terms of composing functions with linear function

    This page titled 5.1: Function Composition is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by Carl Stitz & Jeff Zeager via source content that was edited to the style and standards of the LibreTexts platform.