Maths · Algebra / Precalculus · suggested level; school sequences vary

Composite Functions: Order, Worked Examples & Domain

Double a number, then add 3. Now reverse that order. Starting with 5 gives 13 one way and 16 the other. A composition records which machine acts first.

Start here

For (f ∘ g)(x), apply g first, then f. Keep inputs that are allowed by g and whose g-output is allowed by f.

Original BananaLearn guide · 7 November 2026

Composition: follow the inside function first
Composition: follow the inside function first. Open full-size illustration

On a narrow screen, swipe the diagram or open it full size.

Find a section, worked example or practice question

What a composite function does

A composition feeds one function’s output into another function. If g changes a measurement and f then converts that result, the complete rule is f(g(x)), also written (f ∘ g)(x). Read from the inside out. The small circle means composition, not multiplication.

Define the functions before substituting. With f(x)=2x and g(x)=x+3, f(g(5))=f(8)=16, while g(f(5))=g(10)=13. They use the same two rules but describe different journeys.

Replace the whole input, with brackets

If f(x)=x²−4 and g(x)=3x+1, replacing f’s input gives f(g(x))=(3x+1)²−4. The entire expression 3x+1 takes the place of x. Squaring only the first term would change the rule. Expand to 9x²+6x−3 only if that form is useful.

Leaving a composition unexpanded can make its meaning easier to see. It also preserves which restrictions arose in the inside function. Algebraic simplicity and a correct domain are separate checks.

Why order usually matters

In general, f(g(x)) and g(f(x)) need not agree. A numerical counterexample is enough to disprove equality. To establish equality as functions, both formulas and domains must match for every allowed input.

Some pairs do commute: adding 2 and adding 5 give x+7 in either order. That special case does not justify swapping an arbitrary pair. Write the two expressions independently before comparing them.

A domain condition survives simplification
A domain condition survives simplification. Open full-size illustration

On a narrow screen, swipe the diagram or open it full size.

Find the domain in two stages

First require x to belong to g’s domain. Next require g(x) to belong to f’s domain. For f(x)=√x and g(x)=x−4, the composition √(x−4) needs x≥4. But g(f(x))=√x−4 needs only x≥0.

For a fraction, exclude any zero denominator. For a real square root, require its radicand to be non-negative. When these conditions occur together, solve them together rather than accepting only the easiest one.

A cancellation can hide a forbidden input

Let g(x)=1/x and f(x)=1/x, each with zero excluded. Their composition simplifies to 1/(1/x)=x, but its domain is still x≠0. The unrestricted identity function x on all real numbers is a different function.

Retain restrictions from the original journey beside each simplification. At x=0 the first machine cannot produce an output, so there is nothing for the second machine to undo.

Read a composition from a table

If g(2)=7 and f(7)=10, then f(g(2))=10. To find g(f(2)), you would need f(2) and then the corresponding g-value; the first pair of facts is not enough.

In finite tables, check that the intermediate result appears among the second function’s allowed inputs. A blank or missing entry is not automatically zero. Record it as unavailable from the supplied information.

Break a complicated rule into useful pieces

The rule h(x)=√(5x−2) can be made from g(x)=5x−2 followed by f(u)=√u. This decomposition reveals the domain condition 5x−2≥0, giving x≥2/5. Other decompositions are possible.

Choose pieces that make the next task easier. For evaluation, a number journey may suffice. For domain, isolate the operation with restrictions. Later, this habit helps when working with inverse functions and calculus.

Check your answer and choose the next step

Use one easy allowed value to compare your composite formula with the original two-stage calculation. Then check a boundary value and a forbidden input where relevant. A few numerical checks catch errors but do not prove an identity.

If brackets are the difficulty, revisit substitution and expansion. If restrictions disappear during cancellation, focus on domain. Parents can ask the learner to name the intermediate result rather than supplying the final rule.

See the reasoning

Worked examples and checks

1. Find f(g(x)) and g(f(x)) for f(x)=3x−2 and g(x)=x².

  1. f(g(x))=3x²−2.
  2. g(f(x))=(3x−2)²=9x²−12x+4.
  3. At x=2 the answers are 10 and 16; order changes the result.

2. Find the domain of f(g(x)) when f(x)=1/(x−2), g(x)=√x.

  1. The square root first requires x≥0.
  2. The outer denominator requires √x−2≠0, so x≠4.
  3. Domain: all x≥0 except 4. Both restrictions remain.

3. A fictional price rule adds 20, then applies a 10% discount. Write its rule.

  1. Start with x≥0 as the original price.
  2. Adding first gives x+20; discounting gives 0.9(x+20).
  3. Discounting first and then adding would give 0.9x+20, which is 2 more. Neither order is implied unless the offer states it.

Try, explain, check

12 questions with explained answers

Try each task before opening its explanation. These are original BananaLearn questions, not official exam or past-paper questions. Where several answers can work, the explanation gives the criteria.

  1. For f(x)=x+4, g(x)=2x, find f(g(3)).

    Check answer and reasoning

    10
    g(3)=6, then f(6)=10.

  2. For the same rules, find g(f(3)).

    Check answer and reasoning

    14
    f(3)=7, then double it.

  3. If f(x)=x², g(x)=x−5, find f(g(x)).

    Check answer and reasoning

    (x−5)²
    The complete input x−5 is squared.

  4. Find g(f(x)) for those rules.

    Check answer and reasoning

    x²−5
    Apply the square before subtracting 5.

  5. What is the real domain of √(2x+6)?

    Check answer and reasoning

    x≥−3
    Require 2x+6≥0.

  6. What is the domain of 1/(x²−9)?

    Check answer and reasoning

    All real x except −3 and 3
    Both values make the denominator zero.

  7. If g(4)=8 and f(8)=−1, find f(g(4)).

    Check answer and reasoning

    −1
    The g-output is the required f-input.

  8. Do those two table facts determine g(f(4))?

    Check answer and reasoning

    No
    Neither f(4) nor its g-output has been supplied.

  9. Two reciprocal functions compose to x. Is x=0 allowed?

    Check answer and reasoning

    No
    The first reciprocal is undefined there.

  10. Decompose (2x+1)³ into two functions.

    Check answer and reasoning

    g(x)=2x+1, f(u)=u³
    Then f(g(x)) is the stated rule.

  11. Do adding 2 and adding 7 commute?

    Check answer and reasoning

    Yes, on the real numbers
    Both orders give x+9 with the same domain.

  12. Does agreement at x=0 prove two compositions are identical?

    Check answer and reasoning

    No
    An identity must agree at every allowed input, with matching domains.

A checking record to use in your notebook

Copy these headings and fill them for one worked task, then for a fresh attempt. Use your own evidence rather than copying the model answer.

Question or sentence
What am I being asked to explain?
Model or evidence
Which diagram, rule or passage detail supports my method?
Work
What steps connect the question to the answer?
Independent check
Can I substitute, recount, trace a path or check the text?
Next attempt
What changes in a fresh example?

Choose the next useful step

Explore BananaLearn’s games, learning features and one-to-one tutoring. Maths is our priority; English and Science tutoring are also available. Bring a recent example of schoolwork when checking teaching fit.

Sources, level and update

Original BananaLearn explanations, examples, illustrations and practice. Source facts checked 7 November 2026. Suggested levels are learning guides, not a claim that every board or textbook uses the same sequence.

How we prepare guides · Report a correction

Share the complete guide: https://bananalearn.com/learn/composite-functions-order-and-domain.html