Learn
Lesson · Lines, Functions and Graphs · Functions

Composition of Functions

Composition runs one function on the output of another: (f ∘ g)(x) means f(g(x)), with g first. The order is not a convention that can be swapped, and the composite's domain can be smaller than either function's.

(f o g)(x) = f(g(x)) g runs FIRST (f o g) and (g o f) are different functions domain: x must suit g, AND g(x) must suit f the circle is not multiplication
The definition and its three consequences

Core ideas

What this lesson establishes

“Transformations of Graphs”'s horizontal shifts were compositions written informally. Here the operation gets its own symbol and its own rules.

1

The inner function runs first

In (f ∘ g)(x) the function nearest the input is g, and it goes first. The notation reads right to left, which is the reverse of English reading order, and that mismatch is the whole difficulty. f(g(x)) is the same statement with the order visible.

2

Order changes the answer

With f(x) = 2x + 3 and g(x) = x − 4, (f ∘ g)(x) = 2x − 5 and (g ∘ f)(x) = 2x − 1. At x = 2 they give −1 and 3. Composition is not commutative even when both functions and both composites are lines.

3

The domain is decided in two stages

An input must first be acceptable to g, and then g(x) must be acceptable to f. Both tests happen on the original expression, before any simplification, because simplifying can erase the evidence of the first stage.

The material

Building a composite and finding where it is defined

The definition, why order matters, how the domain is assembled, and why simplification cannot enlarge it.

Definition · Composition

Given functions f and g, the composite f ∘ g is defined by (f ∘ g)(x) = f(g(x)). Its domain is the set of inputs x in the domain of g for which g(x) lies in the domain of f. The symbol is read "f circle g" or "f after g".

"After" is the reading worth adopting, because it says the order out loud. f ∘ g is f after g: g happens, then f happens to the result. The alternative reading, "f of g", is also correct but is easier to say without thinking about which one moves first.

Computing a composite

Substitution again, exactly as in “Function Notation”, with a whole function in the slot. Take f(x) = 2x + 3 and g(x) = x − 4.

(f o g)(x) = f(g(x)) = f(x - 4) = 2(x - 4) + 3 = 2x - 8 + 3 = 2x - 5 (g o f)(x) = g(f(x)) = g(2x + 3) = (2x + 3) - 4 = 2x - 1 at x = 2 g(2) = -2, f(-2) = -1 (f o g)(2) = -1 f(2) = 7, g(7) = 3 (g o f)(2) = 3

Both composites are lines and they are still different functions. The check at x = 2 is worth doing every time a composite is built: evaluate step by step through the two functions, then evaluate the combined formula, and confirm they agree. −1 against −1 catches an order or substitution error immediately.

The domain of a composite

Two conditions, applied in order. The input must be legal for the inner function, and the inner function's output must be legal for the outer one.

f(x) = sqrt(x) g(x) = x - 5 (f o g)(x) = sqrt(x - 5) need x - 5 >= 0 domain [5, inf) (g o f)(x) = sqrt(x) - 5 need x >= 0 domain [0, inf) at x = 9: sqrt(9 - 5) = 2 sqrt(9) - 5 = -2

Same two functions, two different domains, two different outputs. In the first, the subtraction happens before the root, so the root restricts which inputs survive. In the second the root goes first and the subtraction cannot cause a failure, so only the root's own condition applies.

The trap: simplifying before finding the domain

Take f(x) = x² and g(x) = √x. The composite simplifies to a formula whose appearance has forgotten the inner function's domain.

(f o g)(x) = f(sqrt(x)) = (sqrt(x))^2 = x stage 1: g(x) = sqrt(x) needs x >= 0 stage 2: f accepts every output from g domain of f o g: [0, inf), even though the final formula is x the other order: (g o f)(x) = sqrt(x^2) = |x|, domain (-inf, inf)

The simplified formula x accepts negative inputs, but the composite does not: g(−1) never produces a real number, so f is never reached. This needs no cancellation or rational-function technique. It follows directly from the two stages: find the domain before simplifying, and carry it beside the simplified rule.

Interactive

Composition, both ways round

f(g(x)) and g(f(x)), computed separately

