What the formula says
(f ∘ g)(x) = f(g(x))
The composite function f ∘ g, read “f composed with g” or “f of g”, takes an x, lets g work on it, and then hands g’s answer to f. It is a definition: this is what composition means, and it holds for any functions f and g where g’s values can be put into f.
Read it from the inside out. The function next to x works first, even though it comes last in the name f ∘ g. Swap f and g and you usually get a different function altogether.
Worked examples
Let f(x) = 2x + 1 and g(x) = x².
f(g(3)). First g: g(3) = 3² = 9. Then f on that: f(9) = 2 · 9 + 1 = 19.
g(f(3)). First f: f(3) = 2 · 3 + 1 = 7. Then g: g(7) = 7² = 49. The same two functions and the same x, but a different answer, because they work in a different order.
The whole expression. Put g(x) where f has its x: f(g(x)) = 2x² + 1. The other way round, g(f(x)) = (2x + 1)² = 4x² + 4x + 1. Check with x = 3: 2 · 9 + 1 = 19 and 36 + 12 + 1 = 49.
When the inner function decides the domain. Let f(x) = √x and g(x) = x². Then f(g(x)) = √(x²) = |x|, which can be worked out for every x. But g(f(x)) = (√x)² = x can only be worked out for x ≥ 0, because √x has to exist first.
To differentiate a composite function, use the chain rule. If the composition gives x back unchanged in both orders, f and g are each other’s inverses.
Common mistakes
- Working in reading order. In f(g(x)), g works first. It is easy to start with f because it comes first on the line.
- Taking f ∘ g to mean f times g. The ring means composition, not multiplication. With the functions above, f(3) · g(3) = 7 · 9 = 63, which is neither 19 nor 49.
- Forgetting the inner function’s values. f(g(x)) exists only where g(x) is a number f can accept.
Common questions
Which function goes first, f or g?
g, the one next to x. In (f ∘ g)(x) = f(g(x)), g(x) is worked out first, and that answer is what f
works on.
Is f ∘ g the same as g ∘ f?
Usually not. With f(x) = 2x + 1 and g(x) = x², f(g(3)) = 19 but g(f(3)) = 49. There are pairs where the
order does not matter, such as a function and its inverse, but they are the exception.
Where do composite functions come up?
Anywhere one result is worked on further. A discounted price that then has sales tax added is a
composition of two functions, and differentiating something like sin(3x) or e^(x²) means seeing it as
one.