*i.e.*you are probably on a mobile phone). Due to the nature of the mathematics on this site it is best views in landscape mode. If your device is not in landscape mode many of the equations will run off the side of your device (should be able to scroll to see them) and some of the menu items will be cut off due to the narrow screen width.

### Section 3-6 : Combining Functions

The topic with functions that we need to deal with is combining functions. For the most part this means performing basic arithmetic (addition, subtraction, multiplication, and division) with functions. There is one new way of combing functions that we’ll need to look at as well.

Let’s start with basic arithmetic of functions. Given two functions \(f\left( x \right)\) and \(g\left( x \right)\) we have the following notation and operations.

\[\begin{align*}\left( {f + g} \right)\left( x \right) & = f\left( x \right) + g\left( x \right) & \hspace{0.25in}\hspace{0.25in}\left( {f - g} \right)\left( x \right) & = f\left( x \right) - g\left( x \right)\\ \left( {fg} \right)\left( x \right) & = f\left( x \right)g\left( x \right) & \hspace{0.25in}\hspace{0.25in}\left( {\frac{f}{g}} \right)\left( x \right) & = \frac{{f\left( x \right)}}{{g\left( x \right)}}\end{align*}\]Sometimes we will drop the \(\left( x \right)\) part and just write the following,

\[\begin{align*}f + g & = f\left( x \right) + g\left( x \right) & \hspace{0.25in}\hspace{0.25in}f - g & = f\left( x \right) - g\left( x \right)\\ fg & = f\left( x \right)g\left( x \right) & \hspace{0.25in}\hspace{0.25in}\frac{f}{g} & = \frac{{f\left( x \right)}}{{g\left( x \right)}}\end{align*}\]Note as well that we put \(x\)’s in the parenthesis, but we will often put in numbers as well. Let’s take a quick look at an example.

- \(\left( {f + g} \right)\left( 4 \right)\)
- \(g - f\)
- \(\left( {fg} \right)\left( x \right)\)
- \(\displaystyle \left( {\frac{f}{g}} \right)\left( 0 \right)\)

By evaluate we mean one of two things depending on what is in the parenthesis. If there is a number in the parenthesis then we want a number. If there is an \(x\) (or no parenthesis, since that implies and \(x\)) then we will perform the operation and simplify as much as possible.

a \(\left( {f + g} \right)\left( 4 \right)\) Show Solution

In this case we’ve got a number so we need to do some function evaluation.

\[\begin{align*}\left( {f + g} \right)\left( 4 \right) & = f\left( 4 \right) + g\left( 4 \right)\\ & = \left( {2 + 3\left( 4 \right) - {4^2}} \right) + \left( {2\left( 4 \right) - 1} \right)\\ & = - 2 + 7\\ & = 5\end{align*}\]b \(g - f\) Show Solution

Here we don’t have an \(x\) or a number so this implies the same thing as if there were an \(x\) in parenthesis. Therefore, we’ll subtract the two functions and simplify. Note as well that this is written in the opposite order from the definitions above, but it works the same way.

\[\begin{align*}g - f & = g\left( x \right) - f\left( x \right)\\ & = 2x - 1 - \left( {2 + 3x - {x^2}} \right)\\ & = 2x - 1 - 2 - 3x + {x^2}\\ & = {x^2} - x - 3\end{align*}\]c \(\left( {fg} \right)\left( x \right)\) Show Solution

As with the last part this has an \(x\) in the parenthesis so we’ll multiply and then simplify.

\[\begin{align*}\left( {fg} \right)\left( x \right) & = f\left( x \right)g\left( x \right)\\ & = \left( {2 + 3x - {x^2}} \right)\left( {2x - 1} \right)\\ & = 4x + 6{x^2} - 2{x^3} - 2 - 3x + {x^2}\\ & = - 2{x^3} + 7{x^2} + x - 2\end{align*}\]d \(\displaystyle \left( {\frac{f}{g}} \right)\left( 0 \right)\) Show Solution

In this final part we’ve got a number so we’ll once again be doing function evaluation.

\[\begin{align*}\left( {\frac{f}{g}} \right)\left( 0 \right) & = \frac{{f\left( 0 \right)}}{{g\left( 0 \right)}}\\ & = \frac{{2 + 3\left( 0 \right) - {{\left( 0 \right)}^2}}}{{2\left( 0 \right) - 1}}\\ & = \frac{2}{{ - 1}}\\ & = - 2\end{align*}\]Now we need to discuss the new method of combining functions. The new method of combining functions is called **function composition**. Here is the definition.

