1.4 Composition of Functions

Builds new functions from old ones. Covers the pointwise arithmetic of sum, difference, product and quotient briefly, then spends the lesson on composition: evaluating it, why it is not commutative, decomposing a complicated rule into inner and outer parts, and the domain question — where the inner function's restriction survives even after the algebra hides it.

Subject: Precalculus · 65 slides · symbolic lesson

Open the interactive version of this deck

What this lesson covers

The lesson, slide by slide

1. Lesson 1.4 Composition of Functions

Title

Precalculus · Chapter 1 — Functions

§1.4 Composition of Functions, pp. 84-100

2. By the end of this lesson you can

Objectives

Five things, each one you can check yourself on paper.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 84-100 — the pages these objectives are drawn from

3. Before we start: does the order of two operations matter?

Warm-up

You have composed operations since primary school without calling it that.

Discussion prompt

Take the number 5. Double it and then add 3. Now start again: add 3 and then double. Do you get the same answer, and what does that tell you?

Hint: Compute both, then say which operation the second one applied to a bigger number.

Answer:

Doubling first gives 10, then 13. Adding first gives 8, then 16. They differ, and by quite a lot.

The reason is that in the second order, the doubling acts on the 3 as well, so the 3 gets doubled too. Which operation happens first decides what the second one is acting on.

That is composition, and the fact that the two orders disagree is the central fact of this lesson. Almost every mistake in the section is an order-of-operations mistake wearing new notation.

4. Wire the output of one rule into the input of another

Concept

The composition of f with g sends an input first through g and then through f. The output of the inner function becomes the input of the outer one.

composite function — The function that applies g and then f, written f composed with g, or f of g of x. Its value at x is obtained by evaluating g at x first and then evaluating f at that result.

\[ (f \circ g)(x) = f\bigl(g(x)\bigr) \]

Read the notation inside out. The function written closest to the x acts first, even though it is written second in the circle notation and appears on the right. Getting comfortable with that inversion is most of the skill here.

Figure (svg): Two function machines wired in series: an input x enters the first machine labelled g, its output g of x travels along a wire into the second machine labelled f, and the final output f of g of x leaves on the right

The inner function runs first. The notation writes the outer function on the left, which is the opposite of the order things happen — the single most useful thing to remember about composition.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 84-86

5. Combining functions with arithmetic

Section

Section 1

6. Add, subtract, multiply and divide pointwise

Concept

Two functions can be combined by doing arithmetic on their outputs at each input. The result is a new function, defined wherever both originals are.

\[ (f+g)(x) = f(x)+g(x), \qquad \Bigl(\tfrac{f}{g}\Bigr)(x) = \frac{f(x)}{g(x)} \]

It is worth being explicit that this section is the easy one. Sums and products of functions inherit their behaviour from ordinary arithmetic, and the only new thing is the domain intersection. Composition, which starts in the next section, does not work like this at all.

Figure (svg): Two function machines wired in series: an input x enters the first machine labelled g, its output g of x travels along a wire into the second machine labelled f, and the final output f of g of x leaves on the right

The inner function runs first. The notation writes the outer function on the left, which is the opposite of the order things happen — the single most useful thing to remember about composition.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 84-87

7. Composition is the operation that is different

Picture it

Adding two functions puts them side by side. Composing them puts them in series, and that is a different picture.

Figure (svg): Two function machines wired in series: an input x enters the first machine labelled g, its output g of x travels along a wire into the second machine labelled f, and the final output f of g of x leaves on the right

The inner function runs first. The notation writes the outer function on the left, which is the opposite of the order things happen — the single most useful thing to remember about composition.

In the wiring diagram nothing is added anywhere. The whole content is that one machine's output becomes the other's input, which is why the order matters here and not in a sum.

8. Worked example: a quotient of functions

Worked example

The domain needs both originals and one extra condition.

\[ \text{With } f(x)=x^2-1 \text{ and } g(x)=x-1, \text{ find } \tfrac{f}{g} \text{ and its domain.} \]

Write the quotient

Why: One rule over the other.

\[ \frac{x ^{2} - 1}{x - 1} \]

Find where the bottom vanishes

Why: This input must be removed.

\[ x = 1 \]

State the domain before simplifying

Why: Both originals accept every real, so only 1 is lost.

\[ \text{all reals except } 1 \]

Now simplify if useful

Why: The numerator factors and one factor cancels.

\[ = x + 1,\text{ for } x \ne 1 \]

Figure (svg): The solution to Worked example a quotient of functions shown as a ladder of expressions, one row per legal move

The whole solution at once: each drop is one legal move.

\[ \Bigl(\tfrac{f}{g}\Bigr)(x) = x+1, \qquad x \ne 1 \]

Verify: check the simplification did not enlarge the domain

Why: The simplified rule x plus 1 is defined at 1, but the quotient was not, so 1 stays excluded. This is exactly the trap from §1.2, and it reappears here because a quotient of functions is where it most often arises. The graph is the line with a hole punched at the point where x is 1.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 86-87

9. Union or intersection?

Sorting

Each question is about the domain of a combination.

Sort into buckets

Sort each by which set operation applies.

Intersection of the domains
the domain of f plus g; the domain of f times g
Something else
the domain of f divided by g; the inputs where at least one of f and g is defined
int
A sum or product needs both outputs to exist before it can combine them, so an input must be legal for both functions. That is precisely the intersection, and no extra condition arises.
other
A quotient needs the intersection AND the removal of the zeros of the bottom function, which is stricter than the intersection alone. The last item is a union, and it is not the domain of any of these combinations — it is included to show that unions describe a different question entirely.

