A composition of functions is formed by taking the outputs of one function and converting them into the inputs of another function. These functions can be very useful when we have to model different processes with different functions.

Here, we will explore a brief overview of function composition and we will learn how to get a composition if we have two functions. In addition, we will look at several examples with answers in order to master the process used to obtain the composition of functions.

## Summary of composition of functions

The composition of functions is an operation where two functions like $latex f(x)$ and $latex g(x)$ generate a new function like $latex h(x)$ in such a way that we have $latex h(x)=g(f(x))$.

This means that the function $latex g$ is applied to the function $latex f(x)$. This means that basically a function is applied to the result of another function.

**Symbol:** A composition of functions is also denoted as $latex (g\circ f)(x)$, where the small circle, $latex \circ$, is the symbol of the composition of functions. We cannot replace the circle with a point (·) since this indicates the product of two functions.

**Domain:** The composition $latex f(g(x))$ is read as “*f* of *g* of *x*“. In this composition, the domain of the function *f* becomes $latex g(x)$ since the domain is the set of all input values of the function.

To apply the composition $latex f\circ g$, we carry out the following two steps:

**Step 1:** We apply the function *g* to the input *x* and obtain the result $latex g(x)$ as the output.

** Step 2:** We apply the function

*f*using $latex g(x)$ as the input and we get the result $latex f(g(x))$ as the output.

## Composition of functions – Examples with answers

The following function composition examples can be used to fully understand the process used to obtain a function composition. It is advisable to try to solve the exercises yourself before looking at the answer.

**EXAMPLE 1**

Find the composition $latex f(g(x))$ is we have the functions $latex f(x)=2x+3$ and $latex g(x)=x+1$.

##### Solution

To find the combination $latex f(g(x))$, we have to use the outputs of the function $latex g(x)$ on the inputs of $latex f(x)$. Therefore, we use $latex x+1$ as the inputs of the function *f* and we have:

$latex f(g(x))=2(x+1)+3$

$latex f(g(x))=2x+2+3$

$latex f(g(x))=2x+5$

**EXAMPLE 2**

Find the composition $latex f\circ g$ is we have the functions $latex f(x)={{x}^2}+5$ and $latex g(x)=x+1$.

##### Solution

The composition $latex f \circ g$ can also be written as $latex f(g(x))$. Therefore, we have to take the output of $latex g(x)$ and use it as the input of $latex f(x)$. We start by substituting each value of *x* in function *f* for the function *g*:

$latex f(g(x))={{(x+1)}^2}+5$

Now, we can apply the exponent to expand and simplify to the function:

$latex f(g(x))={{x}^2}+2x+1+5$

$latex f(g(x))={{x}^2}+2x+6$

**EXAMPLE 3**

We have the functions $latex f(x)=2{{x}^2}+3x-10$ and $latex g(x)=-x+2$. Find the composition $latex f\circ g$.

##### Solution

Similar to the previous exercise, we know that the composition $latex f \circ g$ can be written as $latex f(g(x))$. Therefore, we replace each *x* in the function $latex f(x)$ with the function $latex g(x)$.

Then, we expand the parentheses with the exponent and simplify the composition of functions:

$latex f\circ g=2{{(-x+2)}^2}+3(-x+2)-10$

$latex =2({{x}^2}-2x+4)-3x+6-10$

$latex =2{{x}^2}-4x+8-3x+6-10$

$latex f\circ g=2{{x}^2}-7x+4$

Start now: Explore our additional Mathematics resources

**EXAMPLE 4**

Find the composition of functions $latex g\circ f$ is we have $latex f(x)=6{{x}^2}+8x-10$ and $latex g(x)=\frac{1}{2}x+5$.

##### Solution

In this case, we have the composition $latex g\circ f$, which is equal to $latex g(f(x))$. Therefore, we use the output of $latex f(x)$ as the input of $latex g(x)$:

$latex g\circ f=\frac{1}{2}(6{{x}^2}+8x-10)+5$

$latex =3{{x}^2}+4x-5+5$

$latex g\circ f=3{{x}^2}+4x$

**EXAMPLE 5**

We have the functions $latex f(x)=2{{x}^2}+5$ and $latex g(x)=\sqrt{-2x+4}$. Find the composition $latex f(g(x))$.

##### Solution

We have to take the function $latex g(x)$ and use it as the input of $latex f(x)$. In this case, the function $latex g(x)$ has a square root.

Let’s see what happens when we expand and simplify:

$latex f(g(x))=2{{(\sqrt{-2x+4})}^2}+5$

$latex =2(-2x+4)+5$

$latex =-4x+8+5$

$latex =-4x+13$

**EXAMPLE 6**

Calculate the composition $latex g\circ f$ if we have the functions $latex f(x)=16\sqrt{x+2}$ and $latex g(x)=\sqrt{x}$.

##### Solution

We know that this composition is equivalent to having $latex g(f(x))$. Therefore, we use the outputs of $latex f(x)$ as the inputs of $latex g(x)$. This case is interesting since we have a square root that goes inside another square root:

$latex g\circ f=\sqrt{16\sqrt{x+2}}$

$latex =4\sqrt{\sqrt{x+2}}$

We can write radicals as exponential expressions with fractional exponents and then apply the power of a power rule to simplify:

$latex 4\sqrt{\sqrt{x+2}}=4{{[{{(x+2)}^{\frac{1}{2}}}]}^{\frac{1}{2}}}$

$latex =4{{(x+2)}^{\frac{1}{4}}}$

Now, we rewrite the exponential expression as the fourth root:

$latex g\circ f=4\sqrt[4]{x+2}$

**EXAMPLE 7**

If we have $latex f(x)=3{{x}^2}+2x-6$, find the composition of functions $latex f\circ f$.

##### Solution

We start by removing the parentheses using the distributive property:

$$-2x(3{{x}^2}+2x-1)+4x+2{{x}^2}+6-4{{x}^3}-10x+5$$

$$=-6{{x}^3}-4{{x}^2}+2x+4x+2{{x}^2}+6-4{{x}^3}-10x+5$$

Here we have several terms with the variable *x* with different powers. We have to make sure to combine only the terms that have the same power:

$$=(-6{{x}^3}-4{{x}^3})+(-4{{x}^2} +2{{x}^2}) +(2x+4x-10x)+(5+6)$$

$latex =-10{{x}^3}-2{{x}^2}-4x+11$

## Composition of functions – Practice problems

Put into practice what you have learned about the composition of functions by solving the following problems. Choose an answer and check it to see if you got the correct answer. Check out the solved examples above in case you need help.

## See also

Interested in learning more about functions? Take a look at these pages:

### Learn mathematics with our additional resources in different topics

**LEARN MORE**