<img src="https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=iA1Pi1a8Dy00ym" style="display:none" height="1" width="1" alt="" />
Skip Navigation
You are viewing an older version of this Concept. Go to the latest version.

Composition of Functions

Two or more functions where the range of the first becomes the domain of the second.

Atoms Practice
Estimated12 minsto complete
Practice Composition of Functions
Estimated12 minsto complete
Practice Now
Composition of Functions

If f(x) = x + 2, and g(x) = 2x + 4, what is f(g(x)) ?

A function can be conceptualized as a 'black box'. The input, or x value is placed into the box, and the box performs a specific set of operations on it. Once the operations are complete, the output (the "f(x)" or "y" value) is retrieved. Once the output is retrieved, the box is ready to work on the next input.

Using this idea, function composition can be seen as a box inside of a box. The input x value goes into the inner box, and then the output of the inner box is used as the input of the outer box.

This lesson is all about boxes inside of boxes. See if you can use what you learn to answer the question above before the review at the end.

Watch This

James Sousa - Composite Functions


Composition of Functions

Functions are often described in terms of “input” and “output.” For example, consider the function f(x) = 2x + 3. When we input an x value, we output a y value, or a function value. We find the output by taking the input x, multiplying by 2, and adding 3. We can do this for any value of x. Now consider a second function g(x) = 5x. For this function too, we can take an x value, input the x into g(x), and obtain an output. What happens if we take the output of g and use it as the input of f?

Example A

Given the function definition above, g(x) = 5x. Therefore if x = 4, then we have g(4) = 5(4) = 20. What happens if we then take the output of 20 and use it as the input of f?


Substituting 20 in for x in f(x) = 2x + 3 gives: f(20) = 2(20) + 3 = 43.

The table below shows several examples of this same process:

x Output from g Output from f
2 10 23
3 15 33
4 20 43
5 25 53

Examining the values in the table, we can see a pattern: all of the final output values from f are 3 more than 10 times the initial input. We have created a new function called h(x) out of f(x) = 2x + 3 in which g(x) = 5x is the input:

h(x) = f(5x) = 2(5x) + 3 = 10x + 3

When we input one function into another, we call this the composition of the two functions. Formally, we write the composed function as f(g(x)) = 10x + 3 or write it as (f o g)x = 10x + 3

Example B

Find f(g(x)) and g(f(x)):

a. f(x) = 3x + 1 and g(x) = x2 b. f(x) = 2x + 4 and g(x) = (1/2)x- 2


a. f(x) = 3x + 1 and g(x) = x2

f(g(x)) = f(x2) = 3(x2) + 1 = 3x2 + 1
g(f(x)) = g(3x + 1) = (3x + 1)2 = 9x2 + 6x + 1
In both cases, the resulting function is quadratic.

b. f(x) = 2x + 4 and g(x) = (1/2) x - 2