10. Worked example: a sum with restricted domains

Worked example

When both functions restrict, the domains intersect.

\[ \text{With } f(x)=\sqrt{x} \text{ and } g(x)=\sqrt{4-x}, \text{ find the domain of } f+g. \]

Find the first domain

Why: The radicand must be nonnegative.

\[ x \ge 0 \]

Find the second

Why: Four minus x must be nonnegative.

\[ x \le 4 \]

Intersect them

Why: An input must be legal for both.

\[ 0 \le x \le 4 \]

Write it as an interval

Why: Both endpoints are allowed.

\[ [0, 4] \]

Figure (svg): The solution to Worked example a sum with restricted domains shown as a ladder of expressions, one row per legal move

The whole solution at once: each drop is one legal move.

\[ \text{domain}(f+g) = [0,4] \]

Verify: test an input outside the intersection

Why: The input 5 is fine for the first rule but makes the second radicand negative, so the sum is undefined there — one failure is enough. Intersecting rather than unioning is the point: a sum needs both pieces to exist, so the domains must both hold at once.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 87-88

11. Trap: unioning the domains instead of intersecting them

Trap

The trap

\[ \text{domain}(f+g) = [0,\infty) \cup (-\infty,4] = (-\infty,\infty) \]

Combine the two domains with a union

Why: Both functions contribute a domain, so all of it is collected together.

The conclusion is that the sum is defined for every real number.

The fix

A sum needs both pieces to exist at the same input, so the domains intersect rather than unite. The answer is the interval from 0 to 4.

Test it: at the input 5, the first square root is fine but the second asks for the root of negative 1, and the sum of a number and something undefined is undefined.

Intersect for every arithmetic combination. A union would be right if you were asking where at least one of them is defined, which is not a question that arises.

12. Predict the extra condition

Prediction

Both f and g have every real number as their domain, and g has three zeros.

Predict first

What is the domain of f divided by g?

  • All reals except the three zeros of g
  • All real numbers
  • All reals except the zeros of f
  • Only the zeros of g

Correct: All reals except the three zeros of g.

Why: The intersection of the two domains is everything, so the only restriction comes from the quotient itself: the bottom function may not be zero. The zeros of f are irrelevant to the domain — they make the quotient equal to zero, which is a perfectly good output.

13. Finish the domain

Faded example

The domain of the quotient of the square root of x by the quantity x minus 9.

Fill in the blanks

x \ge 0 \;\text9\; x \ne ___ \;\Longrightarrow\; [0,9) \cup (9,\infty)

Why: The square root needs a nonnegative input, giving x at or above 0, and the denominator forbids 9. Combining gives the ray from 0 with the single point 9 punched out, which splits it into two intervals. Note that 9 is inside the ray, so it genuinely has to be removed; had the forbidden input been negative it would already have been excluded.

14. Why is this section short?

Socratic

Sums and products of functions take a page; composition takes the rest of the lesson.

Discussion prompt

Explain what makes composition harder than pointwise arithmetic.

Hint: In which one does the output of a rule become the input of another?

Answer:

In a sum, the two functions never interact. Each is evaluated at the same input independently and the results are added, so all the properties of addition carry straight over — including commutativity.

In a composition, one function's output becomes the other's input. That creates a dependency: the outer function sees only what the inner one produced, and it may not accept all of it.

Two consequences follow immediately, and they are the rest of the lesson. The order matters, because swapping changes which rule sees the raw input. And the domain is a two-stage question, because an input must survive the inner rule and its output must then be acceptable to the outer one.

15. Evaluating a composition

Section

Section 2

16. Inside out, every time

Concept

To evaluate a composition at a number, evaluate the inner function first and feed its output into the outer one. Never substitute into both at once.

The table and graph versions are worth practising specifically, because they force the two-stage process into the open. With formulas it is possible to substitute mechanically and get the right answer without ever thinking about which function acted first.

Figure (svg): Two function machines wired in series: an input x enters the first machine labelled g, its output g of x travels along a wire into the second machine labelled f, and the final output f of g of x leaves on the right

The inner function runs first. The notation writes the outer function on the left, which is the opposite of the order things happen — the single most useful thing to remember about composition.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 88-92

17. Following the wire

Picture it

The picture makes the order unambiguous in a way the notation does not.

Figure (svg): Two function machines wired in series: an input x enters the first machine labelled g, its output g of x travels along a wire into the second machine labelled f, and the final output f of g of x leaves on the right

The inner function runs first. The notation writes the outer function on the left, which is the opposite of the order things happen — the single most useful thing to remember about composition.

If you are ever unsure which function acts first, draw the two boxes. The one the input arrow reaches first is the inner one.

18. Worked example: evaluate at a number

Worked example

Two evaluations, in the right order.

\[ \text{With } f(x)=x^2+1 \text{ and } g(x)=2x-3, \text{ find } (f \circ g)(4). \]

Identify the inner function

Why: It is g, written closest to the 4.

Evaluate it

Why: Twice four minus three.

\[ g(4) = 5 \]

Feed that output into the outer function

Why: The input to f is 5, not 4.

\[ f(5) \]

Evaluate

Why: Twenty five plus one.

\[ = 26 \]

Figure (svg): The solution to Worked example evaluate at a number shown as a ladder of expressions, one row per legal move

