Composition of Functions in Math-interactive

What is a composition of functions?

Answer: It is the application of one function to the output of the first function

In the following flow chart, our second function $$g(x))$$ is applied to the result of $$f(x)$$.

As you can see the range of f(x) is the domain of g(x).

Step By Step Flow Chart

The flow chart below shows a step by step walk through of $$(f \cdot g)(x)$$

As you can see, you always go right to left!

Step 1
Try some practice problems down below

Are compositions commutative?

Does $$f(g(x)) = g(f ( x))$$?

Remember that the commutative property states that "order does not matter".

Multiplication is commutative because $$3 \cdot 2 = 2 \cdot 3$$.

On the other hand, subtraction is not commutative because $$3 - 2 \ne 2 - 3$$

We want to know if this property applies to composition of functions.

In other words, does it make if difference whether we write $$\bf{ f(g(x)) }$$ vs $$\bf{ g(f(x)) } \text{ ?}$$

To answer that question, let's explore a specific example

Let $$\bf{ f(x) = x + 5}$$ and $$\bf{ g(x) = 4x}$$

Let's evaluate $$\red {f}( \blue{g}( 3))$$ and $$\blue{g}( \red {f}( 3))$$ and see if we get the same answer.

$$\red {f}( \blue{g}( 3)) \\ \blue{g}( 3) =4 \cdot 3 = 12 \\ \red {f}( 12 ) = 12 + 5 = 17$$

$$\blue{g}( \red {f}( 3)) \\ \red {f}( 3) = 3+ 5 = 8 \\ \blue{g}(8) = 4 \cdot 8 = 32$$

Conclusion: Composition of functions are not commutative because $$f(g( 3)) \red { \ne} g(f(3))$$

What about the composition of inverse function

In other words, what if $$f(x)$$ and $$g(x)$$ are inverses?

Again, the best way to understand this is to try some examples, and see what happens.

$$\red {f(}\blue{g(x)} \red {)} \\ = \red {f(}\blue{ x-3} \red {)} \\ = \red {(}\blue{ x-3} \red {) +3}= \bf{ x}$$

$$\red {f(}\blue{g(x)} \red {)} \\ =\red {f(}\blue{ \sqrt{x}} \red {)} \\ = \red {(} \blue{ \sqrt{x}} \red { )^2} = \bf{ x}$$

Conclusion:

$$f( f^{-1}(x)) = \bf {x}$$

Therefore, you know that:

$$g( g^{-1}(5)) = 5 \\ a( a^{-1}(232232)) = 232232 \\ k( k^{-1}(-90210)) = -90210 \\ k(k ^{-1}(\bigstar)) = \bigstar \\ f( f^{-1}(stuff)) = stuff$$

If you think of the inverse function as 'undoing' the original function, this rule might make sense. Read more about inverse functions here.

Practice Problems Part I

Directions: Evaluate each composition of functions listed below.

Step 1

Evaluate function on right $$f( \red {g(2) })$$

$$g(2) =$$
$$4(2) = \blue{8}$$
Step 2

Substitute that value into left side function $$\red {f}( g(2) )$$

$$f( \blue{ 8 })$$
Step 3
$$f( \blue{ 8 })$$ =
$$8 + 3 = 11$$
Step 1

Evaluate function on right $$f( \red {g(8) })$$

$$g(8) =$$
$$8+1 = \blue{9}$$
Step 2

Substitute that value into left side function $$\red {f}( g(8) )$$

$$f( \blue{ 9 })$$
Step 3
$$f( \blue{ 9 })$$ =
$$9^2 = 81$$
Step 1

Evaluate function on right $$f( \red {h(18) })$$

$$h(18) =$$
$$\sqrt{2\cdot 18} =\sqrt{36}= \blue{6}$$
Step 2

Substitute that value into left side function $$\red {f}( h(18) )$$

$$f( \blue{ 6 })$$
Step 3
$$f( \blue{ 6 })$$ =
$$| 7\cdot 6 + 4 | = 46$$
Step 1

Evaluate function on right $$f( \red {b( 5 ) })$$

$$b(5) =$$
$$5 ^3= \blue{125}$$
Step 2

Substitute that value into left side function $$\red {f}( b(5) )$$

$$f( \blue{ 125 })$$
Step 3
$$f( \blue{ 125 })$$ =
$$3(\blue{125})-1 = 374$$
Step 1

Evaluate function on right $$f( \red {m(11) })$$

$$m(11) =$$
$$5 ^3= \blue{125}$$
Step 2

Substitute that value into left side function $$\red {f}(m(11) )$$

$$f( \blue{ 27 })$$
Step 3
$$f( \blue{ 27 })$$ =
$$\frac{1}{3} \blue{27} + 2 = 9 + 2=11$$

Did you notice that the input of '11' is the same as the output for this composition.

Why do you think that is?

Because these two functions are inverses of each other!
Remember that the rule about the composition of inverse functions.

Practice Problems Part II

Step 1

Substitute right side function into left side

$$\red { k(} \blue{ h(x) } \red {)} = \red { k(} \blue{ x + 3 } \red {)} \\ \red { k(} \blue{ x + 3 } \red {)} = \red {(} \blue{ x + 3 } \red {)^2 + (}\blue{ x + 3 } \red {)}$$

Step 2

Simplify

$$\red {(}x^2 + 6x + 9 \red {) + ( } x + 3 \red {)} \\ x^2 + 6x + 9 + x + 3 \\ x^2 + 7x + 12$$

Step 1

Substitute right side function into left side

$$\red { g(} \blue{ h(x) } \red {)} = \red { g(} \blue{ x + 4 } \red {)} \\ \red { g(} \blue{ x + 4 } \red {)} = \red {2(} \blue{ x + 4 } \red {)^2 - 3(}\blue{ x + 4 } \red {)}$$

Step 2

Simplify

$$\red {2(} \blue{ x + 4 } \red {)^2 - 3(}\blue{ x + 4 } \red {)} \\ 2 (x^2 + 8x + 16) - 3 \cdot x - 3 \cdot 4 \\ 2x^2 + 2\cdot 8x + 2\cdot 16 - 3 x - 12 \\ 2x^2 + 16x + 32 - 3x - 12 \\ 2x^2 + 13x +20$$