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:\)
It follows from the diagram:
Hence, the composite function \(f \circ g\) is given by
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.
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
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:
- \(f \circ g\)
- \(g \circ f\)
- \(f \circ f\)
- \(g \circ g\)
Solution.
- 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}.\]
- 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.
- 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}.\]
- 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:
- \(f \circ g \circ f\)
- \(g \circ f \circ g\)
- \(g \circ f \circ f\)
Solution.
- 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.\]
- 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} .\]
- 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:\)
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
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:\)
Plug both expressions into the original equation and solve it for \(x:\)