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) $$.

composition of functions arrow chart and flow diagram

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!

flow chart step by step of composition 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 $$ \color{Red}{f}( \color{Blue}{g}( 3)) $$ and $$ \color{Blue}{g}( \color{Red}{f}( 3)) $$ and see if we get the same answer.


$$ \color{Red}{f}( \color{Blue}{g}( 3)) $$

$$ \color{Red}{f}( \color{Blue}{g}( 3)) \\ \color{Blue}{g}( 3) =4 \cdot 3 = 12 \\ \color{Red}{f}( 12 ) = 12 + 5 = 17 $$

$$ \color{Blue}{g}( \color{Red}{f}( 3)) $$

$$ \color{Blue}{g}( \color{Red}{f}( 3)) \\ \color{Red}{f}( 3) = 3+ 5 = 8 \\ \color{Blue}{g}(8) = 4 \cdot 8 = 32 $$


Conclusion: Composition of functions are not commutative because $$ f(g( 3)) \color{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.


Example 1

Let $$ \bf{ \color{Red}{ f(x) = x + 3}} \\ \bf{ \color{Blue}{ g(x) = f^{-1}(x) = x -3}} $$

What is $$ f(g(x)) = ? $$

$$ \color{Red}{f(}\color{Blue}{g(x)} \color{Red}{)} = \color{Red}{f(}\color{Blue}{ x-3} \color{Red}{)} = \color{Red}{(}\color{Blue}{ x-3} \color{Red}{) +3}= \bf{ x} $$

Example 1

Let $$ \bf{ \color{Red}{ f(x) = x^2}} \\ \bf{ \color{Blue}{ g(x) = f^{-1}(x) = \sqrt{x}}} $$

What is $$ f(g(x)) = ? $$

$$ \color{Red}{f(}\color{Blue}{g(x)} \color{Red}{)} = \color{Red}{f(}\color{Blue}{ \sqrt{x}} \color{Red}{)} = \color{Red}{(} \color{Blue}{ \sqrt{x}} \color{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.

Problem 1

Let $$ f(x) = x + 3$$ and $$ g(x) = 4x $$. Evaluate $$ f( g( 2)) $$

Step 1

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

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

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

$$ f( \color{Blue}{ 8 }) $$
Step 3
$$ f( \color{Blue}{ 8 }) $$ =
$$ 8 + 3 = 11 $$
Problem 2

Let $$ f(x) = x^2 $$ and $$ g(x) = x+1 $$. Evaluate $$ (f \cdot g)( 8) $$

Remember: $$(f \cdot g)( 8)$$ is the same as $$ f(g(8)) $$

Step 1

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

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

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

$$ f( \color{Blue}{ 9 }) $$
Step 3
$$ f( \color{Blue}{ 9 }) $$ =
$$ 9^2 = 81 $$
Problem 3

Let $$ f(x) = | 7x + 4 | $$ and $$ h(x) = \sqrt{2x}$$. Evaluate $$ (f \cdot h)( 18) $$

Remember: $$(f \cdot h)( 18)$$ is the same as $$ f(h(18)) $$

Step 1

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

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

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

$$ f( \color{Blue}{ 6 }) $$
Step 3
$$ f( \color{Blue}{ 6 }) $$ =
$$ | 7\cdot 6 + 4 | = 46 $$
Problem 4

Let $$ f(x) = 3x -1 $$ and $$ b(x) = x^3 $$. Evaluate $$ f(b(5)) $$

Step 1

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

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

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

$$ f( \color{Blue}{ 125 }) $$
Step 3
$$ f( \color{Blue}{ 125 }) $$ =
$$ 3(\color{blue}{125})-1 = 374 $$
Problem 5

Let $$ f(x) = \frac{1}{3}x + 2 $$ and $$m(x) = 3x - 6$$. Evaluate $$ f(m(11)) $$

Step 1

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

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

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

$$ f( \color{Blue}{ 27 }) $$
Step 3
$$ f( \color{Blue}{ 27 }) $$ =
$$ \frac{1}{3} \color{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.

Challenge problems

Advanced problems - solving algebraically.

Practice Problems Part II

Problem 1

Let $$ k(x) = x^2 + x $$ and $$ h(x) = x + 3$$. Evaluate $$ (k \cdot h)( x ) $$

Remember: $$( \color{red}{k} \cdot \color{blue}{h})( x )$$ is the same as $$ \color{red}{k} ( \color{blue}{h} ( x ) ) $$

Step 1

Substitute right side function into left side

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

Step 2

Simplify

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

Problem 2

Let $$ g(x) = 2x^2 - 3x$$ and $$ h(x) = x + 4$$. Evaluate $$ (g \cdot h)( x ) $$

Remember: $$( \color{red}{g} \cdot \color{blue}{h})( x )$$ is the same as $$ \color{red}{g} ( \color{blue}{h} ( x ) ) $$

Step 1

Substitute right side function into left side

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

Step 2

Simplify

$$ \color{red}{2(} \color{blue}{ x + 4 } \color{red}{)^2 - 3(}\color{blue}{ x + 4 } \color{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 $$

Inverse of Function