Functions can have almost any input. This includes other functions.
In the function notation notes we saw that a function such as $g(x)=3x^2+1$ could have an input of 2x which can be written in function notation as $g(2x)$. The input of 2x can be viewed as another function. Lets define $h(x)=2x$. We can then write the function g to have the an input of h(x):(1)
While the notation might be a little intimidating the statement $g(h(x))$ is equivalent to $g(2x)$. When the argument of one function is another function (i.e. the input of one function is a function) it is referred to as a composite function. The notation for a composite function can be written in two ways, both of which you should be familiar with:(2)
I personally don't like the second form as I find it less clear, but it will show up on homework, IB exams and beyond…
Looking at the example above, we can write the composite of g and h in terms of x:(3)
We can also make a composition of h as a function of g:(4)
Note that in general $g(h(x)) \neq h(g(x))$. This is due to order of operations and using non-linear equations.