The "inside" function g, in f(g(x)), is evaluated first.
Suppose that f(x)=1x+2 and g(x)=4x−1.
(f∘g)(0)=f(g(0))=f(−4)=1−4+2=−12g(x)=4x−1;g(0)=−4 (g∘f)(1)=g(f(1))=↑g(13)=413−1=4−23=−6f(x)=1x+2;f(1)=13 (f∘f)(1)=f(f(1))=f(13)=113+2=173=37 (g∘g)(−3)=g(g(−3))=↑g(−1)=4−1−1=−2g(x)=4x−1;g(−3)=4−3−1=−1