Functions can be added, subtracted, multiplied and divided creating new functions and graphs that are complicated combinations of the various original functions. One important way to transform functions is through function composition. Function composition allows you to line up two or more functions that act on an input in tandem.

Is function composition essentially the same as multiplying the two functions together?

#### Watch This

http://www.youtube.com/watch?v=qxBmISCJSME James Sousa: Composite Functions

#### Guidance

A common way to describe functions is a mapping from the domain space to the range space:

Function composition means that you have two or more functions and the range of the first function becomes the domain of the second function.

There are two notations used to describe function composition. In each case the order of the functions matters because arithmetically the outcomes will be different. Squaring a number and then doubling the result will be different from doubling a number and then squaring the result. In the diagram above, \begin{align*}f(x)\end{align*} occurs first and \begin{align*}g(x)\end{align*} occurs second. This can be written as:

\begin{align*}g \big( f(x) \big)\end{align*} or \begin{align*}(g \circ f) (x)\end{align*}

You should read this “\begin{align*}g\end{align*} of \begin{align*}f\end{align*} of \begin{align*}x\end{align*}.” In both cases notice that the \begin{align*}f\end{align*} is closer to the \begin{align*}x\end{align*} and operates on the \begin{align*}x\end{align*} values first.

In the following three examples you will practice function composition with these functions:

\begin{align*}f(x) = x^2 - 1 \end{align*}

\begin{align*}h(x) = \frac{x - 1}{x + 5}\end{align*}

\begin{align*}g(x) = 3e^x - x\end{align*}

\begin{align*}j(x) = \sqrt{x + 1}\end{align*}

**Example A**

Show \begin{align*}f \big( h(x) \big) \neq h \big( f(x) \big)\end{align*}

**Solution:**

**\begin{align*}f \big( h(x) \big) = f \left( \frac{x - 1}{x + 5} \right) = \left( \frac{x - 1}{x + 5} \right)^2 - 1\end{align*}**

**\begin{align*}h \big( f(x) \big) = h(x^2 - 1) = \frac{(x^2 - 1) - 1}{(x^2 - 1) + 5} = \frac{x^2 - 2}{x^2 + 4}\end{align*}**

In order to truly show they are not equal it is best to find a specific counter example of a number where they differ. Sometimes algebraic expressions may look different, but are actually the same. You should notice that \begin{align*}f \big( h(x) \big)\end{align*}is undefined when \begin{align*}x = -5\end{align*} because then there would be zero in the denominator. \begin{align*}h \big( f(x) \big)\end{align*} on the other hand is defined at \begin{align*}x = -5\end{align*}. Since the two function compositions differ, you can conclude:

\begin{align*}f \big( h(x) \big) \neq h \big( f(x) \big)\end{align*}

**Example B**

What is \begin{align*}g \big( h(x) \big)\end{align*}?

\begin{align*}g \big( h(x) \big) = g \left( \frac{x - 1}{x + 5} \right) = 3e^{\left (\frac{x - 1}{x + 5} \right)} - \left( \frac{x - 1}{x + 5} \right) \\ = 3 \ \text{exp} \left( \frac{x - 1}{x + 5} \right) - \left( \frac{x - 1}{x + 5} \right)\end{align*}

*Note that it is difficult to write and read an exponential function with a large fraction in the exponent. In order to make it easier to work with you can use \begin{align*}exp(x)\end{align*} instead of \begin{align*}e^x\end{align*} which allows more space and easier readability.*

**Example C**

What is \begin{align*}f \Big( j \big( h \big( g ( x ) \big) \big) \Big) \end{align*}?

**Solution:** These functions are *nested* within the arguments of the other functions. Sometimes functions simplify significantly when composed together, as \begin{align*}f\end{align*} and \begin{align*}j\end{align*} do in this case. It makes sense to evaluate those two functions first together and keep them on the outside of the argument.

\begin{align*}f(x) = x^2 - 1; h(x) = \frac{x - 1}{x + 5}; g(x) = 3e^x -x; j(x) = \sqrt{x + 1}\end{align*}

\begin{align*}f \big( j(y) \big) = f \left ( \sqrt{y + 1} \right ) = \left ( \sqrt{y + 1} \right ) ^2 - 1 = y + 1 - 1 = y\end{align*}

Notice how the composition of \begin{align*}f\end{align*} and \begin{align*}j\end{align*} produced just the argument itself?

