Composition Definition: Feeding One Function's Output into Another

By Vegard Gjerde Based on Masterful Learning 12 min read
function-composition math functions learning-strategies

Composition Definition is the representational principle that a composition (fg)(x)=f(g(x))(f \circ g)(x) = f(g(x)) feeds one function’s output directly into another: the inner function gg transforms xx first, then the outer function ff acts on that result. It is valid exactly when xx lies in the domain of gg and g(x)g(x) lies in the domain of ff. Mastering it requires elaboration, retrieval practice, self-explanation, and problem solving—the core strategies in the Unisium Study System.

The composition operator \circ is not commutative: (fg)(x)(f \circ g)(x) and (gf)(x)(g \circ f)(x) are generally different functions. Identifying which function is inner and which is outer—before writing any algebra—is the single most important modeling decision in composition problems.

Unisium hero image for the Composition Definition showing the equation (f ∘ g)(x) = f(g(x)) and a conditions card.
The Composition Definition (fg)(x)=f(g(x))(f \circ g)(x) = f(g(x)) with conditions xdom(g)x\in\mathrm{dom}(g) and g(x)dom(f)g(x)\in\mathrm{dom}(f).

On this page: The Principle | Conditions | Misconceptions | EE Questions | Retrieval Practice | Worked Example | Solve a Problem | FAQ


The Principle

Statement

A composition (fg)(f \circ g) is a new function defined by piping the output of one function gg into the input of another function ff. Formally, (fg)(x)=f(g(x))(f \circ g)(x) = f(g(x)) for every xx where both evaluations succeed. The order matters: gg always acts first, and ff acts on whatever gg produces.

Mathematical Form

(fg)(x)=f(g(x))(f \circ g)(x) = f(g(x))

Where:

  • ff = the outer function (acts second, on g(x)g(x))
  • gg = the inner function (acts first, on xx)
  • xx = the input to the composition (must lie in the domain of gg)
  • (fg)(f \circ g) = the composed function (a new function that chains gg then ff)

Alternative Forms

In different contexts, this appears as:

  • Without operator notation: h(x)=f(g(x))h(x) = f(g(x)) — write the composition as a single rule with gg nested inside ff
  • At a specific input: (fg)(a)=f(g(a))(f \circ g)(a) = f(g(a)) — evaluate by substituting aa into gg first, then feeding the result to ff

Conditions of Applicability

Condition: xdom(g)x\in\mathrm{dom}(g); g(x)dom(f)g(x)\in\mathrm{dom}(f)

Practical modeling notes

  • Check the inner function’s domain restriction first. Any xx excluded from dom(g)\mathrm{dom}(g) is automatically excluded from the composition.
  • Then check whether g(x)g(x) satisfies the outer function’s input restriction. This second filter can shrink the domain further.
  • If both gg and ff accept all real numbers, both conditions are satisfied for every xx and no restriction arises.
  • The domain of (fg)(f \circ g) is the set {xdom(g)g(x)dom(f)}\{x \in \mathrm{dom}(g) \mid g(x) \in \mathrm{dom}(f)\}.

When It Doesn’t Apply

  • Inner domain gap: If xx is outside dom(g)\mathrm{dom}(g), then g(x)g(x) is not defined so (fg)(x)(f \circ g)(x) cannot be computed. For example, g(x)=lnxg(x) = \ln x requires x>0x > 0; negative inputs cannot enter the composition.
  • Outer domain gap: Even when g(x)g(x) is defined, it may fall outside dom(f)\mathrm{dom}(f). For example, f(x)=xf(x) = \sqrt{x} requires g(x)0g(x) \geq 0; any xx for which g(x)<0g(x) < 0 must be excluded.
  • Wrong order: (gf)(x)=g(f(x))(g \circ f)(x) = g(f(x)) is a different composition with potentially different domain and formula. Applying ff first when the problem requires gg first is a modeling error, not a domain failure.

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


Common Misconceptions

