# Composition of Functions : Exercise (4.8) - Solutions

#### Key Points

• Some pairs of functions cannot be composed. Some pairs of functions can be composed only for certain values of $x$.

• The domain of a composite function is either the same as the domain of the first function, or else lies inside it.

• The range of a composite function is either the same as the range of the second function, or else lies inside it.

1.           Functions $f$ and $g$ are given by $f(x) = 2x + 1$ and $g(x) = 3x$.

(a)   Calculate $(g\circ f)(1)$ and $(g\circ f)(3)$.

(b)   Find the formula of $(g\circ f)$ and check the above images. State the domainof $(g\circ f)$.

Show/Hide Solution

$\begin{array}{*{20}{l}} {f(x)=2x+1,\;g(x)=3x} \\ {} \\ {(g\circ f)(1)\;=g\left( {f(1)} \right)} \\ {\;\;\;\;\;\;\;\;\;\;=g\left( {2\times 1+1} \right)} \\ {\;\;\;\;\;\;\;\;\;\;=g(3)} \\ {\;\;\;\;\;\;\;\;\;\;=3\times 3} \\ {\;\;\;\;\;\;\;\;\;\;=9} \\ {} \\ {(g\circ f)(3)\;=g\left( {f(3)} \right)} \\ {\;\;\;\;\;\;\;\;\;\;=g\left( {2\times 3+1} \right)} \\ {\;\;\;\;\;\;\;\;\;\;=g(7)} \\ {\;\;\;\;\;\;\;\;\;\;=3\times 7} \\ {\;\;\;\;\;\;\;\;\;\;=21} \\ {} \\ {(g\circ f)(x)\;=g\left( {f(x)} \right)} \\ {\;\;\;\;\;\;\;\;\;\;=g\left( {2x+1} \right)} \\ {\;\;\;\;\;\;\;\;\;\;=3\left( {2x+1} \right)} \\ {} \\ {f\;\text{is defined for all real numbers of}\;x.} \\ \begin{array}{l}\therefore \;\;\operatorname{dom}(f)=\mathbb{R}\\3\left( {2x+1} \right)\ \text{is defined for all real numbers of}\;x.\ \end{array} \\ {\therefore \;\;\operatorname{dom}(g\circ f)=\mathbb{R}} \end{array}$

2.           The functions $f$ and $g$ are given by $f(x) = x + 2$ and $g(x) = x^2$.

(a)   Find the formulae for $(g\circ f)$,$(g\circ g)$, $(f\circ g)$, $(f\circ f)$, and their domains.

(b)   Find $(g\circ f)(−1)$ and $(g\circ f)(2)$.

(c)   Find $(f\circ g)(−1)$ and $(f\circ g)(2)$.

Show/Hide Solution

