Composition of Function

In this lesson, I will go over eight (8) worked examples to illustrate the process involved in function composition.

If we are given two functions, it is possible to create or generate a “new” function by composing one into the other. The step involved is similar when a function is being evaluated for a given value. For instance, evaluate the function below for x = 3.

f(x)=4x^2-2x+2 or the function of f of x equals the product of 4 and x squared minus twice of x plus 5

It is obvious that I need to replace each x by the given value then simplify.

evaluate f(x) with x=-3. we have f(-3)=4(-3)^2-2(-3)+5=4(9)+6+5=36+6+5=47. The final answer is f(-3)=47.

The key idea in function composition is that the input of the function is not a numerical value, instead, the input is also another function.


General Rule of Composition of Function

Suppose the two given functions are f and g, the composition of  f \circ g is defined by

f o g = f, alternatively, f composed with g is equal to f of g(x)

Also, the composition of g \circ f is defined by

g o f = g, alternatively, g composed with f is equal to g of f(x)

Few notes about the symbolic “formula” above:

  • The order in function composition matters! You always compose functions from right to left. Therefore, given a function, its input is always the one to its right side. In other words, the right function goes inside the left function.
this is a digram showing how you always compose a function that is from right to left or inside out. in f, the function on the right or inside is g(x). so we evaluate g(x) first then its output value will be in input value of f(x).
  • Notice in f \circ g = f\left[ {g\left( x \right)} \right] , the input or “inner function” is function g because it is to the right of function fwhich is the main or “outer function”.
  • In terms of the order of composition, do you see the same pattern in g \circ f = g\left[ {f\left( x \right)} \right] ? That’s right! The function f is the inner function of the outer function g.

Let us go over a few examples to see how function composition works. You will realize later that it is simply an exercise of algebraic substitution and simplification.


Examples of How to Compose Functions

Example 1: Perform the indicated function composition:

given f(x)=2x^2-3x-1 and g(x)=-x+5, find f-composed-g of x

The order of composition is important. Notice that in f \circ g , we want the function g\left( x \right) to be the input of the main function {f\left( x \right)}.

It should look like this:

f compose with g equals f

I start by writing down the main or outer function f\left( x \right) , and in every instance of x, I will substitute the full value of g\left( x \right).

Then, I’ll do whatever is needed to simplify the expressions such as squaring the binomial, applying the distributive property, and combining like terms. Other than that, there’s really nothing much to it.

Let me show you what I meant by that.

Here are the steps to find f. Write down the main function, plug in the input function, square the binomial, apply the distributive property and finally combine like terms. f(x)=2x^2-3x-1=f^2---1= 2(-x+5)^2-3(-x+5)-1=2x^2-20x+50+3x-15-1=2x^2-17x+34. Therefore the final answer is f o g = f=2x^2-17x+34.

Example 2: Perform the indicated function composition:

given f(x)=-10x^2+6x-4 and g(x)=(1/2)x+2, find g o f ,alternatively, g composed with f

I need to find the composite function g \circ f which means function f is the input of function g.

Here are the steps to find g. First, write down the main or outer function, substitute the value of the input function f(x), apply the distributive property of multiplication over addition then combine like terms. g=(1/2)+2=(1/2)(-10x^2+6x-4)+2=-5x^2+3x-2+2=-5x^2+3x. This yields the final answer of g o f = g=-5x^2+3x.

Example 3: Perform the indicated function composition:

given the functions f(x)=4x^2-4 and g(x)=sqrt(-5x+1), find f-compose-g with x, or f

This is an example of function composition where the input is a square root function. Let’s see how it works out.

Again, in f \circ g we want to plug in function g into the function f.

There are the steps to find f-compose-g with x. Start by writing the parent function (outer function), substitute the input function, square the square root to eliminate the radical symbol, perform the distributive property then finally combine like terms. f=4x^2-4=4^2-4=4^2-4=4(-5x+1)-4=-20x+4+4=-20x. The final answer is f o g = f= -20x.

Example 4: Perform the indicated function composition:

for f(x)=9*sqrt(x-1) and g(x)=sqrt(x), find g o f , or g-compose-f with x

This composition of function is quite interesting. I hope you can see that we will have a situation where a square root function goes inside another square root function.

The key to correctly compose this function is to recognize that the square root symbol can be expressed as an exponential expression with fractional exponent equaling to {1 \over 2}. 