Misconception 1: (fg)(x)(f \circ g)(x) means f(x)g(x)f(x) \cdot g(x)

The truth: The notation fgf \circ g is function composition, not multiplication. (fg)(x)=f(g(x))(f \circ g)(x) = f(g(x)) means evaluate gg at xx and feed that result to ff. The product f(x)g(x)f(x) \cdot g(x) is a completely different operation.

Why this matters: For f(x)=2xf(x) = 2x and g(x)=x+1g(x) = x + 1, the composition gives f(g(x))=2(x+1)=2x+2f(g(x)) = 2(x + 1) = 2x + 2, while the product gives 2x(x+1)=2x2+2x2x(x + 1) = 2x^2 + 2x. Confusing the two produces a wrong formula on every problem.

Misconception 2: Composition is commutative — (fg)(x)=(gf)(x)(f \circ g)(x) = (g \circ f)(x)

The truth: Function composition is not commutative in general. The order of evaluation matters: fgf \circ g evaluates gg first, while gfg \circ f evaluates ff first.

Why this matters: Students who treat composition as commutative may occasionally get the same result on specially constructed pairs, but in general the order changes both the formula and potentially the domain. Swapping the order without checking produces a systematic error.

Misconception 3: The domain of (fg)(f \circ g) equals the domain of gg

The truth: The domain of the composition is a subset of dom(g)\mathrm{dom}(g): it includes only those inputs xx for which g(x)g(x) also lies in dom(f)\mathrm{dom}(f). Outputs of gg can fall outside dom(f)\mathrm{dom}(f), shrinking the effective domain further.

Why this matters: Taking the domain to be all of dom(g)\mathrm{dom}(g) overstates where the composition is defined, leading to claims that values exist at inputs where the outer function cannot act.


Elaborative Encoding

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

Within the Principle

  • In (fg)(x)=f(g(x))(f \circ g)(x) = f(g(x)), which function acts on xx first, and which acts on the result? What would the notation (gf)(x)(g \circ f)(x) mean by the same logic?
  • If g(x)=x2g(x) = x^2, what type of object is the argument that ff receives—a variable, a specific number, or an expression in xx?

For the Principle

  • Given a composite rule such as h(x)=sin(x2+1)h(x) = \sin(x^2 + 1), how would you decompose hh into an inner function gg and an outer function ff using the Composition Definition?
  • When does the domain of (fg)(f \circ g) equal the full domain of gg, with no further restriction imposed by ff?

Between Principles

  • The Function Rule Definition uses a single expression f(x)=E(x)f(x) = E(x) to define a function. How does the Composition Definition extend this: is (fg)(x)=f(g(x))(f \circ g)(x) = f(g(x)) itself a function rule definition, and what is its expression E(x)E(x)?

Generate an Example

  • Construct two functions ff and gg such that dom(g)=R\mathrm{dom}(g) = \mathbb{R} yet the domain of (fg)(f \circ g) is a proper subset of R\mathbb{R}. Identify which domain condition fails for the excluded inputs.

Retrieval Practice

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

State the Composition Definition in words: _____A composition (f ∘ g)(x) = f(g(x)) feeds x into the inner function g first, then feeds g(x) into the outer function f. It is valid when x is in the domain of g and g(x) is in the domain of f.
Write the canonical equation for function composition: _____(fg)(x)=f(g(x))(f \circ g)(x)=f(g(x))
State the canonical condition: _____xdom(g);g(x)dom(f)x\in\mathrm{dom}(g); g(x)\in\mathrm{dom}(f)

Worked Example

Use this worked example to practice Self-Explanation.

Problem

Let f(x)=x+3f(x) = x + 3 and g(x)=2xg(x) = 2x. Find the formula for (fg)(x)(f \circ g)(x).

Step 1: Verbal Decoding

Target: formula for (fg)(x)(f \circ g)(x)
Given: ff, gg, xx
Constraints: composition definition; both functions accept all real numbers

Step 2: Visual Decoding