The whole solution at once: each drop is one legal move.

\[ (f \circ g)(4) = f(5) = 26 \]

Verify: check the other order to see the difference

Why: Going the other way, f at 4 is 17 and then g at 17 is 31. So the two orders give 26 and 31 — different, as expected. Doing this comparison once per problem is a cheap way to confirm you composed in the direction that was asked for.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 89-90

19. Predict which acts first

Prediction

Consider the expression giving g of h of x.

Predict first

Which function acts on the raw input x?

  • h, because it is written closest to x
  • g, because it is written first
  • Both simultaneously
  • It depends on the rules involved

Correct: h, because it is written closest to x.

Why: Nested notation is evaluated from the innermost parentheses outward, exactly as in arithmetic. The function adjacent to the input acts on it, and its output is then handed outward. This is a fact about notation and never depends on what the rules happen to be.

20. Worked example: find the formula

Worked example

Substitute the whole inner rule into the outer rule's input slot.

\[ \text{With the same } f \text{ and } g, \text{ find } (f \circ g)(x). \]

Write the outer rule with a hole

Why: Every x in f becomes the slot.

\[ f() = () ^{2} + 1 \]

Drop the entire inner rule into the slot

Why: In brackets, as always.

\[ (2 x - 3) ^{2} + 1 \]

Expand the square

Why: The square of a binomial keeps its middle term.

\[ 4 x ^{2} - 12 x + 9 + 1 \]

Collect

Why: Combine the constants.

\[ 4 x ^{2} - 12 x + 10 \]

Figure (svg): The solution to Worked example find the formula shown as a ladder of expressions, one row per legal move

The whole solution at once: each drop is one legal move.

\[ (f \circ g)(x) = 4x^2-12x+10 \]

Verify: test against the numerical answer

Why: Putting x equal to 4 gives 64 minus 48 plus 10, which is 26 — matching the previous example exactly. Checking a formula against a number you have already computed catches expansion errors immediately, and costs one substitution.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 90-91

21. Find the error: composing in the wrong order

Error analysis

A student is asked for f of g of 4 and computes as follows.

Annotate

On: \( f(4)=17, \;\text{ then }\; g(17)=31 \;\Longrightarrow\; (f \circ g)(4)=31 \)

  • Both individual evaluations are arithmetically correct.
  • But the notation f of g of 4 puts g closest to the input, so g must act first.
  • What was actually computed is g of f of 4, which is the other composition.
  • The correct order gives g at 4 equal to 5, then f at 5 equal to 26.
  • The answer 31 is the right answer to a different question.

Read composition notation inside out. The function written leftmost acts last, which is the opposite of how the expression is read aloud, and it is why this error is so easy to make.

22. Match the expression to what it means

Matching

Four expressions built from the same two functions.

Match the pairs

  • l1. f(g(x))
  • l2. g(f(x))
  • l3. f(x) times g(x)
  • l4. f(f(x))
  • r1. g acts first, then f
  • r2. f acts first, then g
  • r3. both act on x, then the outputs are multiplied
  • r4. f acts, then f acts again on its own output

Why: The first two are the two compositions and are generally different functions. The third is a product, where neither function ever sees the other's output. The fourth composes a function with itself, which is perfectly legal and is how iteration works — the same idea behind compound interest in Chapter 4.

23. Finish the evaluation

Faded example

Using a table where g at 2 is 7, and f at 7 is 1, and f at 2 is 5.

Fill in the blanks

(f \circ g)(2) = f(g(2)) = f(7) = 1

Why: The inner lookup gives 7, and that 7 becomes the input for the second lookup, giving 1. The value 5 in the table is f at 2, which is a distractor: it is what you would use if f acted first. Table problems make the two-stage lookup unavoidable, which is why they are worth practising.

24. What is the first move?

Step zero

You are given two graphs and asked for the value of one composed with the other at a particular input.

Discussion prompt

Describe the first two things you do, in order, and which graph each one uses.

Hint: Which graph does the raw input go to?

Answer:

First, go to the inner function's graph — the one written closest to the input — and read the height above that input. That height is the inner output.

Second, take that height and use it as an input on the outer function's graph. Read the height above it. That is the answer.

The step people skip is the handover: the number read off the first graph is a height, and it has to be carried to the second graph's horizontal axis. Moving a number from one axis to the other is the whole difficulty, and drawing the two arrows makes it hard to get wrong.

25. Why order matters

Section

Section 3

26. Composition is not commutative

Concept

For most pairs of functions, composing in the two orders gives two different functions. Equality of the two orders is a special property, not the norm.

It is worth stating what the exceptions are, because a student who only ever sees the inequality can be surprised later. Composing a function with its inverse returns the input unchanged in both orders, and that is precisely why inverses are worth defining.

Figure (svg): The same two rules composed in both orders, producing two different results, shown as two parallel chains of boxes with the inputs and outputs written at each stage

Composition is not commutative, and the gap is not small. Two rules composed in the two orders are two genuinely different functions.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 92-94

27. The same two rules, both ways round

Picture it

One input, two orders, two answers.

Figure (svg): The same two rules composed in both orders, producing two different results, shown as two parallel chains of boxes with the inputs and outputs written at each stage

Composition is not commutative, and the gap is not small. Two rules composed in the two orders are two genuinely different functions.

The gap between 25 and 7 is not a rounding difference or an edge case. These are two different functions that happen to be built from the same two parts.