f(g(x)) = 2((1/2)x - 2) + 4 = (2/2)x - 4 + 4 = (2/2)x = x
g(f(x)) = g(2x + 4) = (1/2)(2x + 4) - 2 = x+ 2 - 2 = x.
In this case, the composites were equal to each other, and they both equal x, the original input into the function. This means that there is a special relationship between these two functions. We will examine this relationship in Chapter 3. It is important to note, however, that f(g(x) is not necessarily equal to g(f(x)).

Example C

Decompose the function f(x) = (3x - 1)2 - 5 into a quadratic function g(x) and a linear function h(x).


When we compose functions, we are combining two (or more) functions by inputting the output of one function into another. We can also decompose a function. Consider the function f(x) = (2x + 1)2. We can decompose this function into an “inside” and an “outside” function. For example, we can construct f(x) = (2x+ 1)2 with a linear function and a quadratic function. If g(x) = x2 and h(x) = (2x + 1), then f(x) = g(h(x)). The linear function h(x) = (2x + 1) is the inside function, and the quadratic function g(x) = x2 is the outside function.

Let h(x) = 3x - 1 and g(x) = x2 - 5. Then f(x) = g(h(x)) because g(h(x)) = g(3x - 1) = (3x - 1)2 - 5.

The decomposition of a function is not necessarily unique. For example, there are many ways that we could express a linear function as the composition of other linear functions.

Can you answer the question at the beginning of the lesson now?

If f(x) = x + 2, and g(x) = 2x + 4, what is f(g(x)) ?

f(g(x)) = f(2x + 4) = (2x + 4) + 2 = 2x + 6

Once you get the idea, composite functions aren't as difficult as they look!


A composite function is a function formed by using the output of one function as the input of another.

The input of a function is the value on which the function is performed (commonly the x value).

The output of a function is the result of the operations performed on x (commonly y or f(x)).

Guided Practice


1) Given:
\begin{align*}f(x) = 5x + 3\end{align*}
\begin{align*}g(x) = 3x^2\end{align*}
Find: \begin{align*}f(g(4))\end{align*}
2) Given:
\begin{align*}h(n) = 7n +1 + 4(g(n))\end{align*}
\begin{align*}g(t) = -t\end{align*}
\begin{align*}f(x) = -2x + g(x)\end{align*}
Find: \begin{align*}f(h(-5))\end{align*}
3) Given: \begin{align*}g(x) = 5x^2\end{align*}
\begin{align*}h(x)=5x^2 - 2x -4(g(x))\end{align*}
Find \begin{align*}h(g(-1))\end{align*}


1) To find f(g(4)), we need to know what \begin{align*}g(4)\end{align*} is, so we know what to substitute into \begin{align*}f(x)\end{align*}:

Substitute 4 for x for the function g(x), giving: \begin{align*}3 \cdot 4^2\end{align*}
Simplify: \begin{align*}3 \cdot 16 = 48\end{align*}
\begin{align*}\therefore g(4) = 48\end{align*}
Substitute 48 for the x in the function \begin{align*}f(x)\end{align*} giving: \begin{align*}5(48) +3\end{align*}
Simplify: \begin{align*}240 + 3 = 243\end{align*}
\begin{align*}\therefore f(g(4)) = 243\end{align*}

2) First, let's solve for the value of the inner function, \begin{align*}h(-5)\end{align*}. Then we'll know what to plug into the outer function.

\begin{align*}h(-5) = (7)(-5)+1+4(g(-5))\end{align*}
To solve for the value of h, we need to solve \begin{align*}g(-5)\end{align*}
\begin{align*}g(-5) = - (-5)\end{align*}
\begin{align*}\therefore g(-5) = 5\end{align*}
Now we have: \begin{align*}h(-5)=(7)(-5)+1+(4)(5)\end{align*}
Simplify to get: \begin{align*}h(-5)=-14\end{align*}
Now we know that \begin{align*}h(-5) = -14\end{align*}. That tells us that \begin{align*}f(h(-5))\end{align*} is \begin{align*}f(-14)\end{align*}
Find \begin{align*}f(-14) = (-2)(-14)+g(-14)\end{align*}
So to solve for the value of \begin{align*}f(-14)\end{align*}, we need to solve for the value of \begin{align*}g(-14)\end{align*}
\begin{align*}g(-14) = - (-14)\end{align*}
\begin{align*}\therefore g(-14) = 14\end{align*}
Now we can finish up!
\begin{align*}f(-14) = (-2)(-14) + 14\end{align*}
\begin{align*}\therefore f(-14) = 42\end{align*}

3) First, solve for the value of the inner function \begin{align*}g(-1)\end{align*} to find what to plug into the outer function \begin{align*}h(g(-1))\end{align*}

\begin{align*}g(-1) = 5(-1)^2\end{align*}
\begin{align*}g(-1) = 5 \cdot 1\end{align*}
\begin{align*}\therefore g(-1) = 5\end{align*}
Next, solve for \begin{align*}h(g(-1))\end{align*} which we now know is: \begin{align*}h(5)\end{align*}
\begin{align*}h(5) = 5(5^2) + (-2)(5) - 4(g(5))\end{align*}
To solve for the value of h, we need to solve for the value of g(5).
\begin{align*}g(5) = 5(5^2)\end{align*}
\begin{align*}g(5) = 125\end{align*}
\begin{align*}\therefore h(5) = 5(5^2) + (-2)(5) + (-4)(125)\end{align*}
Finally: \begin{align*}h(5) = -385\end{align*}


