Composition Expansion: Evaluate a Composed Function in Two Steps

By Vegard Gjerde Based on Masterful Learning 8 min read
composition-expansion functions math learning-strategies

Composition Expansion lets you replace (fg)(a)(f \circ g)(a) with f(g(a))f(g(a)) — evaluating the inner function first and feeding its output into the outer function. The move is legal only when aa is in the domain of gg and the output g(a)g(a) is in the domain of ff. Checking this two-part domain chain before expanding is the core fluency skill built by the Unisium Study System.

Unisium principle hero card for Composition Expansion showing the equation (f∘g)(a)=f(g(a)) and a two-item conditions card: a in dom(g) and g(a) in dom(f)
Composition expansion rewrites (fg)(a)(f \circ g)(a) as f(g(a))f(g(a)) whenever the domain chain adom(g)a\in\mathrm{dom}(g) and g(a)dom(f)g(a)\in\mathrm{dom}(f) holds.

On this page: The Principle | Conditions | Failure Modes | EE Questions | Retrieval Practice | Practice Ground | Solve a Problem | Related Principles | FAQ | How This Fits


The Principle

The move: At a specific input aa, replace the composed-function notation (fg)(a)(f \circ g)(a) with the nested evaluation f(g(a))f(g(a)).

The invariant: At any input where the domain chain holds, this gives the same defined value as the composition.

Pattern: (fg)(a)f(g(a))(f \circ g)(a) \quad\longrightarrow\quad f(g(a))

With f(t)=tf(t)=\sqrt{t} (domain [0,)[0,\infty)) and g(x)=x3g(x)=x-3:

Legal ✓Illegal ✗
g(7)=40g(7)=4\geq 0 ✓; (fg)(7)f(g(7))=f(4)=2(f\circ g)(7)\to f(g(7))=f(4)=2g(1)=2<0g(1)=-2<0 ✗; (fg)(1)f(g(1))=f(2)(f\circ g)(1)\to f(g(1))=f(-2) — move invalid because g(1)dom(f)g(1)\notin\mathrm{dom}(f)

Conditions of Applicability

Condition: adom(g)a\in\mathrm{dom}(g); g(a)dom(f)g(a)\in\mathrm{dom}(f)

Before applying, check: Does aa land in dom(g)\mathrm{dom}(g)? Does the inner output g(a)g(a) land in dom(f)\mathrm{dom}(f)?

If the condition is violated: Expanding (fg)(a)=f(g(a))(f \circ g)(a) = f(g(a)) applies ff to a value outside its domain — the expression is undefined, but the notation gives no warning.

  • The domain chain has two links: first, aa must be a valid input for gg; second, g(a)g(a) must be a valid input for ff.
  • When gg is defined everywhere (e.g., g(x)=x3g(x) = x - 3 on R\mathbb{R}), only the second link requires explicit checking.
  • When both ff and gg are defined everywhere (e.g., polynomials), both links hold trivially and the expansion is always valid.

Want the complete framework behind this guide? Read Masterful Learning.


Common Failure Modes

Failure mode: expand (fg)(a)(f \circ g)(a) without checking whether g(a)dom(f)g(a)\in\mathrm{dom}(f)ff is applied to a value outside its domain, producing an undefined or meaningless result with no visible error signal.

Debug: After computing g(a)g(a), ask: “Is this output a valid input for ff?” If not, the composition is undefined at aa — stop before evaluating ff.


Failure mode: reverse the order and write g(f(a))g(f(a)) instead of f(g(a))f(g(a)) → a completely different function value is computed; the error is silent because neither function complains about the wrong ordering.

Debug: Read (fg)(f \circ g) right-to-left: gg is applied first, then ff. The rightmost function always acts first.


Elaborative Encoding

Use these questions to build deep understanding. (See Elaborative Encoding for the full method.)

Within the Principle

  • What does the notation (fg)(a)(f \circ g)(a) mean, and why does evaluating gg first (rather than ff first) produce the correct result?
  • Why does the domain chain require two separate checks rather than one? What would it mean for only the first link to hold and the second to fail?

For the Principle

  • How do you decide, before computing anything, whether composition expansion is valid at a given input?
  • What would change if ff‘s domain were all real numbers — would any part of the condition check become unnecessary?