28. Worked example: show two orders differ

Worked example

One well-chosen input settles it.

\[ \text{Show that } f \circ g \ne g \circ f \text{ for } f(x)=x^2, \; g(x)=x+3. \]

Pick a convenient input

Why: Any input where the two disagree will do.

\[ \text{take } x = 2 \]

Compose one way

Why: Add first, then square.

\[ f(g(2)) = f(5) = 25 \]

Compose the other way

Why: Square first, then add.

\[ g(f(2)) = g(4) = 7 \]

Compare

Why: The two results differ at this input.

\[ 25 \ne 7 \]

Figure (svg): The solution to Worked example show two orders differ shown as a ladder of expressions, one row per legal move

The whole solution at once: each drop is one legal move.

\[ (f \circ g)(2)=25 \ne 7=(g \circ f)(2) \]

Verify: confirm with the formulas

Why: One order gives x plus 3, all squared, which expands to x squared plus 6x plus 9. The other gives x squared plus 3. They differ by 6x plus 6, which is zero only at x equal to negative 1 — so the two functions agree at exactly one input and differ everywhere else. One input was enough, but the formulas show how thoroughly they differ.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 92-93

29. Break the false rule

Counterexample

A classmate claims that composing the squaring rule with any linear rule commutes.

Discussion prompt

Find a linear rule for which it fails, and then one for which it works.

Hint: Try one that shifts, and then one that only scales.

Answer:

It fails for adding 3, as this section showed: the two orders give x squared plus 6x plus 9 and x squared plus 3.

It works for multiplying by 1, trivially, and it very nearly works for multiplying by any constant: doubling then squaring gives four x squared, while squaring then doubling gives two x squared. Those differ too — so in fact only the identity works among scalings.

The lesson is that the claim is essentially always false, and the few exceptions are exceptions for a reason rather than by accident. Composing a function with its own inverse, or with the identity, are the cases that genuinely commute.

30. Worked example: a pair that does commute

Worked example

The exception, and the reason it is an exception.

\[ \text{Show that } f(x)=2x \text{ and } g(x)=\tfrac{x}{2} \text{ commute.} \]

Compose one way

Why: Halve, then double.

\[ f(g(x)) = 2(\frac{x}{2}) = x \]

Compose the other way

Why: Double, then halve.

\[ g(f(x)) = \frac{2 x}{2} = x \]

Compare the two results

Why: Both are the identity rule.

Say why

Why: Each rule undoes the other.

Figure (svg): The solution to Worked example a pair that does commute shown as a ladder of expressions, one row per legal move

The whole solution at once: each drop is one legal move.

\[ (f\circ g)(x)=x=(g\circ f)(x) \]

Verify: check this is not the general situation

Why: Doubling and adding 3 do not commute, as the previous example showed, and they are built from equally simple operations. What is special here is not simplicity but that each rule undoes the other exactly. Section 1.7 turns this observation into the definition of an inverse function, and the two-sided condition seen here is exactly what that definition requires.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 94-94

31. Trap: assuming composition behaves like multiplication

Trap

The trap

\[ (f \circ g)(x) \overset{?}{=} (g \circ f)(x) \quad \text{'because order does not matter'} \]

Reason by analogy with multiplication

Why: Multiplying two numbers gives the same answer either way, so composing two functions should too.

The two orders are treated as interchangeable and whichever is easier to compute is used.

The fix

The analogy fails. Multiplication combines two numbers symmetrically; composition feeds one rule's output into the other, which is an inherently ordered thing to do.

Squaring then adding 3 gives x squared plus 3. Adding 3 then squaring gives x squared plus 6x plus 9. These differ by 6x plus 6, which is far from nothing.

Treat the order as part of the problem statement, not a detail. When a question asks for one composition, computing the other is not a near miss — it is a different function.

32. Do these pairs commute?

Sorting

Compose each pair both ways and compare.

Sort into buckets

Sort each pair.

Commute
doubling and halving; adding 2 and adding 5; the cubing rule and the cube root rule
Do not commute
squaring and adding 1
yes
Doubling and halving undo each other, as do cubing and the cube root, so both orders give the identity. Two additions commute for a different reason: adding 2 then 5 and adding 5 then 2 both add 7, because addition of numbers is itself commutative.
no
Squaring then adding 1 gives x squared plus 1, while adding 1 then squaring gives x squared plus 2x plus 1. They differ by 2x, so they agree only at the single input 0.

33. Predict the special case

Prediction

Two functions compose to give the identity rule in both orders.

Predict first

What is the relationship between them?

  • Each is the inverse of the other
  • They are the same function
  • They are both linear
  • Nothing in particular follows

Correct: Each is the inverse of the other.

Why: Composing to the identity in both orders is exactly the definition of inverse functions, which Section 1.7 states formally. Being the same function would not do it — squaring composed with squaring gives the fourth power, not the identity — and the pair need not be linear, as cubing and the cube root show.

34. Explain the asymmetry

Explain it to yourself

Addition of functions commutes and composition does not.

Discussion prompt

Explain what structural difference between the two operations accounts for this.

Hint: In which one does either function ever see the other's output?

Answer:

In a sum, both functions receive the same raw input and neither is affected by the other. Swapping them swaps two numbers that are then added, and addition of numbers commutes, so the result is unchanged.

In a composition, one function receives the raw input and the other receives only what the first produced. Swapping changes what each function is looking at, so there is no reason at all for the results to match.

