We have two function
and
We need to find the composition of these function, i.e.
Now, notice the following diagram
then, we have defined the composition via our diagram, i.e.
We need to find first the image of x via f, and then to this image f(x), find the image via g, as follows