Between Principles

  • How does composition expansion relate to the input-recovery form of inverse cancellation (f1(f(a))=af^{-1}(f(a))=a) in terms of domain chain structure? What condition must hold for that form, and how does it compare?

Generate an Example

  • Describe a composition (fg)(a)(f \circ g)(a) where gg is defined at aa but g(a)g(a) falls outside dom(f)\mathrm{dom}(f), making the expansion invalid. Choose specific functions and a specific input value to make the failure concrete.

Retrieval Practice

Answer from memory, then click to reveal and check. (See Retrieval Practice for the full method.)

State the composition expansion move in one sentence: _____Replace (f ∘ g)(a) with f(g(a)): evaluate the inner function g at a, then evaluate the outer function f at that result.
Write the canonical expansion pattern: _____(fg)(a)=f(g(a))(f \circ g)(a)=f(g(a))
State the canonical condition: _____adom(g);g(a)dom(f)a\in\mathrm{dom}(g); g(a)\in\mathrm{dom}(f)

Practice Ground

Use these exercises to build move-selection fluency. (See Self-Explanation for how to use worked examples effectively.)

Procedure Walkthrough

Starting from (fg)(5)(f \circ g)(5) with f(t)=tf(t)=\sqrt{t} (domain [0,)[0,\infty)) and g(x)=2x6g(x)=2x-6 (domain R\mathbb{R}), evaluate the composition.

StepExpressionOperation
0(fg)(5)(f \circ g)(5)
1(fg)(5)(f \circ g)(5)Inner output: g(5)=2(5)6=4g(5)=2(5)-6=4
2(fg)(5)(f \circ g)(5)First link: 5dom(g)=R5\in\mathrm{dom}(g)=\mathbb{R} ✓ (automatic); second link: 4[0,)4\in[0,\infty)
3f(g(5))=f(4)f(g(5))=f(4)Domain chain satisfied — apply composition expansion
422Evaluate outer: f(4)=4=2f(4)=\sqrt{4}=2

Drills

Forward step — verify the domain chain, then evaluate

Drill 1. Let f(t)=t+4f(t)=t+4 and g(x)=3xg(x)=3x (both defined everywhere). Evaluate (fg)(2)(f \circ g)(2).

Reveal

2dom(g)=R2\in\mathrm{dom}(g)=\mathbb{R} ✓; g(2)=6dom(f)=Rg(2)=6\in\mathrm{dom}(f)=\mathbb{R} ✓.

(fg)(2)=f(g(2))=f(6)=6+4=10(f \circ g)(2)=f(g(2))=f(6)=6+4=10


Drill 2. Let f(t)=tf(t)=\sqrt{t} (domain [0,)[0,\infty)) and g(x)=x3g(x)=x-3 (domain R\mathbb{R}). Verify the domain chain, then evaluate (fg)(12)(f \circ g)(12).

Reveal

g(12)=90g(12)=9\geq 0 ✓; 9dom(f)=[0,)9\in\mathrm{dom}(f)=[0,\infty) ✓.

(fg)(12)=f(g(12))=f(9)=9=3(f \circ g)(12)=f(g(12))=f(9)=\sqrt{9}=3


Drill 3 (eligibility — which inputs are valid?). Let f(t)=tf(t)=\sqrt{t} (domain [0,)[0,\infty)) and g(x)=x5g(x)=x-5. Which inputs from {3,5,7,9}\{3,\,5,\,7,\,9\} allow composition expansion?

Reveal

Check g(a)=a50g(a)=a-5\geq 0, i.e., a5a\geq 5:

  • a=3a=3: g(3)=2<0g(3)=-2<0not eligible (chain fails at link 2).
  • a=5a=5: g(5)=00g(5)=0\geq 0 ✓ — eligible.
  • a=7a=7: g(7)=20g(7)=2\geq 0 ✓ — eligible.
  • a=9a=9: g(9)=40g(9)=4\geq 0 ✓ — eligible.

Drill 4 (negative — applicability contrast). Let f(t)=tf(t)=\sqrt{t} (domain [0,)[0,\infty)) and g(x)=x3g(x)=x-3. Can composition expansion be applied at a=1a=1?

Reveal

g(1)=13=2<0g(1)=1-3=-2<0, so g(1)dom(f)=[0,)g(1)\notin\mathrm{dom}(f)=[0,\infty).