Put another way: a sum treats the two functions symmetrically and a composition does not. The asymmetry is built into the operation, which is why commutativity is the surprising case rather than the expected one.

35. The domain of a composition

Section

Section 4

36. Two conditions, and one of them hides

Concept

An input belongs to the domain of a composition when the inner function accepts it and the inner function's output is then acceptable to the outer function. Both conditions must hold.

This is the hardest idea in Chapter 1, and it is worth saying plainly why. Algebra is normally trusted to preserve meaning, and here it does not preserve the domain. The simplified expression is a different function from the composition, agreeing with it only where the composition is defined.

Figure (svg): A diagram showing the two conditions an input must satisfy to be in the domain of a composition: it must be legal for the inner function, and the inner function's output must be legal for the outer one

Two conditions, and the first is the one that disappears when the algebra tidies up. A composition's domain can never be found from the simplified formula alone.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 94-98

37. The restriction that survives

Picture it

The composition of the squaring rule with the square root simplifies to x, and yet it is not the line.

Figure (svg): A graph showing the composition of the squaring rule with the square root, whose simplified formula is x but whose graph exists only for nonnegative inputs, drawn as a ray starting at the origin rather than a full line

The simplified rule and the composition agree everywhere the composition is defined — but the composition is not defined everywhere the simplified rule is. Same formula, different function.

The dashed line on the left is what the algebra suggests. The solid ray on the right is the actual composition, which cannot accept a negative input because the square root inside would never have run.

38. Worked example: a domain the formula hides

Worked example

The formula simplifies away the square root; the domain does not forget it.

\[ \text{Find the domain of } (f \circ g)(x) \text{ with } f(x)=x^2 \text{ and } g(x)=\sqrt{x}. \]

Apply condition one

Why: The inner function is the square root.

\[ x \ge 0 \]

Apply condition two

Why: The outer rule squares, and accepts every real.

Combine

Why: Only the first condition bites.

\[ x \ge 0 \]

Note what the formula would have said

Why: The composition simplifies to x, whose domain is everything.

Figure (svg): A graph showing the composition of the squaring rule with the square root, whose simplified formula is x but whose graph exists only for nonnegative inputs, drawn as a ray starting at the origin rather than a full line

The simplified rule and the composition agree everywhere the composition is defined — but the composition is not defined everywhere the simplified rule is. Same formula, different function.

\[ \text{domain}(f \circ g) = [0,\infty) \]

Verify: test a negative input

Why: Try negative 4. The inner rule asks for the square root of negative 4, which is not real, so the chain stops before the squaring ever happens. The simplified formula would happily return negative 4, which is precisely why it is a different function.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 95-96

39. Which condition is being tested?

Discrimination

Every restriction on a composition comes from one of the two conditions.

Sort into buckets

Sort each restriction by which condition produced it.

Condition one: the inner function accepts x
the inner function's radicand must be nonnegative; the input must be in the inner function's domain
Condition two: the outer function accepts g(x)
the inner function's output must avoid the outer one's forbidden value; the outer function's denominator must not vanish
one
These are statements about whether the inner machine will run at all on the given input. They are found by looking at the inner rule alone, exactly as in §1.2, and they are the ones that survive simplification invisibly.
two
These are statements about the inner machine's output. They are found by looking at the outer rule's own restrictions and then translating them back into conditions on x, which is the extra step this idea adds.

40. Worked example: both conditions bite

Worked example

Here the outer function contributes a restriction as well.

\[ \text{Find the domain of } f(g(x)) \text{ with } f(x)=\tfrac{1}{x-2} \text{ and } g(x)=\sqrt{x}. \]

Condition one, from the inner rule

Why: The square root needs a nonnegative input.

\[ x \ge 0 \]

Condition two, from the outer rule

Why: Its denominator forbids an input of 2.

\[ g(x) \ne 2 \]

Translate condition two back into x

Why: The square root equals 2 when x is 4.

\[ x \ne 4 \]

Combine both

Why: Nonnegative, with 4 removed.

\[ [0, 4] U(4, \infty) \]

Figure (svg): The solution to Worked example both conditions bite shown as a ladder of expressions, one row per legal move

The whole solution at once: each drop is one legal move.

\[ [0,4) \cup (4,\infty) \]

Verify: check the excluded input directly

Why: At x equal to 4 the inner rule gives 2, and the outer rule then asks for one over zero. So 4 genuinely breaks the chain even though it is a perfectly legal input for the inner function on its own. Condition two is a statement about the inner function's OUTPUT, and translating it back into a statement about x is the step most often skipped.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 97-98

41. Find the error: reading the domain off the simplified formula

Error analysis

A student composes and then simplifies before finding the domain.

Annotate

On: \( f(x)=x^2, \; g(x)=\sqrt{x} \;\Longrightarrow\; (f\circ g)(x)=x \;\Longrightarrow\; \text{domain} = (-\infty,\infty) \)

  • The composition and the simplification are both correct as algebra.
  • But the domain was read off the simplified rule rather than the composition.
  • The inner square root refuses negative inputs, and that refusal is not undone by simplifying.
  • The correct domain is the nonnegative reals.
  • The graph is a ray from the origin, not a full line, which is what the restriction looks like.

This is the §1.2 cancellation trap in its most disguised form. Find the domain from the composition as built, and simplify afterwards if it helps.

42. Predict whether the domain shrinks

Prediction

The inner function is a polynomial and the outer function is a square root.

Predict first

