A composite function is a function that is written inside another function. It is done by substituting one function to another function.
Example: At f(x) = x + 1 and g(x) = x + 2
At (f(g(x)) = f(x + 2)
= (x + 2) + 1 ; from f(x) = x + 1
= x + 2 + 1
= x + 3
(f(g(x)) = x + 3
At g(f(x)) = g(x + 1)
= (x + 1) + 2 ; from g(x) = x + 2
= x + 1 + 2
= x + 3
(g(f(x)) = x + 3