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 · 72 slides · symbolic lesson

Open the interactive version of this deck

What this lesson covers

The lesson, slide by slide

1. Composition of Functions

Title

Precalculus · Section 1.4

Wiring the output of one rule into the input of another

2. What this lesson gives you

Objectives

Section 1.2 gave you one function at a time. This lesson builds new functions out of two old ones, first by ordinary arithmetic on their outputs, and then by the operation that matters most for the rest of the course: feeding one function's answer into the other.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 83-99 — learning objectives 1.4.1 to 1.4.5

Up to now a function has arrived on its own: one rule, one domain, one graph. This lesson is about building new functions out of two you already have, and there are two quite different ways to do it.

The first way is arithmetic. Evaluate both functions at the same input and then add, subtract, multiply or divide the two answers. That takes about ten minutes to learn, because ordinary arithmetic does all the work, and the only new idea is that the result is defined only where both originals are.

The second way is composition, and it takes the rest of the lesson. Here one function's answer becomes the other function's question. That single change brings three genuinely new difficulties: the order matters, the domain is decided partly by a function that vanishes from the final formula, and you will often need to run the process backwards and recognise a composition inside a rule that was handed to you whole.

Everything here is used constantly later. Section 1.5 treats every transformation of a graph as a composition, Section 1.7 is about pairs of functions that undo each other, and the chain rule in calculus is nothing but composition differentiated.

3. Double then add, or add then double?

Warm-up

Discussion prompt

Take the number 5. Double it, then add 3, and write down what you get. Now start over with 5: add 3 first, then double. Do you get the same number? Say in one sentence what the difference is.

Write both answers down before you reveal anything. This takes ten seconds and it plants the idea the whole lesson rests on.

You should have got thirteen one way and sixteen the other. Look at why. In the second run the three was added before the doubling happened, so the doubling acted on eight rather than on five, and the extra three got doubled along with everything else.

You have been composing operations since primary school without a name for it. What this section adds is a notation for the chain and a careful account of when the chain is allowed to run at all. Keep this warmup in mind when you meet the claim that the two orders of a composition are generally different functions: you have just proved a case of it yourself.

4. Combining functions with arithmetic

Section

Part 1

5. Four ways to combine two functions pointwise

Concept

Two functions with number outputs can be combined by doing ordinary arithmetic to their outputs, one input at a time. The result is a brand new function.

\[ (f + g)(x) = f(x) + g(x), \qquad (f - g)(x) = f(x) - g(x) \]

\[ (fg)(x) = f(x)\,g(x), \qquad \left(\frac{f}{g}\right)\!(x) = \frac{f(x)}{g(x)} \]

The book's example is a household budget. If one partner earns a certain amount in year y and the other earns another amount in the same year, the total household income is a third function of y, obtained by adding the two outputs for every year.