Where does the restriction come from?

  • From condition two only, since the polynomial accepts everything
  • From condition one only
  • From both conditions equally
  • There is no restriction

Correct: From condition two only, since the polynomial accepts everything.

Why: A polynomial has every real number in its domain, so condition one imposes nothing. Condition two requires the polynomial's output to be nonnegative, which is an inequality in x and generally restricts the domain considerably. This is the mirror image of the worked example, where the restriction came entirely from the inner rule.

43. Finish the domain

Faded example

Find the domain of the square root of the quantity x squared minus 9.

Fill in the blanks

x^2 - 9 \ge 0 \;\Longrightarrow\; x \le -3 \;\text3\; x \ge ___

Why: The inner polynomial accepts everything, so only condition two matters: its output must be nonnegative. A quadratic is at or above zero outside its roots, giving two rays rather than an interval. Solving this by taking a square root of both sides and writing x at or above 3 alone loses the entire left-hand ray, which is the standard error here.

44. What else do you need?

Missing information

You are told that the composition of f with g simplifies to the rule that returns x.

Discussion prompt

Can you conclude that the domain of the composition is every real number? What else would you need to know?

Hint: Which of the two functions might have refused an input before the simplification happened?

Answer:

No. The simplified formula tells you what the composition computes where it is defined, and says nothing at all about where that is.

You would need the domain of the inner function, and the domain of the outer function to check the second condition. Only with those can the composition's domain be assembled.

The concrete case in this lesson makes the point: squaring the square root simplifies to x, and yet its domain is only the nonnegative reals. The simplified formula was never the whole story, and this is the one place in the chapter where trusting the algebra gives the wrong answer.

45. Decomposing a function

Section

Section 5

46. Composition run backwards

Concept

Given a complicated rule, find simpler rules whose composition it is. There is more than one right answer, and the useful ones split the work at a natural seam.

Decomposition looks like a puzzle exercise and is in fact the single most useful skill in this lesson, because the chain rule in calculus is entirely an instruction about how to differentiate a composition. Recognising a function as a composition is the prerequisite for that.

Figure (svg): A single complicated expression broken into an inner and an outer part, shown by drawing a box around the inner expression and naming what remains as the outer rule

Decomposing is composition run backwards. The test that never fails: whatever you would compute first with a calculator is the inner function.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 98-100

47. Finding the seam

Picture it

The dashed box marks what happens first, and everything outside it is what happens next.

Figure (svg): A single complicated expression broken into an inner and an outer part, shown by drawing a box around the inner expression and naming what remains as the outer rule

Decomposing is composition run backwards. The test that never fails: whatever you would compute first with a calculator is the inner function.

Drawing the box is a reliable method. Whatever sits inside a radical, inside a bracket being raised to a power, or in a denominator, is almost always the inner function.

48. Worked example: decompose a radical rule

Worked example

The radical sign marks the seam.

\[ \text{Write } h(x)=\sqrt{3x-5} \text{ as a composition.} \]

Ask what you would compute first

Why: With a calculator you would work out three x minus five.

\[ \text{compute } 3 x - 5 \]

Name that the inner function

Why: It becomes g.

\[ g(x) = 3 x - 5 \]

Ask what happens to that result

Why: You take its square root.

Name that the outer function

Why: It becomes f.

\[ f(u) = \sqrt{u} \]

Figure (svg): A single complicated expression broken into an inner and an outer part, shown by drawing a box around the inner expression and naming what remains as the outer rule

Decomposing is composition run backwards. The test that never fails: whatever you would compute first with a calculator is the inner function.

\[ g(x)=3x-5, \quad f(u)=\sqrt{u}, \quad h = f \circ g \]

Verify: compose them back

Why: Feeding g into f gives the square root of the quantity 3x minus 5, which is the original rule exactly. Always run this check: it takes one line and catches a decomposition assembled in the wrong order, which is the usual failure.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 99-99

49. Match each rule to its inner function

Matching

Ask what you would compute first in each case.

Match the pairs

  • l1. the square root of (2x + 1)
  • l2. (2x + 1) squared
  • l3. 2 times the square root of x, plus 1
  • l4. 1 over (2x + 1)
  • r1. inner: 2x + 1, outer: the square root
  • r2. inner: 2x + 1, outer: squaring
  • r3. inner: the square root, outer: doubling and adding 1
  • r4. inner: 2x + 1, outer: the reciprocal

Why: Three of the four share an inner function and differ only in what is done afterwards. The third is the odd one out: there the root acts on the bare x, so it goes first and the linear work happens outside. Reading which operation the x is inside is the whole technique.

50. Worked example: a decomposition with a choice

Worked example

Several answers are correct, and one is more useful than the others.

\[ \text{Decompose } h(x)=\frac{1}{(x+2)^3}. \]

Find the innermost computation

Why: You would add 2 to x first.

\[ g(x) = x + 2 \]

Describe everything that follows

Why: Cube it, then take the reciprocal.

\[ f(u) = 1 / u ^{3} \]

Note an alternative split

Why: You could instead cube inside and take the reciprocal outside.

\[ g = (x + 2) ^{3}, f = \frac{1}{u} \]

Choose the one that helps

Why: Both are correct; the first isolates the simplest inner rule.

Figure (svg): The solution to Worked example a decomposition with a choice shown as a ladder of expressions, one row per legal move

The whole solution at once: each drop is one legal move.

\[ g(x)=x+2, \quad f(u)=\frac{1}{u^3} \]

