Composite functions - several functions together
Functions can be denoted as an `f` or `g` or `h` or any letter. Therefore you might see something like `gf(x)`.
`gf(x)` can be broken down to a meaning as follows:
`f(x)` means "do stuff" to `x` (as we know already)
`g(x)` means "do stuff" to `x`
So
`gf(x)` means do "`f`" stuff to `x`
Then do "`g`" stuff to the outcome.
and similarly
`fg(x)` means do "`g`" stuff to `x`
Then do "`f`" stuff to the outcome.
Example 1
If `f(x)=x^2` and `g(x)=x-3`
Find `fg(1)`
This is solved as follows:
`f(x)=x^2` means the "stuff" you do to `x` is square it.
`g(x)=x-3` means the "stuff" you do to `x` is subtract `3`.
`g(1)` means do "stuff" to `x` when `x=1`.
`fg(1)` means do "stuff" to `x` when `x=` the result of `g(1)`.
So `g(x)=x-3`
`g(1)=1-3`
`g(1)=-2`
and `f(x)=x^2`
`f(g(1))=f(-2)=(-2)^2=4`
`fg(1)=4`
Example 2
If `f(x)=x^2` and `g(x)=x-3`
Find `gf(1)`
This is solved as follows:
`f(x)=x^2` means the "stuff" you do to `x` is square it.
`g(x)=x-3` means the "stuff" you do to `x` is subtract `3`.
`f(1)` means do "stuff" to `x` when `x=1`.
`gf(1)` means do "stuff" to `x` when `x=` the result of `f(1)`.
So `f(x)=x^2`
`f(1)=1^2`
`f(1)=1`
and `g(x)=x-3`
`g(f(1))=g(1)-3=1-3=-2`
`gf(1)=-2`
Example 3
If `f(x)=x+2` and `g(x)=3x`
Find `fg(5)`
This is solved as follows:
`f(x)=x+2` means the "stuff" you do to `x` is add `2`.
`g(x)=3x` means the "stuff" you do to `x` is multiply by `3`.
`g(5)` means do "`g` stuff" to `x` when `x=5`.
`fg(5)` means do "`f` stuff" to `x` when `x=` the result of `g(5)`.
So `g(x)=3x`
`g(5)=3times5`
`g(5)=15`
and `f(x)=x+2`
`f(g(5))=15+2`
`fg(5)=17`