Skip to main content

Section 3.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 3.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 3.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 3.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 3.4.

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

Table 3.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{.}\)

Exercises Practice Problems

1.

Suppose \(f(x) = (x+2)^2 \) and \(g(x)\) is given in the graph below:

Evaluate each of the following:

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

  2. \(\displaystyle f(g(4))\)

  3. \(\displaystyle g(g(6))\)

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

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

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

  2. \(\displaystyle f(g(4))=49\)

  3. \(\displaystyle g(g(6))=8\)

  4. \(\displaystyle g(f(0))=5\)

  5. \(\displaystyle f(g(0))=9\)

2.

Suppose \(f(x) = \frac{1}{2}x \) and \(g(x)\) is given in the table below:

Table 3.6.
\(x\) \(-1\) \(1\) \(2\) \(5\) \(4\)
\(g(x)\) \(0\) \(2\) \(4\) \(1\) \(0\)

Evaluate each of the following:

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

  2. \(\displaystyle f(g(5))\)

  3. \(\displaystyle g(g(2))\)

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

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

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

  2. \(\displaystyle f(g(5))=\frac{1}{2}\)

  3. \(\displaystyle g(g(2))=0\)

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

  5. \(\displaystyle f(g(1))=1\)

3.

Suppose \(f(x)\) is given in the graph below and \(g(x)\) is given in the table below:

Table 3.7.
\(x\) \(1\) \(2\) \(3\) \(4\) \(5\)
\(g(x)\) \(0\) \(2\) \(4\) \(1\) \(5\)

Evaluate each of the following or, if there is insufficient information given to answer the question, state that.

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

  2. \(\displaystyle f(g(5))\)

  3. \(\displaystyle g(g(2))\)

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

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

Answer.
  1. \(\displaystyle f(g(1))=5\)

  2. \(\displaystyle f(g(5))=0\)

  3. \(\displaystyle g(g(2))=2\)

  4. There is insuffient information given to compute.

  5. \(\displaystyle f(g(3))=1\)

4.

Suppose \(g(x)\) is given in the graph below and \(h(x)\) is given in the table below:

Table 3.8.
\(x\) \(0\) \(2\) \(4\) \(6\) \(8\)
\(h(x)\) \(0\) \(8\) \(4\) \(6\) \(2\)

Evaluate each of the following or, if there is insufficient information given to answer the question, state that.

  1. \(\displaystyle h(g(1))\)

  2. \(\displaystyle h(g(4))\)

  3. \(\displaystyle h(g(2))\)

  4. \(\displaystyle g(h(2))\)

  5. \(\displaystyle h(h(2))\)

Answer.
  1. There is insuffient information given to compute.

  2. \(\displaystyle h(g(4))=8\)

  3. \(\displaystyle h(g(2))=0\)

  4. \(\displaystyle g(h(2))=0\)

  5. \(\displaystyle h(h(2))=2\)

5.

Suppose \(g(x)=x^2\) and \(h(x)=|x+1|\) is given in the table below:

Evaluate each of the following or, if there is insufficient information given to answer the question, state that.

  1. \(\displaystyle h(g(1))\)

  2. \(\displaystyle h(g(2))\)

  3. \(\displaystyle h(g(-1))\)

  4. \(\displaystyle g(h(-1))\)

  5. \(\displaystyle h(h(-1))\)

Answer.
  1. \(\displaystyle h(g(1))=2\)

  2. \(\displaystyle h(g(2))=5\)

  3. \(\displaystyle h(g(-1))=2\)

  4. \(\displaystyle g(h(-1))=0\)

  5. \(\displaystyle h(h(-1))=1\)