Verify: confirm both splits compose correctly

Why: The first gives one over the quantity x plus 2, all cubed. The second cubes x plus 2 and then takes the reciprocal, which is the same thing. Both are right, and a question asking to decompose will normally accept any correct answer unless it specifies the form of one of the pieces.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 100-100

51. Trap: assembling the decomposition in the wrong order

Trap

The trap

\[ h(x)=\sqrt{3x-5} \;\Longrightarrow\; f(x)=3x-5, \; g(u)=\sqrt{u}, \; h = f \circ g \]

Identify the two pieces correctly

Why: The linear rule and the square root are both present and both correctly written.

They are then labelled so that the linear rule is the outer function and the root is the inner one.

The fix

The pieces are right and the labels are swapped. As written, f composed with g would take the square root first and then multiply by 3 and subtract 5, giving three root x minus five — a different function.

The inner function is the one that acts first, which here is the linear rule. So the linear rule should be called g and the root f.

Always compose your answer back together and compare. It costs one line and catches this immediately, which matters because the two pieces look correct in isolation and nothing else flags the error.

52. Predict how many answers there are

Prediction

You are asked to decompose a rule into an inner and an outer function.

Predict first

How many correct decompositions are there, in general?

  • Many, including a trivial one using the identity
  • Exactly one
  • Exactly two
  • None, unless the rule is a composition by construction

Correct: Many, including a trivial one using the identity.

Why: Any rule can be decomposed trivially by taking the inner function to be the identity and the outer to be the whole rule, which is correct and useless. Between that and the natural split there are usually several genuine alternatives, as the reciprocal-of-a-cube example showed. Questions therefore ask for a decomposition, not the decomposition.

53. Reverse-engineer the pieces

Reverse engineer

A composition gives the rule that squares the quantity x minus 4 and then adds 7.

Fill in the blanks

g(x) = x - 4, \qquad f(u) = u^2 + 7

Why: Subtracting 4 happens first, so it is the inner rule. Squaring and adding 7 both happen to that result, so together they form the outer rule. Composing back gives the square of the quantity x minus 4, plus 7, which matches. Note that the adding of 7 could not be part of the inner rule, since it happens after the squaring.

54. Where decomposition earns its keep

Real world

This skill looks like a puzzle and is in fact the entry requirement for the chain rule.

Discussion prompt

Why would a calculus student need to see a complicated function as a composition before differentiating it?

Hint: Is there a rule for differentiating a square root of something complicated directly?

Answer:

The derivative rules are stated for simple functions — powers, roots, sines. There is a rule for the square root of x, but none for the square root of an arbitrary expression.

The chain rule bridges the gap: it differentiates a composition by differentiating the outer function, evaluating it at the inner one, and multiplying by the inner function's derivative. But it can only be applied once the function has been recognised as a composition.

So decomposition is the step before the calculus, and a student who cannot spot the seam cannot start. That is why this section is worth more attention than its length suggests — the payoff is two chapters away but it is substantial.

55. Combining functions, four ways

Comparison

Fill the blanks from memory. Only the last row behaves differently from ordinary arithmetic.

Comparison matrix

how it combinesdomaincommutative
sum f + gadd the outputsintersection of the domainsyes
product f times gmultiply the outputsintersection of the domainsyes
quotient f over gdivide the outputsintersection, minus the zeros of gno
composition f after gfeed g's output into ftwo conditions, one of them hiddenno

The first two rows inherit everything from arithmetic. The last row is the one that needs a whole lesson, because nothing about it is inherited.

56. Finding the domain of a composition, in order

Pattern

Five steps, and the last one is the one that is skipped.

  1. Identify the inner and outer functions clearly, before touching any algebra.
  2. Write down the domain of the inner function. This is condition one, and it is final.
  3. Write down the domain of the outer function, then translate it into a condition on the inner function's output.
  4. Turn that condition back into a statement about x, by solving for the inputs whose inner output is forbidden.
  5. Intersect the two conditions — and do not go back and read the domain off the simplified formula, which will be wrong.

Step 5's warning is worth more than the other four steps combined. The simplified formula is a different function, and its domain is usually larger.

OpenStax Algebra and Trigonometry 2e, §3.4 Composition of Functions §3.4

57. Check yourself 1 of 3

Check

Inside out.

Check your understanding

With f(x) = 3x and g(x) = x + 4, what is f of g of 2?

  • A. 18 (correct)
  • B. 10
  • C. 24
  • D. 14

Answer: A

Why: The inner function g acts first, giving 2 plus 4, which is 6. Then f triples it, giving 18. Writing the two steps separately is what keeps the order straight.

Why B tempts people
This composes the other way round: f at 2 is 6, then g gives 10. That is g of f of 2, a different composition.
Why C tempts people
This distributes the tripling over the addition incorrectly, computing 3 times 2 plus 3 times 4 as though f were a multiplier acting on a sum in the wrong way.
Why D tempts people
This adds 4 to 2 and then adds rather than multiplies by 3, mixing up the outer rule.

58. Check yourself 2 of 3

Check

The formula is not the domain.

Check your understanding

With f(x) = x squared and g(x) = the square root of x, what is the domain of f composed with g?

  • A. [0, infinity) (correct)
  • B. all real numbers
  • C. (0, infinity)
  • D. (-infinity, 0]

Answer: A