Sketch a two-step pipeline: input xx flows into gg, producing 2x2x; that output flows into ff, producing 2x+32x + 3.

Step 3: Mathematical Modeling

  1. (fg)(x)=f(2x)(f \circ g)(x) = f(2x)

Step 4: Mathematical Procedures

  1. f(2x)=(2x)+3f(2x) = (2x) + 3
  2. (fg)(x)=2x+3\underline{(f \circ g)(x) = 2x + 3}

Step 5: Reflection

  • Verification: At x=1x = 1: g(1)=2g(1) = 2, then f(2)=5f(2) = 5; the formula gives 2(1)+3=52(1) + 3 = 5 ✓.
  • Parameter dependence: Reversing the order gives (gf)(x)=g(x+3)=2(x+3)=2x+6(g \circ f)(x) = g(x + 3) = 2(x + 3) = 2x + 6, a different formula — confirming composition is not commutative.
  • Graphical meaning: The composition shifts the scaled linear function 2x2x upward by 3; the outer function’s additive rule applies after gg doubles the input.

Before moving on: self-explain the model

Try explaining Step 3 out loud (or in writing): why the Composition Definition licenses replacing xx in ff‘s rule with g(x)=2xg(x) = 2x, what that instantiated equation encodes, and why the substitution is valid even though ff was originally written in terms of xx.

Mathematical model with explanation (what “good” sounds like)

Principle: Composition Definition — (fg)(x)=f(g(x))(f \circ g)(x) = f(g(x)) chains the two functions: gg acts first, ff acts on the result.

Conditions: dom(g)=R\mathrm{dom}(g) = \mathbb{R}, so the first condition holds for every xx. g(x)=2xR=dom(f)g(x) = 2x \in \mathbb{R} = \mathrm{dom}(f), so the second condition holds as well.

Relevance: The problem asks for a single rule that achieves the same output as applying gg then ff in sequence. The Composition Definition is precisely that single-rule encoding.

Description: Substitute g(x)=2xg(x) = 2x into the rule for ff: wherever ff expects an input xx, replace it with 2x2x, giving f(2x)=2x+3f(2x) = 2x + 3.

Goal: Find the explicit expression for (fg)(x)(f \circ g)(x).


Solve a Problem

Apply what you’ve learned with Problem Solving.

Problem

Let f(x)=xf(x) = \sqrt{x} and g(x)=x4g(x) = x - 4. Find the formula for (fg)(x)(f \circ g)(x) and state its domain.

Hint (if needed): Which values of xx make g(x)0g(x) \geq 0?

Show Solution

Step 1: Verbal Decoding

Target: formula and domain for (fg)(x)(f \circ g)(x)
Given: ff, gg, xx
Constraints: composition definition; ff requires non-negative input; the second domain condition restricts xx

Step 2: Visual Decoding

Draw a number line. Mark x=4x = 4 (where g(x)=0g(x) = 0). Inputs to the right satisfy g(x)0g(x) \geq 0; inputs to the left are excluded.

Step 3: Mathematical Modeling

  1. (fg)(x)=f(x4)(f \circ g)(x) = f(x-4)
  2. x40x - 4 \geq 0

Step 4: Mathematical Procedures

  1. f(x4)=x4f(x-4) = \sqrt{x-4}
  2. x4x \geq 4
  3. (fg)(x)=x4,dom(fg)=[4,)\underline{(f \circ g)(x) = \sqrt{x-4},\quad \mathrm{dom}(f \circ g) = [4,\,\infty)}

Step 5: Reflection

  • Verification: At x=5x = 5: g(5)=1g(5) = 1, f(1)=1f(1) = 1; formula gives 54=1\sqrt{5 - 4} = 1 ✓. At x=3x = 3: g(3)=1g(3) = -1, f(1)f(-1) is undefined ✓ (correctly excluded).
  • Domain check: x=4x = 4 gives g(4)=0g(4) = 0 and f(0)=0f(0) = 0 — the boundary is closed; x<4x < 4 is excluded because g(x)<0g(x) < 0 lies outside dom(f)\mathrm{dom}(f).
  • Graphical meaning: The formula x4\sqrt{x - 4} is the square-root curve shifted 4 units to the right; the domain [4,)[4, \infty) aligns with the right endpoint of this shift.

