Functions
AI Assistant

Function Composition

Chain functions together — feed one output into another input

Function composition means feeding the output of one function into another. If f(x) = x² and g(x) = x + 3, then f(g(x)) = (x + 3)² — first add 3, then square.

Order matters: f(g(x)) ≠ g(f(x)) in general. With the same functions, g(f(x)) = x² + 3 — first square, then add 3. The graph makes the difference obvious.

Ask the AI anything — try "What is f(g(2))?" or "Decompose h(x) = sqrt(2x + 1)."

Graph

FAQ

What is function composition?
Function composition is the process of applying one function to the result of another. Written as (f ∘ g)(x) = f(g(x)), it means: first apply g to x, then apply f to the result.
Does the order of composition matter?
Yes, almost always. f(g(x)) and g(f(x)) are usually different functions. For example, squaring then adding 3 gives a different result than adding 3 then squaring.
How do I decompose a composite function?
Look for an "inner" and "outer" operation. For h(x) = √(2x + 1), the inner function is g(x) = 2x + 1 and the outer function is f(x) = √x, so h = f(g(x)).
What are real-world examples of composition?
Converting Celsius to Fahrenheit then to a gas bill amount, applying a discount then sales tax, or zooming in on a map then rotating — any time you chain two processes together.