A function
fthe second curvedashed: y = x, or a discarded halfwhere it fails

Method

Building a composite safely

Four steps. The domain step comes before the simplifying step, and that ordering is the point.

1

Write the composite with the inner function in brackets

f(g(x)) first, on its own line, before any substitution. For (f ∘ g) with g(x) = x − 4, that is f(x − 4). Seeing the inner expression sitting in the slot prevents the order from flipping.

2

Substitute into every occurrence of the variable

Same discipline as “Function Notation”: brackets around the whole inner expression, in every slot. 2(x − 4) + 3, not 2x − 4 + 3.

3

Find the domain from the unsimplified form

Ask which inputs g rejects, then which of g's outputs f rejects. For f(x) = x² after g(x) = √x, the inner root requires x ≥ 0; the outer square adds no restriction.

4

Simplify, then check one input end to end

Now expand and collect. Then pick an input, run it through g and f separately, and compare with the simplified formula. Disagreement means the expansion is wrong; agreement at one point is not a proof, but it catches nearly every algebra slip.

Order, value and domain

Score 0 / 0

Two composites, both orders, and a domain that hides

The first pair shows that order matters. The second shows that the simplified formula cannot be trusted for a domain.

f(x) = 2x + 3 g(x) = x - 4 (f o g)(x) = f(x - 4) = 2(x - 4) + 3 = 2x - 5 (g o f)(x) = g(2x + 3) = (2x + 3) - 4 = 2x - 1 x (f o g)(x) (g o f)(x) 0 -5 -1 2 -1 3 -1 -7 -3 step by step at x = 2: g(2) = -2 then f(-2) = -1 agrees f(2) = 7 then g(7) = 3 agrees both orders are defined for every real number ----------------------------------------------------------------- p(x) = x^2 r(x) = sqrt(x) (p o r)(x) = (sqrt(x))^2 = x domain, stage 1: r needs x >= 0 domain, stage 2: p accepts every output domain: [0, inf), carried beside the simplified x the other order: (r o p)(x) = sqrt(x^2) = |x| domain: every real x

The table is the honest way to show that order matters. Both results are lines with the same slope, so a quick glance could mistake them; the intermediate values reveal which constant was applied first.

In the second example the simplified formula x is perfectly happy at x = −1, but the composite is not defined there because √(−1) is not real and the outer square is never reached. This is why stage 1 of the domain test is not optional.

Both checks were done by running an input through the two functions in sequence. That is slower than trusting the algebra and it is the only verification that tests the order as well as the simplification.

For a faded composite, take u(x) = 3x − 1 and v(x) = x + 2. The first line (u ∘ v)(x) = u(x + 2) is supplied. Finish both orders, find each domain, and run x = −1 through each chain before checking the two simplified formulas.

Common mistakes

1
Composing in the written order(f ∘ g) applies g first, even though f is written first. The notation reads right to left. Saying "f after g" out loud before computing puts the order back the right way.
2
Treating the circle as multiplication(f ∘ g)(1) is 8 for f(x) = 3x − 1, g(x) = x + 2, while f(1)·g(1) is 6. The circle is a small raised ring and the multiplication dot is a small raised dot, which does not help; the difference is in what the symbol does, not how it looks.
3
Reading the composite's domain off the simplified formulaSimplifying can erase the operation that recorded a restriction. (√x)² simplifies to x, but negative inputs never pass through the inner root. Test the two stages on the original expressions.

Check your understanding

✓
Finish when you can build either composite, state its domain from the two-stage test rather than from the simplified formula, and verify the order at a chosen input.

Given two functions you should produce f ∘ g and g ∘ f, show they differ by evaluating both at a specific input, and give each domain with the excluded values justified by which stage rejected them. One independent pair should be linear; a second should include a square root whose restriction survives simplification.

Note: Composition is the machinery “Inverse Functions” needs. An inverse is defined by what it does under composition — f⁻¹ ∘ f and f ∘ f⁻¹ both have to be the function that leaves its input alone — so the order sensitivity established here is what makes that definition say something.

Kept in this browser only, for you. Nothing is sent anywhere and nothing checks it. Carry it to another device.

Feedback and recommendations

Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.

No recommendations yet for this lesson.