# 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.

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

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

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

**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.

- 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:

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:

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.

**Example 2**: Perform the indicated function composition:

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

**Example 3**: Perform the indicated function composition:

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.

**Example 4**: Perform the indicated function composition:

This composition of

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}}}.

**Example 5**: Perform the indicated function composition:

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.

**Example 6**: Perform the indicated function composition:

Let us work out an example of 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…

That wasn’t too bad, right?

**Example 7**: Perform the indicated function composition:

If you think the last example on rational functions 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.

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 .

Do you also get ?

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:

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…

Here we go…

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

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