Recipe
Compute a function composition
Use when: you're given f and g and asked to evaluate or simplify g \circ f or f \circ g, at a number or as a general formula
Goal: the correct output or formula for the composite, with its domain checked, not just the algebra carried out
Taught in Function composition
Quick recipe
-
1
In g \circ f, apply f first and g second, even though g is written first. Read the notation right to left.
Example
(g \circ f)(4) means: apply f to 4 first, then apply g to that result.
Why: composition is generally not commutative, so applying the two functions in the wrong order gives the wrong composite entirely.
-
2
Plug the given input into whichever function is applied first, and simplify.
Example
For f(x) = x+3: f(4) = 4 + 3 = 7.
Why: this intermediate output is exactly what the outer function receives next, so it has to be computed before anything else.
-
3
Take the value found in the previous step and plug it into the other function to get the final output.
Example
For g(x) = 2x: g(7) = 2(7) = 14, so (g \circ f)(4) = 14.
Why: this is the literal meaning of (g\circ f)(a) = g(f(a)), the outer function applied to the inner function's output.
-
4
Confirm that every output the inner function can produce is something the outer function is allowed to accept.
Example
For f(x) = x-9 into g(x) = \sqrt{x} with domain [0,\infty): f(3) = -6, which is outside [0,\infty), so g(f(x)) is only defined where x \ge 9.
- the inner function's outputs always land inside the outer function's stated domain — the composition is defined everywhere the inner function is.
- some outputs of the inner function fall outside the outer function's domain — the composition's true domain is only the inputs that avoid that problem.
Why: a formula for the composite can be written down whether or not the composition is actually defined, so this check is the only thing that catches a domain mismatch.
Common mistakes
- Applying the two functions in the opposite order from what the notation names.
- Writing down a formula for the composite without checking whether the inner function's outputs fit inside the outer function's domain.
- Assuming the two orders must agree, instead of treating them as possibly different functions.
- Computing only one order when the problem asks for both.