﻿ Composition of Functions in Math-interactive lesson with pictures , examples and several practice problems

# Composition of Functions in Math-interactive

#### What kind of notation ?

 Notation Meaning $$g \cdot f (x)$$ "g of f of x" $$g ( f (x) )$$ "g of f of x"

#### What is a composition of functions?

A composition involves 2 (or more) functions. In a composition, you use the output of one function as the input of a second function.

In the following flow chart, The output of $$f(x)$$ is used as the input of our second function $$g(x))$$

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

### Step By Step Flow Chart

#### Are compositions commutative?

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

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

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

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

#### Does this property apply to compositions ?

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

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

Let

$$\red{ f(x) = x + 5}$$

$$\blue{ 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))$$

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

$$\blue{g}(\red {f}(3))$$

$$\blue{g}(\red {f}(3)) \\ \red {f}(3) = 3+ 5 = 8 \\ \blue{g}(8) = 4 \cdot 8 \\ \blue{g}(8) = \boxed {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.

Example 1

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

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

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

Example 2

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

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

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

#### Conclusion

Composition of inverse functions always evaluate to $$x$$ (ie the input itself) .

$$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
Step 1

Evaluate function $$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$$
##### Problem 2
Step 1

Evaluate function $$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$$
##### Problem 3
Step 1

Evaluate function $$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$$
##### Problem 4
Step 1

Evaluate function $$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$$
##### Problem 5
Step 1

Evaluate function $$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

##### Problem 1
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$$

##### Problem 2
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$$