Daniel B. answered 12/14/20
A retired computer professional to teach math, physics
f(g(h(I(x)))) is a valid composite function, when this assumption is true:
f, g, h, I are real valued functions of a single real variable.
I will continue assuming that below.
f(g(x))=g(f(x)) is not true for all f, g.
For example, it is not true for these:
f(x) = x+1
g(x) = 2x
(fog)(x)=f(g(x)) is true, because it is the definition of fog
(3fo2g)(x) is normally not a valid composite function.
It could be made valid, it it were interpreted as meaning (3fo(2g))(x)
f(f(x)) is a valid composite function