Algebra 2 · Functions and transformations
Composing functions
Feeding one function’s output into another — and the order matters.
Two functions, two orders
Square 2 and add 3, or add 3 and then square: one route gives 7 and the other 25. The notation f(g(2)) tells you which route to take — but you have to read it in the opposite order from the way it is written.
Composition applies one function to the result of another. The notation reads from the inside out, which is the reverse of the order the letters are written in, and that is where the errors live.
(f \circ g)(x) = f(g(x))
Two worked examples
Example 1 — inside first
- With f(x) = x^2 and g(x) = x + 3.
- Compute f(g(2)): the inner function first.
g(2) = 5 - Then feed that into the outer one.
f(5) = 25 - So f(g(2)) = 25.
Example 2 — the order is not free
- Now compute g(f(2)) with the same two functions.
- The inner one first.
f(2) = 4 - Then the outer.
g(4) = 7 - So g(f(2)) = 7, and f(g(2)) = 25.
- Composition is not commutative, and the gap here is not small.