Composite Function

### Composite Function

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)
\begin{equation} g(h(x))=3(h(x))^2 +1 \end{equation}

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)
\begin{align} g(h(x))=(g \circ h)(x) \end{align}

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…

### Examples

Looking at the example above, we can write the composite of g and h in terms of x:

(3)
\begin{equation} g(h(x))=3(2x)^2+1=3(4x^2)+1=12x^2+1 \end{equation}

We can also make a composition of h as a function of g:

(4)
\begin{equation} h(g(x))=2(g(x))=2(3x^2+1)=6x^2 + 2 \end{equation}

Note that in general $g(h(x)) \neq h(g(x))$. This is due to order of operations and using non-linear equations.