Why: The inner square root refuses negative inputs, so the domain is the nonnegative reals, and the input 0 is allowed because the square root of 0 is 0. The composition simplifies to x, but that formula is a different function with a larger domain.

Why B tempts people
This reads the domain off the simplified formula, which is exactly the error this section exists to prevent.
Why C tempts people
This wrongly excludes 0. Nothing forbids a radicand of zero unless the root sits in a denominator.
Why D tempts people
This is the wrong half of the line, from solving the radicand inequality backwards.

59. Check yourself 3 of 3

Check

Find the seam.

Check your understanding

Which decomposition of the rule giving one over the quantity x plus 5 is correct?

  • A. inner: x + 5, outer: the reciprocal (correct)
  • B. inner: the reciprocal, outer: x + 5
  • C. inner: x, outer: 1 over (x + 5)
  • D. inner: 5, outer: 1 over x

Answer: A

Why: Evaluating by hand you would add 5 first and then take the reciprocal, so the addition is the inner rule. Composing back gives one over the quantity x plus 5, matching the original.

Why B tempts people
Composing these gives one over x, plus 5, which is a different function.
Why C tempts people
This is the trivial decomposition using the identity as the inner function. It composes correctly but does no work, and a question asking to decompose is asking for a genuine split.
Why D tempts people
The inner function must be a rule applied to x, not a constant.

60. Where this shows up outside the classroom

Real world

Any process made of stages is a composition, and the domain question is a real engineering concern.

Discussion prompt

A shop applies a 20 percent discount and then adds 8 percent sales tax. Would the customer pay the same if the tax were applied first? Explain in the language of this lesson.

Hint: Are the two operations scalings, and do scalings commute?

Answer:

The customer pays the same either way, and this is one of the genuine exceptions. Both operations are multiplications — by 0.8 and by 1.08 — and multiplication of numbers is commutative, so the order does not matter.

The moment either stage stops being a pure multiplication, that changes. A flat five-pound discount followed by tax is not the same as tax followed by the flat discount, because the discount is now an addition and additions and multiplications do not commute.

This is exactly the warm-up. Doubling and adding 3 disagree for the same reason a percentage discount and a flat discount behave differently, and it is why the order of operations in pricing rules is specified in contracts rather than left to intuition.

61. Commit before you check

Commit first

State your confidence along with your answer.

Predict first

The composition of f with g simplifies to the formula x. What is the domain of the composition?

  • It cannot be determined from this alone
  • All real numbers
  • The domain of f
  • The domain of g

Correct: It cannot be determined from this alone.

Why: The simplified formula says nothing about the domain. You would need the domain of the inner function and the domain of the outer one to assemble it. The squaring-of-a-square-root example simplifies to x with domain only the nonnegative reals, and doubling composed with halving simplifies to x with domain everything — two compositions with the same simplified formula and different domains.

62. Explain it to someone who missed the lesson

Explain it

The test of understanding is being able to say why, not just what.

Discussion prompt

Explain to a classmate why the composition of the squaring rule with the square root is not the same function as the rule that returns x, even though the algebra says they are equal.

Hint: Ask what each one does with the input negative 4.

Answer:

At the input negative 4, the rule that returns x gives negative 4. The composition cannot even start: the square root of negative 4 is not a real number, so nothing is handed to the squaring rule.

Two functions are the same only when they have the same domain and agree on it. These agree wherever both are defined, but one is defined on more inputs than the other, so they are different functions.

A good explanation names what the algebra actually established: the two rules agree on the composition's domain. That is a true and useful statement, and it is weaker than saying they are equal — the gap between those two claims is the whole point of the section.

63. Exit ticket

Exit ticket

One honest answer, so the next lesson can start in the right place.

Predict first

Which idea from this lesson would you most want to see again?

  • Evaluating compositions inside out, especially from tables and graphs
  • Why the two orders give different functions
  • The domain of a composition and its hidden restriction
  • Decomposing a rule into inner and outer parts

Correct: Any of these is a legitimate answer; the useful one is the honest one.

Why: There is no correct choice here. The third is the hardest idea in the chapter and the one most likely to need a second pass. The fourth is the one whose payoff is furthest away, in the chain rule, and is worth practising even when it feels like a puzzle rather than a technique.

64. Draw the map

Connect it up

One page, drawn from memory, is worth more than rereading the section.

Draw it

Draw the two-machine wiring diagram for a composition, labelling which machine runs first. Beside it, write the two conditions an input must satisfy to be in the domain, and mark which of the two survives simplification invisibly. Then pick any function with a square root in it, decompose it, and compose your pieces back together to check.

If your diagram makes clear that the machine written second in the notation runs first, you have the fact that prevents most of the errors in this section.

65. What you can do now

Recap

Five things, and the last one is what the chain rule will require of you.

if you remember one thingit should be this
about the notationread it inside out: the rule nearest the x acts first
about the orderthe two orders are two different functions
about the domainthe inner function's restriction survives simplification
about decomposingwhatever you would compute first is the inner function

Section 1.5 takes the toolkit functions and moves, stretches and flips them — and its central rule, that changes inside affect the input and changes outside affect the output, is composition seen from another angle.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 84-100 — everything on these slides traces back here

Sources

  1. OpenStax, Precalculus, §1.4 Composition of Functions
  2. OpenStax Algebra and Trigonometry 2e, §3.4 Composition of Functions

Want this taught 1-on-1? Alexander tutors Precalculus — $55/session, free consultation.

Book on Wyzant · Text (657) 465-8108