Given two functions \(f\left( x \right)\) and \(g\left( x \right)\) we have the following two definitions.

- The
**composition**of \(f\left( x \right)\) and \(g\left( x \right)\) (note the order here) is,

\(\left( {f \circ g} \right)\left( x \right) = f\left[ {g\left( x \right)} \right]\) - The
**composition of \(g\left( x \right)\)**and \(f\left( x \right)\) (again, note the order) is,

\(\left( {g \circ f} \right)\left( x \right) = g\left[ {f\left( x \right)} \right]\)

We need to note a couple of things here about function composition. First this is **NOT** multiplication. Regardless of what the notation may suggest to you this is simply not multiplication.

Second, the order we’ve listed the two functions is very important since more often than not we will get different answers depending on the order we’ve listed them.

Finally, function composition is really nothing more than function evaluation. All we’re really doing is plugging the second function listed into the first function listed. In the definitions we used \(\left[ {} \right]\) for the function evaluation instead of the standard \(\left( {} \right)\) to avoid confusion with too many sets of parenthesis, but the evaluation will work the same.

Let’s take a look at a couple of examples.

- \(\left( {fg} \right)\left( x \right)\)
- \(\left( {f \circ g} \right)\left( x \right)\)
- \(\left( {g \circ f} \right)\left( x \right)\)

These are the same functions that we used in the first set of examples and we’ve already done this part there so we won’t redo all the work here. It is here only here to prove the point that function composition is NOT function multiplication.

Here is the multiplication of these two functions.

\[\left( {fg} \right)\left( x \right) = - 2{x^3} + 7{x^2} + x - 2\]b \(\left( {f \circ g} \right)\left( x \right)\) Show Solution

Now, for function composition all you need to remember is that we are going to plug the second function listed into the first function listed. If you can remember that you should always be able to write down the basic formula for the composition.

Here is this function composition.

\[\begin{align*}\left( {f \circ g} \right)\left( x \right) &= f\left[ {g\left( x \right)} \right]\\ & = f\left[ {2x - 1} \right]\end{align*}\]Now, notice that since we’ve got a formula for \(g\left( x \right)\) we went ahead and plugged that in first. Also, we did this kind of function evaluation in the first section we looked at for functions. At the time it probably didn’t seem all that useful to be looking at that kind of function evaluation, yet here it is.

Let’s finish this problem out.

\[\begin{align*}\left( {f \circ g} \right)\left( x \right) &= f\left[ {g\left( x \right)} \right]\\ & = f\left[ {2x - 1} \right]\\ & = 2 + 3\left( {2x - 1} \right) - {\left( {2x - 1} \right)^2}\\ & = 2 + 6x - 3 - \left( {4{x^2} - 4x + 1} \right)\\ & = - 1 + 6x - 4{x^2} + 4x - 1\\ & = - 4{x^2} + 10x - 2\end{align*}\]Notice that this is very different from the multiplication! Remember that function composition is NOT function multiplication.

c \(\left( {g \circ f} \right)\left( x \right)\) Show Solution

We’ll not put in the detail in this part as it works essentially the same as the previous part.

\[\begin{align*}\left( {g \circ f} \right)\left( x \right) &= g\left[ {f\left( x \right)} \right]\\ & = g\left[ {2 + 3x - {x^2}} \right]\\ & = 2\left( {2 + 3x - {x^2}} \right) - 1\\ & = 4 + 6x - 2{x^2} - 1\\ & = - 2{x^2} + 6x + 3\end{align*}\]Notice that this is NOT the same answer as that from the second part. In most cases the order in which we do the function composition will give different answers.

The ideas from the previous example are important enough to make again. First, function composition is NOT function multiplication. Second, the order in which we do function composition is important. In most case we will get different answers with a different order. Note however, that there are times when we will get the same answer regardless of the order.

Let’s work a couple more examples.

- \(\left( {f \circ h} \right)\left( x \right)\)
- \(\left( {h \circ f} \right)\left( x \right)\)
- \(\left( {f \circ f} \right)\left( x \right)\)
- \(\left( {h \circ h} \right)\left( 8 \right)\)
- \(\left( {f \circ h} \right)\left( 4 \right)\)

