On this concept: Formula

Not sure which lesson to do first? Find your level and get a plan →

Math · Advanced Functions · Grade 9-12

Composition Chains

A composition chain applies functions in sequence — (f∘g∘h)(x)=f(g(h(x))) — evaluated inside-out, right to left.

(f∘g∘h)(x)=f(g(h(x)))

Quick Answer

A composition chain applies functions in sequence — (f∘g∘h)(x)=f(g(h(x))) — evaluated inside-out, right to left. Use it whenever a process runs in stages and each stage takes the previous stage's output: convert a price to another currency, apply a discount, add tax; or add 1, square, then double. Start with the innermost function, the one written farthest right, and pass each result outward. Changing the order of the stages usually changes the answer.

Why This Matters

Most real calculations are pipelines, and the order of the stages is part of the rule: on a 100-dollar item, 20% off and then 10 dollars off gives 70 dollars, while 10 dollars off and then 20% off gives 72. Reading f∘g∘h correctly also prepares you to split a complicated formula into simple stages, which is exactly what the chain rule in calculus needs.

Intuitive Explanation

Think of an assembly line with three stations. Station h adds 1, station g squares, station f doubles. Feed in 3: h gives 4, g gives 16, f gives 32. In notation this is f(g(h(3))), written (f∘g∘h)(3). The function written last, h, is the first to touch the input, because it sits innermost in the brackets.

Reorder the stations and the product changes. h(g(f(3))) doubles first to get 6, squares to get 36, then adds 1: 37. Composition is not commutative, so f∘g and g∘f are usually different functions. You can also turn the chain into one formula by substituting from the inside out: g(h(x))=(x+1)2, so f(g(h(x)))=2(x+1)2. At x=3 that gives 2⋅16=32, matching the station-by-station answer.

Composing is not multiplying. (f⋅g)(x)=f(x)⋅g(x) evaluates both functions on the same input and multiplies the results: with f(x)=2x and g(x)=x2, (f⋅g)(3)=6⋅9=54. Composition feeds one output into the next function instead: (f∘g)(3)=f(9)=18. The small circle ∘ means feed in; a dot, or no symbol at all, means multiply.

Think of it like this. Nested gift boxes: you put the gift in the smallest box first, then that box into a bigger one, then into the biggest. The innermost box is handled first even though, in f(g(h(x))), it is written last. Unwrapping runs the other way, outer layer first, which is how an inverse undoes a chain.

Core idea. A composition chain feeds one function's output into the next, evaluated from the innermost function outward.


When to Use

Use a composition chain when the output of one step becomes the input of the next: convert, then discount, then tax; nested brackets such as (x+1)2+4; or notation with ∘. Work from the innermost function outward and keep the order exactly as written. If two functions act on the same input and their results are added or multiplied, that is function arithmetic, not composition; if one rule is applied to its own output again and again, it is an iterated feedback loop.

Tip. Ask: Is one function's output being fed as the input to the next in a fixed order?

How to Recognize It

Before evaluating a chain, find the function that acts on x directly, the innermost one, and check that each later function receives only the previous result.

  1. Is a function written inside another's brackets, as in f(g(x)), or joined with the ∘ symbol?

    If yes, work from the inside out: evaluate g(x) first and feed that number to f. If two functions are joined by + or ×, as in f(x)⋅g(x), both act on x separately, which is function arithmetic.

  2. Does the same function keep acting on its own output, again and again?

    If yes, it is iteration, the feedback idea, and how many rounds you run matters. A composition chain usually links different functions, each used once.

  3. Would swapping two steps change the answer, as with a $5 coupon applied before or after a 20% tax?

    If yes, follow the order in the story exactly: coupon first gives 1.2(p−5), coupon last gives 1.2p−5. The step applied first becomes the innermost function.

  4. Does the question give a complicated formula and ask for the functions that build it?

    If yes, it is decomposition, the chain in reverse: 3x+1 is f(g(x)) with g(x)=3x+1 inside and f(u)=u outside, the split the chain rule needs.

Composition Chains compared with Multiplying functions, Order of composition, and Decomposition

All four rows combine two or more functions, so the notation alone can mislead. Ask whether one function's result is handed to the next, whether outputs are simply multiplied, and whether you are building the chain or taking it apart.

Composition Chains

