Calculus

Set Theory

Set Theory Logo

Composition of Functions

Solved Problems

Example 1.

The functions \(f,g\) are defined as sets of ordered pairs \[f = \left\{ {\left( {3,7} \right),\left( {4,1} \right),\left( {5,8} \right),\left( {6,1} \right)} \right\},\] \[g = \left\{ {\left( {5,4} \right),\left( {9,6} \right),\left( {7,3} \right),\left( {2,6} \right)} \right\}.\] Find the composition of functions \(f \circ g.\) State its domain and range.

Solution.

Draw the arrow diagram for the composition of functions \(f \circ g:\)

A composition of discrete functions
Figure 4.

It follows from the diagram:

\[g\left( 5 \right) = 4,\;\;f\left( 4 \right) = 1,\;\; \Rightarrow \left( {f \circ g} \right)\left( 5 \right) = 1;\]
\[g\left( 7 \right) = 3,\;\;f\left( 3 \right) = 7,\;\; \Rightarrow \left( {f \circ g} \right)\left( 7 \right) = 7;\]
\[g\left( 9 \right) = 6,\;\;f\left( 6 \right) = 1,\;\; \Rightarrow \left( {f \circ g} \right)\left( 9 \right) = 1;\]
\[g\left( 2 \right) = 6,\;\;f\left( 6 \right) = 1,\;\; \Rightarrow \left( {f \circ g} \right)\left( 2 \right) = 1.\]

Hence, the composite function \(f \circ g\) is given by

\[f \circ g = \left\{ {\left( {5,1} \right),\left( {7,7} \right),\left( {9,1} \right),\left( {2,1} \right)} \right\}.\]

The domain of \(f \circ g\) is the set \(\left\{ {5,7,9,2} \right\},\) and the range is the set \(\left\{ {7,1} \right\}.\)

Example 2.

The functions \(f,g\) are defined as \(f\left( x \right) = \frac{2}{{3x - 4}}\) and \(g\left( x \right) = \frac{3}{{4x - 5}}.\) Find the domain of the composition of functions \(f \circ g.\)

Solution.

By definition, \(\left( {f \circ g} \right)\left( x \right) = f\left( {g\left( x \right)} \right).\)

The inner function \({g\left( x \right)}\) is defined for all \(x\) except \(x = \frac{5}{4}.\) Hence, the point \(x = \frac{5}{4}\) must be excluded from the domain of the composition \(f \circ g.\)

The outer function \({f\left( x \right)}\) is defined for all \(x\) except \(x = \frac{4}{3}.\) So, we also need to exclude those values of \(x\) for which the inner function \({g\left( x \right)}\) is equal to \(\frac{4}{3}.\) Determine these values.

\[g\left( x \right) = \frac{3}{{4x - 5}} = \frac{4}{3},\;\; \Rightarrow 4\left( {4x - 5} \right) = 9, \;\;\Rightarrow 16x - 20 = 9,\;\; \Rightarrow 16x = 29,\;\; \Rightarrow x = \frac{{29}}{{16}}.\]

Thus, the domain of \(f \circ g\) consists of all real values of \(x\) except the points \(x = \frac{5}{4}, \frac{29}{16}.\) This can be written in the form

\[\text{dom}\left( {f \circ g} \right) = \left( { - \infty ,\frac{5}{4}} \right) \cup \left( {\frac{5}{4},\frac{{29}}{{16}}} \right) \cup \left( {\frac{{29}}{{16}},\infty } \right).\]

Example 3.

Consider the functions \(g: \mathbb{R} \to \mathbb{R}\) and \(f: \mathbb{R} \to \mathbb{R}\) defined as \(g\left( x \right) = {x^2} - x,\) \(f\left( x \right) = {x^2} + 2x.\) Find the compositions of functions:

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

