Skip to main content

Section 4.1 Evaluating a Composition of Functions

In section Section 2.4, you learned about different ways to combine functions together. In this section, we'll learn a new way: putting functions inside of each other.

Definition 4.1.

A composition of functions is when we put one function inside of another. To compose \(f(x)\) and \(g(x)\text{,}\) we could write either \((f\circ g)(x)\) or \(f(g(x))\text{.}\)

When we want to evaluate a composition of functions, we always work from the inside to the outside. This means that the order we write them in matters.

Example 4.2.

Suppose \(f(x)=2x+1\) and \(g(x)=x^2\) and we want to find \(f(g(-2))\text{.}\) Since we work from the inside out, that means we start by finding \(g(-2)\text{.}\) We use the formula for \(g(x)\) to get \(g(-2)=(-2)^2 = 4\text{.}\) Now, we can plug that into \(f(x)\text{:}\) \(f(g(-2))=f(4)=2(4)+1=9\text{.}\) Therefore, our answer is \(f(g(-2))=4\text{.}\)

Now, let's find \(g(f(-2))\) instead. This time, we start with \(f(x)\text{,}\) since it's on the inside: \(f(-2)=2(-2)+1=-3\text{.}\) Now, we can plug that into \(g(x)\text{:}\) \(g(f(-2))=g(-3)=(-3)^2=9\text{.}\) Therefore, our answer is \(g(f(-2))=9\text{.}\)

Checkpoint 4.3.

Suppose \(f(x)=x^2+2x-3\) and \(g(x)=-x\text{.}\) Evaluate each of the following:

  1. \(\displaystyle f(g(0))\)

  2. \(\displaystyle g(f(-1))\)

  3. \(\displaystyle f(f(2))\)

Answer.

Suppose \(f(x)=x^2+2x-3\) and \(g(x)=-x\text{.}\) Evaluate each of the following:

  1. \(\displaystyle f(g(0))=-3\)

  2. \(\displaystyle g(f(-1))=4\)

  3. \(\displaystyle f(f(2))=32\)

Solution.

Suppose \(f(x)=x^2+2x-3\) and \(g(x)=-x\text{.}\) Evaluate each of the following:

  1. To find \(f(g(0))\text{,}\) we start on the inside with \(g(x)\text{:}\) \(g(0)=-(0)=0\text{.}\) Then, we plug that into \(f(x)\text{:}\) \(f(g(0))=f(0)=(0)^2+2(0)-3 = -3\text{.}\)

  2. To find \(g(f(-1))\text{,}\) we start on the inside with \(f(x)\text{:}\) \(f(-1)=(-1)^2+2(-1)-3 = 1-2-3=-4\text{.}\) Then, we plug that into \(g(x)\text{:}\) \(g(f(-1))=g(-1)=-(-4)=4\text{.}\)

  3. To find \(f(f(2))\text{,}\) we're going to plug into \(f(x)\) twice! First, we find \(f(2)=(2)^2+2(2)-3 = 4+4-3=5\text{.}\) Now, we plug that back into \(f(x)\) again: \(f(f(2))=f(5) = (5)^2+2(5)-3 = 25+10-3 = 32\text{.}\)

You might even have more than two functions that are composed together. We still always work from the inside to the outside.

Example 4.4.

Suppose \(f(x)=x^2-3\text{,}\) and \(g(x)\) and \(h(x)\) are given in the table below.

Table 4.5.
\(x\) \(g(x)\) \(h(x)\)
\(1\) \(2\) \(-1\)
\(2\) \(-3\) \(4\)
\(3\) \(4\) \(0\)

Let's find \(f(h(g(1)))\text{.}\) We start from the inside, so we begin with \(g(x)\text{.}\) From the table, we can see that \(g(1)=2\text{.}\) Now, we can plug that into the next function, \(h(x)\text{:}\) \(h(g(1))=h(2)=4\text{.}\) Finally, we plug that into the most outside function, \(f(x)\text{:}\) \(f(h(g(1)))=f(h(2))=f(4)=(4)^2-3 = 13\text{.}\)