Sometimes we want to take the output of one function and use it as the input of another function. This is the idea of composing functions - we chain them together. Consider the notation: $$ \begin{equation}\begin{aligned} f\circ g(x)\\ \end{aligned}\end{equation} $$
This means that we substitute the function on the right, $g(x)$ into the function on the left, $f(x)$. That is, wherever we see $x$ in $f(x)$, we place $g(x)$: $$ \begin{equation}\begin{aligned} f\circ g(x)=f[g(x)]\\ \end{aligned}\end{equation} $$
Example
Given the functions, $f(x)=x+4$ and $g(x)=\sqrt{x}$, the composition: $$ \begin{equation}\begin{aligned} f\circ g(x)&=f[g(x)]\\ &=g(x)+4\\ &=\sqrt{x}+4\\ \end{aligned}\end{equation} $$
Thus the result of substituting a value such as $x=9$ into the composition is: $$ \begin{equation}\begin{aligned} f\circ g(9)&=\sqrt{9}+4\\ &=3+4\\ &=7\\ \end{aligned}\end{equation} $$
Composition is associative but not commutative
Composition is not commutative: $$ \begin{equation}\begin{aligned} f\circ g \neq g\circ f\\ \end{aligned}\end{equation} $$
Consider the functions $f(x)=\sin{x}$ and $g(x)=x+1$. The two compositions are: $$ \begin{equation}\begin{aligned} f\circ g (x)&=f[g(x)]\\ &=\sin(g(x))\\ &=\sin(x+1)\\ g\circ f (x)&=g[f(x)]\\ &=f(x)+1\\ &=\sin{x}+1\\ \end{aligned}\end{equation} $$
Clearly: $$ \begin{equation}\begin{aligned} \sin(x+1) &\neq \sin{x}+1\\ \therefore f\circ g &\neq g\circ f\\ \end{aligned}\end{equation} $$
Composition is however associative: $$ \begin{equation}\begin{aligned} f\circ (g\circ h) = (f\circ g)\circ h\\ \end{aligned}\end{equation} $$
Consider the functions $f(x)=\sqrt{x}$, $g(x)=\cos{x}$ and $h(x)=x-2$. The compositions are: $$ \begin{equation}\begin{aligned} f\circ g(x) &= f[g(x)]\\ &= \sqrt{g(x)}\\ &= \sqrt{\cos{x}}\\ \end{aligned}\end{equation} $$
$$ \begin{equation}\begin{aligned} (f\circ g)\circ h(x) &= fg[h(x)]\\ &= \sqrt{\cos{[h(x)}]}\\ &= \sqrt{\cos{(x-2)}}\\ \end{aligned}\end{equation} $$ $$ \begin{equation}\begin{aligned} g\circ h(x) &= g[h(x)]\\ &= \cos{[h(x)]}\\ &= \cos{(x-2)}\\ \end{aligned}\end{equation} $$ $$ \begin{equation}\begin{aligned} f\circ (g\circ h)(x) &= f[gh(x)]\\ &= \sqrt{gh(x)}\\ &= \sqrt{cos(x-2)}\\ \end{aligned}\end{equation} $$We see that: $$ \begin{equation}\begin{aligned} \sqrt{cos(x-2)} &= \sqrt{cos(x-2)}\\ \therefore f\circ (g\circ h) (x) &= (f\circ g)\circ h(x)\\ \end{aligned}\end{equation} $$
Thus, there is associativity for composition of functions.