A composite function is formed when the output of the first function becomes the input of the second function.
Let f and g be functions and let x be the input of g. Then, g(x) is the output of function g.
g(x) is the input of function f and the output of function f is f(g(x))
f(g(x) is the composite function of f and g and it is defined as (f ∘ g)(x) = f(g(x))
We can also let x be the input of f. Then, f(x) is the output of function f.
f(x) is the input of function g and the output of function g is g(f(x))
g(f(x) is a composite function of g and f and it is defined as (g ∘ f)(x) = g(f(x))
Example
Let f(x) = x + 5 and let g(x) = x2
Find g ∘ f and f ∘ gg(f(x)) = g(x + 5) = (x + 5)2
= x2 + 5x + 5x + 25
= x2 + 10x + 25
f(g(x)) = f(x2) = x2 + 5
Be careful ! g(f(x)) is not equal to f(g(x)) although it may in some cases.