$\begin{array}{*{20}{l}} {f(x)=x+2,\;g(x)={{x}^{2}}} \\ {} \\ {\left( {g\circ f} \right)(x)=g\left( {f(x)} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;=g\left( {x+2} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;={{{\left( {x+2} \right)}}^{2}}} \\ {} \\ {\left( {g\circ g} \right)(x)=g\left( {g(x)} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;=g\left( {{{x}^{2}}} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;={{{\left( {{{x}^{2}}} \right)}}^{2}}} \\ {\;\;\;\;\;\;\;\;\;\;\;={{x}^{4}}} \\ {} \\ {\left( {f\circ g} \right)(x)=f\left( {g(x)} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;=f\left( {{{x}^{2}}} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;={{x}^{2}}+2} \\ {} \\ {\left( {f\circ f} \right)(x)=f\left( {f(x)} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;=f\left( {x+2} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;=x+2+2} \\ {\;\;\;\;\;\;\;\;\;\;\;=x+4} \\ {} \\ {\text{Both }\;f(x)\;\text{and }g(x)\;\text{are defined for all real numbers of}\;x.} \\ {} \\ {{{{\left( {x+2} \right)}}^{2}},\ {{x}^{4}},\ {{x}^{2}}+2\ \text{and}\ x+4\ \text{are defined for all real numbers of}\;x.\ } \\ {} \\ {\operatorname{dom}\left( {g\circ f} \right)=\operatorname{dom}(f)=\mathbb{R}} \\ {\operatorname{dom}\left( {g\circ g} \right)=\operatorname{dom}(g)=\mathbb{R}} \\ {\operatorname{dom}\left( {f\circ g} \right)=\operatorname{dom}(g)=\mathbb{R}} \\ {\operatorname{dom}\left( {f\circ f} \right)=\operatorname{dom}(f)=\mathbb{R}} \end{array}$

3.           Find the formulae for composite functions $(f\circ g)$, $(g\circ f)$ and their domains in each case.

$\begin{array}{ll} \text{(a)}\ \ f(x)=x+1, & g(x)=2 x^{2}-x+3\\\\ \text{(b)}\ \ f(x)=x^{2}-1, & g(x)=3 x+1\\\\ \text{(c)}\ \ f(x)=-x, & g(x)=x\\\\ \text{(d)}\ \ f(x)=x^{2}, & g(x)=\sqrt{x} \end{array}$

#### Solutions

$\text{(a)}\ \ f(x)=x+1, \ \ \ \ \ g(x)=2 x^{2}-x+3$

Show/Hide Solution

$\begin{array}{l}\left( {f\circ g} \right)(x)=f\left( {g(x)} \right)\\\\\;\;\;\;\;\;\;\;\;\;\;\ \ \ \ \ =f\left( {2{{x}^{2}}-x+3} \right)\\\\\;\;\;\;\;\;\;\;\;\;\;\ \ \ \ \ =2{{x}^{2}}-x+3+1\\\\\;\;\;\;\;\;\;\;\;\;\;\ \ \ \ \ =2{{x}^{2}}-x+4\\\\\left( {g\circ f} \right)(x)=g\left( {f(x)} \right)\\\\\;\;\;\;\;\;\;\;\;\;\;\ \ \ \ \ =g\left( {x+1} \right)\\\\\;\;\;\;\;\;\;\;\;\;\;\ \ \ \ \ =2{{\left( {x+1} \right)}^{2}}-\left( {x+1} \right)+3\\\\\;\;\;\;\;\;\;\;\;\;\;\ \ \ \ \ =2{{x}^{2}}+3x+4\\\\\text{Both }\;f(x)\;\text{and }g(x)\;\text{are defined for all real numbers of}\;x.\\\\\operatorname{dom}(f)=\mathbb{R}\;\text{and}\;\operatorname{dom}(g)=\mathbb{R}\\\\\text{Similarly, both }2{{x}^{2}}-x+4\;\text{and }2{{x}^{2}}+3x+4\;\text{are }\\\text{defined for all real numbers of}\;x.\\\\\operatorname{dom}\left( {f\circ g} \right)=\mathbb{R}\;\text{and}\;\operatorname{dom}\left( {g\circ f} \right)=\mathbb{R}\end{array}$

$\text{(b)}\ \ f(x)=x^{2}-1, \ \ \ \ \ g(x)=3 x+1$

Show/Hide Solution

$\begin{array}{*{20}{l}} {\left( {f\circ g} \right)(x)=f\left( {g(x)} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;=f\left( {3x+1} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;={{{\left( {3x+1} \right)}}^{2}}-1} \\ {\;\;\;\;\;\;\;\;\;\;\;=9{{x}^{2}}+6x} \\ {} \\ {\left( {g\circ f} \right)(x)=g\left( {f(x)} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;=g\left( {{{x}^{2}}-1} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;=3\left( {{{x}^{2}}-1} \right)+1} \\ {\;\;\;\;\;\;\;\;\;\;\;=3{{x}^{2}}-2} \\ {} \\ \begin{array}{l}\text{Both }\;f(x)\;\text{and }g(x)\;\text{are defined for all real numbers of}\;x.\\\\\therefore \ \ \operatorname{dom}(f)=\mathbb{R}\;\text{and}\;\operatorname{dom}(g)=\mathbb{R}\\\\\text{Similarly both }9{{x}^{2}}+6x\;\text{and }3{{x}^{2}}-2\;\text{are defined for }\\\text{all real numbers of}\;x.\end{array} \\ {} \\ {\therefore \ \ \operatorname{dom}\left( {f\circ g} \right)=\mathbb{R}\ \ \text{and}\ \operatorname{dom}\left( {g\circ f} \right)=\mathbb{R}} \end{array}$

$\text{(c)}\ \ f(x)=-x, \ \ \ \ \ g(x)=x$

Show/Hide Solution

$\begin{array}{l}\left( {f\circ g} \right)(x)=f\left( {g(x)} \right)\\\\\;\;\;\;\;\;\;\;\;\;\;\ \ \ =f\left( x \right)\\\\\ \ \ \ \ \ \ \ \ \ \ \ =-x\\\\\left( {g\circ f} \right)(x)=g\left( {f(x)} \right)\\\\\;\;\;\;\;\;\;\;\;\;\;\ \ \ =g\left( {-x} \right)\\\\\ \ \ \ \ \ \ \ \ \ \ \ =-x\\\\\text{Both }\;f(x)\;\text{and }g(x)\;\text{are defined for all real numbers of}\;x.\\\\\operatorname{dom}(f)=\mathbb{R}\;\text{and}\;\operatorname{dom}(g)=\mathbb{R}\\\\\text{Also}-x\ \text{is}\ \text{defined for all real numbers of}\;x.\\\\\operatorname{dom}\left( {f\circ g} \right)=\mathbb{R}\ \text{and}\ \operatorname{dom}\left( {g\circ f} \right)=\mathbb{R}\end{array}$

$\text{(d)}\ \ f(x)=x^2, \ \ \ \ \ g(x)=\sqrt{x}$

Show/Hide Solution

$\begin{array}{*{20}{l}} {\left( {f\circ g} \right)(x)=f\left( {g(x)} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;\;\;=f\left( {\sqrt{x}} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;\;\;={{{\left( {\sqrt{x}} \right)}}^{2}}} \\ {\;\;\;\;\;\;\;\;\;\;\;\;\;=x} \\ {} \\ {\left( {g\circ f} \right)(x)=g\left( {f(x)} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;\;\;=g\left( {{{x}^{2}}} \right)} \\ {\;\;\;\;\;\;\;\;\;\;\;\;\;=\sqrt{{{{x}^{2}}}}} \\ {\;\;\;\;\;\;\;\;\;\;\;\;\;=x} \\ {} \\ {f(x)\;\text{is defined for all real numbers of}\;x.} \\ {} \\ {\operatorname{dom}(f)=\mathbb{R}\;} \\ {} \\ {g(x)\;\text{is defined for }x\ge 0,\;x\in \mathbb{R}} \\ {} \\ {\operatorname{dom}(g)=\left\{ {x\;|\;x\ge 0,\;x\in \mathbb{R}} \right\}} \\ {} \\ \begin{array}{l}x\ \text{is defined for all real numbers of}\;x\ \text{but}\\\sqrt{x}\ \text{is defined for}\ x\ge 0.\ \\\\\operatorname{dom}\left( {f\circ g} \right)=\operatorname{dom}(g)=\left\{ {x\;|\;x\ge 0,\;x\in \mathbb{R}} \right\}\\\end{array} \\ {\operatorname{dom}\left( {g\circ f} \right)=\operatorname{dom}(f)=\mathbb{R}} \end{array}$

4.           A function $f$ is given by $f(x)=x+1$. Find the function $g:\mathbb{R}\to \mathbb{R}$ in each of the following:

$\begin{array}{l} \text{(a)}\ \ \left( {g\circ f} \right)(x) = x^2+5x+5\\\\ \text{(b)}\ \ \left( {f\circ g} \right)(x) = x^2+5x+5 \end{array}$

Show/Hide Solution

$\begin{array}{l} \ \ \ \ \ \ \ \ f(x)=x+1,\ \ g:\mathbb{R}\to \mathbb{R}\\\\ \text{(a)}\;\;\left( {g\circ f} \right)(x)={{x}^{2}}+5x+5\\\\ \ \ \ \ \ \ \ \ g\left( {f(x)} \right)={{x}^{2}}+5x+5\\\\ \ \ \ \ \ \ \ \ g\left( {x+1} \right)={{x}^{2}}+2x+1+3x+3+1\\\\ \ \ \ \ \ \ \ \ g\left( {x+1} \right)={{(x+1)}^{2}}+3(x+1)+1\\\\ \therefore \ \ \ g(x)={{x}^{2}}+3x+1\\\\\\ \text{(b)}\;\;\left( {f\circ g} \right)(x)={{x}^{2}}+5x+5\\\\ \ \ \ \ \ \ \ \ f\left( {g(x)} \right)={{x}^{2}}+5x+5\\\\ \ \ \ \ \ \ \ \ g(x)+1={{x}^{2}}+5x+5\\\\ \therefore \ \ \ g(x)={{x}^{2}}+5x+4 \end{array}$

5.           If $g:\mathbb{R}\to \mathbb{R}$ is given by $g(x)=x^2+3$, find the function $g$ such that

$\begin{array}{l} \text{(a)}\ \ \left( {f\circ g} \right)(x)= 4x^2+3\\\\ \text{(b)}\ \ \left( {g\circ f} \right)(x)= 4x^2+3 \end{array}$

Show/Hide Solution

$\begin{array}{l}\ \ \ \ \ \ \ g:\mathbb{R}\to \mathbb{R},\ \ \ g(x)={{x}^{2}}+3\\\\\text{(a)}\;\;\left( {f\circ g} \right)(x)=4{{x}^{2}}+3\\\\\ \ \ \ \ \ \ \ f\left( {g(x)} \right)=4{{x}^{2}}+3\\\\\ \ \ \ \ \ \ \ f\left( {{{x}^{2}}+3} \right)=4{{x}^{2}}+12-9\\\\\ \ \ \ \ \ \ \ f\left( {{{x}^{2}}+3} \right)=4\left( {{{x}^{2}}+3} \right)-9\\\\\therefore \ \ \ \ \ \ \ f\left( x \right)=4x-9\\\\\\\text{(b)}\;\;\left( {g\circ f} \right)(x)=4{{x}^{2}}+3\\\\\ \ \ \ \ \ \ \ g\left( {f(x)} \right)=4{{x}^{2}}+3\\\\\ \ \ \ \ \ \ \ {{\left( {f(x)} \right)}^{2}}+3=4{{x}^{2}}+3\\\\\ \ \ \ \ \ \ \ \ {{\left( {f(x)} \right)}^{2}}=4{{x}^{2}}\\\\\therefore \ \ \ \ \ \ \ f(x)=\pm \ 2x\end{array}$

6.           Functions $f$ and $g$ are given by $f(x)=px-2$ where $p$ is a constant and $g(x)=4x+3$. Find the value of $p$ for which $\left( {f\circ g} \right)(x) = \left( {g\circ f} \right)(x)$.

Show/Hide Solution

$\begin{array}{l}\ \ \ \ f(x)=px-2,\ \ \ g(x)=4x+3\\\\\ \ \ \;\left( {f\circ g} \right)(x)=\left( {g\circ f} \right)(x)\\\\\ \ \ \ f\left( {g(x)} \right)=g\left( {f(x)} \right)\\\\\ \ \ \ f\left( {4x+3} \right)=g\left( {px-2} \right)\\\\\ \ \ \ p\left( {4x+3} \right)-2=4\left( {px-2} \right)+3\\\\\ \ \ \ 4px+3p-2=4px-8+3\\\\\ \ \ \ 3p-2=-5\\\\\ \ \ \ p=-1\end{array}$

7.           Let $f$ and $g$ be functions given by $f(x) = 3x− 1$ and $g(x) = x+7$. Find the formulae of $f^{-1}\circ g,\ g^{-1}\circ f$ and state their domains. What are the values of $\left(f^{-1}\circ g\right)(3)$ and $\left(g\circ f^{-1}\right)(2)$.

Show/Hide Solution

$\begin{array}{l}\ \ \ \ f(x)=3x-1,\ \ \ g(x)=x+7\\\\\ \ \ \;\text{Let}\ {{f}^{{-1}}}(x)=y\\\\\ \ \ \ f\left( y \right)=x\\\\\ \ \ \ 3y-1=x\\\\\therefore \ \ y=\displaystyle \frac{{x+1}}{3}\\\\\therefore \ \ {{f}^{{-1}}}(x)=\displaystyle \frac{{x+1}}{3}\\\\\therefore \ \ \left( {{{f}^{{-1}}}\circ g} \right)(x)={{f}^{{-1}}}\left( {g(x)} \right)\\\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ={{f}^{{-1}}}\left( {x+7} \right)\\\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\displaystyle \frac{{x+7+1}}{3}\\\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\displaystyle \frac{{x+8}}{3}\\\\\ \ \ \ \text{Both }f(x)\ \text{and }g(x)\ \text{are defined for all real numbers of }x.\\\\\therefore \ \operatorname{dom}(f)=\mathbb{R},\ \operatorname{dom}(g)=\mathbb{R}\\\\\ \ \displaystyle \frac{{x+8}}{3}\ \text{ defined for all real numbers of }x.\\\\\therefore \ \operatorname{dom}({{f}^{{-1}}}\circ g)=\mathbb{R}\\\\\ \ \ \ \text{Let}\ {{g}^{{-1}}}(x)=z\\\\\ \ \ \ g(z)=x\\\\\ \ \ \ z+7=x\\\\\ \ \ \ z=x-7\\\\\therefore \ \ {{g}^{{-1}}}(x)=x-7\\\\\therefore \ \ \left( {{{g}^{{-1}}}\circ f} \right)(x)={{g}^{{-1}}}\left( {f(x)} \right)\\\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ={{g}^{{-1}}}\left( {3x-1} \right)\\\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =3x-1-7\\\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =3x-8\\\\\ \ \ \ \text{Both }f(x)\ \text{and }g(x)\ \text{are defined for all real numbers of }x.\\\\\therefore \ \operatorname{dom}(f)=\mathbb{R},\ \operatorname{dom}(g)=\mathbb{R}\\\\\ \ 3x-8\ \text{ defined for all real numbers of }x.\\\\\therefore \ \operatorname{dom}({{g}^{{-1}}}\circ f)=\mathbb{R}\\\\\therefore \ \left( {{{f}^{{-1}}}\circ g} \right)(3)=\displaystyle \frac{{3+8}}{3}=\displaystyle \frac{{11}}{3}\\\\\ \ \ \ \ \left( {g\circ {{f}^{{-1}}}} \right)(2)=g\left( {{{f}^{{-1}}}(2)} \right)\\\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =g\left( {\displaystyle \frac{{2+1}}{3}} \right)\\\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =g\left( 1 \right)\\\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =1+7\\\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =8\end{array}$

8.           Let the functions $f$ and $g$ be given by $f(x) = 2x−1$ and $g(x) =\displaystyle \frac{2x+3}{x-1}$.

Find the composite function $f\circ g$.

Find the inverse function $f^{-1}$ and $g^{-1}$.

Evaluate $\left(f\circ g^{-1}\right)(1)$ and $\left(f^{-1}\circ g^{-1}\right)(1)$.

Show/Hide Solution

$\begin{array}{l}\ f(x)=2x-1\\\ g(x)=\displaystyle \frac{{2x+3}}{{x-1}}\\\\\ \left( {f\circ g} \right)(x)=f\left( {g(x)} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =f\left( {\displaystyle \frac{{2x+3}}{{x-1}}} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =2\left( {\displaystyle \frac{{2x+3}}{{x-1}}} \right)-1\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\displaystyle \frac{{4x+6-x+1}}{{x-1}}\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\displaystyle \frac{{3x+7}}{{x-1}}\\\\\ \text{Let}\ {{f}^{{-1}}}(x)=y,\ \text{then}\\\ f(y)=x\\\ 2y-1=x\\\ y=\displaystyle \frac{{x+1}}{2}\\\ {{f}^{{-1}}}(x)=\displaystyle \frac{{x+1}}{2}\\\\\text{Let}\ {{g}^{{-1}}}(x)=z,\ \text{then}\\\ g(z)=x\\\ \displaystyle \frac{{2z+3}}{{z-1}}=x\\\ 2z+3=xz-x\\\ xz-2z=x+3\\\ z(x-2)=x+3\\\ z=\displaystyle \frac{{x+3}}{{x-2}}\\\ {{g}^{{-1}}}(x)=\displaystyle \frac{{x+3}}{{x-2}}\\\\\left( {f\circ {{g}^{{-1}}}} \right)(1)=f\left( {{{g}^{{-1}}}(1)} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =f\left( {\displaystyle \frac{{1+3}}{{1-2}}} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =f\left( {-4} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =2\left( {-4} \right)-1\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =-9\\\\\left( {{{f}^{{-1}}}\circ {{g}^{{-1}}}} \right)(1)={{f}^{{-1}}}\left( {{{g}^{{-1}}}(1)} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ={{f}^{{-1}}}\left( {\displaystyle \frac{{1+3}}{{1-2}}} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ={{f}^{{-1}}}\left( {-4} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\displaystyle \frac{{-4+1}}{2}\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =-\displaystyle \frac{3}{2}\end{array}$

9.           Let the functions $f$, $g$ and $h$ be 𝑓(𝑥) = $f(x) = x−2$, $g(x) = x^3$ and $h(x) = 4x$. Show that $\left(h\circ g\right)\circ f= h\circ \left(g\circ f\right)$.

Show/Hide Solution

$\begin{array}{l}\ f(x)=x-2\\\ g(x)={{x}^{3}}\\\ h(x)=4x\\\\\ \left( {h\circ g} \right)(x)=h\left( {g(x)} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =h\left( {{{x}^{3}}} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =4{{x}^{3}}\\\ \\\ \left( {\left( {h\circ g} \right)\circ f} \right)(x)=\left( {h\circ g} \right)\left( {f(x)} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\left( {h\circ g} \right)\left( {x-2} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =4{{\left( {x-2} \right)}^{3}}\\\\\ \left( {g\circ f} \right)(x)=g\left( {f(x)} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =g\left( {x-2} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ={{\left( {x-2} \right)}^{3}}\\\ \\\ \left( {h\circ \left( {g\circ f} \right)} \right)(x)=h\left( {\left( {g\circ f} \right)(x)} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =h\left( {{{{\left( {x-2} \right)}}^{3}}} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =4{{\left( {x-2} \right)}^{3}}\\\\\ \therefore \ \ \left( {\left( {h\circ g} \right)\circ f} \right)(x)=\left( {h\circ \left( {g\circ f} \right)} \right)(x)\\\ \therefore \ \ \left( {h\circ g} \right)\circ f=h\circ \left( {g\circ f} \right)\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \end{array}$