## Concepts:

We know that functions are like factories. And we know how to evaluate a function for a given function. In other words, we know how to figure out what the factory produces based on what is put into it. But so far we have only considered simple, stand-alone factories. But what would happen if we were to put factories inside one another? That is exactly like what composite functions are – functions inside of functions.

DEFINITION: A composite function (also known as a ‘composition of functions’) is when one function is found inside another.

NOTATION AND TERMINOLOGY: Consider the composite function $$f(g(x))$$.  We read this as “f of g of x”. This composite function is the combination of two functions: $$g(x)$$, which is the inner function, and $$f(x)$$, which is the outer function.

In composite function notation $$f \circ g(x)$$, $$f(g \circ x)$$, $$f \circ g \circ x$$, and $$f(g(x))$$ all mean the same thing and are read as “f of g of x”.

A composite function can be composed of any number of functions. But in most cases you will see, there will only be two.

$$f(g(x))$$  – 2  functions, “f of g of x”

$$h(f(g(x)))$$  –  3 functions, “h of f of g of x”

$$k(h(f(g(x))))$$  –  4 functions, “k of h of f of g of x”

RECAP: A composite function – or composition of functions – is when one or more functions are put inside another, like if a factory was put inside a factory.

In composite function notation $$f \circ g(x)$$, $$f(g \circ x)$$, $$f \circ g \circ x$$, and $$f(g(x))$$ all mean the same thing and are read as “f of g of x”.

A composite function can be composed of any number of functions. But in most cases you will see, there will only be two.

$$f(g(x))$$  – 2  functions, “f of g of x”

$$h(f(g(x)))$$  –  3 functions, “h of f of g of x”

$$k(h(f(g(x))))$$  –  4 functions, “k of h of f of g of x”

RECAP: A composite function – or composition of functions – is when one or more functions are put inside another, like if a factory was put inside a factory.

## Key Concepts:

DEFINITION: A composite function (also known as a ‘composition of functions’) is when one function is found inside another.

NOTATION AND TERMINOLOGY: Consider the composite function $$f(g(x))$$.  We read this as “f of g of x”. This composite function is the combination of two functions: $$g(x)$$, which is the inner function, and $$f(x)$$, which is the outer function.

## Example:

Let’s look at an example of a composite function.

When you are given a composite function, you will most likely be asked to simplify and evaluate for a given value.

Consider these two functions:

$$f(x) = x^2 + 4$$

$$g(x) = 2x$$

Both $$f(x)$$ and $$g(x)$$ are their own factories. But in this case, $$g(x)$$ is inside $$f(x)$$. Something goes into the main factory, $$g(x)$$ makes a product, and then $$f(x)$$ makes another product from that.

To simplify this function, all you have to do is put $$g(x)$$ in wherever you see an $$x$$ in $$f(x)$$. Then replace all the instances of $$g(x)$$ with $$5x +1$$. Then simplify!

1. $$f(x) = x^2 +4$$
2. $$f(g(x)) =(g(x))^2 + 4$$
3. $$f(g(x)) = (2x)^2 + 4$$
4. $$f(g(x)) = 4x^2 + 4$$

We can now say that we have found the simplified expression for $$f(g(x)$$! And if we want to evaluate $$f(g(x)$$ for $$x = 1$$, we just put in a $$1$$ for every $$x$$ in the expression.

1. $$f(g(x)) = 4x^2 + 4$$
2. $$f(g(1)) = 4(1)^2 + 4$$
3. $$f(g(1)) = 4 + 4$$
4. $$f(g(1)) = 8$$

(Notice: You would get the same answer if you were to first evaluate $$g(x)$$ for $$x = 1$$ and then plugged that value into $$f(x)$$.)

$$g(x) = 2x$$

$$g(1) = 2(1)$$

$$g(1) = 2$$

$$f(x) = x^2 + 4$$

$$f(2) = (2)^2 + 4$$

$$f(2) = 4 + 4$$

$$f(2) = 8$$

But there is no reason why we can’t also put the $$f(x)$$ factory inside the $$g(x)$$ factory. So let’s try that! Simplify $$g(f(x))$$ (which reads as “g of f of x”).

Follow the same steps as above. Replace all the $$x$$’s found in $$g(x)$$ with $$f(x)$$. Then replace $$f(x)$$ with the expression for $$f(x)$$ and simplify!

1. $$g(x) = 2x$$
2. $$g(f(x)) = 2(f(x))$$
3. $$g(f(x)) = 2(x^2 + 4)$$
4. $$g(f(x)) = 2x^2 + 8$$

And if we want to evaluate $$g(f(x))$$ for $$x = 1$$, we just put in a $$1$$ for every $$x$$ in the expression.

1. $$g(f(x)) = 2x^2 + 8$$
2. $$g(f(x)) = 2(1)^2 + 8$$
3. $$g(f(x)) = 2 + 8$$
4. $$g(f(x)) = 10$$

Notice that $$f(g(x))$$ does not equal $$g(f(x))$$. This is generally true. While they may sometimes be equal, you can never assume.

## Find the simplified expression for $$f(g(x))$$

$$g(x) = x^2 + 2x + 1$$

$$f(x) = 3x$$

## ANSWER: $$f(g(x)) = 3x^2 + 6x + 3$$

1. $$f(g(x)) = 3(g(x))$$
2. $$3(g(x)) = 3(x^2 + 2x + 1)$$
3. $$3(g(x) = 3x^2 + 6x + 3$$

## What does $$f(f(x))$$ equal for $$x = 5$$?

$$f(x) = 2x + 3$$

## ANSWER: $$g(0) = - 14$$

1. $$f(f(x)) = f(2x+3)$$
2. $$f(2x+3) = 2(2x+3) + 3$$
3. $$f(f(x)) = 4x + 9$$
4. $$f(f(5)) = 4(5) + 9$$
5. $$f(f(5)) = 29$$