Not much to do here other than run through the formula.

\[\begin{align*}\left( {f \circ h} \right)\left( x \right)& = f\left[ {h\left( x \right)} \right]\\ & = f\left[ {\sqrt {x + 1} } \right]\\ & = {\left( {\sqrt {x + 1} } \right)^2} - 3\\ & = x + 1 - 3\\ & = x - 2\end{align*}\]b \(\left( {h \circ f} \right)\left( x \right)\) Show Solution

Again, not much to do here.

\[\begin{align*}\left( {h \circ f} \right)\left( x \right) & = h\left[ {f\left( x \right)} \right]\\ & = h\left[ {{x^2} - 3} \right]\\ & = \sqrt {{x^2} - 3 + 1} \\ & = \sqrt {{x^2} - 2} \end{align*}\]c \(\left( {f \circ f} \right)\left( x \right)\) Show Solution

Now in this case do not get excited about the fact that the two functions here are the same. Composition works the same way.

\[\begin{align*}\left( {f \circ f} \right)\left( x \right) & = f\left[ {f\left( x \right)} \right]\\ & = f\left[ {{x^2} - 3} \right]\\ & = {\left( {{x^2} - 3} \right)^2} - 3\\ & = {x^4} - 6{x^2} + 9 - 3\\ & = {x^4} - 6{x^2} + 6\end{align*}\]d \(\left( {h \circ h} \right)\left( 8 \right)\) Show Solution

In this case, unlike all the previous examples, we’ve got a number in the parenthesis instead of an \(x\), but it works in exactly the same manner.

\[\begin{align*}\left( {h \circ h} \right)\left( 8 \right) & = h\left[ {h\left( 8 \right)} \right]\\ & = h\left[ {\sqrt {8 + 1} } \right]\\ & = h\left[ {\sqrt 9 } \right]\\ & = h\left[ 3 \right]\\ & = \sqrt {3 + 1} \\ & = 2\end{align*}\]e \(\left( {f \circ h} \right)\left( 4 \right)\) Show Solution

Again, we’ve got a number here. This time there are actually two ways to do this evaluation. The first is to simply use the results from the first part since that is a formula for the general function composition.

If we do the problem that way we get,

\[\left( {f \circ h} \right)\left( 4 \right) = 4 - 2 = 2\]We could also do the evaluation directly as we did in the previous part. The answers should be the same regardless of how we get them. So, to get another example down of this kind of evaluation let’s also do the evaluation directly.

\[\begin{align*}\left( {f \circ h} \right)\left( 4 \right) & = f\left[ {h\left( 4 \right)} \right]\\ & = f\left[ {\sqrt {4 + 1} } \right]\\ & = f\left[ {\sqrt 5 } \right]\\ & = {\left( {\sqrt 5 } \right)^2} - 3\\ & = 5 - 3\\ & = 2\end{align*}\]So, sure enough we got the same answer, although it did take more work to get it.

- \(\left( {f \circ g} \right)\left( x \right)\)
- \(\left( {g \circ f} \right)\left( x \right)\)

Hopefully, by this point these aren’t too bad.

\[\begin{align*}\left( {f \circ g} \right)\left( x \right) &= f\left[ {g\left( x \right)} \right]\\ & = f\left[ {\frac{x}{3} + \frac{2}{3}} \right]\\ & = 3\left( {\frac{x}{3} + \frac{2}{3}} \right) - 2\\ & = x + 2 - 2\\ & = x\end{align*}\]Looks like things simplified down considerable here.

b \(\left( {g \circ f} \right)\left( x \right)\) Show Solution

All we need to do here is use the formula so let’s do that.

\[\begin{align*}\left( {g \circ f} \right)\left( x \right)& = g\left[ {f\left( x \right)} \right]\\ & = g\left[ {3x - 2} \right]\\ & = \frac{1}{3}\left( {3x - 2} \right) + \frac{2}{3}\\ & = x - \frac{2}{3} + \frac{2}{3}\\ & = x\end{align*}\]So, in this case we get the same answer regardless of the order we did the composition in.

So, as we’ve seen from this last example it is possible to get the same answer from both compositions on occasion. In fact when the answer from both composition is \(x\), as it is in this case, we know that these two functions are very special functions. In fact, they are so special that we’re going to devote the whole next section to these kinds of functions. So, let’s move onto the next section.