← Back to course

Composition of Functions & Domain Restrictions

You’ll be able to

Output becomes input

Composition feeds one function's output into another: (f∘g)(x) = f(g(x)), read "f of g of x." The inner function g acts first. Order matters enormously — (f∘g) and (g∘f) are generally different functions, and the exam tests this deliberately.

Composition and its domain
(f∘g)(x) = f(g(x)) — defined only when x is in the domain of g AND g(x) is in the domain of f
Both conditions. The second is the one that gets dropped, and dropping it is the standard error.
Worked example

Let f(x) = √x and g(x) = x − 3. Find (f∘g)(x) and (g∘f)(x), with domains.

  1. 1.(f∘g)(x) = f(g(x)) = f(x − 3) = √(x − 3).
  2. 2.Domain: g accepts all reals, but f needs a nonnegative input, so x − 3 ≥ 0, giving x ≥ 3.
  3. 3.(g∘f)(x) = g(f(x)) = g(√x) = √x − 3.
  4. 4.Domain: f needs x ≥ 0; g accepts anything f produces. So x ≥ 0.
Answer: (f∘g)(x) = √(x − 3) with domain x ≥ 3, and (g∘f)(x) = √x − 3 with domain x ≥ 0. Both the formulas and the domains differ, which is the clearest possible demonstration that composition is not commutative.

The hidden domain restriction

Consider f(x) = 1/x and g(x) = x − 2. Then (f∘g)(x) = 1/(x − 2), and the restriction x ≠ 2 is visible in the final formula. But now reverse them: (g∘f)(x) = 1/x − 2. The formula looks harmless at x = 0, yet 0 is not in the domain — the inner function 1/x is undefined there, and the composition cannot survive a step its inner function could not take. Simplifying the formula can hide a restriction, so the domain must be determined from the two functions, not from the simplified result.

Watch out

Always find the domain of a composition before simplifying. Cancellation destroys evidence: if f(x) = x² and g(x) = 1/x, then (f∘g)(x) = 1/x², which still shows x ≠ 0 — but many pairings do not leave a trace.

Checkpoint

f(x) = 1/(x − 1) and g(x) = x². What is the domain of (f∘g)?

Decomposition: reading a function as a composition

Going the other way is just as important, and it is what makes the chain rule intelligible next year. Given h(x) = (3x + 1)⁵, ask what is done last: raise to the fifth power. That is the outer function, f(u) = u⁵, so the inner is g(x) = 3x + 1. For h(x) = √(x² + 4), the last operation is the square root, so f(u) = √u and g(x) = x² + 4. Decompositions are not unique, but the "what happens last" test finds the natural one.

Worked example

If f(x) = 2x + 1 and (f∘g)(x) = 2x² − 5, find g(x).

  1. 1.Write the composition explicitly: f(g(x)) = 2·g(x) + 1.
  2. 2.Set it equal to the target: 2·g(x) + 1 = 2x² − 5.
  3. 3.Subtract 1: 2·g(x) = 2x² − 6.
  4. 4.Divide by 2: g(x) = x² − 3.
  5. 5.Check: f(x² − 3) = 2(x² − 3) + 1 = 2x² − 6 + 1 = 2x² − 5. ✓
Answer: g(x) = x² − 3. Treating g(x) as a single unknown quantity and solving for it algebraically works whenever the outer function is invertible — which is exactly when the step "divide by 2" is legal.
Checkpoint

For h(x) = √(x³ + 2), which decomposition satisfies h = f∘g?

Answer the 2 checkpoints as you read.

Sign in to save your progress