For problems 1-3:

\begin{align*}f(x) = 2x - 1\end{align*}
\begin{align*}g(x) = 3x\end{align*}
\begin{align*}h(x) = x^2 + 1\end{align*}
  1. Find: \begin{align*}f(g(-3))\end{align*}
  2. Find: \begin{align*}f(h(7))\end{align*}
  3. Find: \begin{align*}h(g(-4))\end{align*}
  4. Find: \begin{align*} f(g(h(2)))\end{align*}

Evaluate each composition below:

  1. Given: \begin{align*}f(x) = -5x + 2\end{align*} and \begin{align*}g(x) = \frac{1}{2}x + 4\end{align*} Find \begin{align*}f(g(12))\end{align*}
  2. Given: \begin{align*}g(x) = -3x + 6\end{align*} and \begin{align*}h(x) = 9x + 3\end{align*} Find \begin{align*}g(h(\frac{1}{3}))\end{align*}
  3. Given: \begin{align*}f(x) = -\frac{1}{5}x + 4\end{align*} and \begin{align*}g(x) = 4x^2\end{align*} Find \begin{align*}f(g(10))\end{align*}
  4. Given \begin{align*}g(x) = 3|x -4|+ 6\end{align*} and \begin{align*}h(x) = -x^3\end{align*} Find \begin{align*}h(g(4))\end{align*}
  5. Given \begin{align*}f(x) = \sqrt{x + 2}\end{align*} and \begin{align*}g(x) = |2x|\end{align*} Find \begin{align*}g(f(-7))\end{align*}
  6. Given \begin{align*}f(x) = -3x + 2\end{align*} and given \begin{align*}g(x) = 2x^2\end{align*} and given \begin{align*}h(x) = 4|7 - x| + 6\end{align*} Find \begin{align*}f(g(h(1)))\end{align*}
  7. Given \begin{align*}f(x) = (-3)\end{align*} and given \begin{align*}g(x) = \sqrt{2x}\end{align*} and given \begin{align*}h(x) = |4x| - 12\end{align*} Find \begin{align*}f(h(g(18)))\end{align*}
  8. Are compositions commutative? In other words, does \begin{align*}f(g(x)) = g(f(x))\end{align*} ?
  9. Given: \begin{align*}f(x) = -2^2 - 5x\end{align*} and \begin{align*}h(x) = 3x + 2\end{align*} Find \begin{align*}f(h(x))\end{align*}
  10. Two functions are inverses of each other if \begin{align*} f(g(x)) = x\end{align*} and \begin{align*}g(f(x)) = x\end{align*} If \begin{align*}f(x) = x + 3\end{align*}, find its inverse: \begin{align*}g(x)\end{align*}
  11. A toy manufacturer has a new product to sell. The number of units to be sold, n, is a function of the price p such that: \begin{align*}n(p) = 30 - 25p\end{align*} The revenue r earned from the sales is a function of the number of units sold n such that: \begin{align*}r(n) = 1000 - \frac{1}{4}x^2\end{align*} Find the function for revenue in terms of price, p.


composite function

composite function

A composite function is a function h(x) formed by using the output of one function g(x) as the input of another function f(x). Composite functions are written in the form h(x)=f(g(x)) or h=f \circ g.


The domain of a function is the set of x-values for which the function is defined.


A function is a relation where there is only one output for every input. In other words, for every value of x, there is only one value for y.
Function composition

Function composition

Function composition involves 'nested functions' or functions within functions. Function composition is the application of one function to the result of another function.


The input of a function is the value on which the function is performed (commonly the x value).


The output of a function is the result of the operations performed on the independent variable (commonly x). The output values are commonly the values of y or f(x).


The range of a function is the set of y values for which the function is defined.

Image Attributions

Explore More

Sign in to explore more, including practice questions and solutions for Composition of Functions.


Please wait...
Please wait...

Original text