Solution.

  1. The composite function \(\left(f \circ g\right)\left(x\right)\) is written as \(f\left( {g\left( x \right)} \right).\) We take the outer function \(f\left( x \right)\) and substitute the inner function \({g\left( x \right)}\) for \(x:\)
    \[\left(f \circ g\right)\left(x\right) = f\left( {g\left( x \right)} \right) = {g^2}\left( x \right) + 2g\left( x \right) = {\left( {{x^2} - x} \right)^2} + 2\left( {{x^2} - x} \right) = \color{magenta}{x^4} - \color{green}{2{x^3}} + \color{red}{x^2} + \color{red}{2{x^2}} -\color{blue}{2x} = \color{magenta}{x^4} -\color{green}{2{x^3}} + \color{red}{3{x^2}} - \color{blue}{2x}.\]
  2. Calculate the composition \(g \circ f:\)
    \[\left(g \circ f\right)\left(x\right) = g\left( {f\left( x \right)} \right) = {f^2}\left( x \right) - f\left( x \right) = {\left( {{x^2} + 2x} \right)^2} - \left( {{x^2} + 2x} \right) = \color{magenta}{x^4} + \color{green}{4{x^3}} + \color{red}{4{x^2}} - \color{red}{x^2} - \color{blue}{2x} = \color{magenta}{x^4} + \color{green}{4{x^3}} + \color{red}{3{x^2}} - \color{blue}{2x}.\]
    Notice that \(f \circ g \ne g \circ f,\) that is the composition of functions is not commutative.
  3. The composition of functions \(f \circ f\) is given by
    \[\left(f \circ f\right)\left(x\right) = f\left( {f\left( x \right)} \right) = {f^2}\left( x \right) + 2f\left( x \right) = {\left( {{x^2} + 2x} \right)^2} + 2\left( {{x^2} + 2x} \right) = \color{magenta}{x^4} + \color{green}{4{x^3}} + \color{red}{4{x^2}} + \color{red}{2{x^2}} + \color{blue}{4x} = \color{magenta}{x^4} + \color{green}{4{x^3}} + \color{red}{6{x^2}} + \color{blue}{4x}.\]
  4. Similarly we determine the function \(g \circ g:\)
    \[\require{cancel}\left(g \circ g\right)\left(x\right) = g\left( {g\left( x \right)} \right) {g^2}\left( x \right) - g\left( x \right) = {\left( {{x^2} - x} \right)^2} - \left( {{x^2} - x} \right) = \color{magenta}{x^4} - \color{green}{2{x^3}} + \cancel{\color{red}{x^2}} - \cancel{\color{red}{x^2}} + \color{blue}{x} = \color{magenta}{x^4} - \color{green}{2{x^3}} + \color{blue}{x}.\]

Example 4.

Let the functions \(g: \mathbb{R} \to \mathbb{R}\) and \(f: \mathbb{R} \to \mathbb{R}\) be defined as \(g\left( x \right) = \sqrt{x},\) \(f\left( x \right) = {x^2} + 1.\) Find the compositions of functions:

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

Solution.

  1. The find the composite function \(f \circ g \circ f,\) we first determine the composition of inner functions \(g \circ f:\)
    \[\left(g \circ f\right)\left(x\right) = g\left( {f\left( x \right)} \right) = g\left( {{x^2} + 1} \right) = \sqrt {{x^2} + 1} .\]
    Then, using the associative law, the triple composition is given by
    \[\left(f \circ g \circ f\right)\left(x\right) = \left(f \circ \left({g \circ f}\right)\right)\left(x\right) = f\left[ {g\left( {f\left( x \right)} \right)} \right] = f\left( {\sqrt {{x^2} + 1} } \right) = {\left( {\sqrt {{x^2} + 1} } \right)^2} + 1 = {x^2} + 1 + 1 = {x^2} + 2.\]
  2. Here we first find the composition \(f \circ g:\)
    \[\left(f \circ g\right)\left(x\right) = f\left( {g\left( x \right)} \right) = f\left( {\sqrt x } \right) = {\left( {\sqrt x } \right)^2} + 1 = x + 1.\]
    Hence,
    \[\left(g \circ f \circ g\right)\left(x\right) = \left(g \circ \left( {f \circ g} \right)\right)\left(x\right) = g\left[ {f\left( {g\left( x \right)} \right)} \right] = g\left( {x + 1} \right) = \sqrt {x + 1} .\]
  3. Calculate the composition of functions \(g \circ f \circ f\) using the same approach. Since
    \[\left(f \circ f\right)\left(x\right) = f\left( {f\left( x \right)} \right) = f\left( {{x^2} + 1} \right) = {\left( {{x^2} + 1} \right)^2} + 1 = {x^4} + 2{x^2} + 1 + 1 = {x^4} + 2{x^2} + 2,\]
    the triple composition \(g \circ f \circ f\) is given by
    \[\left(g \circ f \circ f\right)\left(x\right) = \left(g \circ \left( {f \circ f} \right)\right)\left(x\right) = g\left[ {f\left( {f\left( x \right)} \right)} \right] = g\left( {{x^4} + 2{x^2} + 2} \right) = \sqrt {{x^4} + 2{x^2} + 2} .\]

