Composing a function
- 2 step process; output of one function is the input of the next
- f(g(x)) the physical letters (f or g) do not matter, however, you MUST do the one on the inside of the parenthesis first (order does matter)
- (g º f)(x) the symbol for composition is an open circle; it is not closed like the multiply dot
Look at this simple example:
f(g(3)) when f(x)=x+2 and g(x)= x²-3x-10
We first solve g(3). We will replace all "x" for "3":
g(3)= 3²-3(3)-10
g(3)=-10
-10 is now our output and our new input for f(g(3))
We now put our new input (-10) in for x in f(x)=x+2
f(x)=x+2
=-10+2
=-8
f(g(3)) when f(x)=x+2 and g(x)= x²-3x-10
We first solve g(3). We will replace all "x" for "3":
g(3)= 3²-3(3)-10
g(3)=-10
-10 is now our output and our new input for f(g(3))
We now put our new input (-10) in for x in f(x)=x+2
f(x)=x+2
=-10+2
=-8
Now we'll compose two functions: gº(f(x)) when f(x)=x-1 and g(x)=x-1
Substitute the function f(x) in for "x" in the function g(x):
=x-1-1
Our new function is x-2.
Substitute the function f(x) in for "x" in the function g(x):
=x-1-1
Our new function is x-2.
Compose hº(f(x)) when h(x)=x³-1 and f(x)=x-1
We put f(x) in for "x" in the function h(x):
=(x-1)³-1
=(x-1)(x-1)(x-1)-1
=x²-x-x+1(x-1)-1
=x³-x²-x²+x-x²+x+x-1-1
Solution: x³-3x²+3x-2
We put f(x) in for "x" in the function h(x):
=(x-1)³-1
=(x-1)(x-1)(x-1)-1
=x²-x-x+1(x-1)-1
=x³-x²-x²+x-x²+x+x-1-1
Solution: x³-3x²+3x-2
Here is a real life example of composition from Purplemath:
You work forty hours a week at a furniture store. You receive a $220 weekly salary, plus a 3% commission on sales over $5000. Assume that you sell enough this week to get the commission. Given the functions f (x) = 0.03x and g(x) = x – 5000, which of ( f o g)(x) and (g o f )(x) represents your commission?
You work forty hours a week at a furniture store. You receive a $220 weekly salary, plus a 3% commission on sales over $5000. Assume that you sell enough this week to get the commission. Given the functions f (x) = 0.03x and g(x) = x – 5000, which of ( f o g)(x) and (g o f )(x) represents your commission?
- Well, ( f o g)(x) = f(g(x)) would mean that I would take my sales x, subtract off the $5000 that didn't get the commission, and then multiply by 3%. On the other hand, (g o f )(x) =
g( f (x)) would mean that I would take my sales x, multiply by 3%, and then subtract $5000 from the result. This could land me in negative numbers! (Would I owe money to my boss?)
So ( f o g)(x) does what we need it to do: ( f o g)(x) represents my commission.