Meaning
Use this when one function's output becomes the next function's input in a fixed sequence.
Key test
Is one function's output being fed as the input to the next in a fixed order?
Formula
(f∘g∘h)(x)=f(g(h(x)))
Example
Let h(x)=x+1, g(x)=x2, f(x)=2x. Find (f∘g∘h)(3).

Multiplying functions

Meaning
Combines outputs by product f(x)⋅g(x), not by feeding one into the other.
Key test
Use when functions are multiplied, not nested.
Formula
(fg)(x)=f(x)g(x)
Example
x2⋅sin⁡x

Order of composition

Meaning
f∘g vs g∘f generally give different results.
Key test
Use to check you applied the inner function first; the order is not interchangeable.
Formula
f(g(x))≠g(f(x)) usually
Example
f=x+1,g=x2: f(g)=x2+1, g(f)=(x+1)2

Decomposition

Meaning
The reverse: breaking one complex function back into a chain.
Key test
Use when you must identify inner and outer functions, e.g. before the chain rule.
Example
x2+1=f(g) with g=x2+1

Formula & Notation

(f∘g∘h)(x)=f(g(h(x)))
(f∘g∘h)(x)=f(g(h(x))); composition is associative: (f∘g)∘h=f∘(g∘h), but NOT commutative: f∘g≠g∘f in general

How to read it: f∘g∘h means apply h first, then g, then f (right to left, innermost to outermost).

Worked Examples

Example 1 — Evaluate a chain

Easy

Let h(x)=x+1, g(x)=x2, f(x)=2x. Find (f∘g∘h)(3).
Show the steps and the answer
  1. Start with the innermost function: h(3)=3+1=4.

    In f(g(h(3))), h is the only function that touches 3 directly.

  2. Feed that result to g: g(4)=42=16.

    g receives the output of h, not the original 3.

  3. Feed that to f: f(16)=2⋅16=32.

    f is the outermost function, so it acts last.

  4. Check with a single formula: f(g(h(x)))=2(x+1)2, and 2(3+1)2=2⋅16=32.

    Substituting from the inside out gives the same answer as stage-by-stage evaluation.

Answer: 32

Takeaway: Evaluate the rightmost function first and pass each output outward.

Example 2 — Order swapped

Standard

With the same f(x)=2x and g(x)=x2, does (f∘g)(3) equal (g∘f)(3)?
Show the steps and the answer
  1. Compute (f∘g)(3): g(3)=9 first, then f(9)=18.

    In f∘g, g is the inner function, so it acts first.

  2. Compute (g∘f)(3): f(3)=6 first, then g(6)=36.

    Swapping the order makes f the inner function.

  3. Compare the formulas: f(g(x))=2x2, while g(f(x))=(2x)2=4x2.

    Squaring after doubling squares the 2 as well, so the two results differ for every x≠0.

Answer: No — 18 vs 36

Takeaway: Composition is not commutative: f∘g and g∘f are generally different functions.

Example 3 — Find the mistake: reading the chain left to right

Application

A shirt costs p dollars. Let d(p)=0.8p (a 20% discount) and t(p)=p+5 (a $5 shipping fee); the checkout total is (t∘d)(p). For p=50, Nina writes: "Apply t first since it comes first: t(50)=55, then d(55)=44, so the total is $44." Find the mistake and correct it.
Show the steps and the answer
  1. Read the notation: (t∘d)(50)=t(d(50)).

    The function next to the input, d, is innermost and acts first.

  2. Name the error: Nina read t∘d left to right and added the fee before the discount.

    That computes d(t(50)), a different chain in which the discount also cuts the shipping fee.

  3. Apply d first: d(50)=0.8⋅50=40.

    The discount is taken on the shirt's price alone.

  4. Then apply t: t(40)=40+5=45.

    The fee is added after the discount, as the chain specifies.

Answer: $45

Takeaway: In t∘d the right-hand function runs first; reading left to right swaps the stages and changes the answer.

Where You'll See It

  • Shopping abroad

    A 120-euro jacket with 25% off, paid in dollars at 1.10 dollars per euro, is a chain: discount, 120⋅0.75=90 euros, then convert, 90⋅1.10=99 dollars. Here the order happens not to matter, since both stages multiply, but a flat 5-euro fee would make it matter.

  • Reading a temperature sensor

    A common sensor outputs a voltage v; software converts it to Celsius with C(v)=100v−50, then to Fahrenheit with F(C)=1.8C+32. A reading of 0.7 V gives C=20 and F=68. The whole chain is the single function F(C(v))=180v−58.