The domain chain fails at the second link. (fg)(1)(f \circ g)(1) is undefined — the expansion move (fg)(1)f(g(1))=f(2)(f\circ g)(1)\to f(g(1))=f(-2) is invalid because the condition g(a)dom(f)g(a)\in\mathrm{dom}(f) is not satisfied.


Drill 5. Let f(t)=1tf(t)=\dfrac{1}{t} (domain R{0}\mathbb{R}\setminus\{0\}) and g(x)=x2+1g(x)=x^2+1 (domain R\mathbb{R}). Verify the domain chain, then evaluate (fg)(3)(f \circ g)(3).

Reveal

3dom(g)=R3\in\mathrm{dom}(g)=\mathbb{R} ✓; g(3)=100g(3)=10\neq 0, so 10dom(f)10\in\mathrm{dom}(f) ✓.

(fg)(3)=f(g(3))=f(10)=110(f \circ g)(3)=f(g(3))=f(10)=\dfrac{1}{10}


Drill 6 (near-miss — negative). Let f(t)=ln(t)f(t)=\ln(t) (domain (0,)(0,\infty)) and g(x)=5x2g(x)=5-x^2. Attempt to evaluate (fg)(5)(f \circ g)(\sqrt{5}). Does the domain chain hold?

Reveal

g(5)=5(5)2=55=0g(\sqrt{5})=5-(\sqrt{5})^2=5-5=0.

Since ln(0)\ln(0) is undefined, 0dom(f)=(0,)0\notin\mathrm{dom}(f)=(0,\infty).

The chain fails — the expansion move (fg)(5)f(g(5))=f(0)(f\circ g)(\sqrt{5})\to f(g(\sqrt{5}))=f(0) is invalid. This is a near-miss: 5\sqrt{5} looks like a clean input for gg, but gg maps it exactly to 00, the one value excluded from dom(f)\mathrm{dom}(f).


Drill 7. Let f(t)=ln(t)f(t)=\ln(t) (domain (0,)(0,\infty)) and g(x)=exg(x)=e^x (domain R\mathbb{R}). Verify the domain chain, then evaluate (fg)(3)(f \circ g)(3).

Reveal

g(3)=e3>0g(3)=e^3>0, so e3dom(f)=(0,)e^3\in\mathrm{dom}(f)=(0,\infty) ✓.

(fg)(3)=f(g(3))=f(e3)=ln(e3)=3(f \circ g)(3)=f(g(3))=f(e^3)=\ln(e^3)=3


Action label — identify the operation

Drill 8. What was done between these two steps? (Use g(x)=x3g(x)=x-3.)

f(g(7))f(4)f(g(7)) \quad\longrightarrow\quad f(4)

Reveal

Evaluated the inner function: g(7)=73=4g(7)=7-3=4.

(This is not the composition expansion step — that happened when (fg)(7)(f\circ g)(7) was written as f(g(7))f(g(7)). This step computes the numerical value of gg.)


Drill 9. In the chain below, identify which step is the composition expansion step. (Use g(x)=x2+5g(x)=x^2+5, f(t)=t5f(t)=\sqrt{t-5}.)

(fg)(2)    f(g(2))    f(9)    2(f \circ g)(2) \;\longrightarrow\; f(g(2)) \;\longrightarrow\; f(9) \;\longrightarrow\; 2

Reveal

Step 1: (fg)(2)f(g(2))(f \circ g)(2)\to f(g(2)) is the composition expansion.

Domain check: g(2)=4+5=9g(2)=4+5=9, and 95=409-5=4\geq 0, so 9dom(f)9\in\mathrm{dom}(f) ✓. The expansion is valid.


Drill 10. What was done between these two steps, and what condition makes it valid?

(fg)(4)f(g(4))(f \circ g)(4) \quad\longrightarrow\quad f(g(4))

Reveal

Applied composition expansion: rewrote (fg)(4)(f \circ g)(4) as f(g(4))f(g(4)).

This is valid when 4dom(g)4\in\mathrm{dom}(g) and g(4)dom(f)g(4)\in\mathrm{dom}(f) — both links of the domain chain must hold.


Solve a Problem

Apply what you’ve learned with Problem Solving.