Thus, we have \sqrt {x - 1} = {\left( {x - 1} \right)^{{1 \over 2}}} and \sqrt x = {\left( x \right)^{{1 \over 2}}}

These are the complete solution on how to find the composition of g(x) with f(x). Always begin by writing the main function, substitute the input function, separate into two radical expressions, simplify the square root of 9, express the square root into exponential expressions with fractional exponents, then simplify the exponents using the Power to a Power Rule. Finally, rewrite the exponential expression back into radical expression with an index of 4. That is, g=sqrt= sqrt(9)*sqrt= 3* sqrt=3^(1/2)=3(x-1)^(1/4). Therefore, the final answer is g=3* sqrt(x-) with index 4.

Example 5: Perform the indicated function composition:

f(x)=-3x^2-7x+4, find f-compose-f with x, or f

So far in our previous examples, we have performed function compositions using two distinct functions. However, it is also possible to compose a function with itself.

f=-3^2-7+4=-3(-3x^2-7x+4)^2-7(-3x^2-7x+4)+4=-27x^4-126x^3-75x^2+168x-48+21x^2+49x+4=-27x^4-126x^3-54x^2+217x-72. So the final answer when the function f is composed with itself is f o f = f = -27x^4-126x^3-54x^2+217x-72.

Example 6: Perform the indicated function composition:

given functions f(x)=2/(x+3) and g(x)=(-3x-2)/x, find f o g or f-compose-g with x

Let us work out an example of a function composition that deals with rational functions. The algebra involved is a bit tedious, however, you should be okay as long as you are careful in simplifying the expressions in every step of the way.

In this example, you will apply the procedures on how to add or subtract rational expressions, and also on how to multiply rational expressions.

Here we go…

This seemingly complicated composition of function problem when reduced has a very simple answer. The steps are as follows: write down the outer function, substitute the input function, add the complex denominator using LCD method, combine like terms on the numerator , divide by multiplying the numerator to the reciprocal of the denominator, then finally simplify the expression by canceling common factors. So we have, f=2/ =2/ = 2 /  = 2/  = 2 * [x/(-2)]= -x. The final solution is f o g = f = -x.

That wasn’t too bad, right?


Example 7: Perform the indicated function composition:

given functions f(x)=(3x+2)/(x-1) and g(x)=(x+2)/(x-3), find g o f or g-compose-f with x

If you think that our last example of rational function composition was messy, wait till you see this next example. It can be a bit messier but still very manageable. So don’t fret! Always have that “laser” focus in every simplification process in order to successfully work this out correctly.

The input function f will be substituted into every x of the main function g.

Here are the steps to find g. Write the main function, plug in the input function, add and subtract the fractions using LCD, combine the fractions to create a single denominator, divide by multiplying the complex numerator to the reciprocal of the complex denominator , and then cancel out the common factors. We have g= / = {+2} / {-3}={+} / {+} = /= * =x. The final answer is g o f = g  = x.

That was easy, wasn’t it? 😀

For more practice, I suggest that you try reversing the order of function composition. In other words, find f \circ g .

Is is true also that reversing the order will yield same result? That is, f = g = x.

Do you also get ?

function f evaluated with function g is equal to x

If that’s the case where g \circ f = f \circ g = x, then we conclude that functions g and f are inverses of each other. I have a separate tutorial on how to prove or verify if two functions are inverse of each other.


Example 8: Find the composite function:

given three functions to compose, f(x)=1/(x+1), g(x)=sqrt(x-1)/x, and h(x)=x^2+1, compose f o g o h, or f{g}

In this example, we are going to compose three functions. Observing the notation of the desired composite function f \circ g \circ h, we are going to work it out from right to left.

I first need to plug in function h into function g then simplify to get a new function.

The output of previous step will be substituted further into the main function f to obtain the final answer. Symbolically, it looks like this…

f o g o h = f

Here we go…

I will start by finding the composition g \circ h = g\left( h \right) .

g-compose-h with x, we get g=sqrt/h(x) = sqrt/(x^2+1) = sqrt(x^2+1-1)/(x^2+1) = sqrt(x^2)/(x^2+1) = x/(x^2+1). Therefore, g = x/(x^2+1). Remember this is an intermediary function which will the input of the most outer function f(x).

The result of g\left( h \right) = {\Large{{x \over {{x^2} + 1}}}}  becomes the input of function f

f=1/ = 1/{ = (x^2+1)/(x^2+x+1). Therefore the final answer is f o g o h = f=(x^2+1)/(x^2+x+1).

Practice with Worksheets