Example 5.

The function \(f:\left[ { - 1,\infty } \right) \to \left[ {0,\infty } \right)\) is defined as \(f\left( x \right) = \sqrt {{x^3} + 1} .\) Show that the composition \(f^{-1} \circ f\) is the identity function.

Solution.

Find the inverse function \(f^{-1}\) by solving the equation \(y = \sqrt {{x^3} + 1}\) for \(x:\)

\[y = \sqrt {{x^3} + 1} ,\;\; \Rightarrow {x^3} + 1 = {y^2},\;\; \Rightarrow {x^3} = {y^2} - 1,\;\; \Rightarrow x = \sqrt[3]{{{y^2} - 1}}.\]

To calculate the composition of functions \(f^{-1} \circ f,\) we substitute \(y = \sqrt {{x^3} + 1}\) in the equation \(x = \sqrt[3]{{{y^2} - 1}}.\) For any \(x\) in the domain of \(f,\) we have

\[\left({f^{ - 1}} \circ f\right)\left(x\right) = {f^{ - 1}}\left( {f\left( x \right)} \right) = {f^{ - 1}}\left( y \right) = \sqrt[3]{{{y^2} - 1}} = \sqrt[3]{{{{\left( {\sqrt {{x^3} + 1} } \right)}^2} - 1}} = \sqrt[3]{{{x^3} + \cancel{1} - \cancel{1}}} = \sqrt[3]{{{x^3}}} = x.\]

Thus, \({f^{ - 1}} \circ f = I,\) where \(I\) is the identity function in the domain of \(f.\)

Example 6.

The functions \(f, g: \mathbb{R} \to \mathbb{R}\) are defined as \(f\left( x \right) = 2{x^2} + 1,\) \(g\left( x \right) = 1 - x.\) Solve the equation \[f \circ g + g \circ f + 5 = 0.\]

Solution.

Calculate the compositions of functions \(f \circ g\) and \(g \circ f:\)

\[\left( {f \circ g} \right)\left( x \right) = f\left( {g\left( x \right)} \right) = f\left( {1 - x} \right) = 2{\left( {1 - x} \right)^2} + 1 = 2\left( {1 - 2x + {x^2}} \right) + 1 = 2 - 4x + 2{x^2} + 1 = 2{x^2} - 4x + 3;\]
\[\left( {g \circ f} \right)\left( x \right) = g\left( {f\left( x \right)} \right) = g\left( {2{x^2} + 1} \right) = 1 - \left( {2{x^2} + 1} \right) = \cancel{1} - 2{x^2} - \cancel{1} = - 2{x^2}.\]

Plug both expressions into the original equation and solve it for \(x:\)

\[f \circ g + g \circ f + 5 = 0,\;\; \Rightarrow \cancel{2{x^2}} - 4x + 3 - \cancel{2{x^2}} + 5 = 0,\;\; \Rightarrow 8 - 4x = 0,\;\; \Rightarrow x = 2.\]
Page 1 Page 2