Problem: Let f(x)=x+1f(x)=\sqrt{x+1} (domain [1,)[-1,\infty)) and g(x)=x22g(x)=x^2-2 (domain R\mathbb{R}). Evaluate (fg)(3)(f \circ g)(3).

Full solution
StepExpressionMove
0(fg)(3)(f \circ g)(3)
1(fg)(3)(f \circ g)(3)Inner output: g(3)=322=7g(3)=3^2-2=7
2(fg)(3)(f \circ g)(3)First link: 3dom(g)=R3\in\mathrm{dom}(g)=\mathbb{R} ✓ (automatic); second link: 7[1,)7\in[-1,\infty)
3f(g(3))=f(7)f(g(3))=f(7)Domain chain satisfied — apply composition expansion
4222\sqrt{2}Evaluate outer: f(7)=7+1=8=22f(7)=\sqrt{7+1}=\sqrt{8}=2\sqrt{2}

PrincipleKeyRelationship
Composition DefinitionfunctionCompositionRepresentational backbone — defines what (fg)(x)(f\circ g)(x) means; composition expansion is the move that applies this definition at a specific input
Piecewise Branch SelectionpiecewiseBranchSelectionSame domain-gate pattern: before evaluating, you must verify which branch (or domain link) the input satisfies
Inverse CancellationinverseCancelClosest sibling — its input-recovery form also requires a domain-side check (adom(f)a\in\mathrm{dom}(f)) and produces a clean numeric result

FAQ

What is composition expansion?

Composition expansion is the move that rewrites (fg)(a)(f \circ g)(a) as f(g(a))f(g(a)): evaluate the inner function gg at input aa, then feed that output into the outer function ff. It is valid only when the domain chain condition holds — adom(g)a\in\mathrm{dom}(g) and g(a)dom(f)g(a)\in\mathrm{dom}(f).

When is composition expansion valid?

At input aa: when aa is in the domain of gg, and the output g(a)g(a) is in the domain of ff. If either condition fails, the composed function fgf \circ g is not defined at aa and the expansion cannot be applied.

What goes wrong if I skip the domain check?

You may apply ff to a value outside its domain — for example, computing 2\sqrt{-2} or ln(0)\ln(0). The result is undefined. The expansion notation itself gives no warning, making the mistake easy to overlook in a longer chain.

How is composition expansion different from the composition definition?

The definition (fg)(x)=f(g(x))(f \circ g)(x) = f(g(x)) states the general rule as a symbolic identity. Composition expansion is the move applied at a specific numeric input aa — it is the act of substituting aa and checking the domain chain, not just restating the definition.

Does the order of ff and gg matter?

Yes — order matters critically. (fg)(a)(f \circ g)(a) expands to f(g(a))f(g(a)): gg is applied first. (gf)(a)(g \circ f)(a) expands to g(f(a))g(f(a)): ff is applied first. These produce different values in general, and reversing the order is the most common error with no built-in signal.


How This Fits in Unisium

In Unisium, composition expansion is one of a family of function moves — alongside inverse cancellation and piecewise branch selection — all gated on an applicability condition that must be verified before the move is valid. Repeated drill practice in the Unisium Study System trains the “condition-first, then expand” reflex: you learn to check whether g(a)g(a) lands in the domain of ff as automatically as you check whether a radical has a non-negative radicand. That reflex is what separates fluent function work from error-prone pattern-matching.

Explore further:

  • Functions Subdomain Map — Return to the functions hub to see how composition work feeds inverse moves and later calculus prerequisites
  • Derivative Chain Rule — This calculus successor reuses the same inner/outer structure, but differentiates it instead of evaluating it
  • Principle Structures — See where composition expansion sits in the functions principle hierarchy
  • Elaborative Encoding — Build deep understanding of why the domain chain has two links
  • Retrieval Practice — Make the condition and pattern instantly accessible

Ready to master composition expansion? Start practicing with Unisium or explore the full learning framework in Masterful Learning.

Masterful Learning book cover

Masterful Learning

The study system for physics, math, & programming that works: retrieval, connection, explanation, problem solving, and more.

Read the book (opens in new tab) ISBN 979-8-2652-9642-9

Ready to apply this strategy?

Join Unisium and start implementing these evidence-based learning techniques.

Start Learning with Unisium Read More Guides

Want the complete framework? This guide is from Masterful Learning.

Learn about the book →