Composition of Functions
Suppose that $$${y}={f{{\left({u}\right)}}}={\ln{{\left({u}\right)}}}$$$ and $$${u}={g{{\left({x}\right)}}}={\sin{{\left({x}\right)}}}$$$. Since $$${y}$$$ is a function of $$${u}$$$ and $$${u}$$$ is afunction of $$${x}$$$ the we obtain that $$${y}$$$ is a function of $$${x}$$$: $$${y}={f{{\left({u}\right)}}}={f{{\left({g{{\left({x}\right)}}}\right)}}}={f{{\left({\sin{{\left({x}\right)}}}\right)}}}={\ln{{\left({\sin{{\left({x}\right)}}}\right)}}}$$$.
The procedure is called composition because the new function is composed of the two given functions $$$f$$$ and $$$g$$$.
If we are given two functions $$$f$$$ and $$$g$$$, we start with a number $$$x$$$ in the domain of $$$g$$$ and find value $$$g\left(x\right)$$$. If this number is in the domain of $$$f$$$, then we can calculate the value of $$${f{{\left({g{{\left({x}\right)}}}\right)}}}$$$. The result is a new function $$${h}{\left({x}\right)}={f{{\left({g{{\left({x}\right)}}}\right)}}}$$$ obtained by substituting $$$g$$$ into $$$f$$$.
Definition. Given two functions $$${f{}}$$$ and $$${g{}}$$$, the composite function $$${f{\circ}}{g{}}$$$ is defined by $$${\left({f{\circ}}{g}\right)}{\left({x}\right)}={f{{\left({g{{\left({x}\right)}}}\right)}}}$$$.
Domain of composite functions is set of all $$${x}$$$ such that $$${x}$$$ is in domain of $$${g{}}$$$ and $$${g{{\left({x}\right)}}}$$$ is in domain of $$${f{}}$$$.
Example 1. Find $$${f{\circ}}{g{}}$$$, $$${g{\circ}}{f{}}$$$, $$${f{\circ}}{f{}}$$$, $$${g{\circ}}{g{}}$$$ if $$${f{{\left({x}\right)}}}={{x}}^{{3}}$$$ and $$${g{{\left({x}\right)}}}=\frac{\sqrt{{{x}}}}{{{x}-{1}}}$$$.
$$${f{\circ}}{g{=}}{f{{\left({g{{\left({x}\right)}}}\right)}}}={f{{\left(\frac{\sqrt{{{x}}}}{{{x}-{1}}}\right)}}}={{\left(\frac{\sqrt{{{x}}}}{{{x}-{1}}}\right)}}^{{3}}$$$
$$${g{\circ}}{f{=}}{g{{\left({f{{\left({x}\right)}}}\right)}}}={g{{\left({{x}}^{{3}}\right)}}}=\frac{\sqrt{{{{x}}^{{3}}}}}{{{{x}}^{{3}}-{1}}}$$$.
Notice, that in general $$${f{\circ}}{g{\ne}}{g{\circ}}{f{}}$$$.
$$${f{\circ}}{f{=}}{f{{\left({f{{\left({x}\right)}}}\right)}}}={f{{\left({{x}}^{{3}}\right)}}}={{\left({{x}}^{{3}}\right)}}^{{3}}={{x}}^{{9}}$$$
$$${g{\circ}}{g{=}}{g{{\left({g{{\left({x}\right)}}}\right)}}}={g{{\left(\frac{\sqrt{{{x}}}}{{{x}-{1}}}\right)}}}=\frac{\sqrt{{\frac{\sqrt{{{x}}}}{{{x}-{1}}}}}}{{\frac{\sqrt{{{x}}}}{{{x}-{1}}}-{1}}}$$$.
Note, that we can take composition of more than two functions: $$${\left({f{\circ}}{g{\circ}}{h}\right)}{\left({x}\right)}={f{{\left({g{{\left({h}{\left({x}\right)}\right)}}}\right)}}}$$$.
Example 2. Find $$${f{\circ}}{g{\circ}}{h}$$$ if $$${f{{\left({x}\right)}}}={{x}}^{{2}}$$$, $$${g{{\left({x}\right)}}}=\frac{{x}}{{{x}-{1}}}$$$ and $$${h}{\left({x}\right)}={\sin{{\left({x}\right)}}}$$$.
$$${f{\circ}}{g{\circ}}{h}={f{{\left({g{{\left({h}{\left({x}\right)}\right)}}}\right)}}}={f{{\left({g{{\left({\sin{{\left({x}\right)}}}\right)}}}\right)}}}={f{{\left(\frac{{\sin{{\left({x}\right)}}}}{{{\sin{{\left({x}\right)}}}-{1}}}\right)}}}={{\left(\frac{{\sin{{\left({x}\right)}}}}{{{\sin{{\left({x}\right)}}}-{1}}}\right)}}^{{2}}$$$.
Sometimes we need to perform inverse task, in other words given composite function, we need to find functions it is formed from.
Example 3. Find f, g, and h if $$${f{\circ}}{g{\circ}}{h}={{\left({\cos{{\left({x}+{9}\right)}}}\right)}}^{{2}}$$$.
The formula for $$${f{\circ}}{g{\circ}}{h}$$$ says: first add 9, then take the cosine of the result, and finally square.
So, we take $$${h}{\left({x}\right)}={x}+{9}$$$, $$${g{{\left({x}\right)}}}={\cos{{\left({x}\right)}}}$$$ and $$${f{{\left({x}\right)}}}={{x}}^{{2}}$$$.
Then
$$${f{\circ}}{g{\circ}}{h}={f{{\left({g{{\left({h}{\left({x}\right)}\right)}}}\right)}}}={f{{\left({g{{\left({x}+{9}\right)}}}\right)}}}={f{{\left({\cos{{\left({x}+{9}\right)}}}\right)}}}={{\left({\cos{{\left({x}+{9}\right)}}}\right)}}^{{2}}$$$.
It is worth noting, that characteristic of function as composite is not connected with natural functional dependence of $$${f{}}$$$ and $$${x}$$$, it is just a way to represent this dependence.
For example, let $$${f{=}}\sqrt{{{1}-{{u}}^{{2}}}}$$$ for $$${u}\in{\left[-{1},{1}\right]}$$$ and $$${y}={\sin{{\left({x}\right)}}}$$$ for $$${x}\in{\left[-\frac{\pi}{{2}},\frac{\pi}{{2}}\right]}$$$ then $$${\left({f{\circ}}{g}\right)}{\left({x}\right)}={f{{\left({g{{\left({x}\right)}}}\right)}}}={f{{\left({\sin{{\left({x}\right)}}}\right)}}}=\sqrt{{{1}-{{\left({\sin{{\left({x}\right)}}}\right)}}^{{2}}}}={\cos{{\left({x}\right)}}}$$$. Here $$${\cos{{\left({x}\right)}}}$$$ is represented as composite function.