\[ T(y) = h(y) + w(y), \qquad \text{written simply as } T = h + w \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 83-84 — combining functions using algebraic operations

Read the four definitions as instructions rather than as symbols. Each one says: pick an input, evaluate both functions there, and then do one piece of arithmetic to the two answers you get.

The household income example is worth holding on to, because it shows why anyone would want this. You have two columns of numbers indexed by the same years, and you want a third column. Adding them year by year is exactly what the sum of two functions means, and once you trust that it works for every year you can drop the year from the notation and write the relationship between the functions themselves.

Notice that nothing here is fed into anything. Both functions look at the same original input, independently. That sounds obvious now, but it is the exact point that gets lost in about twenty minutes when composition arrives, so fix it while it is still easy.

6. Reading the four combination rules

Notation

Annotate

On: \( \left(\frac{f}{g}\right)\!(x) = \frac{f(x)}{g(x)} \)

  • f over g is the NAME of a new function. The parentheses around x say it is being evaluated, just like any other function.
  • Two separate evaluations at the SAME input x, and then one division. Nothing is fed from one function into the other.
  • For this to make sense, x must be an input the top function accepts. That is the first domain condition.
  • x must also be an input the bottom function accepts, and the value g(x) must not be zero. That is the extra condition division brings.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 84 — the definitions of f + g, f − g, fg and f/g

Step through the annotations one at a time. The quotient is worth decoding carefully because it carries all the complications the other three do, and one more of its own.

The left-hand side is a name. The symbol for f over g is the name of a new function, and putting x in brackets after it means that new function is being evaluated. The right-hand side is the recipe: two separate evaluations at the same input, followed by one division.

Two of the annotations are about inputs and one is about an output. Both original functions must accept x, which is a condition on the input, and the bottom function must not return zero there, which is a condition on what comes out. Those are different kinds of requirement, and keeping them apart will save you a lot of trouble in the second half of this lesson.

7. Example 1.39: a difference and a quotient

Worked example

Find and simplify the difference and the quotient below, and decide whether they are the same function.

\[ f(x) = x - 1, \qquad g(x) = x^2 - 1 \]

Write the general form for the difference

Why: Subtract the outputs at the same input.

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

Substitute both rules

Why: Keep the whole of f inside brackets; the minus sign applies to all of it.

\[ (g - f)(x) = (x^2 - 1) - (x - 1) \]

Remove the brackets and collect

Why: The two constants cancel.

\[ (g - f)(x) = x^2 - 1 - x + 1 = x^2 - x \]

Factor the result

Why: A common factor of x.

\[ (g - f)(x) = x(x - 1) \]

Write the general form for the quotient

Why: Divide the outputs at the same input.

\[ \left(\frac{g}{f}\right)\!(x) = \frac{g(x)}{f(x)} = \frac{x^2 - 1}{x - 1} \]

Factor the numerator and cancel

Why: The difference of two squares. The cancelling is only legal where the denominator is not zero.

\[ \frac{(x + 1)(x - 1)}{x - 1} = x + 1, \qquad x \ne 1 \]

Check both at a sample input

Why: At x equal to 3, g is 8 and f is 2. The difference should be 6 and the quotient 4, and the two answers differ, so the two functions are not the same.

\[ g(3) - f(3) = 8 - 2 = 6 = 3(3 - 1), \qquad \frac{8}{2} = 4 = 3 + 1 \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 84 — Example 1.39

The one place this goes wrong is the bracket in the second line. You are subtracting a whole function, not just its first term, so the whole of the second rule has to go inside brackets before the minus sign is distributed. Drop that bracket and the plus one comes out with the wrong sign.

The quotient is the more interesting half. Factoring the top as a difference of two squares makes a factor of the bottom appear, and cancelling it leaves a simple linear rule. But cancelling is only legal where the thing you cancelled is not zero, which is why the condition on the input is written alongside and not treated as an afterthought.

The check at the end is a habit to build now. Pick any easy input, evaluate both original functions there, do the arithmetic by hand, and confirm that your simplified formula agrees. It takes fifteen seconds and it catches sign errors, dropped brackets and bad cancellations.

8. The hole the quotient leaves behind

Picture it

Figure (svg): The straight line y equals x plus one drawn across the plane, with a small open circle punched out at the point where x is one and y is two.

Cancelling the common factor gives the line, but it cannot give back the input that was never allowed. The graph is the line with one point removed.

The simplified rule is the straight line. The original quotient is that same line with a single point removed, because the input 1 made the bottom function zero and no amount of cancelling can put it back.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 84 — the note after Example 1.39

Look at the picture rather than the algebra for a moment. The simplified rule is an ordinary straight line, defined everywhere, and the original quotient agrees with it at every input except one.

At that one input the original was asked to divide by zero, so it simply had no value. The graph records that with a hollow circle: the line is there, but that particular point of it is not.

This is the shape of a mistake you will make repeatedly if you are not careful, and it comes back in a bigger way later in this lesson when a composition is simplified and a restriction disappears from view. The rule to remember is that simplifying can never give a function new inputs; it can only hide the fact that some were missing.

9. Try It 1.25: the product and the other difference

Worked example

Same two functions. Find the product and the difference taken the other way round.

\[ f(x) = x - 1, \qquad g(x) = x^2 - 1 \]

Write the product as a single expression

Why: Multiply the two outputs.

\[ (fg)(x) = (x - 1)(x^2 - 1) \]

Expand

Why: Multiply each term of the first bracket by each term of the second.

\[ (fg)(x) = x^3 - x - x^2 + 1 \]

Write it in descending powers

Why: Reorder the four terms.

\[ (fg)(x) = x^3 - x^2 - x + 1 \]

Write the difference the other way round

Why: Now f comes first.

\[ (f - g)(x) = (x - 1) - (x^2 - 1) \]

Remove the brackets and collect

Why: The constants cancel again, and the squared term changes sign.

\[ (f - g)(x) = x - 1 - x^2 + 1 = -x^2 + x \]

Check at a sample input, and compare the two differences

Why: At x equal to 2 the product is 1 times 3, which is 3, and the cubic gives 8 minus 4 minus 2 plus 1, also 3. The difference taken this way is minus 2, the opposite of the plus 2 found in Example 1.39, so the two differences are not the same function.

\[ (fg)(2) = 3 = 8 - 4 - 2 + 1, \qquad (f - g)(2) = -2 = -(g - f)(2) \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 84 — Try It 1.25

Do this one on paper before you read the steps. It is the same pair of functions as the worked example, so there is nothing new to learn, only the algebra to get right.

For the product, expand carefully and then put the terms in descending order of power. It is tempting to leave the answer as two brackets multiplied together, and that is not wrong, but writing it out lets you compare it with the other combinations and see that it is a cubic.

The difference is where the point of the exercise sits. Taking f minus g gives exactly the negative of the g minus f found in the worked example, so the two are not the same function. Subtraction of functions is no more commutative than subtraction of numbers, and that is a small rehearsal for the much more important failure of commutativity coming in Part 4.

10. Why a combination needs both domains at once

Intuition

Figure (svg): A number line from zero to twelve with three bars beneath it. The first bar covers the whole line. The second starts at five with a solid dot and runs right. The third starts at five with a hollow dot and runs right.

Each combination inherits the inputs both originals accept. Dividing throws away one more: the input where the bottom function is zero.

To compute a sum you must evaluate both functions at the same input, so that input has to be legal for both. The domain of the combination is therefore the overlap of the two domains, never the union of them.

Division adds one more condition, and it is a condition about outputs rather than inputs: wherever the bottom function returns zero, the quotient is undefined, even though both original functions were perfectly happy there.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 95 — Exercise 209

Look at the three bars. The top one is the whole line, because a polynomial accepts every real number. The middle one starts at five, because a square root refuses a negative inside. The bottom one starts just after five.

To evaluate a sum you need both original values at the same time, so the input has to be legal for both functions. That means you take the overlap of the two domains, not the union. Students who reason that the sum should be defined wherever either piece is defined have confused the two set operations, and the bar picture is the quickest cure.

The third bar shows what division adds. Five is a perfectly legal input for both original functions, so it survives the overlap, and then it is removed for a completely different reason: the bottom function returns zero there. Notice that this is a condition about an output, which is the first hint of the thinking you will need for the domain of a composition.

11. Exercise 205: all four combinations at once

Worked example

Build all four combinations and give the domain of each.

\[ f(x) = x^2 + 2x, \qquad g(x) = 6 - x^2 \]

Add the two rules

Why: The squared terms cancel.

\[ (f + g)(x) = x^2 + 2x + 6 - x^2 = 2x + 6 \]

Subtract them

Why: Subtracting a negative squared term doubles it.

\[ (f - g)(x) = x^2 + 2x - 6 + x^2 = 2x^2 + 2x - 6 \]

Multiply them

Why: Expand the product of the two rules.

\[ (fg)(x) = (x^2 + 2x)(6 - x^2) = -x^4 - 2x^3 + 6x^2 + 12x \]

Divide them

Why: Write one over the other.

\[ \left(\frac{f}{g}\right)\!(x) = \frac{x^2 + 2x}{6 - x^2} \]

State the domains

Why: Both originals accept every real number, so the first three do too. The quotient loses the inputs where the bottom is zero.

\[ 6 - x^2 = 0 \;\Longrightarrow\; x = \pm\sqrt{6} \]

Write the quotient's domain in interval notation

Why: Two points removed from the line.

\[ (-\infty, -\sqrt{6}) \cup (-\sqrt{6}, \sqrt{6}) \cup (\sqrt{6}, \infty) \]

Check every line at one input

Why: At x equal to 1, f is 3 and g is 5. The sum should be 8, the difference minus 2, the product 15, the quotient three fifths, and each formula agrees.

\[ 2(1) + 6 = 8, \; 2 + 2 - 6 = -2, \; -1 - 2 + 6 + 12 = 15, \; \tfrac{3}{5} \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 95 — Exercise 205

This is the standard exam question on the first half of the section, so it is worth doing all four parts in one sitting rather than picking one.

The sum is prettier than you might expect, because the squared terms cancel and a quadratic pair collapses to a straight line. The difference does the opposite and doubles the squared term. The product is the only messy one, and the safe route is to expand fully and then order the terms by power.

The domains are the real content. Three of the four combinations accept every real number, because both originals do. The quotient loses exactly the inputs where the bottom is zero, and since the bottom is six minus a square, those are the positive and negative square roots of six. Writing that as three intervals is the standard form the book expects.

The final line checks all four formulas against one input at once. If a single one of them disagrees, you know exactly which expansion to go back to.

12. Which domain rule applies?

Sorting

Sort into buckets

For each combination, decide whether the domain is just the overlap of the two domains, or the overlap with something further removed.

Just the overlap
(f + g)(x); (f − g)(x); (fg)(x); (f + g)(x), where f contains a square root
Overlap, then remove more
(f/g)(x), where g has two zeros; (g/f)(x), where f has one zero
over
Adding, subtracting and multiplying need only that both functions can be evaluated, so the overlap of the two domains is the whole story. A square root inside f is already accounted for in f's own domain.
more
Division also requires the bottom function to be nonzero. Those inputs are legal for both originals, so they survive the overlap and then have to be removed separately.

Sort all six before revealing. You are not being asked what the domains actually are, only which rule you would reach for.

Four of them are pure overlap. Adding, subtracting and multiplying all need nothing more than both functions being evaluable at the same input. The last of the four is there to catch a specific worry: a square root inside one of the functions does restrict things, but that restriction is already part of that function's own domain, so the overlap handles it without any new rule.

Two of them need something extra. Whenever a function sits underneath, its zeros have to be removed, and they have to be removed after the overlap is taken, not instead of it. The number of zeros does not change the method, only how many points you punch out.

13. Trap: cancelling puts the missing point back

Trap

The trap

A quotient is simplified, and the domain is read off the tidy answer:

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

\[ \text{domain: all reals?} \]

Wrong. The tidy answer accepts an input the original never did.

The fix

Find the domain before you simplify. The original quotient divides by zero at the input 1, so 1 is out, and cancelling cannot let it back in.

\[ \frac{x^2 - 1}{x - 1} = x + 1, \quad x \ne 1 \]

The graph is the line with one point punched out.

This is the single most common slip in the first half of the section, and it happens because the algebra feels like it is telling you something. You cancel, you get a clean linear rule, and the clean rule genuinely has no restrictions, so it is very natural to report that there are none.

The defence is an order of operations for your own working: find the domain first, from the unsimplified expression, and only then tidy the formula. Once the domain is written down, no amount of algebra can take it away from you.

If you want a picture to keep, keep the hollow circle. The simplified rule and the original agree everywhere except at one point, where one of them has a value and the other has nothing at all.

14. Finish the domain of a sum with a square root

Fill the middle

\[ f(x) = 3x^2, \qquad g(x) = \sqrt{x - 5} \]

Fill in the blanks

\text5 f + g: \; x \ge 5, \qquad \text___ \tfrac______: \; x > ___

Why: The first rule accepts every real number, so the overlap is decided entirely by the square root, which needs its inside to be at or above zero, giving five and above. For the quotient the bottom must also be nonzero, and the square root is zero at exactly five, so five itself drops out and the domain is everything strictly above five.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 95 — Exercise 209

Fill both blanks before checking. They happen to be the same number, and that is not a coincidence worth being pleased about, so read the reason for each separately.

The first blank is about the overlap. One function accepts everything, so the overlap is entirely decided by the square root, which needs whatever is under it to be at or above zero.

The second blank is about division. The same overlap applies, and then the bottom function must not be zero. A square root is zero exactly where its inside is zero, so the single endpoint drops out and the interval becomes open at the left. Notice the wording change from at or above to strictly above; on an exam that distinction is worth a mark.

15. Composition: the machine picture

Section

Part 2

16. The cost of heating a house on day five

Concept

Figure (svg): Two graphs. The left one plots average daily temperature against the day of the year as a wave running from about minus two up to twenty six degrees, with day five marked low on the wave. The right one plots heating cost against temperature as a falling straight line, with the temperature from the left graph marked on it and a cost of about eight dollars fifty read off.

Two separate functions, read one after the other. Day five is cold, so the cost is high; the day never touches the cost graph directly.

The book opens with a chain of two dependencies. What it costs to heat a house depends on the average temperature, and the average temperature depends on the day of the year. Neither function mentions the other's variable.

\[ C(T) \text{: cost from temperature}, \qquad T(d) \text{: temperature from day} \]

To get the cost on day five, you cannot put 5 into the cost function; the cost function does not accept days. You evaluate the temperature function first and put its answer into the cost function.

\[ \text{cost on day } 5 = C\bigl(T(5)\bigr) \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 83 — the opening example

Look at the two graphs before the algebra. The left one is a wave, because the average temperature rises and falls with the seasons. The right one is a falling line, because the colder it is the more you spend. Neither graph mentions the other's variable anywhere.

Now follow the dashed lines. Day five sits in the coldest part of the wave, at a temperature just below zero. That temperature is then carried across and used as a horizontal position on the second graph, where it produces a cost of about eight dollars fifty for that day.

The key sentence in this slide is that you cannot put the number five into the cost function. The cost function accepts temperatures, and five is a day. This is not a technicality about notation; it is the real reason composition exists as a separate idea. Two functions can be chained only when the first one's outputs are the kind of thing the second one's inputs are.

17. Two machines wired in series

Picture it

Figure (svg): A wiring diagram. Top row: an input x enters a box labelled g, its output g of x leaves and enters a box labelled f, whose output is f of g of x. Bottom row: the same chain with numbers, 1 entering an add-two box, 3 leaving it and entering a squaring box, and 9 coming out.

Follow the wire. The number 1 never reaches the squaring machine untouched; what arrives there is 3, the output of the first machine.

Draw each function as a machine with an input slot and an output chute. Composition wires the first machine's chute into the second machine's slot, and the pair now behaves as a single machine.

composite function — The function that applies g first and then f. Its value at an input x is found by evaluating g at x and then evaluating f at that result.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 85 — the definition of a composition

This picture is the one to carry with you for the rest of the lesson. Whenever you lose track of which function acts first, draw two boxes and an arrow.

The top row is the general case and the bottom row is a concrete run. Follow the bottom row carefully: the number one goes into the first machine and never reaches the second machine at all. What reaches the second machine is three, the first machine's output. That is why squaring the original input would be wrong here, and why the answer is nine rather than one.

Notice also that the pair of machines, bolted together, behaves like a single machine with one input slot and one output chute. That is what it means to call the composition a function in its own right: you can now ask about its domain, its graph and its own compositions with other functions.

18. Reading f composed with g

Notation

Annotate

On: \( (f \circ g)(x) = f\bigl(g(x)\bigr) \)

  • The composition operator. Read the left side as f composed with g at x, and the right side as f of g of x. They mean exactly the same thing.
  • In the circle notation g is written second, but it acts FIRST. The function nearest the x is the one the input meets first.
  • Ordinary order of operations: innermost brackets first. Evaluate g at x, then hand the answer to f.
  • The circle is not a multiplication sign. In general f of g of x is nothing like f of x times g of x.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 85 — equation 1.2

Work through the annotations slowly, because the notation is genuinely awkward and being fluent with it saves a great deal of confusion later.

The awkward part is the second annotation. In the circle notation the two names are written left to right, but the one on the right acts first. There is no way around this; it is the price of matching the notation for f of g of x, where the same reversal is forced by the brackets. The reliable rule is that the function written closest to the input is the one the input meets first.

The last annotation is the one that costs marks. The circle is not a multiplication dot. It is worth writing out, once, both the product and the composition of a simple pair and seeing how different they are, which is exactly what the next slide does.

19. Composition is not multiplication

Concept

Figure (svg): Two diagrams side by side. On the left, the input x splits and goes into both f and g at the same time, and their two outputs meet at a plus sign. On the right, the input x goes into g, and only g's output goes into f.

In a sum the two rules never meet. In a composition one rule's answer is the other rule's question, which is why swapping them changes everything.

This is the most expensive confusion in the section, because the notation looks similar and the words sound similar. A product evaluates both functions at the same input and multiplies the two answers. A composition evaluates one function and hands its answer to the other.

\[ f(x)\,g(x) \;\ne\; f\bigl(g(x)\bigr) \quad \text{in general} \]

Composition is a binary operation on functions, in the same way that addition is a binary operation on numbers: it takes two functions and returns a new one. Unlike addition, it cares which one goes first.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 85 — the warning about composition and multiplication

Compare the two diagrams directly. On the left the input arrow splits, and both machines receive the same original number; whatever they produce is then combined at the end. On the right there is only one path, and the second machine never sees the original number.

That difference in wiring is the whole story. In the parallel picture it makes no difference which machine you draw on top, so a sum or product of functions does not care about order. In the series picture, swapping the machines changes which one gets the raw input, so the answer changes.

Calling composition a binary operation is a useful way to think of it. Just as addition takes two numbers and makes a third, composition takes two functions and makes a third. The analogy is good, but it stops at commutativity, which addition has and composition does not.

20. Squaring after shifting, and shifting after squaring

Worked example

The book's first pair. Compose these two simple rules both ways and compare.

\[ f(x) = x^2, \qquad g(x) = x + 2 \]

Substitute g into f

Why: Wherever f says its input, write the whole of g.

\[ f\bigl(g(x)\bigr) = f(x + 2) = (x + 2)^2 \]

Expand

Why: Square the binomial.

\[ f\bigl(g(x)\bigr) = x^2 + 4x + 4 \]

Now substitute f into g

Why: Wherever g says its input, write the whole of f.

\[ g\bigl(f(x)\bigr) = g(x^2) = x^2 + 2 \]

Set the two results equal and solve

Why: Ask whether they can ever agree.

\[ x^2 + 4x + 4 = x^2 + 2 \;\Longrightarrow\; 4x = -2 \;\Longrightarrow\; x = -\tfrac12 \]

Figure (svg): Three curves. A dashed parabola y equals x squared sits in the middle; a solid parabola two units to its left is labelled f of g of x; another solid parabola two units above it is labelled g of f of x. A dot marks the single input where the two solid curves agree.

Composing inside shifts the graph sideways; composing outside shifts it up. The gold dot is the single input where the two agree, which is not the same as being the same function.

Check at that input and at one other

Why: At minus a half both give 2.25, and at x equal to 1 they give 9 and 3. Agreeing at one single input is not the same as being the same function.

\[ f(g(1)) = 9, \quad g(f(1)) = 3, \qquad f(g(-\tfrac12)) = g(f(-\tfrac12)) = \tfrac94 \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 85 — the example before the definition

These are the two simplest interesting functions in the book, and they already show everything. Substituting the inner rule into the outer one is a mechanical move, but write the brackets: the whole of the inner rule goes where the outer rule's input sits, and only then do you expand.

Notice how different the two answers are. One is a quadratic with a linear term, the other a quadratic without one. Setting them equal and solving shows there is exactly one input where they agree, at minus a half.

Look at the graph. Composing on the inside shifted the parabola sideways; composing on the outside lifted it upwards. Those two curves cross once, and the crossing is exactly the input you solved for. Agreeing at one input is a very long way from being the same function, and you will meet people who think one shared value proves equality. It proves nothing at all.

21. Which function touches the input first?

Prediction

\[ h\Bigl(g\bigl(f(x)\bigr)\Bigr) \]

Predict first

Three functions are nested. Which one is applied to the raw input x?

  • f, because it is written closest to x
  • h, because it is written first
  • g, because it is in the middle
  • All three at once

Correct: f, because it is written closest to x

Why: Nested brackets are worked from the inside out, exactly as in ordinary arithmetic. The raw input reaches f, f hands its answer to g, and g hands its answer to h. Reading left to right gives the order backwards, which is why so many students compose in the wrong direction.

Commit to an option before revealing. This is a ten-second question, and the point is to make the inside-out habit automatic before the algebra gets heavy.

Nested brackets are worked innermost first, exactly as in ordinary arithmetic. The raw input reaches the function written closest to it, and each answer is handed outwards one layer at a time.

If you picked the one written first, you read left to right, which is the natural reading order for everything else you do and exactly the wrong order here. It is a good idea to get into the habit of scanning a nested expression from the inside out, physically starting at the x and working out, until it stops feeling strange.

22. Example 1.41: what does c of s of 3 mean?

Socratic

Two functions from a fitness tracker. One counts calories burned from a number of sit-ups; the other counts sit-ups completed in a number of minutes.

\[ c(s) \text{: calories from sit-ups}, \qquad s(t) \text{: sit-ups from minutes} \]

Discussion prompt

Interpret the expression c of s of 3 in plain English. Say what the 3 measures, what the inner evaluation gives, and what the whole expression gives.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 86 — Example 1.41

Write a sentence before revealing. Interpretation questions like this appear on every test on this section, and they are easier than the algebra if you keep the units in view.

The three is a number of minutes, because the inner function is the one that accepts minutes. The inner evaluation therefore produces a number of sit-ups, which is a count, not a time. That count then goes into the calorie function, which is the only function here that accepts counts of sit-ups.

So the whole expression is a number of calories. The general lesson is that the units of the inner output must match the units of the outer input, and when they do, the composition tells you a genuinely new thing: calories burned per three minutes of exercise, from two functions neither of which mentioned both quantities.

23. Example 1.42: which composition is meaningful?

Elimination

\[ f(x) \text{: miles driven in } x \text{ hours}, \qquad g(y) \text{: gallons used driving } y \text{ miles} \]

Eliminate the wrong options

Only one of these expressions makes sense. Cross out the ones that do not, and say what each one would be trying to feed into what.

  • a. f(g(y))
  • b. g(f(x))
  • c. f(x) g(y)
  • d. f(f(x))

Survives elimination: b

Why: The outer function must accept whatever the inner function produces. Miles come out of f and miles go into g, so g of f of x is the one that works: it gives the gallons used in driving for x hours. Every other option feeds a quantity into a function that measures something else.

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

Eliminate the impossible options before you read the reasons. This is the same units argument as the sit-up example, with the difference that here one order is meaningless rather than merely different.

One function turns hours into miles; the other turns miles into gallons. Miles come out of the first and miles go into the second, so the gallons function belongs on the outside. Any other arrangement asks a function to accept a quantity it does not measure.

The product option is worth a second look. It is not meaningless in the sense of being undefined, since you can certainly multiply two numbers, but miles times gallons is not a quantity anyone wants, and it is not a composition at all. Keeping the product and the composition apart in your head is worth the effort.

24. Try It 1.26: force first, then acceleration

Real world

Two functions from physics. One gives the gravitational pull on a planet at a given distance from the sun; the other gives the acceleration a planet undergoes when a given force acts on it.

\[ G(r) \text{: force at distance } r, \qquad a(F) \text{: acceleration from force } F \]

Discussion prompt

Form the one composition of these two functions that makes sense, and say in a sentence what the new function does.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 87 — Try It 1.26

Try this on your own before revealing. There is no algebra at all; the only question is which function goes on the outside.

One function gives a force from a distance, and the other gives an acceleration from a force. Force is what comes out of the first and what goes into the second, so the acceleration function is the outer one and the composite takes a distance from the sun and returns an acceleration.

This is genuinely how the physics is organised. Newton's law of gravitation gives you a force at a distance, and the second law converts a force into an acceleration. Chaining them is what lets an astronomer predict an orbit from a distance alone, and the chaining is exactly the composition you just wrote down.

25. Evaluating a composition

Section

Part 3

26. Inside out, one evaluation at a time

Concept

Whatever form the two functions come in, the procedure never changes: evaluate the inner function at the starting input, then evaluate the outer function at that result. Two lookups, in that order, and never both at once.

\[ f\bigl(g(3)\bigr): \quad \text{first find } g(3), \text{ then evaluate } f \text{ there} \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 87 — evaluating composite functions

The four bullets look like four different procedures, but they are one procedure in four costumes. In every case you evaluate the inner function first and then use its answer as the input to the outer function.

It is worth practising the table and graph versions specifically, even though the formula version is the one that appears most often. With formulas you can substitute mechanically and get the right answer without ever really thinking about the two stages. With a table you cannot; you have to physically look up two things, and the second lookup uses a number that was not in the question.

The last bullet is the one that produces a formula rather than a number. Instead of a specific value, you substitute the entire inner rule, in brackets, wherever the outer rule shows its input. It is the same move, done with an expression instead of a number.

27. Example 1.43: a composition from a table

Worked example

The two functions are given only as a table of four inputs. Find both compositions at the input 3.

xf(x)g(x)
163
285
332
417

Start inside for the first one

Why: The inner function is g, so look up 3 in the g column.

\[ g(3) = 2 \]

Use that output as the new input

Why: Now the input to f is 2, not 3.

\[ f\bigl(g(3)\bigr) = f(2) \]

Read f at 2

Why: Look up 2 in the f column.

\[ f\bigl(g(3)\bigr) = 8 \]

Now the other order

Why: The inner function is f this time.

\[ f(3) = 3, \qquad g\bigl(f(3)\bigr) = g(3) = 2 \]

Figure (svg): Two dot plots. The left one shows the four values of g at the inputs one to four, with the point at input three and output two highlighted and dashed lines dropping to the axes. The right one shows the four values of f, with the point at input two and output eight highlighted.

The output of the left plot becomes the input of the right plot. The number 3 is used once and then never again.

Check that the two orders really differ

Why: Eight against two: the same input and the same two functions, in different orders, give different answers. It is a coincidence that f of 3 equals 3, and that coincidence is what makes the second chain so short.

\[ f\bigl(g(3)\bigr) = 8 \;\ne\; 2 = g\bigl(f(3)\bigr) \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 87-88 — Example 1.43 and Table 1.21

Cover the solution and try both compositions yourself. All the information you need is four rows of numbers.

For the first one, the inner function is the second column. Look up three there and you get two. Now two is your new input, and you look it up in the first column, where it gives eight. Two lookups, and crucially the second one uses a number that never appeared in the original question.

The other order is shorter only by accident. The outer function happens to return three when you feed it three, so the chain looks like it does nothing on the first step. Do not read anything into that; it is a coincidence of these four rows.

The picture shows both chains as dots with dashed guides. The dashed vertical line on the left drops to a height, and that height becomes a horizontal position on the right. That switch, from reading a height to using it as a position, is the step to slow down on, and it is exactly the step the graph version of this idea makes visible.

28. Try It 1.27: two more table lookups

Prediction

xf(x)g(x)
163
285
332
417

Predict first

Using the same table, what are f of g of 1, and g of f of 4?

  • Both equal 3
  • 6 and 3
  • 3 and 7
  • 8 and 2

Correct: Both equal 3

Why: For the first, g at 1 is 3, and f at 3 is 3. For the second, f at 4 is 1, and g at 1 is 3. The two happen to agree here, which is a coincidence of this particular table and not a general rule.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 88 — Try It 1.27

Work both out before choosing an option. The table is the same one; only the inputs have changed.

For the first, the inner function sends one to three, and then the outer function sends three to three. For the second, the outer function is now on the inside: it sends four to one, and then the other function sends one to three.

Both come out as three, and it is important to see that this is a coincidence rather than evidence that the order does not matter. The previous slide, with the same table, gave eight one way and two the other. One matching pair proves nothing.

29. Example 1.44: a composition from two graphs

Worked example

The two functions are given only as graphs. Find the value of f of g of 1.

Figure (svg): Two graphs side by side. Panel a is an upward parabola with its lowest point at three, minus one; an arrow rises from x equals one to the curve at height three. Panel b is a downward parabola with its highest point at three, six; an arrow rises from x equals three to the curve at height six.

Two separate readings. The height you read on the left becomes the horizontal position you use on the right.

Locate the input on the inner graph

Why: Go to 1 on the horizontal axis of the graph of g.

\[ x = 1 \text{ on graph (a)} \]

Read the inner output

Why: Climb to the curve and read the height.

\[ g(1) = 3 \]

Carry that number to the other graph

Why: The number 3 is now a horizontal position, not a height.

\[ f\bigl(g(1)\bigr) = f(3) \]

Read the outer output

Why: Climb to the curve on graph (b) and read the height.

\[ f\bigl(g(1)\bigr) = 6 \]

Check with the other order, Try It 1.28

Why: Reading f at 2 gives 5, and then g at 5 gives 3. So g of f of 2 is 3, and the two orders again disagree. The switch from reading a height to reading a position is the step to slow down on.

\[ f(2) = 5, \quad g(5) = 3 \;\Longrightarrow\; g\bigl(f(2)\bigr) = 3 \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 89-91 — Example 1.44, Figure 1.62, and Try It 1.28

This is the version of the idea most likely to appear on a test, because it cannot be done mechanically. Try it from the picture before reading the steps.

Go to one on the horizontal axis of the left graph, climb to the curve, and read the height: three. Now carry that three across to the right graph, but use it as a horizontal position rather than a height. Climb to the curve there and read six.

The arrows on the picture record exactly that path. Notice that the number three does two different jobs in two different places, first as an output and then as an input, and that is the entire content of composition drawn out.

The check runs the other order, which is the Try It for this example. Reading the right graph first at two gives five, and then the left graph at five gives three. Different answer, same two graphs.

30. Example 1.45: a number through two formulas

Worked example

Both rules are formulas now, and the input is a number.

\[ f(t) = t^2 - t, \qquad h(x) = 3x + 2, \qquad \text{find } f\bigl(h(1)\bigr) \]

Evaluate the inner function at 1

Why: The inner expression is h of 1, so start there.

\[ h(1) = 3(1) + 2 = 5 \]

Replace the inner expression by its value

Why: The outer function is now being evaluated at 5.

\[ f\bigl(h(1)\bigr) = f(5) \]

Substitute 5 into the outer rule

Why: Wherever the outer rule shows its input, write 5.

\[ f(5) = 5^2 - 5 \]

Finish the arithmetic

Why: Twenty five minus five.

\[ f\bigl(h(1)\bigr) = 20 \]

Check that the letters do not matter

Why: The outer rule was written in t and the inner one in x, but both were evaluated at numbers, so the names are irrelevant. Feeding 1 into the outer rule first would give zero, and then h of 0 is 2, which is a completely different answer.

\[ f(1) = 0, \quad h(0) = 2 \;\Longrightarrow\; h\bigl(f(1)\bigr) = 2 \ne 20 \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 91-92 — Example 1.45

Both rules are formulas now, so there is a temptation to substitute into both at once. Resist it and keep the two stages separate.

The inner expression is the one in the innermost brackets, so evaluate it first and get five. Only now does the outer rule come into play, and its input is five, not one. Substituting one into the outer rule would give zero, a completely different and completely wrong answer.

One small thing worth noticing: the two rules were written with different letters for their inputs. That makes no difference at all here, because both were evaluated at numbers. A function's input letter is a placeholder, and the name of the placeholder never affects the value.

31. Try It 1.29: the same pair in the other order

Faded example

\[ f(t) = t^2 - t, \qquad h(x) = 3x + 2 \]

Fill in the blanks

f(2) = 2 \qquad\text8\qquad h\bigl(f(2)\bigr) = ___

Why: The inner function is now the quadratic one. Two squared minus two is two, and then three times two plus two is eight. Work strictly inside out: the outer rule never sees the original input.

The second half of the Try It uses the input minus two instead, and it is worth doing both lines rather than just one.

\[ f(-2) = (-2)^2 - (-2) = 6, \qquad h\bigl(f(-2)\bigr) = 3(6) + 2 = 20 \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 92 — Try It 1.29

Fill the two blanks before checking. The pair is the same as in the worked example, but the roles have swapped, so the quadratic rule is now the inner one.

Two squared minus two is two, and then three times two plus two is eight. Note that the inner answer, two, happens to equal the input, which makes the chain look like it did nothing. It did; you just cannot see it.

The second line, with minus two as the input, is the more instructive one, because the squaring turns the negative into a positive and the inner answer jumps to six. Do both lines rather than one; the negative input is where sign errors live.

32. Exercise 216: composing the formulas themselves

Worked example

Now compose without ever choosing a number, so the answer is a formula.

\[ f(x) = 2x^2 + 1, \qquad g(x) = 3x - 5 \]

Substitute the whole inner rule into the outer one

Why: Wherever f shows its input, write the bracketed inner rule.

\[ f\bigl(g(x)\bigr) = 2(3x - 5)^2 + 1 \]

Expand the square

Why: Square the binomial before multiplying by 2.

\[ (3x - 5)^2 = 9x^2 - 30x + 25 \]

Multiply out and collect

Why: Double each term, then add the one.

\[ f\bigl(g(x)\bigr) = 18x^2 - 60x + 51 \]

Now the other order

Why: Wherever g shows its input, write the whole of f.

\[ g\bigl(f(x)\bigr) = 3(2x^2 + 1) - 5 = 6x^2 - 2 \]

Compose g with itself

Why: The same rule twice; nothing special happens.

\[ (g \circ g)(x) = 3(3x - 5) - 5 = 9x - 20 \]

Compose f with itself at minus two

Why: Inner first: f at minus two is 9, and then f at 9.

\[ (f \circ f)(-2) = f(9) = 2(81) + 1 = 163 \]

Check the general formula against a direct evaluation

Why: Part (a) of the exercise asks for f of g of 2. Directly, g at 2 is 1 and f at 1 is 3. The general formula at x equal to 2 gives 72 minus 120 plus 51, which is also 3.

\[ 18(4) - 60(2) + 51 = 3 = f(1) \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 95 — Exercise 216

This is the workhorse skill of the section. There is no number to evaluate at, so the answer must be a formula in x.

The move is always the same: wherever the outer rule shows its input, write the entire inner rule inside brackets. The brackets are not optional. Here the outer rule squares its input, and the inner rule has two terms, so without brackets you would square only the first of them.

Expand the square first and then multiply by the coefficient. Doing it in the other order is a classic source of a missing factor. The other three parts run the same way, including composing a function with itself, which feels strange the first time and is nothing special once you write it out.

The check is the one habit worth stealing from this slide. You have a general formula, so test it at a specific input by computing the two stages separately. If the two agree you have almost certainly expanded correctly.

33. Find the error: multiplying instead of composing

Error analysis

Annotate

On: \( f(x) = x^2, \; g(x) = x + 2 \;\Longrightarrow\; (f \circ g)(x) = x^2(x + 2) = x^3 + 2x^2 \)

  • It was read as a multiplication sign. The circle never means multiply; it means substitute.
  • This is the product of the two functions, a cubic. The composition is a quadratic, so even the degree is wrong.
  • Substitute the inner rule into the outer one: f of g of x is x plus 2, all squared, which expands to x squared plus 4x plus 4.
  • Check at x equal to 1. The wrong answer gives 3; the composition gives 9. One number would have caught it.

Look at the line before you reveal the annotations, and see whether you can name the mistake in one word.

The circle was read as a multiplication sign, so the two rules were multiplied together instead of one being substituted into the other. The result is a cubic; the correct composition is a quadratic. Getting the degree wrong is a good sign that something structural, not arithmetic, has gone astray.

The last annotation is the cheapest insurance you can buy. Test at the input one: the wrong line gives three, the correct composition gives nine. Any single input would have exposed it, and the check takes a few seconds.

34. Why this two-step habit matters in calculus

Intuition

Composition is not a curiosity of this chapter. Almost every function you will differentiate next year is a composition, and the rule for differentiating one, the chain rule, works by recognising the inner and outer parts.

\[ y = \sqrt{5 - x^2} \quad\text{is}\quad \text{outer } \sqrt{\,\cdot\,} \text{ applied to inner } 5 - x^2 \]

So the skill of spotting which part is inside and which part is outside, which the last section of this lesson trains directly, is being built here for a job you will do hundreds of times later.

It is worth knowing why this section gets so much attention for something that looks like a notation exercise.

Almost every function you will differentiate in a calculus course is a composition. The rule for differentiating one, called the chain rule, begins by asking you to identify the inner and the outer function, and then differentiates each and multiplies. If you cannot spot the seam, you cannot start.

So the decomposition skill coming up in Part 6 is not an oddity invented to fill a section. It is direct rehearsal for something you will do hundreds of times, and students who found the chain rule hard almost always found it hard because the decomposition step was never made automatic here.

35. Why the order matters

Section

Part 4

36. Composition is not commutative

Concept

Addition and multiplication of numbers do not care about order. Composition of functions does, and the reason is visible in the machine picture: swapping the machines changes which one receives the raw input.

\[ f \circ g \;\ne\; g \circ f \quad \text{in general} \]

This is not a rare failure. For most pairs of functions the two orders give genuinely different rules, and the pairs that do agree are special enough to have their own name, which you meet in Section 1.7.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 85 — the remark that the two orders are different functions

Addition and multiplication of numbers are commutative, and you have relied on that for so long that it feels like a property of operations in general. It is not.

Go back to the machine picture for the reason. Swapping the two machines changes which one receives the untouched input and which one receives a number that has already been altered. There is no principle that would make those two chains agree.

The pairs that do agree in both orders are special, and they are special in an interesting way: they undo each other, so both chains return the input unchanged. That is what an inverse pair is, and Section 1.7 is entirely about them. For now, treat agreement as something that must be demonstrated rather than assumed.

37. Example 1.40: two orders, two different rules

Worked example

Compose these two linear rules both ways and decide whether composition is commutative.

\[ f(x) = 2x + 1, \qquad g(x) = 3 - x \]

Substitute g into f

Why: Wherever f shows its input, write the whole of g in brackets.

\[ f\bigl(g(x)\bigr) = 2(3 - x) + 1 \]

Expand and collect

Why: Distribute the 2, then add the 1.

\[ f\bigl(g(x)\bigr) = 6 - 2x + 1 = 7 - 2x \]

Now substitute f into g

Why: Wherever g shows its input, write the whole of f in brackets.

\[ g\bigl(f(x)\bigr) = 3 - (2x + 1) \]

Remove the brackets

Why: The minus sign applies to both terms.

\[ g\bigl(f(x)\bigr) = 3 - 2x - 1 = 2 - 2x \]

Figure (svg): Two parallel straight lines of the same negative slope, one five units above the other, with a marked vertical gap at x equals one.

Same slope, different height. The two orders disagree at every single input, by exactly five.

Check the gap at a sample input

Why: Both rules have slope minus 2, but one sits five units above the other, so they differ at every input. At x equal to 1 they give 5 and 0, a gap of exactly 5, and the difference of the two formulas is the constant 5.

\[ (7 - 2x) - (2 - 2x) = 5 \quad \text{for every } x \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 86 — Example 1.40

Two linear rules, and the algebra is four lines long, so this is a good one to do entirely on paper first.

Both directions use the same move, substitution with brackets, and in the second direction the brackets matter more than usual because the outer rule subtracts its input. Miss the bracket and the plus one becomes a minus one and you will get a different answer.

Look at the picture. The two composites are parallel lines: the same slope, one sitting five units above the other. Parallel lines never meet, so these two functions disagree at every single input, not just at most of them. The vertical segment at one marks that constant gap.

The check computes the difference of the two formulas symbolically and gets the constant five. That is a stronger statement than checking one input, and it is worth doing when both composites turn out to be linear.

38. Socks and shoes

Intuition

Put on socks, then shoes, and the result is a dressed foot. Put on shoes, then socks, and the result is a strange sight. Both orders are perfectly well defined operations; they simply produce different outcomes.

That is the whole content of non-commutativity. It does not say that one order is illegal. It says that the two orders are two different functions, and you must build the one the problem asked for.

\[ (f \circ g)(x) \text{ and } (g \circ f)(x) \text{ are two separate rules} \]

This analogy is old and it is used because it works. Both orders of putting on socks and shoes are perfectly possible operations; they just give very different results, and only one of them is what anyone wants.

The point to take from it is a precise one. Non-commutativity does not mean that one order is illegal or undefined. Both compositions usually exist and both are perfectly good functions. What is false is the claim that they are the same function.

So when a question asks for a specific order, build that one. Read the notation carefully, identify which function is written closest to the input, and do not let the left-to-right reading of the circle notation talk you into the other chain.

39. Break the rule that order does not matter

Counterexample

Discussion prompt

Someone claims that f of g of x always equals g of f of x, because it is the same two functions either way. Give the simplest counterexample you can, and say in one sentence what your example proves.

Write your own counterexample before revealing, and try to make it as small as you can. A good counterexample is one you could reproduce under exam pressure in ten seconds.

Squaring and adding one is about as cheap as it gets. Start at the input one: one order gives four and the other gives two. A single input where the two chains disagree is enough to prove that the two composite functions are different, because functions are equal only when they agree at every input in a common domain.

The second half of the question matters more than the first. A counterexample tells you something structural, not just that one claim is false. Here it tells you that there is no reason to expect agreement at all, because the two chains feed the raw input to different machines. Agreement is the exception that needs explaining.

40. Exercise 283: a pair that does commute

Worked example

Some special pairs agree in both orders. Compose this pair both ways.

\[ f(x) = x^3 + 1, \qquad g(x) = \sqrt[3]{x - 1} \]

Substitute g into f

Why: The cube of a cube root undoes the root.

\[ f\bigl(g(x)\bigr) = \bigl(\sqrt[3]{x - 1}\bigr)^{3} + 1 = (x - 1) + 1 \]

Simplify

Why: The minus one and the plus one cancel.

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

Now substitute f into g

Why: Put the whole cubic under the cube root.

\[ g\bigl(f(x)\bigr) = \sqrt[3]{(x^3 + 1) - 1} = \sqrt[3]{x^3} \]

Simplify

Why: The cube root of a cube.

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

Check numerically, and name what happened

Why: At x equal to 2 the inner cube root gives 1 and then the cube gives 2; the other way, the cubic gives 9 and the cube root of 8 gives 2. Both orders return the input untouched, so these two functions undo each other. That relationship is called being inverses, and Section 1.7 is about it.

\[ f(g(2)) = 2, \qquad g(f(2)) = 2 \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 98 — Exercises 283 and 284

This one is worth doing carefully, because it is your first sight of something that becomes a whole section later.

Cubing undoes a cube root and a cube root undoes cubing, so in one direction the cube kills the root and the added one cancels the subtracted one, and in the other direction the added one cancels first and then the root kills the cube. Either way what comes out is exactly what went in.

A composition that returns its input untouched is called the identity, and a pair of functions with that property in both directions is called a pair of inverses. You will meet the definition properly in Section 1.7. What matters now is that this is why the two orders agree here: it is not luck, it is a genuine structural relationship, and it is rare.

41. Do these pairs commute?

Sorting

Sort into buckets

For each pair, decide whether the two orders of composition give the same function or different functions.

Same both ways
f(x) = x + 3 and g(x) = x − 3; f(x) = 2x and g(x) = 5x; f(x) = x³ + 1 and g(x) = cube root of (x − 1); f(x) = 1/x and g(x) = 1/x
Different
f(x) = x² and g(x) = x + 1; f(x) = 2x + 1 and g(x) = 3 − x
same
Two shifts by opposite amounts undo each other and give x. Two pure scalings give 10x either way, because multiplication of numbers is commutative. The cube and the cube root undo each other, and so does the reciprocal with itself.
diff
Squaring after adding one gives x squared plus 2x plus 1, while adding one after squaring gives x squared plus 1. The linear pair from Example 1.40 gives 7 minus 2x one way and 2 minus 2x the other.

Sort all six before revealing. For each one, actually compose in both directions rather than guessing from the shape of the rules.

Three of the same-both-ways cases are undoing pairs: a shift and the opposite shift, a cube and a cube root, and the reciprocal with itself. In each case both chains return the input. The fourth is different: two pure scalings commute because multiplying numbers is commutative, so ten times x comes out either way, and the two functions are not inverses at all.

The two that differ are the familiar kind. Squaring after adding one gives a quadratic with a linear term; adding one after squaring gives one without. And the linear pair is the one from Example 1.40, with its constant gap of five. Most pairs you meet will belong in this bucket.

42. Trap: treating the circle like a product

Trap

The trap

The circle gets read as a dot, and the two rules are simply multiplied:

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

\[ \text{with } f(x) = x^2,\; g(x) = x + 2 \]

\[ \Rightarrow\; x^3 + 2x^2 \]

Wrong by a whole degree.

The fix

The circle means substitute, not multiply. Put the inner rule where the outer rule shows its input.

\[ (f \circ g)(x) = (x + 2)^2 \]

One number settles it. At the input 1 the product gives 3 and the composition gives 9.

This is the same error as the earlier annotate slide, and it appears twice in this deck deliberately, because it is the single most common mistake in the section and it survives a long time if it is not confronted directly.

The circle means substitute. The way to keep that fixed is to say the notation out loud as f of g of x rather than as f circle g, because the spoken form has the substitution built into it and the written form does not.

The defence is a one-number test. Pick the easiest input you can and compute both the product and the composition. If they disagree, and they almost always will, you know immediately which one you have written down.

43. The domain of a composition

Section

Part 5

44. Two conditions, and one of them is invisible

Concept

An input x is allowed into a composition only if two things hold. First, the inner function must accept x at all. Second, the number the inner function produces must be an input the outer function accepts.

domain of a composition — The set of inputs x that are in the domain of the inner function and for which the inner function's output lies in the domain of the outer function.

\[ \text{domain of } f \circ g = \{\,x : x \in \text{dom } g \text{ and } g(x) \in \text{dom } f\,\} \]

The second condition is the one people check. The first is the one people forget, because once the algebra has been simplified the inner function has often disappeared from view.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 92-93 — the domain of a composite function

This is the hardest idea in the lesson, so read the definition twice and then read it a third time asking yourself what each condition is a condition on.

The first condition is about the input. The inner function has to accept x at all; if it does not, there is nothing to hand on and the chain never starts. The second condition is about an intermediate value. Whatever the inner function produces must be a legal input for the outer function.

People reliably check the second and forget the first, and there is a good reason. Once you have built the composite and tidied the algebra, the inner function has usually disappeared from the expression you are looking at, taking its restrictions with it. The rest of this part is about seeing that happen and learning to defend against it.

45. Reading the domain rule

Notation

Annotate

On: \( \text{dom}(f \circ g) = \{\, x \in \text{dom } g \;:\; g(x) \in \text{dom } f \,\} \)

  • Start from the inner function's domain, never from the whole real line. If the inner function rejects x, there is nothing to hand on.
  • A condition on the OUTPUT of the inner function. You usually turn it into a condition on x by solving an equation.
  • Read it as such that. The set is a subset of the inner function's domain, so the composition can never accept more inputs than the inner rule does.
  • The domain of the outer function is not required to contain x itself. It only has to contain the values the inner function produces.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 93 — the boxed definition and the How To that follows it

Take the annotations one at a time, and pay particular attention to where the set starts.

It starts inside the inner function's domain, not inside the whole real line. That has an immediate consequence worth stating out loud: a composition can never accept more inputs than its inner function does. Its domain is always a subset of the inner domain, possibly a proper one.

The second annotation is where the work happens. The condition on the output is usually turned into a condition on the input by setting the inner rule equal to the value the outer function rejects and solving. That solving step is the whole technique of the next three worked examples.

The last annotation removes a worry people often have. The number x itself does not have to be in the outer function's domain. Only the values the inner function produces have to be. You will see a case shortly where the composition happily accepts inputs the outer function would refuse outright.

46. The inner function's outputs must be legal inputs for the outer one

Intuition

Figure (svg): The graph of the inner function four over three x minus two, with a vertical asymptote at two thirds and a horizontal red line at height one. The curve meets that line at x equals two, marked with a red dot.

The outer function refuses the input 1. Reading across from height one and down to the axis shows exactly which x must be thrown out: x equals two.

Here is the inner function of Example 1.46 drawn on its own. The outer function refuses exactly one input, the number 1, so the question becomes: which x makes the inner function produce 1?

Reading across from height one and down to the horizontal axis answers it: the input 2. That value of x is perfectly legal for the inner function, which is precisely why it is so easy to miss, and it must be thrown out of the composition's domain.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 93 — Example 1.46

This slide shows the inner function of the coming example on its own, before any composing happens, and it is worth spending a moment on because it makes the abstract second condition completely concrete.

The outer function refuses exactly one input, the number one. So the question is not abstract at all: which values of x make this curve reach height one? The horizontal red line is drawn at that height, and the curve crosses it once.

Drop from the crossing to the horizontal axis and you get two. That input is perfectly acceptable to the inner function, which is exactly why it is so easy to overlook, and it must be thrown out of the composition's domain. Notice also the separate vertical line, where the inner function itself is undefined. Those are two different exclusions found in two different ways.

47. Example 1.46: the restriction the formula hides

Worked example

Find the domain of the composition of these two rational functions.

\[ f(x) = \frac{5}{x - 1}, \qquad g(x) = \frac{4}{3x - 2} \]

Find the inner function's own domain

Why: The bottom must not be zero.

\[ 3x - 2 = 0 \;\Longrightarrow\; x = \tfrac23 \text{ is excluded} \]

Find the outer function's domain

Why: Again, the bottom must not be zero.

\[ x - 1 = 0 \;\Longrightarrow\; f \text{ rejects the input } 1 \]

Ask which x makes the inner output illegal

Why: Set the inner rule equal to the value the outer function rejects.

\[ \frac{4}{3x - 2} = 1 \]

Solve that equation

Why: Cross-multiply and rearrange.

\[ 4 = 3x - 2 \;\Longrightarrow\; 6 = 3x \;\Longrightarrow\; x = 2 \]

Collect both exclusions

Why: One from each condition.

\[ x \ne \tfrac23 \quad\text{and}\quad x \ne 2 \]

Write the domain in interval notation

Why: Two punctures in the real line.

\[ \left(-\infty, \tfrac23\right) \cup \left(\tfrac23, 2\right) \cup (2, \infty) \]

Check by simplifying the composite and testing both exclusions

Why: The composite simplifies to 5 times 3x minus 2, over 6 minus 3x. At x equal to 2 the bottom is zero, so the formula catches that one. At x equal to two thirds the formula happily returns zero, so it does not catch that one at all: the first exclusion is invisible after simplification.

\[ f\bigl(g(x)\bigr) = \frac{5(3x - 2)}{6 - 3x}, \qquad \text{at } x = \tfrac23 \text{ it gives } 0 \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 93 — Example 1.46

This is the example the whole part is built around, so work it with the solution covered if you can.

The first two steps are routine: find where each rule divides by zero. The third step is the one that is new, and it is a small change of question. You are not asking where the outer function fails; you are asking which input makes the inner function produce the value at which the outer function fails. That turns into an equation, and solving it gives a second excluded input.

The check is the part to remember. Simplify the composite and look at what the simplified formula knows. It knows about the exclusion at two, because the bottom genuinely vanishes there. It knows nothing at all about the exclusion at two thirds; feed it that input and it returns zero perfectly happily.

That is the whole warning of this part in one calculation. The simplified expression is not the composition; it agrees with the composition everywhere the composition is defined, and it carries on where the composition stops.

48. The hole the algebra cannot see

Picture it

Figure (svg): The graph of the simplified composite: a curve rising from below minus two, crossing the horizontal axis with a hollow circle at two thirds, climbing steeply to a vertical asymptote at x equals two, and returning from far below on the other side to level off near minus five.

The simplified formula shows the blow-up at two loud and clear. The hole at two thirds is invisible in that formula; only the inner function knows about it.

The simplified composite is drawn here. Its vertical asymptote at 2 is unmissable, and that is the exclusion coming from the outer function. The exclusion at two thirds leaves no mark at all on this curve, which is exactly the point: you cannot recover the inner function's restriction from the tidied formula.

The hollow circle has been drawn in by hand, using knowledge of the inner rule. Nothing in the algebra of the simplified expression would put it there.

Look at what the curve tells you and what it does not. The vertical asymptote is unmissable, and it correctly records the exclusion that came from the outer function.

Now look at the hollow circle. It was drawn in by hand, using knowledge of the inner rule. If you had been handed only the simplified expression and asked to sketch it, you would have drawn the curve passing smoothly through that point, and nothing in the algebra would have told you otherwise.

So the honest summary is that the graph of a simplified composite tells you about only one of the two conditions. To see the other you have to go back to the inner function, which is why the procedure insists on starting there.

49. Example 1.47: a composition of two square roots

Worked example

Now both functions restrict their inputs. Find the domain of the composition.

\[ f(x) = \sqrt{x + 2}, \qquad g(x) = \sqrt{3 - x} \]

Find the inner function's domain

Why: A square root needs a nonnegative inside.

\[ 3 - x \ge 0 \;\Longrightarrow\; x \le 3, \quad \text{that is } (-\infty, 3] \]

Build the composite

Why: Substitute the whole inner rule into the outer one.

\[ f\bigl(g(x)\bigr) = \sqrt{\sqrt{3 - x} + 2} \]

Ask what the outer function needs

Why: Its input must be at or above minus two.

\[ \sqrt{3 - x} \ge -2 \]

Check whether that adds anything

Why: A square root is never negative, so its value is always at least zero, which already clears minus two by a margin. No new restriction appears.

\[ \sqrt{3 - x} \ge 0 > -2 \quad \text{always} \]

Figure (svg): Three curves on the same axes. A solid orange curve is the inner square root of three minus x. A thick blue curve above part of it is the true composite. A dashed red curve, the formula printed in the book, sits higher and carries on further to the right.

Both honest curves stop dead at x equals three, because the inner square root does. The dashed curve is the book's slip: it keeps going, and it is not the same function.

Check the endpoint and one interior point, and note the book's slip

Why: At x equal to 3 the inner root is 0 and the composite is the square root of 2. At x equal to minus one the inner root is 2 and the composite is 2. The printed text simplifies the composite to the square root of 5 minus x, which would give 2.449 at that input; that expression comes from forgetting the inner square root, and its domain runs out to 5 instead of 3. The domain is the inner function's domain.

\[ \text{domain of } f \circ g = (-\infty, 3] \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 93 — Example 1.47

Try this before reading. Both functions restrict their inputs now, which sounds harder and is actually easier, because the second condition turns out to cost nothing.

Start with the inner function: a square root needs a nonnegative inside, so the inputs stop at three. Then build the composite and ask what the outer function needs. Its input has to be at or above minus two, and a square root is never negative, so that requirement is met automatically and adds no new restriction. The domain is exactly the inner function's domain.

There is a misprint here worth knowing about. The printed solution simplifies the composite to the square root of five minus x, which would be right if the inner function were three minus x without its own square root. With the inner square root present, the true composite is the square root of the quantity square root of three minus x, plus two. The two expressions give different values, for instance at the input minus one, where the true composite gives two and the printed one gives about 2.449.

The dashed red curve in the picture is the printed expression. Notice that it carries on to the right of three, where the honest curves stop. The final answer the book reports, the interval up to and including three, is correct; only the middle line is wrong.

50. Try It 1.30: a reciprocal after a square root

Worked example

Both conditions bite this time. Find the domain of the composition.

\[ f(x) = \frac{1}{x - 2}, \qquad g(x) = \sqrt{x + 4} \]

Find the inner function's domain

Why: The inside of the root must be nonnegative.

\[ x + 4 \ge 0 \;\Longrightarrow\; x \ge -4 \]

Find what the outer function rejects

Why: Its bottom must not be zero.

\[ x - 2 = 0 \;\Longrightarrow\; f \text{ rejects the input } 2 \]

Ask which x makes the inner output equal 2

Why: Set the inner rule equal to the forbidden value.

\[ \sqrt{x + 4} = 2 \]

Solve it

Why: Square both sides.

\[ x + 4 = 4 \;\Longrightarrow\; x = 0 \]

Combine the two conditions

Why: Start from the inner domain and punch out the bad input.

\[ x \ge -4 \text{ and } x \ne 0 \]

Write it in interval notation

Why: A closed end at minus four and a hole at zero.

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

Check the two boundary inputs and one safe one

Why: At x equal to minus four the inner root is zero and the composite is minus a half, so minus four is genuinely allowed. At x equal to zero the inner root is 2 and the outer rule divides by zero, so zero is genuinely out. At x equal to 5 the inner root is 3 and the composite is 1.

\[ f(g(-4)) = -\tfrac12, \quad f(g(0)) \text{ undefined}, \quad f(g(5)) = 1 \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 94 — Try It 1.30

This is the example where both conditions actually bite, so it is the best rehearsal for an exam question.

The inner square root fixes a left endpoint at minus four, and that endpoint is included, because a square root of zero is fine. Then the outer reciprocal refuses the input two, so you solve to find which x makes the inner root equal two, and the answer is zero.

Putting them together gives a closed end on the left and a puncture in the middle, which is an unusual-looking interval and exactly the kind of thing a question is testing. Write it as two intervals joined, with a square bracket at minus four and round brackets around the hole.

The final check evaluates the composite at three inputs: the left endpoint, which works; the punctured point, which does not; and an ordinary interior point. Three quick evaluations confirm the shape of the answer.

51. Slide the inner function and watch the domain move

Tweak it

Parameter explorer

The outer rule is take the square root and the inner rule is subtract h. Slide h and read off where the graph starts. What does the left endpoint of the graph have to do with the inner function?

\[ \sqrt{x - ({h})} \]

  • h — from -3 to 4: the shift h in the inner rule

Start with the slider in the middle and move it slowly to the right. The graph does not change shape at all; it simply slides, and the point where it begins slides with it.

Read off that starting point for two or three values of the slider and compare it with the value of the shift. They are the same number every time. The outer square root has not changed at all, so the whole of the domain restriction is coming from the inner rule.

Now push the slider to a negative value. The graph starts to the left of zero, which means the composition accepts negative inputs even though the outer square root refuses negative inputs. That is the last annotation of the domain rule made visible: the outer function's domain constrains the intermediate values, not x itself.

52. Find the error: the domain read off the simplified rule

Error analysis

\[ f(x) = \frac{5}{x-1}, \qquad g(x) = \frac{4}{3x-2} \]

Annotate

On: \( f\bigl(g(x)\bigr) = \frac{5(3x-2)}{6-3x} \;\Longrightarrow\; \text{domain: } x \ne 2 \)

  • The simplification itself is correct. Clearing the small fraction inside the big one really does give this expression.
  • This is the domain of the SIMPLIFIED expression, not of the composition. The two are not the same set.
  • The input two thirds was never legal, because the inner function divides by zero there. Simplifying erased the evidence.
  • Find the inner function's domain first, before you touch the algebra. Then the simplification can only take inputs away, never add them.

Read the line and try to name the error before revealing. The algebra is correct, so if you are hunting for an arithmetic slip you will not find one.

The mistake is a category error. What has been reported is the domain of the simplified expression, which is a different function from the composition. The two agree wherever the composition is defined, but the simplified expression is defined in one extra place.

The defence is procedural rather than clever: find the inner function's domain before you touch the algebra, and write it down. After that, simplification can only ever remove inputs, never add them back, and you will not be tempted to read the answer off the wrong object.

53. Domains, side by side

Comparison

Comparison matrix

combinationexcluded by the inner ruleexcluded by the outer rule
f(g(x)) with f(x) = 1/x, g(x) = x − 3nothing3
g(f(x)) with the same pair0nothing
p(m(x)) with p(x) = 1/x, m(x) = x² − 4nothing2 and -2
m(p(x)) with the same pair0nothing

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, pp. 95-96 — Exercises 219 and 225

Fill the blanks before checking, and for each one decide first whether the exclusion is coming from the inner rule or the outer rule.

Rows one and three have inner rules that accept every real number, so nothing is lost at the first stage, and the whole exclusion comes from the outer reciprocal refusing zero. You solve for the inputs whose inner output is zero, which in the third row means the two points where a square equals four.

Rows two and four have the reciprocal on the inside, and now the exclusion is immediate: the reciprocal is undefined at zero before anything else happens, and no value it produces can upset the polynomial that follows. Same two functions, opposite orders, and the exclusions move from one column to the other.

54. Trap: forgetting the inner function's own domain

Trap

The trap

Only the outer rule is checked:

\[ f(x) = \tfrac1x, \; g(x) = \sqrt{x - 1} \]

\[ f\bigl(g(x)\bigr) = \frac{1}{\sqrt{x-1}} \]

\[ \text{dom: } x \ne 1? \]

Wrong. Half the real line was never available.

The fix

Start from the inner rule. The square root needs its inside at or above zero, so every input below 1 is gone before the outer rule is even consulted.

\[ x > 1 \]

Then the outer rule removes the input where the root is zero, which is 1 itself, and 1 was already excluded.

This is the mirror image of the earlier trap. There, a restriction was lost because the algebra tidied it away; here, it is lost because only the outer rule was ever consulted.

The composite formula looks like a fraction, so the instinct is to hunt for the input that makes the bottom zero and stop. But the bottom is a square root, and half the real line was never available to it in the first place.

Both traps have the same cure, and it is worth writing at the top of your working: start from the inner function. Once its domain is written down, the outer condition can only shrink it further.

55. Decomposing a function

Section

Part 6

56. Composition run backwards

Concept

Composition builds a complicated function out of two simple ones. Decomposition runs the process in reverse: given one complicated rule, find two simpler rules that compose to it.

\[ f(x) = g\bigl(h(x)\bigr): \quad \text{find } g \text{ and } h \]

The method is to read the formula and look for a chunk that is wrapped inside something else. The chunk is the inner function; whatever is being done to it is the outer function.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 94 — decomposing a composite function

Everything so far has taken two functions and made one. Decomposition goes the other way: you are handed one rule and asked to find two simpler ones that chain to it.

The method is to read the formula looking for a chunk that is wrapped inside something else. The chunk is the inner function; the wrapping is the outer one. In practice you scan for brackets, radicals, absolute value bars and denominators, because those are the symbols that wrap things.

Unlike the composing direction, this one has no formula to follow, so it feels less secure at first. What makes it safe is that there is always a check available: recompose your two pieces and see whether the original expression comes back exactly.

57. Finding the seam

Picture it

Figure (svg): A large expression, the square root of five minus x squared, with a dashed rectangle drawn around the part under the radical and a second rectangle around the whole radical. Two arrows lead down to a box naming the inner function and a box naming the outer function.

Look for a chunk that is wrapped in something. The chunk is the inner function; the wrapping is the outer one.

In the expression drawn here, the chunk under the radical is a complete little rule of its own, and the radical is a complete rule applied to whatever it is given. Cutting between them is the natural seam.

Always recompose afterwards. Feeding the inner rule into the outer one should give back the original expression exactly; if it does not, the cut was in the wrong place.

Look at the expression and ask what is being done to what. The quadratic under the radical is a complete little rule of its own, and the radical is a complete rule applied to whatever it is handed.

The two dashed boxes mark exactly that. The inner box contains the chunk; the outer box contains the whole operation being applied to it. Cutting between them gives the two functions in the boxes below.

The bottom line of the picture is the part people skip and should not. Recomposing is not a formality; it is the only test the method has. Feed the inner rule into the outer one and confirm that the original expression, character for character, comes back.

58. Example 1.48: a square root over a quadratic

Worked example

Write this rule as a composition of two functions.

\[ f(x) = \sqrt{5 - x^2} \]

Look for something inside something

Why: The quadratic sits under the radical, so it is the natural inner part.

\[ \text{inside: } 5 - x^2 \]

Name the inner function

Why: Call the chunk h.

\[ h(x) = 5 - x^2 \]

Name the outer function

Why: Whatever is done to the chunk: take a square root.

\[ g(x) = \sqrt{x} \]

Recompose to check

Why: Feed h into g and see whether the original comes back.

\[ g\bigl(h(x)\bigr) = g(5 - x^2) = \sqrt{5 - x^2} \]

Check the inherited restriction too

Why: The original needs its radicand nonnegative, so x must lie between minus the square root of 5 and the square root of 5. That is exactly where the inner output is legal for the outer square root, which is the domain condition from the previous part doing its work.

\[ 5 - x^2 \ge 0 \;\Longleftrightarrow\; -\sqrt5 \le x \le \sqrt5 \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 94 — Example 1.48

Try this one with the solution covered. There is very little to compute, and the whole skill is in seeing where to cut.

The quadratic sits under the radical, which is a clear visual signal that it is being used as a single quantity. So it becomes the inner function, and the outer function is simply the square root.

Then recompose and check. Feeding the quadratic into the square root reproduces the original exactly, so the decomposition is correct.

The last step connects this back to the previous part. The original rule needs whatever is under its radical to be nonnegative, and that is precisely the statement that the inner output must be a legal input for the outer square root. The domain condition you learned abstractly is doing visible work here.

59. Try It 1.31: a root in the bottom of a fraction

Worked example

Decompose this one. There is more than one chunk to choose from, so pick the one that leaves both pieces simple.

\[ f(x) = \frac{4}{3 - \sqrt{4 + x^2}} \]

Find the chunk that is wrapped

Why: The whole square root is used as a single quantity in the bottom, so take that as the inner function.

\[ g(x) = \sqrt{4 + x^2} \]

Name what is done to it

Why: Subtract it from 3 and divide 4 by the result.

\[ h(x) = \frac{4}{3 - x} \]

Recompose to check

Why: Feed g into h.

\[ h\bigl(g(x)\bigr) = \frac{4}{3 - \sqrt{4 + x^2}} \]

Find where the composition fails

Why: The outer rule rejects the input 3, so solve for the x that produces it.

\[ \sqrt{4 + x^2} = 3 \;\Longrightarrow\; 4 + x^2 = 9 \;\Longrightarrow\; x = \pm\sqrt5 \]

Check the recomposition at an easy input

Why: At x equal to zero the inner root is 2, and then 4 divided by 3 minus 2 is 4, which is what the original formula gives at zero. And at plus or minus the square root of 5 the bottom really is zero, confirming those two exclusions.

\[ f(0) = \frac{4}{3 - 2} = 4, \qquad 3 - \sqrt{4 + 5} = 0 \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 94 — Try It 1.31

This one has more than one plausible seam, so decide where to cut before reading on. You could take the inner function to be the quadratic under the radical, but then the outer function would be a fraction with a radical still in it, which is no simpler than what you started with.

The better cut takes the whole square root as the inner function, because the rest of the expression uses it as a single quantity. What remains is a clean rational rule: subtract from three, then divide four by the result.

Recompose and the original comes back. Then look at where the composition fails, which is a good habit whenever a denominator appears. The outer rule refuses the input three, so you solve for the inputs whose inner output is three, and both the positive and negative square root of five are excluded.

The final check tests the recomposition at the easiest input available, zero, and confirms the two excluded values really do make the bottom vanish.

60. A decomposition is never unique

Intuition

There is always more than one way to cut a formula, and the book says so explicitly: choose the decomposition that looks most convenient.

\[ \sqrt{5 - x^2}: \quad h(x) = 5 - x^2,\; g(x) = \sqrt{x} \qquad\text{or}\qquad h(x) = x^2,\; g(x) = \sqrt{5 - x} \]

Both recompose correctly, so both are right answers. The first is usually preferred because each piece is as plain as possible, and because the inner function is the chunk that is literally written inside the symbol.

There is also always a lazy decomposition, taking the inner function to be x itself, and it is correct but useless. A decomposition earns its keep only when both pieces are simpler than the original.

The book says this explicitly and it is worth taking seriously, because students often assume there is one right answer and mark themselves wrong when their cut differs from the solutions.

Both of the decompositions shown recompose correctly, so both are right. The first is usually preferred, and the reason is practical rather than mathematical: each piece is as plain as it can be, and the inner function is literally the chunk written inside the symbol.

The warning at the end is a real one. You can always take the inner function to be x itself and the outer function to be the original rule, and that recomposes perfectly and teaches you nothing. A decomposition is useful only when both pieces are genuinely simpler than what you started with, which is the standard an examiner, and later the chain rule, will apply.

61. Match each rule to its inner function

Matching

Match the pairs

  • a. h(x) = (x + 2)²
  • b. h(x) = (5x − 1)³
  • c. h(x) = 1/(x − 2)³
  • d. h(x) = |x² + 7|
  • w. inner x + 2, outer: square it
  • x. inner 5x − 1, outer: cube it
  • y. inner x − 2, outer: cube it and take the reciprocal
  • z. inner x² + 7, outer: take the absolute value

Why: In each case the inner function is the chunk written inside the brackets, the bars or the denominator, and the outer function is everything that is then done to it. Recomposing each pair gives the original rule back, which is the only test a decomposition has to pass.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 96 — Exercises 227, 238, 241 and 240

Match all four before revealing. For each one, ask which symbol is doing the wrapping.

The first two wrap with brackets, so the contents of the brackets are the inner function and the power is the outer one. The third wraps twice, with a cube and then a reciprocal, and the sensible inner function is still the linear chunk in the denominator.

The fourth wraps with absolute value bars, which behave exactly like brackets for this purpose. The pattern in all four is the same: find the symbol that encloses something, and the enclosed part is the inner function.

62. Exercise 217: three functions in a row

Fill the middle

Nothing changes with three. Work from the innermost outward.

\[ f(x) = x^4 + 6, \quad g(x) = x - 6, \quad h(x) = \sqrt{x} \]

\[ h(x) = \sqrt{x} \;\longrightarrow\; g\bigl(h(x)\bigr) = \sqrt{x} - 6 \]

Fill in the blanks

f\Bigl(g\bigl(h(x)\bigr)\Bigr) = \left(\sqrt6 - 6\right)^___ + ___

Why: The innermost rule gives the square root of x. The middle rule subtracts six from it. The outer rule raises that to the fourth power and adds six. The square root also fixes the domain: only inputs at or above zero reach the chain at all.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 95 — Exercise 217

Fill the blanks before checking, and build the chain from the innermost outward rather than trying to write the whole thing at once.

The innermost rule gives a square root. The middle rule subtracts six from whatever it is given, so it produces the square root minus six. The outer rule raises whatever it is given to the fourth power and adds six, which puts the whole previous expression inside a fourth power.

Two things are worth noticing. First, nothing about the method changed when a third function appeared; you simply worked outwards one layer at a time. Second, the domain is fixed by the innermost rule alone here, because the square root refuses negative inputs and the other two rules accept everything, so the chain only runs for inputs at or above zero.

63. Order the decomposition steps

Ranking

Put in order

Put the steps of a complete decomposition into the order you should carry them out.

  1. Read the formula and find a chunk that sits inside something else
  2. Call that chunk the inner function
  3. Call whatever is done to the chunk the outer function
  4. Recompose the two and confirm you get the original formula back
  5. State the inputs the original formula rejects

Why: Spotting the chunk comes first, because the two names follow from it. The recomposition is the only check the method has, so it must come before you report anything, and the domain is stated last because it belongs to the original function rather than to either piece.

Put the five steps in order before checking. The only genuinely debatable one is where the recomposition goes.

It goes before you report anything. Recomposing is the only check the method has, and if you state an answer first and check second, the temptation to accept a cut that nearly works is very strong.

The domain comes last for a reason worth understanding. The restrictions belong to the original function, not to either piece separately, and you can only describe them once you know how the two pieces fit together.

64. Putting it together

Section

Part 7

65. Exercise 291: two discounts, one function

Worked example

A shop takes 30 percent off a selected item, and then the till takes a further 15 percent off at the checkout. Write one function giving the final price from the original price.

Write the first discount as a function

Why: Paying 70 percent of the price.

\[ d(x) = 0.70x \]

Write the second discount as a function

Why: Paying 85 percent of whatever it now costs.

\[ t(x) = 0.85x \]

Compose them in the order the shop applies them

Why: The till acts on the already reduced price, so the till function is on the outside.

\[ P(x) = t\bigl(d(x)\bigr) = 0.85(0.70x) \]

Simplify

Why: Multiply the two factors.

\[ P(x) = 0.595x \]

Figure (svg): A chain: two hundred dollars enters a box that takes thirty percent off, one hundred and forty dollars leaves it and enters a box that takes fifteen percent off, and one hundred and nineteen dollars comes out. Below, two bars compare the true final price of one hundred and nineteen dollars with the wrong answer of one hundred and ten dollars.

The second discount is taken on the already reduced price, so the two cuts do not simply add. Composition, not addition, is what the till does.

Check on a price, and against the tempting wrong answer

Why: On an original price of 200, the first cut gives 140 and the second gives 119, which is what the composed rule gives. Adding the two percentages would predict 45 percent off, or 110, which is 9 too little; the second cut is taken on a smaller number, so the discounts do not add.

\[ 0.595(200) = 119 \;\ne\; 0.55(200) = 110 \]

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 99 — Exercise 291

Try this before reading. It is the most common real use of composition you will meet, and almost everyone gets the wrong answer the first time.

Write each discount as a function of the current price. Taking thirty percent off means paying seventy percent, so the rule is multiply by nought point seven. Taking fifteen percent off means paying eighty five percent. Then compose them in the order the shop applies them, with the till on the outside because it acts on the already reduced price.

The composed rule multiplies by nought point five nine five, which is a discount of forty and a half percent, not forty five. Look at the two bars in the picture: nine dollars on a two hundred dollar item, and the gap grows with the price.

The reason is that the second discount is taken on a smaller number. Percentages taken one after another compose; they do not add. This is the same structural fact as everything else in this lesson, wearing a price tag.

66. Pattern: composing, evaluating, and finding the domain

Pattern

Figure (svg): A flow diagram. An input x reaches a first gate asking whether x is legal for the inner rule; a no branch leads up to a box marked excluded. A yes branch leads to a second gate asking whether the inner output is legal for the outer rule, again with a no branch to excluded, and a yes branch to a box marked in the domain.

Two gates, in this order. Most lost marks come from checking only the second one.
  1. Identify the inner function: it is the one written closest to the input.
  2. To evaluate at a number, compute the inner value first, then substitute it into the outer rule. Never substitute into both.
  3. To get a formula, put the whole inner rule, in brackets, wherever the outer rule shows its input, and only then expand.
  4. For the domain, start from the inner function's domain, then remove the inputs whose inner output the outer function rejects.
  5. Never read the domain off the simplified formula, and never confuse the circle with a product.

This is the checklist to work through whenever a composition appears, and it is ordered so that the cheap identification steps come before the expensive algebra.

The first two items settle direction and mechanics. Identify the inner function by finding the one written closest to the input, and then keep the two evaluations separate. The formula case is the same move with an expression in place of a number, and the brackets are what makes it safe.

The fourth item is the one that separates a complete answer from a lucky one. Start from the inner function's domain and shrink it; never start from the final formula and hope. The flow diagram draws that as two gates, and the whole difficulty of this section is that the second gate is visible in the tidied algebra and the first one is not.

67. Check: which function acts first?

Check

Check your understanding

With f(x) = x² and g(x) = 3x − 1, what is the value of the composition f of g at 2?

  • A. 25 (correct)
  • B. 11
  • C. 20
  • D. 35

Answer: A

Why: The inner function is g, so evaluate it first: g at 2 is 5. Then the outer function squares that, giving 25. The raw input 2 is never squared.

Why B tempts people
That is the other order: f at 2 is 4, and then g at 4 is 11. The question asked for f composed with g.
Why C tempts people
That is the product f(2) times g(2), which is 4 times 5. The circle is not a multiplication sign.
Why D tempts people
That squares the input first and then applies g twice over, which is not a step in either composition.

Answer before revealing. The question is about direction, not about arithmetic, and all four options are numbers you could get from these two rules by doing something reasonable.

The inner function is the one written closest to the input, so it acts first and turns two into five. The outer function then squares that, giving twenty five. If you got eleven you composed the other way; if you got twenty you multiplied the two outputs instead of chaining them.

Both of those wrong answers are the two headline errors of this lesson, which is why they are here as options. Getting this one right quickly is a good sign that the direction has stuck.

68. Check: the domain of a composition

Check

Check your understanding

With f(x) = 1/x and g(x) = √(x − 1), what is the domain of f composed with g?

  • A. all x with x ≥ 1
  • B. all x with x > 1 (correct)
  • C. all real numbers except 1
  • D. all x with x ≥ 0

Answer: B

Why: The inner square root needs its inside at or above zero, so x must be at least 1. The outer reciprocal then rejects the input zero, and the square root is zero exactly at x equal to 1, so that endpoint drops out too, leaving everything strictly above 1.

Why A tempts people
This uses only the inner function's domain and forgets that the outer rule cannot divide by the zero the root produces at the endpoint.
Why C tempts people
This reads the restriction off the simplified formula as though the square root accepted every input, which it does not.
Why D tempts people
That is the domain of the plain square root of x, not of the square root of x minus one.

Work out both conditions before choosing. This is the standard exam question on the second half of the section.

The inner square root needs its inside at or above zero, which rules out everything below one. Then the outer reciprocal refuses the input zero, and the square root is zero exactly at the left endpoint, so that endpoint drops out as well. What survives is everything strictly above one.

The most tempting wrong answer keeps the endpoint, because it comes from checking only the inner condition. The next most tempting comes from reading the restriction off the simplified formula as if the square root accepted every input. Both are the failures this part was built to prevent.

69. Check: evaluating from a table

Check

xf(x)g(x)
441
508
894
930

Check your understanding

Using the rows shown, what is f of g of 8?

  • A. 4 (correct)
  • B. 0
  • C. 9
  • D. 1

Answer: A

Why: Start inside: g at 8 is 4. Then look up f at 4, which is also 4. The repeated number is a coincidence of this table, so it is worth writing both lookups down rather than trusting a glance.

Why B tempts people
That is g of f of 8: f at 8 is 9, and then g at 9 is 0. It is the other order.
Why C tempts people
That is f at 8, which uses the outer function on the raw input and never consults g at all.
Why D tempts people
That is g at 4, which applies the inner function twice instead of switching to the outer one.

OpenStax, Precalculus, §1.4 Composition of Functions §1.4, p. 97 — Table 1.23

Do both lookups explicitly, writing the intermediate number down. Doing it in your head is how the wrong options get chosen.

The inner function sends eight to four, and then the outer function sends four to four. The repeated number is a coincidence of these rows, and it is exactly the kind of coincidence that makes a careless reader think they have finished after one lookup.

Each wrong option corresponds to a specific slip: one is the other order, one applies the outer function to the raw input, and one applies the inner function twice. If you picked one of them, find which of those three you did.

70. Explain why the order cannot be swapped

Explain it to yourself

Discussion prompt

In two or three sentences, explain to someone who missed the lesson why f of g of x is usually different from g of f of x. Use the machine picture, and give one concrete pair of rules to make it stick.

Write your answer out before revealing. Being able to explain this in your own words is a much better test of understanding than being able to compute a composition, because the computation can be done mechanically.

A good answer has two parts. The structural part says that swapping the machines changes which one receives the untouched input, so there is no reason the results should match. The concrete part gives a pair of rules and an input where they visibly disagree.

The parabola pair is the cleanest concrete example, because you can see the difference rather than just compute it: composing on the inside slides the curve sideways and composing on the outside lifts it, and those are obviously different curves even though they cross once.

71. Exit ticket

Exit ticket

\[ f(x) = \frac{1}{x - 3}, \qquad g(x) = \sqrt{x + 1} \]

Discussion prompt

Write the composition of f with g as a single formula, and give its domain in interval notation. Name the two conditions you used.

This combines both halves of the domain rule on a pair you have not seen before. Write the composite, then the domain, then name your two conditions.

The composite is one over the quantity square root of x plus one, minus three. The first condition is the inner square root, which needs its inside at or above zero and so fixes a closed left endpoint at minus one. The second condition is that the bottom must not vanish, which happens when the inner square root equals three, that is at the input eight.

So the answer is the interval from minus one to eight, closed on the left and open on the right, joined to everything above eight. If you reported only the exclusion at eight, you checked the second condition and skipped the first, which is the error this lesson has warned about four times.

72. Recap

Recap

operationhow it is builtdomain
f + g, f − g, fgarithmetic on the two outputs at the same inputthe overlap of the two domains
f divided by gone output over the otherthe overlap, minus the zeros of g
f composed with gthe inner output becomes the outer inputinputs in dom g whose output lies in dom f
decompositioncut the formula at its natural seambelongs to the original rule, not to either piece

\[ (f \circ g)(x) = f\bigl(g(x)\bigr) \;\ne\; f(x)\,g(x) \;\text{ and }\; (f \circ g)(x) \;\ne\; (g \circ f)(x) \]

Next, Section 1.5 uses composition quietly everywhere: every transformation of a graph is a composition with a simple inner or outer rule, and the shift you saw on the parabola slide is the first case of it.

OpenStax Algebra and Trigonometry 2e, §3.4 Composition of Functions §3.4 — the same material in Algebra and Trigonometry

Two ways to build a function from two others. Arithmetic combinations evaluate both functions at the same input and then do one operation to the answers; their domain is the overlap, with the zeros of the bottom function removed as well when you divide.

Composition chains them instead, and it brings three things the arithmetic combinations do not. The order matters, so the two directions are generally different functions. The domain needs two conditions, the first of which vanishes from the simplified formula. And a composition can be run backwards, which is the decomposition skill you will need for the chain rule.

The one line to leave with is on the slide: the circle is not a product, and it is not symmetric. If you check nothing else on an exam, check that you have composed in the direction asked for and that you started the domain from the inner function.

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