What Function Composition Means
Composition feeds the output of one function into another. The notation (f ∘ g)(x) = f(g(x)) reads from the inside out: do g first, then f. Think of a two-step machine where g is the first station and f the second.
f(x) = 2x + 3, g(x) = x²
- For f(g(x)), replace the x in f with g(x) = x².
- f(g(x)) = 2(x²) + 3 = 2x² + 3.
- For g(f(x)), replace the x in g with f(x) = 2x + 3.
- g(f(x)) = (2x + 3)² = 4x² + 12x + 9.
- They differ, so the order matters.
Answer: f(g(x)) = 2x² + 3 and g(f(x)) = 4x² + 12x + 9
Evaluating a Composition at a Number
f(g(2)) and g(f(2))
- Work inside out. g(2) = 2² = 4.
- Then f(4) = 2(4) + 3 = 11, so f(g(2)) = 11.
- For the other order, f(2) = 2(2) + 3 = 7.
- Then g(7) = 7² = 49, so g(f(2)) = 49.
- Check against the formulas: 2(2)² + 3 = 11 and (2·2 + 3)² = 49 ✓
Answer: f(g(2)) = 11 and g(f(2)) = 49
Numbers are the easiest way to catch an algebra slip. If your formula and the step-by-step number disagree, the formula is wrong.
The Domain of a Composite Function
The domain of f(g(x)) is every x that is allowed in g and whose output g(x) is allowed in f. Square roots and denominators are where this bites.
f(x) = √x, g(x) = x − 4
- g(x) = x − 4 accepts every real x.
- f(g(x)) = √(x − 4).
- The square root needs x − 4 ≥ 0.
- So x ≥ 4.
- Compare with g(f(x)) = √x − 4, whose domain is x ≥ 0. Two different composites, two different domains.
Answer: Domain of f(g(x)): [4, ∞)
Decomposing a Function Into Two Parts
Going the other way is a skill in calculus, where the chain rule needs it. Spot the inner function, the thing in brackets or under a root, and call the rest the outer function.
| h(x) | Inner g(x) | Outer f(x) |
|---|---|---|
| (3x + 1)⁵ | 3x + 1 | x⁵ |
| √(x² + 9) | x² + 9 | √x |
| e^(2x) | 2x | eˣ |
| 1/(x − 4) | x − 4 | 1/x |
Order Matters: A Numbers Check
Let f(x) = x + 1 and g(x) = 2x. Then f(g(3)) = f(6) = 7, but g(f(3)) = g(4) = 8. In general (f∘g)(x) = 2x + 1 and (g∘f)(x) = 2x + 2. Composition is not commutative, so always read it from the inside out.
Our Take: What Is Overrated, Underrated and Plain Wrong
Overrated: the notation. (f∘g)(x) just means “apply g, then f”.
Underrated: substituting the whole expression in brackets. Writing f(g(x)) with g(x) in brackets prevents most sign errors.
Plain wrong: treating f(g(x)) as f(x) × g(x). That is a product, not a composition.
Composition in Everyday Life
A 20% discount followed by 8% sales tax is two functions composed. With g(p) = 0.8p and f(p) = 1.08p, f(g(p)) = 1.08 × 0.8p = 0.864p. On a $100 item that is $86.40 whichever order you apply them, but only because multiplication commutes. Add a flat $5 coupon in the mix and the order suddenly matters.
- Reading f(g(x)) from the left: do g first.
- Multiplying f(x) · g(x) instead of composing.
- Forgetting the domain restriction of the inner function.
Why Students Get Stuck on Function Composition, and What a Good Calculator Should Do
Searching for help with function composition usually starts late at night with one problem that will not work out. F(g(x)) reads inside-out, and the domain of the result is easy to overlook. A good calculator fixes that by showing each step, checking its own answer and explaining the idea in plain words. This section covers what students struggle with, what they want, and how this page responds.
In short: students need to substitute in the right order and keep the domain in view, not just see a final number, and a calculator earns trust only when its steps can be checked.
Understand the pain points
What students get stuck on
Most mistakes here are not about arithmetic. They come from one rule applied the wrong way round, which is why seeing every step matters.
- Swapping f(g(x)) and g(f(x))f(x) = 2x + 1 and g(x) = x^2, find f(g(x))↗
- Substituting into the wrong variablef(x) = x^2 and g(x) = x + 3, find g(f(x))↗
- Forgetting the domain of the inner functionf(x) = sqrt(x) and g(x) = x - 4, find f(g(x))↗
- Not expanding the result fullyf(x) = 1/x and g(x) = x + 2, find f(g(x))↗
Understand the frustrations and desires
What they feel, and what they want
Each frustration points to a wish: a clearer step, a built-in check, an explanation in plain words.
- Wants the substitution shown in order
- Wants f(g(x)) and g(f(x)) side by side
- Wants the domain of the composite
Build the page around their intent
Each intent has a place on this page
The page follows intent, not features, so each need has a clear starting point.
- I need an answer now: type the problem into the calculator at the top of this page.f(x) = 2x + 1 and g(x) = x^2, find f(g(x))↗
- I need to understand: the sections below explain the idea in plain words and list the common mistakes.
- I need to check my work: every step is shown, so the first line that differs from yours is the one to study.
- I need practice: open the solver, tap + and choose Create Practice Test.
- I need it explained aloud: in the solver, tap + and choose Create Video.