Common Mistakes

  1. The slip: Evaluating left to right

    Instead: composition is inside-out; the rightmost (innermost) function runs first.

  2. The slip: Assuming f∘g=g∘f

    Instead: composition is generally not commutative; order changes the result.

  3. The slip: Plugging the input into the wrong stage

    Instead: feed x into the innermost function, then pass each result outward.


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. Let f(x)=x−4, g(x)=3x and h(x)=x2. Find (f∘g∘h)(2).

    Hint: Start with the rightmost function.

  2. With the same f(x)=x−4, g(x)=3x, h(x)=x2, find (h∘g∘f)(2).

    Hint: Now f is innermost.

  3. With f(x)=x−4, g(x)=3x and h(x)=x2, write (f∘g∘h)(x) as a single formula.

    Hint: Substitute h(x) into g, then that result into f.

  4. Write k(x)=(x+1)3 as a chain f(g(h(x))) of three simpler functions.

    Hint: List what happens to x first, second and third.

  5. A $50 price goes through 'take 20% off', then 'add $3 shipping', then 'add 10% tax'. Is this a composition chain or a product of functions? Find the final price.

    Hint: Does each step use the result of the step before?

  6. For (f∘g∘h)(1) with f(x)=x+5, g(x)=2x and h(x)=x2, a student applies f first and gets 1→6→12→144. Find and correct the mistake.

    Hint: Which function is innermost in f(g(h(x)))?

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

Is f(f(x)) the same as (f(x))2?

No. f(f(x))f(f(x)) feeds the output back into ff, while (f(x))2(f(x))^2 multiplies the output by itself. With f(x)=x+4f(x) = x + 4 and x=1x = 1: f(f(1))=f(5)=9f(f(1)) = f(5) = 9, but (f(1))2=25(f(1))^2 = 25. The notation f2(x)f^2(x) adds confusion, because some books use it for f(f(x))f(f(x)) and others for (f(x))2(f(x))^2; in trigonometry, sin⁡2x\sin^2 x always means (sin⁡x)2(\sin x)^2. Check which meaning your course uses.

How do I undo a composition chain?

Undo the steps in reverse order, each with its own inverse. If h(x)=2x+3h(x) = 2x + 3 means 'double, then add 3', then h−1h^{-1} means 'subtract 3, then halve': h−1(x)=x−32h^{-1}(x) = \frac{x - 3}{2}. In symbols, (f∘g)−1=g−1∘f−1(f \circ g)^{-1} = g^{-1} \circ f^{-1}, like taking off your shoes before your socks. Undoing in the original order, halving first, would give x2−3\frac{x}{2} - 3, which is wrong.

Can g∘f make sense when f∘g does not?

Yes, because each stage must accept the number the previous stage hands it. Take f(x)=xf(x) = \sqrt{x} and g(x)=−x2−1g(x) = -x^2 - 1. Since g(x)g(x) is always −1-1 or less, f(g(x))f(g(x)) asks for the square root of a negative number and has no real value for any xx. The other order works: g(f(x))=−x−1g(f(x)) = -x - 1 for every x≥0x \ge 0. Domains travel through the chain, so check them stage by stage.

How does the chain rule in calculus use composition?

When functions are chained, their rates of change multiply. If u=3xu = 3x and y=u2y = u^2, then uu changes 3 times as fast as xx, and yy changes 2u2u times as fast as uu, so yy changes 2u⋅3=18x2u \cdot 3 = 18x times as fast as xx. That product of rates is the chain rule, dydx=dydu⋅dudx\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}. Gears work the same way: a 3-to-1 pair driving a 2-to-1 pair gives 6 to 1.

Learning Path

Composition Chains

You are here

You need Function Composition: what f(g(x)) means for two functions. Composition chains extend it to three or more stages and train the inside-out order and the fact that order matters. Next, the Chain Rule differentiates a chain stage by stage, multiplying the rates of change, and Decomposition runs the process backward, splitting a function such as 3x2+1 into simple stages.

See Also