PrincipleRelationship to Composition Definition
Function Rule DefinitionFoundation: the composed rule f(g(x))f(g(x)) is itself computed by applying each function’s rule in turn
Composition ExpansionDirect computational counterpart: after you know what (fg)(x)(f \circ g)(x) means, this is the move that evaluates it at a specific input
Piecewise DefinitionSibling: composing with a piecewise inner function requires selecting the active branch before applying the outer function
Inverse DefinitionCounterpart: f1f^{-1} is characterized by ff1=idf \circ f^{-1} = \mathrm{id} and f1f=idf^{-1} \circ f = \mathrm{id} — composition is the language of invertibility

See Principle Structures for how to organize these relationships visually.


FAQ

What is the Composition Definition?

The Composition Definition (fg)(x)=f(g(x))(f \circ g)(x) = f(g(x)) states that composing two functions creates a new function that pipes the output of the inner function gg into the outer function ff. It is valid when xx lies in the domain of gg and g(x)g(x) lies in the domain of ff.

When does the Composition Definition apply?

It applies whenever two functions are chained so that the output of one serves as the input of the other. The two domain conditions must both hold: the starting input must be valid for gg, and the intermediate output g(x)g(x) must be valid for ff.

What is the domain of a composed function?

The domain of (fg)(f \circ g) is the set of all xx in dom(g)\mathrm{dom}(g) for which g(x)dom(f)g(x) \in \mathrm{dom}(f). It is always a subset of dom(g)\mathrm{dom}(g), and can be strictly smaller if some outputs of gg fall outside dom(f)\mathrm{dom}(f).

What is the difference between (fg)(x)(f \circ g)(x) and (gf)(x)(g \circ f)(x)?

In (fg)(x)=f(g(x))(f \circ g)(x) = f(g(x)), gg acts first. In (gf)(x)=g(f(x))(g \circ f)(x) = g(f(x)), ff acts first. These are generally different functions with different formulas and domains. They are equal in special cases—for instance, when f(x)=2xf(x) = 2x and g(x)=3xg(x) = 3x both give (fg)(x)=(gf)(x)=6x(f \circ g)(x) = (g \circ f)(x) = 6x—but in general the two compositions produce different formulas.

What are the most common mistakes with function composition?

The top three: (1) reading fgf \circ g as multiplication — the \circ symbol means chaining, not multiplying; (2) swapping the order without checking, because composition is not commutative; (3) taking the domain of the composition to be all of dom(g)\mathrm{dom}(g) without checking whether gg‘s outputs lie in dom(f)\mathrm{dom}(f).


  • Functions Subdomain Map — Return to the functions hub to see how composition connects to inverse work, logarithms, and later calculus prerequisites
  • Derivative Chain Rule — The first calculus successor that turns composition structure into a derivative move
  • Principle Structures — Organize the Composition Definition within the broader functions hierarchy
  • Self-Explanation — Learn to explain the inner/outer function identification step by step
  • Retrieval Practice — Make the composition notation and domain conditions instantly accessible
  • Problem Solving — Apply the Five-Step Strategy to composition problems systematically

How This Fits in Unisium

Unisium’s functions track introduces composition as the third representational principle, after the Function Rule Definition and Piecewise Definition. Practice sessions use elaborative encoding questions to anchor the inner/outer distinction, spaced retrieval prompts to keep the notation fluent, and structured Five-Step worked examples to build the domain-checking habit. Students who can decompose an unfamiliar expression into inner and outer parts transfer directly to chain-rule problems in calculus.

Ready to master function composition? Start practicing with Unisium or explore the complete 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 →