Thus,

\begin{align*}f \Big( j \big( h \big( g(x) \big) \big) \Big) = h \big( g(x) \big) & = h(3e^x - x) \\ & = \frac{(3e^x - x) - 1}{(3e^x - x) + 5} \\ & = \frac{3e^x - x - 1}{3e^x - x + 5}\end{align*}

**Concept Problem Revisited**

Function composition is not the same as multiplying two functions together. With function composition there is an outside function and an inside function. Suppose the two functions were doubling and squaring. It is clear just by looking at the example input of the number 5 that 50 (squaring then doubling) is different from 100 (doubling then squaring). Both 50 and 100 are examples of function composition, while 250 (five doubled multiplied by five squared) is an example of the product of two separate functions happening simultaneously.

#### Vocabulary

** Function composition** is when there are two or more functions and the range of the first function becomes the domain of the second function.

** Nesting** refers to a function being operated on or in the argument of another function.

A ** counterexample** is a specific instance that contradicts a statement. When you are asked to show a statement is not true, it is best to find a counterexample to the statement.

#### Guided Practice

For the three guided practice problems use the following functions.

\begin{align*}f(x) = | x |\end{align*}

\begin{align*}g(x)=e^x\end{align*}

\begin{align*}h(x) = -x\end{align*}

1. Compose \begin{align*}g \big( f(x) \big)\end{align*} and graph the result. Describe the transformation.

2. Compose \begin{align*}h \big( g(x) \big)\end{align*} and graph the result. Describe the transformation.

3. Compose \begin{align*}g \Big( h \big( f(x) \big) \Big)\end{align*} and graph the result. Describe the transformation.

**Answers:**

1. \begin{align*}g(f(x)) = g (|x|) = e^{|x|}\end{align*}

The positive portion of the exponential graph has been mirrored over the \begin{align*}y\end{align*} axis and the negative portion of the exponential graph has been entirely truncated.

2. \begin{align*}h \big( g(x) \big) = h(e^x) = -e^x\end{align*}

The exponential graph has been reflected over the \begin{align*}x\end{align*}-axis.

3. \begin{align*}g \Big( h \big( f(x) \big) \Big) = g(h(|x|)) = g(-|x|) = e^{-|x|}\end{align*}

The negative portion of the exponential graph has been mirrored over the \begin{align*}y\end{align*}-axis and the positive portion of the exponential graph has been truncated.

#### Practice

For questions 1-9, use the following three functions: \begin{align*}f(x) = |x|, h(x) = -x, g(x) = (x - 2)^2 -3\end{align*}.

1. Graph \begin{align*}f(x), h(x)\end{align*} and \begin{align*}g(x)\end{align*}.

2. Find \begin{align*}f \big( g(x) \big)\end{align*} algebraically.

3. Graph \begin{align*}f \big( g(x) \big)\end{align*} and describe the transformation.

4. Find \begin{align*}g \big( f(x) \big)\end{align*} algebraically.

5. Graph \begin{align*}g \big( f(x) \big) \end{align*} and describe the transformation.

6. Find \begin{align*}h \big( g(x) \big)\end{align*} algebraically.

7. Graph \begin{align*}h \big( g(x) \big)\end{align*} and describe the transformation.

8. Find \begin{align*}g \big( h(x) \big)\end{align*} algebraically.

9. Graph \begin{align*}g \big( h(x) \big)\end{align*} and describe the transformation.

For 10-16, use the following three functions: \begin{align*}j(x) = x^2, k(x) = |x|, m(x) = \sqrt{x}\end{align*}.

10. Graph \begin{align*}j(x), k(x)\end{align*} and \begin{align*}m(x)\end{align*}.

11. Find \begin{align*}j \big( k(x) \big)\end{align*} algebraically.

12. Graph \begin{align*}j \big( k(x) \big)\end{align*} and describe the transformation.

13. Find \begin{align*}k \big( m(x) \big)\end{align*} algebraically.

14. Graph \begin{align*}k \big( m(x) \big)\end{align*} and describe the transformation.

15. Find \begin{align*}m \big( k(x) \big)\end{align*} algebraically.

16. Graph \begin{align*}m \big( k(x) \big)\end{align*} and describe the transformation.

### Answers for Explore More Problems

To view the Explore More answers, open this PDF file and look for section 1.11.