Quarry School

College Algebra / Composition of functions

Composition of functions

Subject: Mathematics

All 10 lessons, in order.

The unit at a glance

  1. Combine two functions with arithmetic

    Imagine two pay envelopes for the same year.

  2. Composition passes one answer into the next function

    Picture two machines standing in a row.

  3. Order changes the result, and units must fit

    Picture a store applying a discount and a coupon.

  4. Follow a composition through tables

    Picture a row of labeled drawers.

  5. Follow a composition across two graphs

    A graph draws a function's input-output pairs as points.

  6. Evaluate formulas one number at a time

    Keep two recipe cards on a counter.

  7. Substitute the whole inside expression

    Before filling a form with letters, run the two machines with numbers.

  8. A composite domain has two gates

    Picture a trip with two ticket checks.

  9. Square roots add boundary checks

    Picture a square tile whose area you know.

  10. Decompose by naming the inside and outside jobs

    Imagine receiving a finished sandwich and describing its preparation in two jobs: assemble it, then wrap it.

Rules (10)
  • Combine two functions with arithmetic

    (f + g)(x) = f(x) + g(x); (f − g)(x) = f(x) − g(x); (fg)(x) = f(x)·g(x); (fg)(x) = f(x)g(x).
    Use inputs allowed by both functions; for the quotient also require g(x) ≠ 0.

  • Composition passes one answer into the next function

    (f ∘ g)(x) = f(g(x)). First apply g, then apply f to g's output.
    The product (fg)(x) = f(x)·g(x) is a different operation.

  • Order changes the result, and units must fit

    Usually f(g(x)) ≠ g(f(x)) as functions. Check both orders rather than assuming equality.
    For a meaningful composition, the inner output must be an acceptable outer input, including its units.

  • Follow a composition through tables

    To evaluate f(g(a)) from tables, read g(a), then use that output as the input for the f lookup.
    A composition is defined only when both lookups exist.

  • Follow a composition across two graphs

    For f(g(a)): read the y-value of g at x = a; use that number as the x-value on f; read f's y-value.
    A point (a, b) on g means g(a) = b.

  • Evaluate formulas one number at a time

    For f(h(a)), calculate h(a) first; then substitute that entire numerical answer into every input slot of f.
    The input-variable letter does not change the instructions.

  • Substitute the whole inside expression

    To form f(g(x)), replace every input-variable occurrence in f with the whole parenthesized expression g(x).
    (a + b)2 = a2 + 2ab + b2, because (a + b)(a + b) has two cross products ab.

  • A composite domain has two gates

    The domain of f ∘ g consists of the x values allowed by g for which g(x) is allowed by f.
    Keep original restrictions when simplifying the composite formula.

  • Square roots add boundary checks

    A(x) requires A(x) ≥ 0. A denominator A(x) requires A(x) > 0.
    For f(g(x)), apply every root requirement at its own stage and keep both gates.

  • Decompose by naming the inside and outside jobs

    To write h(x) = f(g(x)), choose g as the inside job and f as the job applied to its output.
    Check by substitution and preserve h's original domain.

Recipes (10)
  • Combine two functions with arithmetic
    1. 1. Find the requested operation and its order. g − f means the g answer minus the f answer.
    2. 2. Use the same input in both original functions, because their outputs must refer to the same starting value.
    3. 3. Record where both formulas work and, for division, where the bottom output is nonzero.
    4. 4. Put each whole expression in parentheses before combining it. Simplify while keeping every original domain restriction.
    5. 5. Check one permitted input directly in the original functions.
  • Composition passes one answer into the next function
    1. 1. Rewrite the circle notation as nested parentheses, meaning one pair of parentheses inside another: (f ∘ g)(x) = f(g(x)).
    2. 2. Name the inner function, which touches the original input.
    3. 3. Evaluate that function and write its output as a separate intermediate, or in-between, answer.
    4. 4. Put that whole intermediate answer into the outer function.
    5. 5. Check the path: original input, inner output, final output.
  • Order changes the result, and units must fit
    1. 1. For each order, identify the function nearest the original input.
    2. 2. Evaluate or substitute that inner function into the other function.
    3. 3. Compare the resulting formulas and their domains. A different answer at one allowed input proves the functions differ.
    4. 4. For an application, label the starting input, intermediate output, and final output with units.
    5. 5. Check that the intermediate unit matches the outer function's expected input unit.
  • Follow a composition through tables
    1. 1. Read the nested notation and choose the inner table.
    2. 2. Find the column labeled with the original input in that table.
    3. 3. Read its output and write it as the intermediate value.
    4. 4. Find that value among the input labels of the outer table, which may be a different column.
    5. 5. Read the outer output. If either required input is absent from a complete table, the composition is undefined there.
  • Follow a composition across two graphs
    1. 1. Choose the inner graph from the function nearest the starting input.
    2. 2. Locate that input on the inner graph's x-axis and move vertically to its curve.
    3. 3. Read the curve's y-coordinate as the intermediate output.
    4. 4. Locate that number on the outer graph's x-axis and move vertically to its curve.
    5. 5. Read the outer y-coordinate as the final answer. Check each graph's own scale.
  • Evaluate formulas one number at a time
    1. 1. Expand circle notation into parentheses if needed.
    2. 2. Copy the inner formula and replace every input letter with the original number, using parentheses for negative numbers.
    3. 3. Complete that arithmetic and write the intermediate output.
    4. 4. Copy the outer formula and replace every input letter with that output.
    5. 5. Complete the arithmetic and check by substituting into a combined formula.
  • Substitute the whole inside expression
    1. 1. Copy the outer formula and identify every input slot.
    2. 2. Write the complete inner formula in parentheses in every slot.
    3. 3. Keep powers outside those parentheses so they act on the entire input.
    4. 4. Expand with distribution. For a square, multiply the two identical parentheses and keep both cross products.
    5. 5. Combine like terms, preserve any domain restrictions, and check a small allowed input by the two-stage route.
  • A composite domain has two gates
    1. 1. Find the inner domain. Record inputs making an inner denominator zero or violating any other inner requirement.
    2. 2. Find what the outer function cannot accept. For an outer denominator, determine its forbidden input values.
    3. 3. Set g(x) equal to each forbidden outer input and solve. Exclude the solutions that are in the inner domain.
    4. 4. Keep only starting inputs passing both gates. For roots, use inequalities rather than only equations, as the next lesson explains.
    5. 5. Write the result in interval notation and check a permitted input and each excluded input using the original stages.
  • Square roots add boundary checks
    1. 1. Write the inner radicand requirement before using the inner function's output.
    2. 2. Substitute the inner output into the outer radicand and require it to be nonnegative.
    3. 3. Use the inner range when possible. A real square root output is always at least zero.
    4. 4. Before squaring an inequality, check that both compared sides are nonnegative. Then square and solve while preserving the earlier requirements.
    5. 5. If a root is a denominator, replace its nonnegative condition with a greater than zero one.
    6. 6. Combine the bounds and test endpoints in the original two-stage formula.
  • Decompose by naming the inside and outside jobs
    1. 1. Work out h at a permitted small input. The final job you perform suggests the outer function; everything before it suggests the inner function.
    2. 2. Define g(x) as that package, which will be calculated first.
    3. 3. Define f(x) as the operation applied to one input package.
    4. 4. Substitute g(x) into f and show that f(g(x)) recreates h(x).
    5. 5. Check the composite domain against the original domain. A formula match alone can hide a lost input.
    6. 6. If another split is requested, choose a different package and repeat the same checks.
Traps (10)

Lesson 1 of 10

Combine two functions with arithmetic

Subject: MathematicsLeans on: SubstitutionLeans on: Subtracting parenthesesLeans on: FactoringLeans on: DomainLeans on: Shared factorLeans on: Multiplying powersOpen this lesson
Leans on 0Comes back in 0

1 In plain words

Imagine two pay envelopes for the same year. One person earned f(x) dollars and another earned g(x) dollars. To find their household income, you open both envelopes and add the amounts. You use the same year for both people. Algebraic operations on functions work this way: get two answers at the same input, then add, subtract, multiply, or divide those answers. You are making a new function from two old ones. A sum of functions adds the outputs. A difference of functions subtracts them. A product of functions multiplies them. A quotient of functions divides them, provided the bottom answer is not zero.

2 Picture it

f(2) = 3g(2) = 424−22468f(2) = 3g(2) = 4−11234−22468
At shared input 2, the solid line gives height 3 and the dashed line gives height 4; their sum is 7.

Reminder

Reminder: Substitution, Subtracting parentheses, Factoring, Domain, Shared factor, Multiplying powers
  • Substitution. Replace the input letter everywhere: x2 − 1 at x = 3 gives 32 − 1 = 8.
  • Subtracting parentheses. A minus outside reverses every sign: −(x − 1) = −x + 1.
  • Factoring. x2 − 1 = (x − 1)(x + 1), because the middle terms cancel when multiplied.
  • Domain. A denominator cannot be zero: 1x−1 excludes x = 1.
  • Shared factor. x2 − x = x·x − x·1 = x(x − 1). Distributing x rebuilds the two terms.
  • Multiplying powers. x·x2 = x·x·x = x3, because three copies of x are multiplied.

3 Why

Each original function gives exactly one output at an allowed input. Arithmetic then combines those two numbers into one new answer, so the result is another function. Both original answers must exist: an unavailable answer cannot be added or multiplied. Division needs one more check, because no number multiplied by zero can give a nonzero numerator. Units also matter. Two incomes measured in dollars can be added. Dollars and hours describe different things, so their sum would not represent a meaningful total.

4 The rule

(f+g)(x)=f(x)+g(x); (f−g)(x)=f(x)−g(x); (fg)(x)=f(x)·g(x); (fg)(x)=f(x)g(x).

Use inputs allowed by both functions; for the quotient also require g(x)≠0.

The same idea, five ways

Say it

f plus g of x; f times g of x; f divided by g of x

Write it

Put one input into both recipes, then combine their two outputs.

In math
  • (f + g)(x) = f(x) + g(x)
  • (f−g)(x)=f(x)−g(x)
  • (fg)(x) = f(x)·g(x)
  • (fg)(x)=f(x)g(x)
  • f + g names a recipe; (f + g)(2) names its output at 2
Like

Two pay envelopes for the same year.

See it

(f + g)(2) = f(2) + g(2)

(fg)(2) = f(2)·g(2)

The final parentheses hold the input 2

The same idea, other ways

As two envelopes

At one year, open both pay envelopes. Adding their amounts gives the total for that year; using different years would answer a different question. At year 2, the two incomes are 38400 and 43600 dollars. Together they give 82000 dollars in the pictured household column.

input youtput I(y)078000180000282000384000486000588000↓ evaluate: input given, read the output below it
Each household output adds the two incomes in that year.
With two small outputs

If f(2) = 3 and g(2) = 4, the sum at 2 is 7 and the product at 2 is 12. You combine 3 and 4 after evaluating, rather than putting 3 through g.

1234
Multiplying output 3 by output 4 gives 12; a product uses both outputs independently.

Part 1: Sum of functions

A sum collects two amounts. If f and g represent incomes in the same currency and year, their sum is household income. Both amounts must exist before you can add them.

  • (f + g)(x) = f(x) + g(x).
  • The domain is the intersection of the original domains: inputs accepted by both.
  • The shared input may be a date or an item name instead of a number; both outputs must be real numbers.
  • Addition and subtraction need matching units or two unitless outputs. If two price rules for the same book give 12 dollars and 8 dollars, their sum is 20 dollars because the quantities match.

f(x) = x + 1

g(x) = 2x

(f + g)(x) = 3x + 1

Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Sum of functions

Write it

A sum collects two amounts. If f and g represent incomes in the same currency and year, their sum is household income. Both amounts must exist before you can add them.

In math
  • (f + g)(x) = f(x) + g(x).
  • The domain is the intersection of the original domains: inputs accepted by both.
  • The shared input may be a date or an item name instead of a number; both outputs must be real numbers.
  • Addition and subtraction need matching units or two unitless outputs. If two price rules for the same book give 12 dollars and 8 dollars, their sum is 20 dollars because the quantities match.
Like

A sum collects two amounts. If f and g represent incomes in the same currency and year, their sum is household income. Both amounts must exist before you can add them.

See it

f(x) = x + 1

g(x) = 2x

(f + g)(x) = 3x + 1

Worked example

Add formulas

For f(x) = x + 1 and g(x) = 2x, find (f + g)(x). You want one formula for the total output at any input. Plan: use the quantity or input named in the question, write the first result, then finish the stated operation.

Show the steps and the answer
23x + 1inputoutput7
The sum formula matches adding the separate outputs.
  1. (f+g)(x)=(x+1)+2x.A sum adds the original function outputs.
  2. x+2x+1=3x+1.One x and two x amounts make three x amounts.
Answer
(f + g)(x) = 3x + 1, for every real x.
Double-check At x = 2, f(2) + g(2) = 3 + 4 = 7 and 3(2) + 1 = 7.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: f(2) + g(3) is (f + g)(2).
The g function received a different input.
✓ Instead: (f + g)(2) uses f(2) + g(2).
Tips and tricks
  • Write the input beside both function names before adding.

Part 2: Difference of functions

A difference compares two outputs at one input. Think of money earned minus money spent in one month. Subtract the whole second amount, including every term in its formula. In a cup-selling model, profit is revenue minus cost. If R(x) = 3x and C(x) = 0.75x + 18 dollars, profit is 2.25x − 18 dollars. At 24 cups, 72 dollars earned minus 36 dollars spent leaves 36 dollars.

  • (g−f)(x)=g(x)−f(x).
  • Subtraction order matters: a − b and b − a usually differ.

(g−f)(x)=(x2−1)−(x−1)

=x2−1−x+1

=x2−x=x(x−1)

Reminder
Reminder: Pulling out a factor
  • Pulling out a factor. x2 − x = x·x − x·1 = x(x − 1), because both terms contain x.
The same idea, five ways
Say it

Difference of functions

Write it

A difference compares two outputs at one input. Think of money earned minus money spent in one month. Subtract the whole second amount, including every term in its formula. In a cup-selling model, profit is revenue minus cost. If R(x) = 3x and C(x) = 0.75x + 18 dollars, profit is 2.25x − 18 dollars. At 24 cups, 72 dollars earned minus 36 dollars spent leaves 36 dollars.

In math
  • (g−f)(x)=g(x)−f(x).
  • Subtraction order matters: a − b and b − a usually differ.
Like

A difference compares two outputs at one input. Think of money earned minus money spent in one month. Subtract the whole second amount, including every term in its formula. In a cup-selling model, profit is revenue minus cost. If R(x) = 3x and C(x) = 0.75x + 18 dollars, profit is 2.25x − 18 dollars. At 24 cups, 72 dollars earned minus 36 dollars spent leaves 36 dollars.

See it

(g−f)(x)=(x2−1)−(x−1)

=x2−1−x+1

=x2−x=x(x−1)

Worked example

Subtract the whole linear formula

OpenStax problem

Let f(x) = x − 1 and g(x) = x2 − 1. Find (g − f)(x). You want the g output minus the whole f output. Plan: keep the second output in parentheses, change both of its signs, then collect matching terms.

Show the steps and the answer

(x2−1)−(x−1)

=x2−1−x+1

=x2−x

  1. (g−f)(x)=(x2−1)−(x−1).The requested order is g minus f.
  2. =x2−1−x+1.Subtracting x − 1 means adding its opposite, −x + 1.
  3. =x2−x=x(x−1).The constants −1 and +1 cancel, and both remaining terms contain a factor x.
Answer
(g − f)(x) = x2 − x = x(x − 1), for every real x.
Double-check At x = 3, g(3) − f(3) = 8 − 2 = 6; 32 − 3 = 6.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: (x2−1)−(x−1)=x2−x−2.
The final −1 was subtracted, so it becomes +1.
✓ Instead: x2−1−x+1=x2−x.
Tips and tricks
  • Put parentheses around the second function before distributing the subtraction.

Part 3: Product of functions

A product multiplies two outputs at the same input. If one output is a price per ticket and the other is the number of tickets, their product is the total price. Multiplication may change the units.

  • (fg)(x) = f(x)·g(x).
  • The product needs both functions defined, but an output of zero is allowed.
x³x2x²2x²
An area model with sides x + 2 and x2.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Product of functions

Write it

A product multiplies two outputs at the same input. If one output is a price per ticket and the other is the number of tickets, their product is the total price. Multiplication may change the units.

In math
  • (fg)(x) = f(x)·g(x).
  • The product needs both functions defined, but an output of zero is allowed.
Like

A product multiplies two outputs at the same input. If one output is a price per ticket and the other is the number of tickets, their product is the total price. Multiplication may change the units.

See it
x³x2x²2x²
The same picture again: An area model with sides x + 2 and x2.

Worked example

Multiply a line by a square

Let f(x) = x + 2 and g(x) = x2. Find (fg)(x). You want to multiply their outputs at the same x. Plan: use the quantity or input named in the question, write the first result, then finish the stated operation.

Show the steps and the answer

(x+2)x2

=x3+2x2

  1. (fg)(x)=(x+2)x2.The product multiplies f(x) by g(x).
  2. =x·x2+2·x2=x3+2x2.Distribution multiplies both terms, and x times x2 contains three factors x.
Answer
(fg)(x) = x3 + 2x2, for every real x.
Double-check At x = 2, f(2)g(2) = 4 × 4 = 16; 23 + 2(22) = 8 + 8 = 16.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: (fg)(x) means f(g(x)).
The product multiplies outputs; composition passes one output into another function.
✓ Instead: (fg)(x) = (x + 2)x2.
Tips and tricks
  • A multiplication dot belongs between the two output expressions.

Part 4: Quotient of functions

A quotient is a ratio: one output divided by another at the same input. The denominator is the bottom expression. It must not be zero, even if later cancellation makes the formula look harmless. The same cost model gives average cost per cup as 0.75x+18x, for x > 0 cups. At 24 cups, 3624 = 32 dollars per cup. Zero cups cannot supply a cost per cup because division by zero fails.

  • (gf)(x) = g(x)f(x), with both functions defined and f(x) ≠ 0.
  • Equal functions need matching domains and matching outputs, not only matching simplified formulas.
1excluded(−∞, 1) ∪ (1, ∞)
(−∞, 1) and (1, ∞) on a number line.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Quotient of functions

Write it

A quotient is a ratio: one output divided by another at the same input. The denominator is the bottom expression. It must not be zero, even if later cancellation makes the formula look harmless. The same cost model gives average cost per cup as 0.75x+18x, for x > 0 cups. At 24 cups, 3624 = 32 dollars per cup. Zero cups cannot supply a cost per cup because division by zero fails.

In math
  • (gf)(x) = g(x)f(x), with both functions defined and f(x) ≠ 0.
  • Equal functions need matching domains and matching outputs, not only matching simplified formulas.
Like

A quotient is a ratio: one output divided by another at the same input. The denominator is the bottom expression. It must not be zero, even if later cancellation makes the formula look harmless. The same cost model gives average cost per cup as 0.75x+18x, for x > 0 cups. At 24 cups, 3624 = 32 dollars per cup. Zero cups cannot supply a cost per cup because division by zero fails.

See it
1excluded(−∞, 1) ∪ (1, ∞)
The same picture again: (−∞, 1) and (1, ∞) on a number line.

Worked example

Cancel without restoring the forbidden input

OpenStax problem

For f(x) = x − 1 and g(x) = x2 − 1, find (gf)(x). You want the g output divided by the f output and the inputs where that division works. Plan: use the quantity or input named in the question, write the first result, then finish the stated operation.

Show the steps and the answer

x2−1x−1

=(x+1)(x−1)x−1

= x + 1 only when x ≠ 1

  1. (gf)(x)=x2−1x−1. Require x≠1.The original bottom x − 1 is zero at 1.
  2. x2−1=(x+1)(x−1).Multiplying these factors gives x2 − x + x − 1, so the middle terms cancel.
  3. (x+1)(x−1)x−1=x+1, while keeping x≠1.A common nonzero factor can be divided out; at 1 that factor is zero, so cancellation was never legal there.
Answer
  • (gf)(x) = x + 1, with x ≠ 1.
  • Domain: (−∞, 1) ∪ (1, ∞).
Double-check At x = 3, g(3)f(3) = 82 = 4 and x + 1 = 4. At x = 1 the original expression is 00, so it has no defined quotient.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: The quotient is the unrestricted function x + 1.
That line accepts input 1, but the original quotient does not.
✓ Instead: Use x + 1 with x ≠ 1; the domain is part of the function.
Tips and tricks
  • Write excluded inputs before factoring.

5 How

  1. Find the requested operation and its order. g − f means the g answer minus the f answer.
  2. Use the same input in both original functions, because their outputs must refer to the same starting value.
  3. Record where both formulas work and, for division, where the bottom output is nonzero.
  4. Put each whole expression in parentheses before combining it. Simplify while keeping every original domain restriction.
  5. Check one permitted input directly in the original functions.

Combine two functions and keep their domains

1
Is the operation division?
YesAlso remove every input giving a zero bottom output before canceling.
NoUse the overlap of the original domains.
↓
2
Did cancellation hide a forbidden input?
YesKeep it excluded; a shorter formula cannot restore a missing original output.
NoKeep the domain you recorded.
  1. Write the accepted inputs of each original function. Keep inputs accepted by both.
  2. For a quotient, solve bottom function = 0 to locate the additional inputs to remove. Plug each proposed excluded input back into that bottom.
  3. Substitute the formulas with parentheses around the whole second expression.
  4. Simplify and keep all original exclusions. Check using the two original outputs.

6 Worked example

Worked example

The same input, four different combinations

Let f(x) = x + 1 and g(x) = 2x. Find their sum, difference f − g, product, and quotient f divided by g at input 2. The question asks you to get both outputs at 2, then combine those outputs in four ways. Plan: evaluate both functions at the same input 2, combine their outputs in four ways, then derive the four combined formulas.

Show the steps and the answer

Same input: 2

f(2) = 3; g(2) = 4

3+4=7;3−4=−1

3×4=12;3÷4=34

  1. f(2)=2+1=3 and g(2)=2×2=4.Both functions receive input 2, so both answers describe that same input.
  2. (f+g)(2)=3+4=7.The sum adds the two outputs.
  3. (f−g)(2)=3−4=−1.The written order puts the f output first.
  4. (fg)(2)=3×4=12.The product multiplies the outputs.
  5. (fg)(2)=34.The quotient divides the f output by the nonzero g output.
  6. As formulas, (f+g)(x)=(x+1)+2x=3x+1 and (f−g)(x)=(x+1)−2x=1−x.Only matching x terms combine; the written subtraction order stays fixed.
  7. (fg)(x)=(x+1)(2x)=2x2+2x, and (fg)(x)=x+12x, requiring x≠0.Distribution multiplies both terms. The quotient removes the input 0 that makes 2x zero.
Answer
  • Sum: 7.
  • Difference: −1.
  • Product: 12.
  • Quotient: 34.
Double-check Undo each output operation at input 2: 7 − 4 = 3 checks the sum; −1 + 4 = 3 checks the difference; 12 ÷ 4 = 3 checks the product; 34 × 4 = 3 checks the quotient. The four combined formulas derived above also give these answers at 2.

Ladder: from easy to exam-hard

Try each rung before you open its steps.

Rung 1 of 6

Subtract one constant output

Let p(x) = x + 5 and q(x) = 2. This is a constant function: it returns the same output 2 for every input. Find (p − q)(x). You want the first output minus 2. Plan: write the original outputs with parentheses, record any forbidden input, then simplify and check.

Show the steps and the answer
0x + 3inputoutput3
Subtracting a constant shifts the output by that amount.
  1. (p−q)(x)=(x+5)−2.Subtraction acts on the two outputs.
  2. =x+3.5−2=3.
Answer
x + 3, for every real x.
Double-check At 0, 5 − 2 = 3, matching 0 + 3.

Rung 2 of 6

Subtract a whole function: (g − f)(x)

Let f(x) = x2 − 5x + 2 and g(x) = 3x2 + x − 5. Find (g − f)(x), simplify it, and state its domain. Then check your formula at x = 2 using the original functions.

Show the steps and the answer
  1. Find the operation and its order: (g−f)(x) means the g output minus the f output, g(x)−f(x).Subtraction does not commute: f − g would give the opposite of every value. Here f is listed first in the problem, but it must go second.
  2. Use the same input x in both original functions: g(x)=3x2+x−5 and f(x)=x2−5x+2.(g − f)(x) subtracts two outputs that come from one starting value, so both formulas must use that same x.
  3. Record where both formulas work. f and g are polynomials, so each accepts every real number. This is a difference, not a quotient, so no bottom output has to be kept nonzero. Domain of g−f: all real numbers, (−∞,∞).An input is allowed in g − f exactly when it is allowed in both g and f. The extra nonzero condition applies only to division.
  4. Put each whole expression in parentheses: (g−f)(x)=(3x2+x−5)−(x2−5x+2).The minus sign subtracts all of f(x), not just its first term. The parentheses keep the three terms of f(x) together.
  5. Distribute the minus sign to every term in the second parentheses: 3x2+x−5−x2+5x−2.Subtracting (x2 − 5x + 2) is the same as adding −x2 + 5x − 2, so all three signs flip. Dropping the parentheses would subtract only the x2 and give the wrong answer 2x2 − 4x − 3.
  6. Combine like terms: (3x2−x2)+(x+5x)+(−5−2)=2x2+6x−7.Only terms with the same power of x combine. Neither f nor g had a restriction, so the domain is still all real numbers after simplifying.
  7. Check x=2 directly in the original functions: g(2)=3(2)2+2−5=9 and f(2)=(2)2−5(2)+2=−4, so g(2)−f(2)=9−(−4)=13. The formula gives 2(2)2+6(2)−7=8+12−7=13, so they match.Working from f and g separately tests the order and every sign change. The dropped-parentheses answer would give −3 here, and the reversed order f − g would give −13.
Answer
  • (g−f)(x)=2x2+6x−7
  • domain: all real numbers, (−∞, ∞).
Double-check At x = 2: g(2) − f(2) = 9 − (−4) = 13, and 2(2)2 + 6(2) − 7 = 13. At x = −1: g(−1) = 3(−1)2 + (−1) − 5 = −3 and f(−1) = (−1)2 − 5(−1) + 2 = 8, so g(−1) − f(−1) = −3 − 8 = −11, and 2(−1)2 + 6(−1) − 7 = 2 − 6 − 7 = −11. Both inputs agree.

Work to write

  1. (g−f)(x)=g(x)−f(x)
  2. (g−f)(x)=(3x2+x−5)−(x2−5x+2)
  3. =3x2+x−5−x2+5x−2
  4. =2x2+6x−7
  5. Domain: all real numbers, (−∞, ∞), because f and g are polynomials and there is no division
  6. Check x = 2: g(2) − f(2) = 9 − (−4) = 13 and 2(2)2 + 6(2) − 7 = 13

Rung 3 of 6

Factor a difference of squares

Rewrite x2 − 16 as a product. You want two factors whose multiplication recreates the original expression. Plan: recognize x2 − 42, use the difference and sum of x and 4, then multiply to check.

Show the steps and the answer
x²4xx−4x−16−4x4
The opposite middle terms disappear when added.
  1. 16=42, so x2−16=x2−42.This is a difference of two squares.
  2. x2−42=(x−4)(x+4).Expanding gives x2 + 4x − 4x − 16; the middle terms cancel.
Answer
(x−4)(x+4).
Double-check At x = 6, 36 − 16 = 20 and (6 − 4)(6 + 4) = 2 × 10 = 20.

Rung 4 of 6

Factor and retain the hole

Let p(x) = x2 − 16 and q(x) = x − 4. Find (pq)(x) and its domain. You want a quotient formula and every permitted input. Plan: write the original outputs with parentheses, record any forbidden input, then simplify and check.

Show the steps and the answer
4hole(−∞, 4) ∪ (4, ∞)
The open dot keeps the original excluded input visible.
  1. Start with x2−16x−4 and record x≠4.The original denominator must be nonzero.
  2. Factor the top: (x−4)(x+4)x−4.x2 − 16 is a difference of squares.
  3. Cancel the factor x−4 to obtain x+4, still with x≠4.The cancellation divides by a factor known to be nonzero only on that restricted domain.
Answer
  • (pq)(x)=x+4,x≠4.
  • Domain: (−∞, 4) ∪ (4, ∞).
Double-check At 6 the original quotient is 202 = 10, matching 6 + 4. Input 4 still produces 00 in the original quotient.

Rung 5 of 6

A product and a quotient with two original exclusions

Let p(x) = x − 3 and q(x) = x2 − 9. Find (pq)(x), (pq)(x), their domains, and whether they are the same function. You want to multiply the outputs, then divide them. Plan: identify the original bottom zeros before factoring or canceling.

Show the steps and the answer
−33(−∞, −3) ∪ (−3, 3) ∪ (3, ∞)
Both original bottom zeros, −3 and 3, remain open after cancellation.
  1. (pq)(x)=(x−3)(x2−9).A product multiplies outputs at one shared input.
  2. =x·x2+x(−9)+(−3)x2+(−3)(−9).Every term in the first group multiplies every term in the second.
  3. =x3−9x−3x2+27=x3−3x2−9x+27.x·x2 contains three x factors, and two negative factors make positive 27.
  4. For the quotient, start with x−3x2−9. Solve x2−9=0, so x2=9 and x=3 or x=−3.This finds both inputs that would make the original bottom zero, so both must be removed.
  5. Check: 32−9=0 and (−3)2−9=0. Exclude both 3 and −3.Substitution confirms that both original divisions fail.
  6. Factor x2−9=(x−3)(x+3). Then x−3(x−3)(x+3)=1x+3, with both exclusions retained.Canceling a common nonzero factor preserves outputs only where the original quotient existed.
  7. At x=4, (pq)(4)=1×7=7 and (pq)(4)=17.Two different outputs at one shared allowed input prove the functions are different.
Answer
  • (pq)(x) = x3 − 3x2 − 9x + 27, domain (−∞, ∞).
  • (pq)(x) = 1x+3, domain (−∞, −3) ∪ (−3, 3) ∪ (3, ∞).
  • They are different functions.
Double-check At 4, the expanded product gives 64 − 48 − 36 + 27 = 7. The shorter quotient gives 14+3 = 17. At 3 its original form is 00, so 3 stays excluded.

Rung 6 of 6

The domains of the two ingredients differ

Let f(x) = x+6 and g(x) = 2x−5. Find f + g, f − g, fg, f/g and g/f with their domains. You want formulas and the inputs each operation can accept. Plan: overlap the two original domains, then remove any zero bottom output for each quotient.

Show the steps and the answer
−65[−6, 5) ∪ (5, ∞)
The overlap includes the root boundary −6 but excludes the fraction input 5.
  1. f needs x+6≥0, so x≥−6. g needs x−5≠0, so x≠5.The root requires a nonnegative inside, and the fraction requires a nonzero bottom.
  2. The overlap is [−6,5)∪(5,∞).Arithmetic needs both original outputs at the same starting input.
  3. (f+g)(x)=x+6+2x−5; (f−g)(x)=x+6−2x−5; (fg)(x)=2x+6x−5.Apply the requested operation to the two complete outputs.
  4. For f/g, g(x) never equals zero on its domain, since its top is 2. Thus (fg)(x)=x+6×x−52=(x−5)x+62.Division multiplies by the reciprocal of the nonzero bottom output.
  5. For g/f, also require x+6≠0. It equals zero at x=−6, because −6+6=0. Remove −6.This finds and confirms the extra starting input that would make the quotient bottom zero.
  6. (gf)(x)=2(x−5)x+6, with domain (−6,5)∪(5,∞).The bottom combines the original fraction bottom and the root output; both must stay nonzero.
Answer
  • (f + g)(x) = x+6 + 2x−5, domain [−6, 5) ∪ (5, ∞).
  • (f − g)(x) = x+6 − 2x−5, domain [−6, 5) ∪ (5, ∞).
  • (fg)(x) = 2x+6x−5, domain [−6, 5) ∪ (5, ∞).
  • (fg)(x) = (x−5)x+62, domain [−6, 5) ∪ (5, ∞).
  • (gf)(x) = 2(x−5)x+6, domain (−6, 5) ∪ (5, ∞).
Double-check At −6, f gives 0 and g gives −211, so their sum exists and equals −211. The quotient g/f fails because its bottom output is 0. At 5, g fails before any arithmetic, so even the shorter f/g formula cannot use 5.

Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: A product must exclude inputs where either output is zero.
Multiplication by zero has the valid answer zero. Only division forbids a zero bottom.
✓ Instead: A product requires both functions to be defined; a quotient additionally requires its denominator output to be nonzero.
✗ Not this: (f + g)(2) = 2f + 2g.
f and g name recipes. The final parentheses supply input 2 to both recipes rather than multiplying the recipes.
✓ Instead: (f + g)(2) = f(2) + g(2) = 3 + 4 = 7 in the main example.
✗ Not this: After x−3x2−9 becomes 1x+3, only −3 is excluded.
At x = 3, the original expression is 00. Canceling has hidden that failed input.
✓ Instead: Keep x ≠ −3 and x ≠ 3 in the simplified quotient.
✗ Not this: The domain of f + g for the last rung is [−6, ∞).
At x = 5, g gives 20, so there is no second output to add.
✓ Instead: Both original domains must hold: [−6, 5) ∪ (5, ∞).

Tips and tricks

  • Know cold.
    Arithmetic gives both functions the same input. Memory cue: same input, two answers, one operation.
    Composition runs the inner function first. Memory cue: read ∘ as after, so f ∘ g means f after g.
    Replace every input slot with the whole expression. Memory cue: every slot gets the whole package.
    Check both domain gates. Memory cue: gate 1 checks x, gate 2 checks the first answer.
    An ordinary root permits zero; a denominator forbids it. Memory cue: root zero can stay, bottom zero goes away.
    When decomposing, identify the last operation. Memory cue: the last calculator step is the outer function.
  • Understand, then rebuild when needed.
    Expanded sums, products, factorizations, and composition formulas can be recreated with substitution and distribution. Do not memorize each final formula.
    Rebuild a table or graph path by carrying the inner output to the outer input.
    Rebuild domain intervals from the allowed points and the endpoint checks.
    Rebuild a decomposition by identifying the final operation, then recomposing to check.
  • Put on the cheat sheet for study.
    Arithmetic: (f + g)(x) = f(x) + g(x); (f − g)(x) = f(x) − g(x); (fg)(x) = f(x)·g(x); (fg)(x) = f(x)g(x). Use the shared domain, with g(x) ≠ 0 for the quotient.
    Composition: (f ∘ g)(x) = f(g(x)). Its domain keeps x allowed by g and g(x) allowed by f.
    Roots: A needs A ≥ 0; 1A needs A > 0.
    Square expansion: (a + b)2 = a2 + 2ab + b2. Difference of squares: a2 − b2 = (a − b)(a + b).
    Intervals: brackets include finite endpoints, parentheses exclude them, and infinity always takes parentheses.
    This is a study sheet. For a closed-book exam, practice recalling the short definitions and rebuilding the rest without looking.
  • A function name before parentheses means input: f(2) reads f of 2. A number before parentheses means multiplication: 3(2) = 6.

7 The trap

Subtracting only the first term of a function. (x2 − 1) − (x − 1) subtracts the entire second expression, so both of its signs change.

Problems marked OpenStax come from Precalculus 2e by Jay Abramson, published by OpenStax, under the CC BY-NC-SA 4.0 licence. Access for free at https://openstax.org/books/precalculus-2e/pages/1-introduction-to-functions.

Lesson 2 of 10

Composition passes one answer into the next function

Subject: MathematicsLeans on: Function notationLeans on: Order of operationsLeans on: Multiplication notationOpen this lesson
Leans on 1Comes back in 0

1 In plain words

Picture two machines standing in a row. Put in 2. The first machine adds 1 and hands out 3. The second machine doubles that 3 and hands out 6. One machine hands its finished answer straight to the next. This handoff is composition of functions, also called function composition. The combined recipe is a composite function. You can use it when one question depends on the answer to another. To price heating for a day, first find the day’s temperature, then use that temperature to find the cost. One starting input travels through both jobs and produces one final answer.

2 Picture it

xgffirstsecondg(x)f(g(x))
The machines run left to right, g then f.

Reminder

Reminder: Function notation, Order of operations, Multiplication notation
  • Function notation. f(3) means the f output at input 3; if f(x) = 2x, f(3) = 6.
  • Order of operations. Finish parentheses first: 2(2 + 1) = 2 × 3 = 6.
  • Multiplication notation. A dot multiplies numbers: f(2)·g(2) = 4 × 3 = 12.

3 Why

The parentheses show what input each function receives. In f(g(x)), f is waiting for the value written inside its parentheses, namely g(x). You must obtain that value before f can act. This is the same order of operations used when you calculate 2(3 + 1): finish the inner calculation first. Because each machine produces one answer from an allowed input, the connected machines also produce one final answer wherever both stages can run.

4 The rule

(f∘g)(x)=f(g(x)).

First apply g, then apply f to g's output.
The product (fg)(x)=f(x)·g(x) is a different operation.

The same idea, five ways

Say it

f of g of x; f composed with g at x; f after g

Write it

Put x into g first, then put g’s answer into f. The inner function is the first job; the outer function is the last job.

In math
  • (f ∘ g)(x) = f(g(x))
  • f ∘ g names the new recipe
  • (f ∘ g)(2) names its output at 2
  • x → g(x) → f(g(x))
Like

Day becomes temperature, then temperature becomes heating cost.

See it
2g: add 1f: doublefirstsecond36
The path starts in g even though f is written first in f(g(2)).

The same idea, other ways

As connected machines

Follow the wire. The first machine g changes x into g(x). The second machine f changes that intermediate answer into f(g(x)).

xgffirstsecondg(x)f(g(x))
There is one continuous path through the machines.
As a heating bill

To estimate a heating cost for a day, first find that day's temperature. Then use the temperature to find the cost. A day cannot go straight into a rule that expects a temperature. Descriptive variables are names chosen to remind you what they measure: d for day, T for temperature, C for cost. C(T(d)) says cost after temperature after day.

day dTCfirstsecondtemperaturecost
The descriptive letters name day, temperature and cost.
With a small number

Start with 2. Add 1 to obtain 3. Double 3 to obtain 6. The intermediate answer is a new input, not a number to multiply by the original input.

2add 1doublefirstsecond36
Two actions happen in sequence.
From the parentheses

In f(g(x)), the input slot of f contains g(x). Compute the contents of the slot first. Memory cue: inside first, outside last.

f( g(x) )

Finish g(x)

Then f receives that result

Part 1: Inner function

The inner function is the first job. It is closest to the starting input in the nested notation. The name of the function does not decide its role; its position does.

  • In f(g(x)), g is inner.
  • In g(f(x)), f is inner.
2g(x) = x + 1inputoutput3
2 goes in, the rule is g(x) = x + 1, and 3 comes out.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Inner function

Write it

The inner function is the first job. It is closest to the starting input in the nested notation. The name of the function does not decide its role; its position does.

In math
  • In f(g(x)), g is inner.
  • In g(f(x)), f is inner.
Like

The inner function is the first job. It is closest to the starting input in the nested notation. The name of the function does not decide its role; its position does.

See it
2g(x) = x + 1inputoutput3
The same picture again: 2 goes in, the rule is g(x) = x + 1, and 3 comes out.

Worked example

Find the intermediate answer

In f(g(2)) with g(x) = x + 1, find the first answer. You are not finding the final f output yet. Plan: use the quantity or input named in the question, write the first result, then finish the stated operation.

Show the steps and the answer
2add 1inputoutput3
This is the first stage only.
  1. Evaluate g(2)=2+1=3.g is next to the starting input inside the parentheses.
Answer
The intermediate answer is 3.
Double-check The expression is now f(3), so f still has a job to do.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: In g(f(x)), g is inner because it is written first.
The inner function is closest to the starting x, which is f here.
✓ Instead: g(f(x)) applies f first; g is outer.
Tips and tricks
  • Point to the function directly touching the original input; that is the first job.

Part 2: Outer function

The outer function is the second job. Its input is the answer from the inner function. Think of a packing station receiving the item that a previous station finished.

  • In f(g(x)), f is outer.
  • An outer function must accept the intermediate output as its input.
3f(x) = 2xinputoutput6
3 goes in, the rule is f(x) = 2x, and 6 comes out.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Outer function

Write it

The outer function is the second job. Its input is the answer from the inner function. Think of a packing station receiving the item that a previous station finished.

In math
  • In f(g(x)), f is outer.
  • An outer function must accept the intermediate output as its input.
Like

The outer function is the second job. Its input is the answer from the inner function. Think of a packing station receiving the item that a previous station finished.

See it
3f(x) = 2xinputoutput6
The same picture again: 3 goes in, the rule is f(x) = 2x, and 6 comes out.

Worked example

Finish the second stage

The first stage gave 3. If f(x) = 2x, find f(3). The question asks for the final output after doubling the intermediate answer. Plan: use the quantity or input named in the question, write the first result, then finish the stated operation.

Show the steps and the answer
3doubleinputoutput6
The second stage completes the composition.
  1. f(3)=2×3=6.The input slot of f now holds 3.
Answer
The final answer is 6.
Double-check Dividing 6 by 2 returns the outer input 3, which was g's answer.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: The outer function always receives the original x.
It receives the in-between output. For g(x) = x + 1 and f(x) = 2x, input 2 reaches f as 3.
✓ Instead: f(g(2)) = f(3) = 6, while f(2) = 4 answers a different question.
Tips and tricks
  • Write the in-between answer inside the outer parentheses before calculating.

Part 3: Composition operator and Binary operation

The open circle ∘ is the composition operator: it connects two functions into one new function. A binary operation takes two starting objects and makes one result. Here the starting objects are functions. The word binary refers to the number of starting objects, rather than to a computer’s zeros and ones. A degree is an angle measure. Its symbol ° appears after a number, as in 30°; it does not connect two functions.

  • Read (f ∘ g)(x) as f composed with g at x.
  • Read f(g(x)) as f of g of x.
  • Both notations describe the same handoff.
  • f ∘ g is a function name; (f ∘ g)(x) is that function’s output at input x.

f · g: multiply the two outputs

f ∘ g: g acts first, then f

30°: angle of thirty degrees

Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Composition operator and binary operation

Write it

The open circle ∘ is the composition operator: it connects two functions into one new function. A binary operation takes two starting objects and makes one result. Here the starting objects are functions. The word binary refers to the number of starting objects, rather than to a computer’s zeros and ones. A degree is an angle measure. Its symbol ° appears after a number, as in 30°; it does not connect two functions.

In math
  • Read (f ∘ g)(x) as f composed with g at x.
  • Read f(g(x)) as f of g of x.
  • Both notations describe the same handoff.
  • f ∘ g is a function name; (f ∘ g)(x) is that function’s output at input x.
Like

The open circle ∘ is the composition operator: it connects two functions into one new function. A binary operation takes two starting objects and makes one result. Here the starting objects are functions. The word binary refers to the number of starting objects, rather than to a computer’s zeros and ones. A degree is an angle measure. Its symbol ° appears after a number, as in 30°; it does not connect two functions.

See it

f · g: multiply the two outputs

f ∘ g: g acts first, then f

30°: angle of thirty degrees

Worked example

Circle versus product

For f(x) = 2x and g(x) = x + 1, compare (f ∘ g)(2) and (fg)(2). You want to see what each symbol tells you to do. Plan: use the quantity or input named in the question, write the first result, then finish the stated operation.

Show the steps and the answer
2gffirstsecond36
The picture shows the composition path.
  1. (f∘g)(2)=f(3)=6.Composition sends g(2) = 3 into f.
  2. (fg)(2)=f(2)·g(2)=4×3=12.The product uses two separate outputs at 2.
Answer
  • Composition: 6.
  • Product: 12.
Double-check The connected-machine path ends at 6; multiplying the independent outputs 4 and 3 ends at 12.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: Binary operation means zeros and ones in this definition.
Here binary counts the two starting objects. Addition takes two numbers; composition takes two functions.
✓ Instead: Binary operation means an operation with two starting objects.
✗ Not this: (f ∘ g)(2) equals f(2)·g(2).
The open circle requests an output handoff, whereas the dot requests multiplying independent outputs.
✓ Instead: f(g(2)) is the composition; f(2)·g(2) is the product.
Tips and tricks
  • Recognize binary operation as vocabulary for a two-object operation. The word does not add a calculation step.
  • Read the open circle as after before deciding which function acts first.

5 How

  1. Rewrite the circle notation as nested parentheses, meaning one pair of parentheses inside another: (f ∘ g)(x) = f(g(x)).
  2. Name the inner function, which touches the original input.
  3. Evaluate that function and write its output as a separate intermediate, or in-between, answer.
  4. Put that whole intermediate answer into the outer function.
  5. Check the path: original input, inner output, final output.

Evaluate a two-stage composition

1
Does the inner function accept the starting input?
YesCalculate its output and continue.
NoThe composition has no output at this start.
↓
2
Does the outer function accept that in-between output?
YesEvaluate the outer function to finish.
NoThe composition has no output at this start.
  1. Rewrite (f ∘ g)(a) as f(g(a)); read it as f after g at a.
  2. Find the inner function next to a and calculate g(a). Write that in-between answer on its own line.
  3. Use the whole in-between answer as the outer input. Find f of that answer.
  4. Check the path from original input to in-between answer to final output.

6 Worked example

Worked example

Add 1, then double

Let g(x) = x + 1 and f(x) = 2x. Find (f ∘ g)(2). The input is 2; add 1 first, then use that answer as the input to the doubling function. Plan: finish g first, then carry its whole answer into f.

Show the steps and the answer
2g: add 1f: doublefirstsecond36
The 3 coming out of g goes into f.
  1. (f∘g)(2)=f(g(2)).The circle means composition, so g is the inner function.
  2. g(2)=2+1=3.The original input goes into g first.
  3. f(g(2))=f(3)=2×3=6.The output 3 from g is the input to f.
Answer
(f ∘ g)(2) = 6.
Double-check Combining the rules gives f(g(x)) = 2(x + 1); at 2 this is 2(2 + 1) = 6. The separate product at 2 is f(2)g(2) = 4 × 3 = 12, confirming that the two operations differ.

Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: (f ∘ g)(2) = f(2)·g(2) = 12.
The circle requests a handoff, while multiplication uses separate outputs at the same input.
✓ Instead: Find g(2) = 3, then f(3) = 6.
✗ Not this: f(g(2)) means g(f(2)).
Swapping the parentheses changes which machine receives 2.
✓ Instead: f(g(2)) starts with g; g(f(2)) starts with f.

Tips and tricks

  • Know cold: inside first, outside last. Write one intermediate answer so the order stays visible.
  • Draw two boxes and a connecting arrow when the notation feels crowded.
  • Know cold memory cue: read ∘ as after. f ∘ g says f after g, so g acts first.

7 The trap

Starting with f because its name appears first. In f ∘ g, g receives the original input. Expand the circle notation before calculating.

Lesson 3 of 10

Order changes the result, and units must fit

Subject: MathematicsLeans on: SubstitutionLeans on: DistributionLeans on: Subtracting parenthesesLeans on: Composition orderLeans on: Function equalityLeans on: Discount fractionsLeans on: Divide a fraction by a whole numberOpen this lesson
Leans on 0Comes back in 0

1 In plain words

Picture a store applying a discount and a coupon. A 64-dollar price falls to 48 dollars after 25% off. An 8-dollar coupon then leaves 40 dollars. Reverse the jobs: the coupon leaves 56 dollars, and 25% off that amount leaves 42 dollars. The order changes what the second job receives. Composition can work the same way. Commutative means switching two jobs always preserves the result; composition does not have that property in general. Meaning matters too. If a driving rule gives miles from hours, a fuel rule accepting miles can follow it. The miles fit its input slot, the way a matching key fits a lock.

2 Picture it

hoursmileagefuel usefirstsecondmilesgallons
Miles fit the fuel rule's input slot.

Reminder

Reminder: Substitution, Distribution, Subtracting parentheses, Composition order, Function equality, Discount fractions, Divide a fraction by a whole number
  • Substitution. Replacing x with 3 − x in 2x + 1 gives 2(3 − x) + 1.
  • Distribution. 2(3 − x) = 6 − 2x, because 2 multiplies each term.
  • Subtracting parentheses. 3−(2x+1)=3−2x−1.
  • Composition order. G(m(2)) starts with m(2), then puts that answer into G.
  • Function equality. A formula accepting every x differs from the same formula restricted to x ≠ 1.
  • Discount fractions. 25% off leaves 75%, so multiply the price by 0.75. At 64 dollars, 0.75 × 64 = 48 dollars.
  • Divide a fraction by a whole number. 65 ÷ 2 = 65 × 12 = 35. Likewise 96r2 ÷ 8 = 12r2.

3 Why

The first function changes what the second function receives. Reversing them therefore changes the second input, which can change the final answer. Agreement at a single input is not enough to establish equal functions: they must have the same domain and agree at every input there. In an application, a unit tells you what a number measures. A number labeled gallons cannot fill an input slot labeled hours, even when the bare formulas permit the arithmetic.

4 The rule

Usually f(g(x))≠g(f(x)) as functions.

Check both orders rather than assuming equality.
For a meaningful composition, the inner output must be an acceptable outer input, including its units.

The same idea, five ways

Say it

order matters; f after g may differ from g after f

Write it

Changing which job happens first can change the next input and the final output.

In math
  • f(g(x)) and g(f(x)) are usually different functions
  • 2 + 3 = 3 + 2: addition is commutative
  • 5 − 2 ≠ 2 − 5: subtraction is not commutative
  • hours → miles → gallons
Like

A discount and a coupon act on different intermediate prices when reversed.

See it
$6425% off$8 couponfirstsecond$48$40
Discount then coupon gives 40 dollars; the reverse order gives 42 dollars.

The same idea, other ways

As two jobs

The first job sets up the second. Adding a coat after washing an object is a different process from washing after adding the coat.

First job changes the second input

Switching jobs can switch the answer

As labeled packages

The inner function hands over a package with a label. If the label says miles, the next function must accept miles. A number alone does not tell you its meaning.

2 hours× 45÷ 30firstsecond90 miles3 gallons
The unit on each output matches the next input.

Part 1: Compare both orders

Composition can happen to commute for a particular pair. You still need to check. Two functions can also happen to agree at one input without being equal everywhere.

  • One unequal output proves functions differ.
  • One equal output does not prove functions equal.
both give 1f(g(1)) = 2g(f(1)) = 4−22246810
y = x2 + 1, solid, beside y = (x + 1)2, dashed.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Compare both orders

Write it

Composition can happen to commute for a particular pair. You still need to check. Two functions can also happen to agree at one input without being equal everywhere.

In math
  • One unequal output proves functions differ.
  • One equal output does not prove functions equal.
Like

Composition can happen to commute for a particular pair. You still need to check. Two functions can also happen to agree at one input without being equal everywhere.

See it
both give 1f(g(1)) = 2g(f(1)) = 4−22246810
The same picture again: y = x2 + 1, solid, beside y = (x + 1)2, dashed.

Worked example

A coincidence is not function equality

For f(x) = x + 1 and g(x) = x2, compare both orders at 0 and at 1. You want to test whether one matching answer tells the whole story. Plan: use the quantity or input named in the question, write the first result, then finish the stated operation.

Show the steps and the answer

One matching input: not enough

One differing input: functions differ

Compare x2 + 1 with x2 + 2x + 1

  1. At 0, f(g(0))=f(0)=1 and g(f(0))=g(1)=1.Both paths happen to end at 1 for this input.
  2. At 1, f(g(1))=f(1)=2 and g(f(1))=g(2)=4.The first stage now sends different numbers to the second stage.
Answer
They agree at 0, but differ at 1, so they are different functions.
Double-check Their formulas are x2 + 1 and (x + 1)2 = x2 + 2x + 1. The extra 2x disappears at 0 but not at 1.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: Composition never commutes for any pair.
Two adding machines can commute: adding 1 then 2 has the same effect as adding 2 then 1.
✓ Instead: Composition is not commutative in general; particular pairs may commute.
Tips and tricks
  • Use a small test input to catch a difference, then use formulas and domains to establish equality.

Part 2: Interpret a composition with units

Read the composition as a sentence. If s takes minutes and returns sit-ups, and c takes sit-ups and returns calories, c(s(t)) is calories burned during t minutes of sit-ups.

  • The inner s output counts sit-ups.
  • The outer c output counts calories.
  • The input and output letters are placeholders; the units explain their meaning.
4 minutess: 12tc: n ÷ 4firstsecond48 sit-ups12 calories
4 minutes goes into s: 12t, then 48 sit-ups into c: n ÷ 4: 12 calories.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Interpret a composition with units

Write it

Read the composition as a sentence. If s takes minutes and returns sit-ups, and c takes sit-ups and returns calories, c(s(t)) is calories burned during t minutes of sit-ups.

In math
  • The inner s output counts sit-ups.
  • The outer c output counts calories.
  • The input and output letters are placeholders; the units explain their meaning.
Like

Read the composition as a sentence. If s takes minutes and returns sit-ups, and c takes sit-ups and returns calories, c(s(t)) is calories burned during t minutes of sit-ups.

See it
4 minutess: 12tc: n ÷ 4firstsecond48 sit-ups12 calories
The same picture again: 4 minutes goes into s: 12t, then 48 sit-ups into c: n ÷ 4: 12 calories.

Worked example

Minutes to sit-ups to calories

Use the illustrative models s(t) = 12t sit-ups and c(n) = n4 calories. Interpret and evaluate c(s(4)). You want the calories assigned by this model to the sit-ups completed in 4 minutes. Plan: use the quantity or input named in the question, write the first result, then finish the stated operation.

Show the steps and the answer
4 minutesscfirstsecond48 sit-ups12 calories
The function labels tell you what each stage measures.
  1. s(4)=12×4=48 sit-ups.s accepts minutes and returns the exercise count.
  2. c(s(4))=c(48)=484=12 calories.c accepts the count produced by s.
Answer
  • Interpretation: c(s(4)) is the modeled calories burned in 4 minutes of sit-ups.
  • Value: c(s(4)) = 12 calories.
Double-check c(s(t)) = 12t4 = 3t, so at 4 minutes the combined model gives 3 × 4 = 12 calories.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: c(s(4)) counts the sit-ups done in 4 minutes.
The inner s output counts sit-ups. The outer c output counts calories.
✓ Instead: s(4) counts sit-ups; c(s(4)) counts the modeled calories burned doing those sit-ups.
Tips and tricks
  • Read inside to outside, naming each quantity: minutes, sit-ups, calories.
  • An interpretation question needs a sentence. A numerical value can be found only when the functions’ rules or values are supplied.

Part 3: Check whether the reverse order makes sense

A numerical formula may accept a number that its application cannot interpret. In the driving story, fuel use must follow distance. Feeding gallons into a driving-time rule gives the wrong kind of input.

  • If m accepts hours and returns miles, and G accepts miles and returns gallons, G(m(h)) is meaningful.
  • m(G(h)) does not match these units; G cannot start with hours and m cannot take gallons.
2 hoursm: ×45G: ÷30firstsecond90 miles3 gallons
2 hours goes into m: ×45, then 90 miles into G: ÷30: 3 gallons.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Check whether the reverse order makes sense

Write it

A numerical formula may accept a number that its application cannot interpret. In the driving story, fuel use must follow distance. Feeding gallons into a driving-time rule gives the wrong kind of input.

In math
  • If m accepts hours and returns miles, and G accepts miles and returns gallons, G(m(h)) is meaningful.
  • m(G(h)) does not match these units; G cannot start with hours and m cannot take gallons.
Like

A numerical formula may accept a number that its application cannot interpret. In the driving story, fuel use must follow distance. Feeding gallons into a driving-time rule gives the wrong kind of input.

See it
2 hoursm: ×45G: ÷30firstsecond90 miles3 gallons
The same picture again: 2 hours goes into m: ×45, then 90 miles into G: ÷30: 3 gallons.

Worked example

Hours to distance to fuel

Let m(h) = 45h miles and G(d) = d30 gallons. Evaluate the meaningful composition at 2 hours and explain the order. You want gallons used for the distance driven in 2 hours. Plan: use the quantity or input named in the question, write the first result, then finish the stated operation.

Show the steps and the answer
2 hoursmGfirstsecond90 miles3 gallons
Follow the units to choose the order.
  1. m(2)=45×2=90 miles.The mileage rule accepts hours.
  2. G(m(2))=G(90)=9030=3 gallons.The fuel rule accepts miles.
  3. Reject m(G(h)) as an interpretation for these models.G expects miles rather than hours, and m expects hours rather than G's gallon output.
Answer
  • G(m(2)) = 3 gallons.
  • The order is hours to miles to gallons.
Double-check The model uses 1 gallon per 30 miles; 3 gallons cover 3 × 30 = 90 miles, the distance obtained from 2 hours.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: m(G(2)) converts 2 hours into gallons.
G accepts miles, and its gallon output cannot enter m, which accepts hours.
✓ Instead: G(m(2)) converts hours to miles to gallons.
Tips and tricks
  • Write the input and output unit under each function name before deciding which name goes inside.

Part 4: Both orders can be meaningful and can sometimes commute

When two rules both accept and return ordinary real numbers, you can often use either order. The outputs can still differ, as the earlier linear pair showed. Some particular pairs do give equal functions in both orders.

  • Both orders can be meaningful when the input and output quantities match.
  • A pair that commutes does not make composition commutative in general.
  • For f(x) = x + 1 and g(x) = x + 2, both compositions give x + 3 on all real inputs.

f(x) = x + 1; g(x) = x + 2

f(g(x)) = (x + 2) + 1 = x + 3

g(f(x)) = (x + 1) + 2 = x + 3

Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Both orders can be meaningful and can sometimes commute

Write it

When two rules both accept and return ordinary real numbers, you can often use either order. The outputs can still differ, as the earlier linear pair showed. Some particular pairs do give equal functions in both orders.

In math
  • Both orders can be meaningful when the input and output quantities match.
  • A pair that commutes does not make composition commutative in general.
  • For f(x) = x + 1 and g(x) = x + 2, both compositions give x + 3 on all real inputs.
Like

When two rules both accept and return ordinary real numbers, you can often use either order. The outputs can still differ, as the earlier linear pair showed. Some particular pairs do give equal functions in both orders.

See it

f(x) = x + 1; g(x) = x + 2

f(g(x)) = (x + 2) + 1 = x + 3

g(f(x)) = (x + 1) + 2 = x + 3

Worked example

A pair whose order does not change the function

Let f(x) = x + 1 and g(x) = x + 2, both with all real inputs. Find both compositions and compare them. You want to see a case where reversing two connected rules gives the same complete function. Plan: use the quantity or input named in the question, write the first result, then finish the stated operation.

Show the steps and the answer
4g: add 2f: add 1firstsecond67
Adding 2 then 1 gives 7.
4f: add 1g: add 2firstsecond57
Adding 1 then 2 also gives 7.
  1. f(g(x))=f(x+2)=(x+2)+1=x+3.g adds 2 first, then f adds 1.
  2. g(f(x))=g(x+1)=(x+1)+2=x+3.f adds 1 first, then g adds 2.
  3. Both composite domains are all real numbers.Both component rules accept every real intermediate answer.
Answer
Both compositions equal x + 3 on (−∞, ∞), so this pair commutes.
Double-check At x = 4 the first path is 4 to 6 to 7 and the reverse path is 4 to 5 to 7. The symbolic calculations establish the agreement for every real input.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: This example proves that all function compositions commute.
It proves equality for this specific pair; the earlier pair gave different formulas.
✓ Instead: Check each pair and its domains separately.
Tips and tricks
  • Functions with the same input and output units can permit both orders without giving equal answers.

Part 5: Distance to force to acceleration

A distance rule can return a force, and a force rule can return an acceleration. Acceleration measures how quickly speed or direction changes. To find acceleration from distance, hand the distance rule's force output to the acceleration rule. In this model, G names the force rule, F names its force input to a, and r names distance. The letters are labels for their quantities.

  • For the scaled practice model below, the meaningful order is a(G(r)).
  • The units pass from distance to force to acceleration.
  • a(G(r)) means the modeled acceleration of a planet at distance r from the sun.
r = 4G: 96 ÷ r²a: F ÷ 8firstsecondF = 63/4
r = 4 goes into G: 96 ÷ r2, then F = 6 into a: F ÷ 8: 3/4.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Distance to force to acceleration

Write it

A distance rule can return a force, and a force rule can return an acceleration. Acceleration measures how quickly speed or direction changes. To find acceleration from distance, hand the distance rule's force output to the acceleration rule. In this model, G names the force rule, F names its force input to a, and r names distance. The letters are labels for their quantities.

In math
  • For the scaled practice model below, the meaningful order is a(G(r)).
  • The units pass from distance to force to acceleration.
  • a(G(r)) means the modeled acceleration of a planet at distance r from the sun.
Like

A distance rule can return a force, and a force rule can return an acceleration. Acceleration measures how quickly speed or direction changes. To find acceleration from distance, hand the distance rule's force output to the acceleration rule. In this model, G names the force rule, F names its force input to a, and r names distance. The letters are labels for their quantities.

See it
r = 4G: 96 ÷ r²a: F ÷ 8firstsecondF = 63/4
The same picture again: r = 4 goes into G: 96 ÷ r2, then F = 6 into a: F ÷ 8: 3/4.

Worked example

Choose a meaningful gravity-model composition

In an invented scaled model, G(r) = 96r2 force units for r > 0 distance units, and a(F) = F8 acceleration units for F ≥ 0 force units. Interpret and evaluate a(G(4)). You want acceleration obtained from the force at distance 4. Plan: use the quantity or input named in the question, write the first result, then finish the stated operation.

Show the steps and the answer
4Gafirstsecond63/4
The handoff is force, and the final number measures acceleration in this invented scaled model.
  1. G(4)=9642=9616=6 force units.The distance input goes into the inner force model first.
  2. a(G(4))=a(6)=68=34 acceleration units.The outer model accepts the force output and divides it by 8.
  3. The reverse connection does not match the stated quantity labels.G expects distance, not the acceleration returned by a.
Answer
  • a(G(4)) = 34 acceleration units.
  • It means the modeled acceleration at distance 4.
Double-check a(G(r)) = 96r2 ÷ 8 = 12r2 for r > 0. At 4 it gives 1216 = 34, agreeing with the two-stage route.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: Use G(a(r)) to obtain acceleration from distance.
a expects force, and G expects distance; that order mixes the quantity labels.
✓ Instead: Use a(G(r)).
Tips and tricks
  • Read the input and output names before manipulating an application formula.

Part 6: A price example makes order visible

A percentage reduction changes with the price it receives. A coupon removes a fixed amount. This is why moving the coupon earlier changes the later percentage savings. Compare the numeric prices first, then write the two formulas.

  • On starting prices x ≥ 11 dollars, both composed prices are nonnegative and both store instructions make sense.
  • The reverse order in this example costs 2 dollars more.
$6425% off$8 offfirstsecond$48$40
$64 goes into 25% off, then $48 into $8 off: $40.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

A price example makes order visible

Write it

A percentage reduction changes with the price it receives. A coupon removes a fixed amount. This is why moving the coupon earlier changes the later percentage savings. Compare the numeric prices first, then write the two formulas.

In math
  • On starting prices x ≥ 11 dollars, both composed prices are nonnegative and both store instructions make sense.
  • The reverse order in this example costs 2 dollars more.
Like

A percentage reduction changes with the price it receives. A coupon removes a fixed amount. This is why moving the coupon earlier changes the later percentage savings. Compare the numeric prices first, then write the two formulas.

See it
$6425% off$8 offfirstsecond$48$40
The same picture again: $64 goes into 25% off, then $48 into $8 off: $40.

Worked example

A store’s two orders

Let d(x) = 0.75x apply 25% off a price, and c(x) = x − 8 apply an 8-dollar coupon. Compare c(d(64)) and d(c(64)), then find both formulas. You want the price in each order. Plan: keep a separate line for each discount or coupon.

Show the steps and the answer
$6425% off$8 offfirstsecond$48$40
The same picture a third time: $64 goes into 25% off, then $48 into $8 off: $40.
$64$8 off25% offfirstsecond$56$42
Reversing the jobs applies 25% off to 56 dollars.
  1. d(64)=0.75×64=48; c(48)=48−8=40.The percentage discount comes first in c(d(64)); the coupon acts on its remaining price.
  2. c(64)=64−8=56; d(56)=0.75×56=42.In the reverse order, the percentage discount acts on the price after the coupon.
  3. c(d(x))=0.75x−8; d(c(x))=0.75(x−8)=0.75x−6.Substitute the whole inner price; distribution gives 0.75 × 8 = 6.
Answer
  • Discount then coupon: 40 dollars.
  • Coupon then discount: 42 dollars.
  • c(d(x))=0.75x−8.
  • d(c(x))=0.75x−6.
Double-check The discount after the coupon saves 25% of 56, which is 14 dollars: 56 − 14 = 42. The discount before the coupon saves 16 dollars, giving 64 − 16 − 8 = 40.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: A discount and coupon always give the same final price in either order.
The percentage reduction depends on its current input price: it saves 16 dollars before the coupon but 14 afterward.
✓ Instead: For this 64-dollar item the two prices are 40 and 42 dollars.
Tips and tricks
  • Write the current price after each instruction. Do not apply both instructions separately to the original price.

Part 7: Interpret a word-only composition

You can explain a composition even when no numerical formulas are given. Each function’s description tells you the kind of input and output. Follow those descriptions as you would follow labels on packages. The outside function names the final quantity.

  • Interpret means state what the expression measures in words.
  • A quantity description by itself does not supply a numerical rate.
3 minutesscfirstsecondsit-upscalories
3 minutes goes into s, then sit-ups into c: calories.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Interpret a word-only composition

Write it

You can explain a composition even when no numerical formulas are given. Each function’s description tells you the kind of input and output. Follow those descriptions as you would follow labels on packages. The outside function names the final quantity.

In math
  • Interpret means state what the expression measures in words.
  • A quantity description by itself does not supply a numerical rate.
Like

You can explain a composition even when no numerical formulas are given. Each function’s description tells you the kind of input and output. Follow those descriptions as you would follow labels on packages. The outside function names the final quantity.

See it
3 minutesscfirstsecondsit-upscalories
The same picture again: 3 minutes goes into s, then sit-ups into c: calories.

Worked example

Two orders of composition, and a pool hose with water cost

(a) Let f(x) = 3x − 4 and g(x) = x. Find f(g(x)) and g(f(x)), give the domain of each, and decide whether they are the same function. (b) A hose fills a pool at a steady rate, so after t minutes the pool holds V(t) = 12t gallons. The water company charges W(v) = 0.005v dollars for v gallons. Decide which composition, W(V(t)) or V(W(t)), is meaningful. Find a formula for the meaningful one and evaluate it at t = 50. Label every quantity with its units.

Show the steps and the answer
  1. For f(g(x)), the inner function is g, because g acts on x first. For g(f(x)), the inner function is f.In a composition the function written closest to x is applied first. Its output becomes the input of the outer function.
  2. f(g(x))=f(x)=3x−4. The domain is x≥0.Replace x in f with x. The inner root needs x ≥ 0, and f accepts any real number, so no further restriction is added.
  3. g(f(x))=g(3x−4)=3x−4. The domain needs 3x−4≥0, so x≥43.Replace x in g with 3x − 4. A square root needs a non-negative input, so the inner output must be at least 0.
  4. Test x=4, which is in both domains: f(g(4))=3·2−4=2, and g(f(4))=8≈2.83. The values are 2 and 8, which differ.One allowed input that gives different outputs proves the two functions are different. The domains also differ, [0, ∞) against [43, ∞), which is a second reason.
  5. In part (b), label the units. V takes t in minutes and returns gallons. W takes v in gallons and returns dollars.A composition makes sense only when the inner output is an acceptable input for the outer function, units included.
  6. W(V(t)): the starting input is t minutes, the intermediate output V(t) is in gallons, and the final output W is in dollars. Gallons is exactly what W expects, so this order is meaningful.The intermediate unit (gallons) matches W's input unit (gallons).
  7. V(W(t)) would feed W's output, which is in dollars, into V, which expects minutes. This order is not meaningful.The intermediate unit (dollars) does not match V's input unit (minutes). The formula can be written, but it does not describe anything real.
  8. W(V(t))=0.005(12t)=0.06t dollars. At t=50: V(50)=600 gallons, so W(600)=0.005·600=3 dollars.Substitute the inner formula into the outer one, then evaluate. The result is the cost of the water after t minutes.
Answer
(a) f(g(x)) = 3x − 4 with domain x ≥ 0. g(f(x)) = 3x−4 with domain x ≥ 43. They are not the same function, since at x = 4 they give 2 and 8. (b) W(V(t)) is the meaningful composition. W(V(t)) = 0.06t dollars, and W(V(50)) = 3 dollars, so 50 minutes of filling costs $3. V(W(t)) is not meaningful, because it would feed dollars into a function that expects minutes.
Double-check (a) Recompute at x = 9: f(g(9)) = 3·3 − 4 = 5, and g(f(9)) = 23 ≈ 4.80. These still differ. (b) 50 minutes × 12 gallons per minute = 600 gallons, and 600 gallons × $0.005 per gallon = $3. Also 0.06 × 50 = 3, which agrees.

Work to write

  1. f(g(x)) = 3x − 4, domain x ≥ 0
  2. g(f(x)) = 3x−4, domain x ≥ 43
  3. At x = 4: f(g(4)) = 2 and g(f(4)) = 8, so f(g(x)) ≠ g(f(x))
  4. t (minutes) → V(t) (gallons) → W(V(t)) (dollars); gallons matches W's input
  5. V(W(t)) is not meaningful: dollars cannot be input as minutes
  6. W(V(t)) = 0.06t dollars
  7. W(V(50)) = W(600) = 3 dollars
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: c(s(3)) means 3 calories.
The 3 is the time input to s, not the final output of c.
✓ Instead: It means calories burned during 3 minutes of sit-ups; the number of calories is not supplied.
Tips and tricks
  • Answer template: starting input, inner quantity, final outer quantity.

Part 8: Units alone choose an order

No speed or fuel formula is needed to choose the meaningful order. The matching labels decide the connection, like matching a plug to its socket. Here hours enter f and miles leave it; those miles fit g, whose final output measures gallons.

  • For these definitions, g(f(x)) is meaningful.
  • Bare-number substitution does not prove that an applied interpretation matches its units.
x hoursfgfirstsecondmilesgallons
x hours goes into f, then miles into g: gallons.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Units alone choose an order

Write it

No speed or fuel formula is needed to choose the meaningful order. The matching labels decide the connection, like matching a plug to its socket. Here hours enter f and miles leave it; those miles fit g, whose final output measures gallons.

In math
  • For these definitions, g(f(x)) is meaningful.
  • Bare-number substitution does not prove that an applied interpretation matches its units.
Like

No speed or fuel formula is needed to choose the meaningful order. The matching labels decide the connection, like matching a plug to its socket. Here hours enter f and miles leave it; those miles fit g, whose final output measures gallons.

See it
x hoursfgfirstsecondmilesgallons
The same picture again: x hours goes into f, then miles into g: gallons.

Worked example

Choose the textbook’s meaningful notation

OpenStax problem

f(x) gives miles driven in x hours, and g(y) gives gallons used for driving y miles. Which is meaningful: f(g(y)) or g(f(x))? You want the order whose handoff has the unit the second rule expects. Plan: label each input and output before choosing an order.

Show the steps and the answer
x hoursfgfirstsecondmilesgallons
The same picture a third time: x hours goes into f, then miles into g: gallons.
  1. f: hours → miles; g: miles → gallons.Each description names its input and output quantity.
  2. Choose g(f(x)): f(x) supplies miles, which g accepts.The quantity passed between functions matches.
  3. Reject f(g(y)): g(y) supplies gallons, while f needs hours.Gallons cannot fill the time slot in these definitions.
Answer
  • g(f(x)) is meaningful: gallons used for the miles driven in x hours.
  • f(g(y)) does not match these quantity definitions.
Double-check Trace the chosen path: hours → miles → gallons. The middle miles appear both as f’s output and g’s required input.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: f(g(y)) must be meaningful because f is written first.
The written first name is outer and must accept the inner output, here gallons.
✓ Instead: g(f(x)) has the matching hours → miles → gallons path.
Tips and tricks
  • Write hours → miles and miles → gallons, then join the repeated unit.

Part 9: Evaluate asks for output; solve asks for input

Two questions can use the same machines while searching in opposite directions. Evaluate supplies a starting input and asks what comes out. Solve supplies a desired output and asks which starting input gets there. The equation records that desired output, like finding how long a trip must take to reach a chosen destination.

  • Evaluate c(s(4)) means start with time 4 and find calories.
  • Solve c(s(t)) = 45 means start with desired calories 45 and find time t.
15 minutess: 18tc: n ÷ 6firstsecond270 sit-ups45 calories
15 minutes goes into s: 18t, then 270 sit-ups into c: n ÷ 6: 45 calories.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

Evaluate asks for output; solve asks for input

Write it

Two questions can use the same machines while searching in opposite directions. Evaluate supplies a starting input and asks what comes out. Solve supplies a desired output and asks which starting input gets there. The equation records that desired output, like finding how long a trip must take to reach a chosen destination.

In math
  • Evaluate c(s(4)) means start with time 4 and find calories.
  • Solve c(s(t)) = 45 means start with desired calories 45 and find time t.
Like

Two questions can use the same machines while searching in opposite directions. Evaluate supplies a starting input and asks what comes out. Solve supplies a desired output and asks which starting input gets there. The equation records that desired output, like finding how long a trip must take to reach a chosen destination.

See it
15 minutess: 18tc: n ÷ 6firstsecond270 sit-ups45 calories
The same picture again: 15 minutes goes into s: 18t, then 270 sit-ups into c: n ÷ 6: 45 calories.

Worked example

Find the time from a requested calorie output

In an invented practice model, s(t) = 18t sit-ups and c(n) = n6 calories. How many minutes give c(s(t)) = 45 calories? You are given the output 45 and must find the input time. Plan: form the combined formula, set it equal to the requested output, solve for time, then check both original functions.

Show the steps and the answer
15 minutess: 18tc: n ÷ 6firstsecond270 sit-ups45 calories
The same picture a third time: 15 minutes goes into s: 18t, then 270 sit-ups into c: n ÷ 6: 45 calories.
  1. c(s(t))=c(18t)=18t6=3t.s supplies the whole exercise count to c, and 18 ÷ 6 = 3.
  2. Solve 3t = 45. Divide both sides by 3: t=15.This locates the starting time whose final calorie output is 45; division undoes multiplication by 3.
  3. Check s(15)=18×15=270 sit-ups, then c(270)=2706=45 calories.The proposed time must produce the requested final output in the original two-stage calculation.
Answer
The model reaches 45 calories after 15 minutes.
Double-check The combined rate is 3 calories per minute. Fifteen groups of 3 give 45, confirming the time separately.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: Evaluate c(s(45)) to answer when 45 calories are reached.
That treats 45 as minutes and asks a different output question.
✓ Instead: Solve c(s(t)) = 45; in the worked model the time is 15 minutes.
Tips and tricks
  • Given input: evaluate. Given output and a question asking when or which input: solve.

Part 10: A fresh interpretation to copy as a pattern

A printer first turns time into a page count. Ink use then depends on that count. This is the same handoff idea with different quantities, so you can rebuild the interpretation by reading labels rather than memorizing one story.

  • w(p(t)) describes grams of ink used during t minutes of printing.
10 minutespwfirstsecondpagesgrams of ink
10 minutes goes into p, then pages into w: grams of ink.
Reminder
Reminder: Function notation
  • Function notation. The name chooses a recipe and the parentheses supply its input: f(3) is the f output at input 3.
The same idea, five ways
Say it

A fresh interpretation to copy as a pattern

Write it

A printer first turns time into a page count. Ink use then depends on that count. This is the same handoff idea with different quantities, so you can rebuild the interpretation by reading labels rather than memorizing one story.

In math
  • w(p(t)) describes grams of ink used during t minutes of printing.
Like

A printer first turns time into a page count. Ink use then depends on that count. This is the same handoff idea with different quantities, so you can rebuild the interpretation by reading labels rather than memorizing one story.

See it
10 minutespwfirstsecondpagesgrams of ink
The same picture again: 10 minutes goes into p, then pages into w: grams of ink.

Worked example

Minutes to pages to ink

p(t) counts pages printed in t minutes, and w(n) counts grams of ink used for n pages. Interpret w(p(10)) and explain why p(w(10)) does not match these definitions. You want a sentence about quantities. Plan: read each expression from the inside outward.

Show the steps and the answer
10 minutespwfirstsecondpagesgrams of ink
The same picture a third time: 10 minutes goes into p, then pages into w: grams of ink.
  1. p(10) counts pages printed in 10 minutes.p accepts minutes and returns pages.
  2. w(p(10)) counts the grams of ink used for those pages.w accepts pages and returns grams.
  3. p(w(10)) would hand grams of ink to p, which needs minutes.The output of w cannot fill p’s time input slot under the stated definitions.
Answer
  • w(p(10)) means grams of ink used in 10 minutes of printing.
  • p(w(10)) does not match the stated quantity labels.
Double-check The correct route starts with minutes and ends with ink: minutes → pages → grams. The final w tells you that the answer is ink.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: w(p(10)) returns pages.
The outside w returns grams, while only the inside p returns pages.
✓ Instead: The final answer measures grams of ink.
Tips and tricks
  • The outside function names the final quantity in your answer.

5 How

  1. For each order, identify the function nearest the original input.
  2. Evaluate or substitute that inner function into the other function.
  3. Compare the resulting formulas and their domains. A different answer at one allowed input proves the functions differ.
  4. For an application, label the starting input, intermediate output, and final output with units.
  5. Check that the intermediate unit matches the outer function's expected input unit.

Choose an order and compare it

1
Do the inner output quantity and outer input quantity match?
YesThis order is meaningful; calculate if formulas are supplied.
NoReject this applied interpretation even if bare-number arithmetic can be carried out.
↓
2
Do the two orders have different domains or a different output at an allowed input?
YesThey are different functions.
NoUse complete formulas and domains to determine whether they agree everywhere.
  1. Write each function as its input quantity → its output quantity. A unit is a named measure such as hours or miles.
  2. Start with the function accepting the given input quantity; put it inside the other name.
  3. Pass its output to a function accepting that output quantity.
  4. For pure-number functions, calculate both formulas and their domains. One different output proves they differ; equality requires the same outputs everywhere and the same domain.

6 Worked example

Worked example

Two orders of composition, and a unit check for fuel use

(a) Let f(x) = 2x + 5 and g(x) = x2. Find f(g(x)) and g(f(x)). Decide whether they are the same function. (b) A delivery van drives at a steady speed, so the distance it covers in t hours is D(t) = 60t miles. The van uses fuel according to G(d) = d30 gallons for d miles driven. Find the meaningful composition that gives gallons used after t hours, and evaluate it at t = 3. Explain why the other order, D(G(d)), is not meaningful.

Show the steps and the answer
  1. For f(g(x)), the inner function is g, because it acts on x first. For g(f(x)), the inner function is f.In a composition, the function written nearest the input is applied first.
  2. Substitute g(x) = x2 into f: f(g(x))=2(x2)+5=2x2+5.f doubles its input and adds 5, and here its input is x2.
  3. Substitute f(x) = 2x + 5 into g: g(f(x))=(2x+5)2=4x2+20x+25.g squares its input, and here its input is the whole expression 2x + 5.
  4. Compare the two results at x=1. f(g(1))=2(1)+5=7 and g(f(1))=(7)2=49. Both functions have domain all real numbers.A single allowed input that gives different outputs proves the functions are different.
  5. In part (b), label the units. For D, the input t is in hours and the output is in miles. For G, the input d is in miles and the output is in gallons.A composition is meaningful only if the inner output can be used as the outer input.
  6. Use the order G(D(t)). The chain is t hours →D(t) miles →G(D(t)) gallons. So G(D(t))=60t30=2t gallons.D gives miles, and miles is the unit G expects as its input.
  7. Evaluate at t=3. D(3)=60(3)=180 miles, and G(180)=18030=6 gallons.First find the intermediate output, then feed it into the outer function.
  8. Check the order D(G(d)). G(d) gives gallons, but D expects an input in hours.The intermediate unit (gallons) does not match the input unit D expects (hours), so this composition has no real-world meaning.
Answer
(a) f(g(x)) = 2x2 + 5 and g(f(x)) = 4x2 + 20x + 25. They are different functions, since at x = 1 the outputs are 7 and 49. (b) G(D(t)) = 2t gallons, and G(D(3)) = 6 gallons. D(G(d)) is not meaningful because G outputs gallons while D needs hours.
Double-check Part (a): at x = 0, f(g(0)) = 5 and g(f(0)) = 25. These still differ. Part (b): 3 hours at 60 miles per hour is 180 miles. At 30 miles per gallon, 180 miles uses 6 gallons. The formula 2t gives 2(3) = 6 and agrees.

Work to write

  1. f(g(x))=2x2+5
  2. g(f(x))=(2x+5)2=4x2+20x+25
  3. f(g(1)) = 7 ≠ 49 = g(f(1)), so f∘g ≠ g∘f
  4. t (hours) → D(t) (miles) → G(D(t)) (gallons)
  5. G(D(t))=60t30=2t
  6. G(D(3)) = 6 gallons
  7. D(G(d)) is not meaningful: G outputs gallons, but D needs hours

Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: Matching at x = 0 proves two compositions are equal.
Function equality requires matching domains and outputs at every allowed input.
✓ Instead: Compare formulas and domains; test another input to expose a possible difference.
✗ Not this: A fuel output of 3 gallons can become 3 hours without explanation.
The same numeral can measure different quantities, but changing its unit changes its meaning.
✓ Instead: Only hand an output to a function that accepts that output's quantity.

Tips and tricks

  • Write input units above the first arrow and output units above each following arrow.
  • Understand, then rebuild: the order from the parentheses or the units. Do not memorize which letter goes first; letters can change.

7 The trap

Treating a valid arithmetic calculation as proof that an application makes sense. Label the units as well as the numbers.

Problems marked OpenStax come from Precalculus 2e by Jay Abramson, published by OpenStax, under the CC BY-NC-SA 4.0 licence. Access for free at https://openstax.org/books/precalculus-2e/pages/1-introduction-to-functions.

Lesson 4 of 10

Follow a composition through tables

Subject: MathematicsLeans on: Table readingLeans on: Composition orderLeans on: DomainLeans on: Listing separate inputsOpen this lesson
Leans on 0Comes back in 0

1 In plain words

Picture a row of labeled drawers. The label tells you which drawer to open, and the number inside is its answer. A table records those labels and answers in matching columns. For two jobs in a row, open a drawer in the first table, take its number, and use that number as the drawer label in the second table. You may move to a different column. Here each table lists every input its function accepts. An unlisted input therefore has no answer. A table showing only selected samples would leave other inputs unknown instead. The in-between answer selects the second drawer; it is not automatically the starting label.

2 Picture it

3g tablef tablefirstsecond28
3 goes into g table, then 2 into f table: 8.
input xoutput f(x)16283341
The textbook puts both functions under one shared input row.
input xoutput g(x)13253247
x: 1, 2, 3, 4; g(x): 3, 5, 2, 7.

Reminder

Reminder: Table reading, Composition order, Domain, Listing separate inputs
  • Table reading. Read one column downward: the f picture's input 2 has output 8.
  • Composition order. f(g(3)) starts in g, then uses its answer in f.
  • Domain. When a table lists every accepted input, its input row gives the complete domain; these pictures accept only 1, 2, 3, and 4.
  • Listing separate inputs. {1, 3} lists only 1 and 3. The interval [1, 3] also includes every number between them, so it describes a different set.

3 Why

Each column states one input-output pair. In f(g(3)), the first lookup is the output beneath input 3 in the g table. That value becomes the input label for the f table. Reading both outputs beneath 3 would instead give f(3) and g(3), two independent evaluations. The two-stage lookup also explains the composite domain. Some allowed starting inputs produce intermediate numbers that do not appear among the next function's accepted inputs, so those starts cannot finish the composition.

4 The rule

To evaluate f(g(a)) from tables, read g(a), then use that output as the input for the f lookup.

A composition is defined only when both lookups exist.

The same idea, five ways

Say it

f of g of three; f after g at three

Write it

Look up g at 3, then look up f at the number g returns.

In math
  • f(g(3)) = f(2) = 8
  • (f ∘ g)(3) = 8
  • 3 → g → 2 → f → 8
Like

One drawer gives you the label of the next drawer.

See it
3g tablef tablefirstsecond28
The same picture again: 3 goes into g table, then 2 into f table: 8.

The same idea, other ways

As labeled drawers

Open drawer 3 in g. It contains 2. Open drawer 2 in f. It contains 8. The second drawer number comes from the first drawer's contents.

drawer 3gffirstsecondlabel 28
The first output selects the second drawer.
As a path

Write only the numbers along the path: 3 to 2 to 8. Then label the first arrow g and the second arrow f. This keeps the meaning attached to each lookup.

3gffirstsecond28
Two labeled arrows replace crowded parentheses.
x1234
f(x)6831
g(x)3527

Part 1: Read f after g

Start in g because it is inner. Its answer tells you where to look in f. The outer table's output is the final answer.

  • f(g(3)) uses g(3) first.
  • The outer input is g’s output, which may differ from the starting input.
input xoutput g(x)13253247↓ evaluate: input given, read the output below it
Read downward under 3 to find the next input 2.

Worked example

One more f-after-g path

OpenStax problem

Using the two complete tables beside this example, find f(g(1)). The input is 1; find its final answer after g and then f. Plan: read g under 1, then use its output as the next input in f.

input xoutput f(x)16283341
The same picture again: x: 1, 2, 3, 4; f(x): 6, 8, 3, 1.
input xoutput g(x)13253247
The same picture again: x: 1, 2, 3, 4; g(x): 3, 5, 2, 7.
Show the steps and the answer
input xoutput f(x)16283341↓ evaluate: input given, read the output below it
x: 1, 2, 3, 4; f(x): 6, 8, 3, 1, read at x = 3.
input xoutput g(x)13253247↓ evaluate: input given, read the output below it
x: 1, 2, 3, 4; g(x): 3, 5, 2, 7, read at x = 1.
  1. The column under 1 in g gives g(1)=3.g receives the original input.
  2. The column under 3 in f gives f(3)=3.The first output selects the outer input.
Answer
f(g(1)) = 3.
Double-check The path is 1 to 3 to 3; the final 3 belongs to f's output row.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: f(g(1)) = 6 because f gives 6 under input 1.
This used f first even though g touches the starting 1.
✓ Instead: g(1) = 3, then f(3) = 3, so f(g(1)) = 3.
Tips and tricks
  • Read the inner output before moving to the other input row.

Part 2: Read g after f

Reversing the composition changes which table receives the starting input. You must restart the path rather than reverse the digits of the first answer.

  • g(f(4)) uses f(4) first.
  • A repeated final answer does not imply the paths match.
input xoutput f(x)16283341↓ evaluate: input given, read the output below it
Input 4 in f sends 1 to the outer table.

Worked example

A g-after-f path

OpenStax problem

Using the two complete tables beside this example, find g(f(4)). The input is 4; find the final answer after f and then g. Plan: read f under 4, then read g under the number f returns.

input xoutput f(x)16283341
The same picture a third time: x: 1, 2, 3, 4; f(x): 6, 8, 3, 1.
input xoutput g(x)13253247
The same picture a third time: x: 1, 2, 3, 4; g(x): 3, 5, 2, 7.
Show the steps and the answer
input xoutput f(x)16283341↓ evaluate: input given, read the output below it
The same picture again: x: 1, 2, 3, 4; f(x): 6, 8, 3, 1, read at x = 4.
input xoutput g(x)13253247↓ evaluate: input given, read the output below it
The same picture again: x: 1, 2, 3, 4; g(x): 3, 5, 2, 7, read at x = 1.
  1. Read f(4)=1 under input 4 in f.f is inner in this order.
  2. Read g(1)=3 under input 1 in g.The first answer 1 is the new input.
Answer
g(f(4)) = 3.
Double-check The path 4 to 1 to 3 uses a column from each table in the requested order.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: g(f(4)) = g(4) = 7.
The outer function receives f(4), not the original 4.
✓ Instead: f(4) = 1, then g(1) = 3, so g(f(4)) = 3.
Tips and tricks
  • Restart at the original input when you reverse the order.

Part 3: Build tables of composite outputs

Collect every successful two-stage path in a new table. Include only starting inputs that finish both stages. Here both original tables list every accepted input. A missing second lookup means the composition is undefined at that start. Braces list separate inputs: {1, 3} means only 1 and 3, rather than the entire stretch from 1 to 3.

  • The composite f ∘ g accepts only inputs 1 and 3.
  • The composite g ∘ f accepts only inputs 3 and 4.
  • If a table lists selected samples rather than a complete function, an unlisted lookup is unknown from that table, not proven undefined.
input xoutput (f ∘ g)(x)1338↓ evaluate: input given, read the output below it
These are all starting inputs that can pass through g and then f.

Worked example

Collect both composite functions

Build complete tables for f ∘ g and g ∘ f from the two complete function tables pictured here. Try each starting input and keep the paths that finish. Plan: record both lookups for each of the four inputs, then draw a new table containing only successful paths.

Show the steps and the answer
input xoutput f(x)16283341
The same picture, shown 4 times now: x: 1, 2, 3, 4; f(x): 6, 8, 3, 1.
input xoutput g(x)13253247
The same picture, shown 4 times now: x: 1, 2, 3, 4; g(x): 3, 5, 2, 7.
input xoutput (f ∘ g)(x)1338
f after g has two allowed starting inputs.
input xoutput (g ∘ f)(x)3243
g after f has a different pair of allowed starting inputs.
  1. For f∘g, starting at 1 gives g(1)=3, then f(3)=3. Starting at 3 gives g(3)=2, then f(2)=8.Both intermediate answers appear as accepted f inputs.
  2. Starting at 2 gives g(2)=5, and starting at 4 gives g(4)=7. Both paths stop before f.The complete f table accepts neither 5 nor 7.
  3. For g∘f, starting at 3 gives f(3)=3, then g(3)=2. Starting at 4 gives f(4)=1, then g(1)=3.Both intermediate answers appear as accepted g inputs.
  4. Starting at 1 gives f(1)=6, and starting at 2 gives f(2)=8. Both paths stop before g.The complete g table accepts neither 6 nor 8.
Answer
  • f ∘ g accepts exactly {1, 3}, meaning only inputs 1 and 3; its complete output table is pictured.
  • g ∘ f accepts exactly {3, 4}, meaning only inputs 3 and 4; its complete output table is pictured.
Double-check There are four possible starting inputs for each order. Each order has two successful paths and two stopped paths, so every starting input has been accounted for.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: If f(5) is missing, guess the next output from a pattern.
The displayed data does not establish a rule for new inputs.
✓ Instead: When the table lists every input the function accepts, 5 is outside its domain; when it shows selected samples, its value is unknown from the table.
Tips and tricks
  • Write the intermediate input before deciding whether a path can finish.

Part 4: The same function can receive its own answer

You can visit the same drawer system twice. In p(p(3)), the first p receives 3. The second p receives the number from that first drawer. The two visits can use different columns. This is composition with the same function, rather than squaring its first output.

  • p(p(a)) means apply p to a, then apply p to the resulting output.
  • The second lookup must use an accepted p input.
3p tablep tablefirstsecond02
The same table is visited twice, with a new input for the second visit.

Worked example

Use the same table twice

Find p(p(3)) in this complete p table. You put the first answer through p again. Plan: read p under 3, then move to p under the number it returns.

input xoutput p(x)02142130
x: 0, 1, 2, 3; p(x): 2, 4, 1, 0.
Show the steps and the answer
input xoutput p(x)02142130↓ evaluate: input given, read the output below it
x: 0, 1, 2, 3; p(x): 2, 4, 1, 0, read at x = 3 and 0.
input xoutput q(x)01132031
x: 0, 1, 2, 3; q(x): 1, 3, 0, 1.
  1. p(3)=0.The innermost p acts on 3 first.
  2. p(p(3))=p(0)=2.The same function receives a new input, 0, on the second pass.
Answer
p(p(3)) = 2.
Double-check Read backward: p returns 2 under input 0, and p returns 0 under input 3. Multiplying p(3) by itself would give 0, which answers a different question.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: p(p(3))=p(3)2=0.
A square multiplies the first output by itself. A composition uses that output as a new input.
✓ Instead: p(3) = 0 and p(0) = 2, so p(p(3)) = 2.
Tips and tricks
  • Write both lookups even when the function names match.

5 How

  1. Read the nested notation and choose the inner table.
  2. Find the column labeled with the original input in that table.
  3. Read its output and write it as the intermediate value.
  4. Find that value among the input labels of the outer table, which may be a different column.
  5. Read the outer output. If either required input is absent from a complete table, the composition is undefined there.

Evaluate or solve a composition from complete tables

1
Is the starting input given?
YesEvaluate: read down in the inner table, then down in the outer table.
NoThe final output is given: solve backward, reading upward from every matching output.
↓
2
Is a needed input missing from the next table?
YesIf the table defines every accepted input, the composition is undefined there. If it gives selected samples, its value is unknown from this table.
NoRead the matching output and continue.
  1. Rewrite the composition with parentheses. Identify the function nearest the starting input.
  2. For an evaluation, find the input in the inner table and read down to its output.
  3. Locate that in-between number in the outer input row and read down again.
  4. For a solve question, start from the requested final output, read up to every matching outer input, then find which inner inputs produce those numbers.
  5. Check by reading each claimed path forward. If a lookup is missing, distinguish a complete definition from selected samples.

6 Worked example

Worked example

Both orders from the tables at input 3

OpenStax problem

The two pictures list every input accepted by f and g. Find f(g(3)) and g(f(3)). You start at input 3 and find the final output in each order. Plan: read the inner table first, write its answer, and use that answer as an input in the outer table.

input xoutput f(x)16283341
The same picture, shown 5 times now: x: 1, 2, 3, 4; f(x): 6, 8, 3, 1.
input xoutput g(x)13253247
The same picture, shown 5 times now: x: 1, 2, 3, 4; g(x): 3, 5, 2, 7.
Show the steps and the answer
input xoutput f(x)16283341↓ evaluate: input given, read the output below it
In f, input 2 gives 8 and input 3 gives 3.
input xoutput g(x)13253247↓ evaluate: input given, read the output below it
In g, input 3 gives the intermediate value 2.
  1. For f(g(3)), read the column under 3 in the g picture: g(3)=2.g is the inner function in this expression.
  2. Move to the column under 2 in the f picture: f(2)=8.The intermediate answer 2 becomes the outer input.
  3. For g(f(3)), read the column under 3 in the f picture: f(3)=3.The reversed composition starts with f.
  4. Move to the column under 3 in the g picture: g(3)=2.The intermediate answer happened to equal the original input this time.
Answer
  • f(g(3)) = 8.
  • g(f(3)) = 2.
Double-check Read backward from the final answers. The 8 in f sits below input 2, and the 2 in g sits below input 3, so the first path is 3 → 2 → 8. For the other order, the 2 in g sits below 3, and the 3 in f sits below 3, so its path is 3 → 3 → 2.

Ladder: from easy to exam-hard

Try each rung before you open its steps.

Rung 1 of 5

One successful two-table path

The pictured p and q tables list every accepted input. Find p(q(0)). You start at 0 and want the final answer. Plan: read q under 0, then p under its answer.

input xoutput p(x)02142130
The same picture again: x: 0, 1, 2, 3; p(x): 2, 4, 1, 0.
input xoutput q(x)01132031
The same picture again: x: 0, 1, 2, 3; q(x): 1, 3, 0, 1.
Show the steps and the answer
input xoutput p(x)02142130↓ evaluate: input given, read the output below it
x: 0, 1, 2, 3; p(x): 2, 4, 1, 0, read at x = 1.
input xoutput q(x)01132031↓ evaluate: input given, read the output below it
x: 0, 1, 2, 3; q(x): 1, 3, 0, 1, read at x = 0.
  1. q(0)=1.The inner function q receives the starting 0.
  2. p(q(0))=p(1)=4.The output 1 from q selects the column under 1 in p.
Answer
p(q(0)) = 4.
Double-check Read backward: output 4 in p belongs to input 1, and output 1 in q occurs under 0, confirming this path.

Rung 2 of 5

Reverse the table order

Use these complete p and q tables to find q(p(0)). You start at 0 again, but p goes first. Plan: read p under 0, then q under the in-between answer.

input xoutput p(x)02142130
The same picture a third time: x: 0, 1, 2, 3; p(x): 2, 4, 1, 0.
input xoutput q(x)01132031
The same picture a third time: x: 0, 1, 2, 3; q(x): 1, 3, 0, 1.
Show the steps and the answer
input xoutput p(x)02142130↓ evaluate: input given, read the output below it
x: 0, 1, 2, 3; p(x): 2, 4, 1, 0, read at x = 0.
input xoutput q(x)01132031↓ evaluate: input given, read the output below it
x: 0, 1, 2, 3; q(x): 1, 3, 0, 1, read at x = 2.
  1. p(0)=2.p is inner in q(p(0)).
  2. q(p(0))=q(2)=0.The first output 2 becomes the input of q.
Answer
q(p(0)) = 0.
Double-check Output 0 in q occurs under input 2, and p gives 2 under input 0. A final output of 0 is a valid answer.

Rung 3 of 5

Use the same table twice

Find p(p(3)) in this complete p table. You put the first answer through p again. Plan: read p under 3, then move to p under the number it returns.

input xoutput p(x)02142130
The same picture, shown 4 times now: x: 0, 1, 2, 3; p(x): 2, 4, 1, 0.
Show the steps and the answer
input xoutput p(x)02142130↓ evaluate: input given, read the output below it
The same picture again: x: 0, 1, 2, 3; p(x): 2, 4, 1, 0, read at x = 3 and 0.
input xoutput q(x)01132031
The same picture, shown 4 times now: x: 0, 1, 2, 3; q(x): 1, 3, 0, 1.
  1. p(3)=0.The innermost p acts on 3 first.
  2. p(p(3))=p(0)=2.The same function receives a new input, 0, on the second pass.
Answer
p(p(3)) = 2.
Double-check Read backward: p returns 2 under input 0, and p returns 0 under input 3. Multiplying p(3) by itself would give 0, which answers a different question.

Rung 4 of 5

A path cannot finish

Find q(p(1)) from the complete tables pictured here. Determine whether both stages have an answer. Plan: find p(1), then look for that number in q’s input row.

input xoutput p(x)02142130
The same picture, shown 5 times now: x: 0, 1, 2, 3; p(x): 2, 4, 1, 0.
input xoutput q(x)01132031
The same picture, shown 5 times now: x: 0, 1, 2, 3; q(x): 1, 3, 0, 1.
Show the steps and the answer
input xoutput p(x)02142130↓ evaluate: input given, read the output below it
The same picture again: x: 0, 1, 2, 3; p(x): 2, 4, 1, 0, read at x = 1.
input xoutput q(x)01132031
The same picture, shown 6 times now: x: 0, 1, 2, 3; q(x): 1, 3, 0, 1.
  1. p(1)=4.p is the inner function.
  2. q(4) is undefined in this complete table.The input row of q contains only 0, 1, 2, and 3, so it does not accept 4.
Answer
q(p(1)) is undefined.
Double-check The value 4 appears in p’s output row, but never in q’s input row. The failed outer lookup confirms the stop.

Rung 5 of 5

Solve backward for every start

Which starting inputs x satisfy p(q(x)) = 4 in these complete tables? The final output 4 is given; find every starting input producing it. Plan: read upward from 4 in p, then upward from the needed number in q.

input xoutput p(x)02142130
The same picture, shown 6 times now: x: 0, 1, 2, 3; p(x): 2, 4, 1, 0.
input xoutput q(x)01132031
The same picture, shown 7 times now: x: 0, 1, 2, 3; q(x): 1, 3, 0, 1.
Show the steps and the answer
input xoutput p(x)02142130↑ solve: output given, read every input above it
x: 0, 1, 2, 3; p(x): 2, 4, 1, 0, solved for p(x) = 4.
input xoutput q(x)01132031↑ solve: output given, read every input above it
x: 0, 1, 2, 3; q(x): 1, 3, 0, 1, solved for q(x) = 1.
  1. Only p(1)=4, so q(x) must equal 1.The outer function must receive input 1 to return the requested output 4.
  2. The output 1 in q occurs under inputs 0 and 3.Solving from a table requires every match, rather than only the first one.
  3. Check x=0: q(0)=1 and p(1)=4. Check x=3: q(3)=1 and p(1)=4.Forward evaluation verifies that both claimed inputs give the requested final output.
Answer
  • x = 0 or x = 3.
  • Solution set: {0, 3}.
Double-check The other two starts fail the requested output: q(1) = 3 gives p(3) = 0, and q(2) = 0 gives p(0) = 2.

Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: f(g(3)) = f(3)·g(3) = 3 × 2 = 6.
That is the product of two outputs, not the two-stage lookup.
✓ Instead: g(3) = 2, then f(2) = 8.
✗ Not this: The composite domain {1, 3} can be written [1, 3].
The interval also includes 2 and 2.5, but neither is an accepted input of this complete composite.
✓ Instead: Write {1, 3}, which lists only the two accepted starting inputs.

Tips and tricks

  • Put one finger on the inner output and another on the matching outer input.
  • Draw every table as an input row above an output row; use the intermediate answer to select the next column.
  • Rebuild, do not memorize: find the inner input on top, read down, then carry the number to the other table.

7 The trap

Reading the same input column in both pictures. The outer lookup uses the inner output, which can move you to a new column.

Problems marked OpenStax come from Precalculus 2e by Jay Abramson, published by OpenStax, under the CC BY-NC-SA 4.0 licence. Access for free at https://openstax.org/books/precalculus-2e/pages/1-introduction-to-functions.

Lesson 5 of 10

Follow a composition across two graphs

Subject: MathematicsLeans on: Ordered pairLeans on: AxesLeans on: Negative squaresLeans on: CompositionOpen this lesson
Leans on 0Comes back in 0

1 In plain words

A graph draws a function's input-output pairs as points. Think of it as a map: the horizontal address is the input and the vertical address is the output. For one function, start at the input on the x-axis, find the graph directly above or below it, and read the height on the y-axis. A composition uses two maps. The height you read on the first map becomes a horizontal address on the second map. You do not carry the first point across unchanged. You carry its output number, then use that number as the next input.

2 Picture it

x = 2 on gread g heightuse x = 4 on ffirstsecond4height 16
x = 2 on g goes into read g height, then 4 into use x = 4 on f: height 16.

Reminder

Reminder: Ordered pair, Axes, Negative squares, Composition
  • Ordered pair. (2, 4) means input 2 and output 4; the first coordinate is horizontal.
  • Axes. The x-axis runs horizontally; the y-axis runs vertically.
  • Negative squares. (−1)2=(−1)×(−1)=1.
  • Composition. f(g(2)) uses g's output as f's input.

3 Why

An ordered pair (a, b) on a function graph means that input a produces output b. The first graph therefore turns the starting x-coordinate into an intermediate y-coordinate. The definition of composition makes this intermediate output the outer input, so it must be located along the second graph's horizontal axis. Reading the height there finishes the second function evaluation. The graphs can have different scales, so read their numbered axes instead of comparing the physical heights on the page.

4 The rule

For f(g(a)): read the y-value of g at x=a; use that number as the x-value on f; read f's y-value.

A point (a, b) on g means g(a)=b.

The same idea, five ways

Say it

f of g of two

Write it

Read g’s height at horizontal input 2, then use that number as f’s horizontal input.

In math
  • g(2) = 4
  • f(4) = 16
  • f(g(2)) = 16
  • On g: (2, 4); on f: (4, 16)
Like

Use the destination on one map as the starting address on a second map.

See it
x = 2 on gread g heightuse x = 4 on ffirstsecond4height 16
The same picture again: x = 2 on g goes into read g height, then 4 into use x = 4 on f: height 16.

The same idea, other ways

As two address maps

The first map sends horizontal address 2 to vertical address 4. The second map starts at horizontal address 4 and sends it to vertical address 16.

2g graphf graphfirstsecond416
The maps connect through the number 4.
As two ordered pairs

The pair (2, 4) says g(2) = 4. The pair (4, 16) says f(4) = 16. The output coordinate of the first pair matches the input coordinate of the second.

On g: (2, 4)

On f: (4, 16)

Match the middle 4

Part 1: Read the inner graph

The inner graph handles the original input. An output can be below zero, and it still becomes a valid next input if the outer function accepts it. In this part, g(x) = x + 2 and f(x) = x2 are the two rules you will connect.

  • Read input horizontally and output vertically.
  • A point below the x-axis gives a negative output.
g(−3) = −1−4−22−224
Input −3 gives height −1 on the line.

Worked example

A negative intermediate output

Using g(x) = x + 2, find the first graph reading for f(g(−3)). You only need the output of g at input −3. Plan: read the inner curve at the starting horizontal input, then carry its height to the outer x-axis.

(−3, −1)−4−22−224
The first output lies below the horizontal axis.
Show the steps and the answer
  1. Find (−3,−1) on g, so g(−3)=−1.The point records input −3 and output −1.
Answer
The next input is −1.
Double-check −3 + 2 = −1, agreeing with the point's height.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: f(g(−3))=f(−3)=9.
This skipped the inner graph, which gives g(−3) = −1.
✓ Instead: Read g at −3 first, then read f at −1 to obtain 1.
Tips and tricks
  • A point below the x-axis has a negative output. Keep its minus sign at the handoff.

Part 2: Move to the outer graph

The outer graph starts from the intermediate number on its own horizontal axis. Its height is the final answer. A negative input is a location to the left of zero, not a negative height you must keep.

  • f(−1) is read at horizontal input −1.
  • For the square graph, input −1 gives output 1.
f(−1) = 1−22246810
A negative horizontal input can produce a positive height.

Worked example

Finish the negative-input path

The inner graph gave −1, and f(x) = x2. Find the final output in f(g(−3)). You now read f at input −1. Plan: the first reading is already −1. Put −1 on the outer x-axis and read the curve’s height there.

(−1, 1)−22246810
Read the new output above horizontal input −1.
Show the steps and the answer
  1. Locate −1 on f's x-axis and read the point (−1,1).The intermediate value is now the outer input.
  2. f(−1)=1.The point's vertical coordinate is the final output.
Answer
f(g(−3))=1.
Double-check Using formulas, (−3 + 2)2 = (−1)2 = 1.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: The in-between −1 must stay a height of −1 on f.
The in-between output becomes the next horizontal input. It does not force the outer output to match.
✓ Instead: Use x = −1 on f and read its height 1.
Tips and tricks
  • Move the first output to the second x-axis before reading the next height.

Part 3: Read the unlabeled curve from the grid

An exam graph may give a grid with no printed answer beside its points. Count along the numbered x-axis to your input. Travel straight up or down to the curve. Then read across to the y-axis. A height of 0 means the curve is on the x-axis. It is an answer, rather than a failed lookup.

  • A point’s horizontal coordinate is its input and its vertical coordinate is its output.
  • Two graphs may use different scales. Read their numbers separately.
246246
y=−x+4.

Worked example

Read both orders from the grid

Use these graphs of g(x) = 4 − x and f(x) = x2 without labeled answer points. Find f(g(2)) and g(f(2)). You start at 2 in each order. Plan: find the first curve’s height from the grid, then carry that number to the other x-axis.

246246
The same picture again: y = −x + 4.
−22426101418
Read f from its grid: both inputs 2 and −2 have height 4.
Show the steps and the answer
2g graphf graphfirstsecond24
The path carries g’s height 2 onto f’s x-axis, then reads final height 4.
  1. At horizontal input 2 on g, the line meets height 2, so g(2)=2.The grid crossing pairs input 2 with output 2.
  2. At input 2 on f, the curve meets height 4, so f(g(2))=4.The first output 2 becomes the second input.
  3. For the reverse order, f(2)=4 from the curve.The innermost f receives 2 first.
  4. At input 4 on g, the line meets the x-axis at height 0, so g(f(2))=0.A point on the x-axis has output 0, which is a valid numerical answer.
Answer
  • f(g(2)) = 4.
  • g(f(2)) = 0.
Double-check Check with formulas: (4 − 2)2 = 22 = 4, and 4 − 22 = 4 − 4 = 0. The two formula calculations match the readings.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: g(f(2)) has no answer because the last point has height 0.
Zero is a valid output. Undefined means there is no permitted answer, rather than an answer equal to zero.
✓ Instead: f(2) = 4 and g(4) = 0, so g(f(2)) = 0.
Tips and tricks
  • Pencil on the x-axis, vertically to the curve, then horizontally to the y-axis.

5 How

  1. Choose the inner graph from the function nearest the starting input.
  2. Locate that input on the inner graph's x-axis and move vertically to its curve.
  3. Read the curve's y-coordinate as the intermediate output.
  4. Locate that number on the outer graph's x-axis and move vertically to its curve.
  5. Read the outer y-coordinate as the final answer. Check each graph's own scale.

Read a two-graph composition

1
Can the necessary intersection be read in the drawn portion of the graph?
YesRead the numbered axes and carry that output to the next graph.
NoUse a supplied formula or other data if available; otherwise the picture does not determine that value.
↓
2
Does the question give the starting input?
YesFollow each curve forward to its output.
NoIf the final output is given instead, read backward to every matching input, then verify each forward path.
  1. Rewrite the request with nested parentheses and choose the graph nearest the starting input.
  2. Put your pencil at the starting input on that graph’s x-axis. Move vertically to the curve, then horizontally to read its y-axis value.
  3. Write the in-between answer on a separate line.
  4. Place that number on the outer graph’s x-axis. Move vertically to its curve and horizontally to read its output.
  5. Check each numbered scale. Give exact values at clear grid intersections and describe uncertain readings as estimates.

6 Worked example

Worked example

A line feeds a square graph

The first picture is g(x) = x + 2 and the second is f(x) = x2. Use the labeled points to find f(g(2)). The input is 2 on g; the resulting height selects the input on f. Plan: read the inner curve at the starting horizontal input, then carry its height to the outer x-axis.

g(2) = 4242468
On g, input 2 meets the line at height 4.
Show the steps and the answer
f(4) = 162426101418
On f, the new input 4 meets the curve at height 16.
  1. On g, find the labeled point (2, 4), so g(2)=4.The point's horizontal coordinate is the input and its vertical coordinate is the output.
  2. Move to input 4 on f's horizontal axis.g's output becomes f's input, rather than staying a height.
  3. Read the labeled point (4, 16), so f(4)=16.The outer graph gives the final output at the intermediate input.
Answer
f(g(2)) = 16.
Double-check The formulas give g(2) = 2 + 2 = 4, then f(4) = 42 = 16. This separate formula calculation agrees with the graph reading.

Ladder: from easy to exam-hard

Try each rung before you open its steps.

Rung 1 of 5

Two clear labeled points

The graphs show g(x) = x + 2 and f(x) = x2. Find f(g(0)). The starting input is 0; you want the final height after visiting both graphs. Plan: read the height on g first, then use that number as the horizontal input on f.

(0, 2)−4−224−4−22468
y = x + 2, with the point (0, 2).
(2, 4)−4−22426101418
y = x2, with the point (2, 4).
Show the steps and the answer
  1. At horizontal input 0, g has point (0, 2), so g(0)=2.The first coordinate is input, and the second coordinate is output.
  2. Move the output 2 to f’s horizontal axis. The point (2, 4) gives f(2)=4.Composition makes the first height the second input.
  3. f(g(0))=4.The second height is the final output.
Answer
f(g(0)) = 4.
Double-check The formula route gives (0 + 2)2 = 22 = 4. This agrees with the two graph readings.

Rung 2 of 5

Carry a height to a new horizontal position

Using g(x) = x + 2 and f(x) = x2, find f(g(2)) from the graphs. The input is 2; the first height tells you where to start on the second graph. Plan: read g at 2, carry the height across, then read f at that new input.

(2, 4)−4−224−4−22468
y = x + 2, with the point (2, 4).
(4, 16)−4−22426101418
y = x2, with the point (4, 16).
Show the steps and the answer
  1. On g, (2, 4) means g(2)=4.The graph’s height over input 2 is 4.
  2. On f, start at horizontal input 4. Its point (4, 16) gives f(4)=16.The handoff 4 becomes a horizontal coordinate, not a requested height.
  3. f(g(2))=16.The completed two-stage path ends at height 16.
Answer
f(g(2)) = 16.
Double-check The combined formula gives (2 + 2)2 = 42 = 16. Reading both original graphs at horizontal input 2 would instead give two separate outputs and would miss this path.

Rung 3 of 5

A negative handoff can work

Using g(x) = x + 2 and f(x) = x2, find f(g(−3)). The input is negative, and the first output is also negative. You want the second graph’s output at that handoff. Plan: read g at −3, then start on f to the left of zero.

(−3, −1)−4−224−4−22468
y = x + 2, with the point (−3, −1).
Show the steps and the answer
(−1, 1)−4−22426101418
y = x2, with the point (−1, 1).
  1. On g, the point (−3,−1) gives g(−3)=−1.A point below the horizontal axis has a negative output.
  2. Put −1 on f’s horizontal axis. The point (−1,1) gives f(−1)=1.Negative inputs are positions to the left of zero; their square is nonnegative.
  3. f(g(−3))=1.The final output is the second graph’s height, not the first output’s sign.
Answer
f(g(−3))=1.
Double-check The original formulas give g(−3) = −3 + 2 = −1 and f(−1) = (−1)(−1) = 1. The combined formula gives (−3 + 2)2 = 1 as well.

Rung 4 of 5

Reverse which graph receives the start

Using g(x) = x + 2 and f(x) = x2, find g(f(2)) and compare it with the earlier f(g(2)). The same input now enters f first. Plan: restart at 2 on f, carry its height to g, and compare the final heights.

Show the steps and the answer
(4, 6)−4−224−4−22468
y = x + 2, with the point (4, 6).
(2, 4)−4−22426101418
The same picture again: y = x2, with the point (2, 4).
  1. On f, (2, 4) gives f(2)=4.f is now inside the parentheses and receives the starting input.
  2. On g, horizontal input 4 gives point (4, 6), so g(4)=6.The first output becomes g’s input.
  3. g(f(2))=6, while the earlier f(g(2))=16.Changing the first graph changes the route even when the first handoff happens to be 4 in both cases.
Answer
  • g(f(2)) = 6.
  • f(g(2)) = 16.
  • The two orders differ at input 2.
Double-check The reverse combined formula is x2 + 2, which gives 4 + 2 = 6. The original order gives (x + 2)2, which gives 16 at the same input.

Rung 5 of 5

Solve backward and keep every matching path

The graphs show g(x) = x + 2 and f(x) = x2, both accepting every real input. Solve f(g(x)) = 4. The final height is supplied; you want every starting input that leads to it. Plan: find every input where the outer f graph has height 4, then find the g inputs that produce those numbers.

(−4, −2)(0, 2)−4−22−4−2246
y = x + 2, with the points (−4, −2) and (0, 2).
(−2, 4)(2, 4)−22246810
y = x2, with the points (−2, 4) and (2, 4).
Show the steps and the answer
  1. On f, height 4 meets the curve at (−2,4) and (2, 4). The outer input can be −2 or 2.Both a negative and a positive number square to 4, so both intersections must be read.
  2. On g, output −2 occurs at point (−4,−2), so one starting input is −4.The first function must produce the chosen outer input −2.
  3. On g, output 2 occurs at point (0, 2), so another starting input is 0.The second matching outer input requires another backward path.
  4. Check forward: −4→−2→4 and 0→2→4.Every claimed start must finish at the requested height after both graphs.
Answer
x = −4 or x = 0.
Double-check Algebra gives (x + 2)2 = 4. A number squaring to 4 is −2 or 2, so x + 2 = −2 or x + 2 = 2. Subtracting 2 gives x = −4 or x = 0, agreeing with both graph paths.

Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: After reading g(2) = 4, find where f has height 4.
That would search for an input giving output 4. Composition instead supplies 4 as an input.
✓ Instead: Find x = 4 on f and read its height 16.

Tips and tricks

  • Say horizontal, vertical, horizontal, vertical as you trace a graphical composition.
  • Use labeled points for exact values. If a graph reading is estimated, label the answer as an estimate.
  • Know cold: across on the x-axis, up or down to the curve, read the height, then carry the height to the next x-axis.

7 The trap

Using the first graph's output as a height on the second graph. Move it to the second x-axis before finding the outer output.

Lesson 6 of 10

Evaluate formulas one number at a time

Subject: MathematicsLeans on: Order of operationsLeans on: Signed arithmeticLeans on: SubstitutionLeans on: Composition orderLeans on: Input-slot namesOpen this lesson
Leans on 0Comes back in 0

1 In plain words

Keep two recipe cards on a counter. For a composition, follow the inner recipe first, write its answer, and then use that answer in the outer recipe. A formula is a recipe written with letters. Each input letter labels a place to insert a value. The names x, t, and u can label the same place. For example, f(u) = u and f(x) = x describe the same root recipe. Using u for an outer input helps you keep it separate from the x inside another formula. The function name tells you which recipe to use; the letter inside the parentheses tells you where its input belongs.

2 Picture it

ahffirstsecondh(a)f(h(a))
Each stage uses the result of the preceding stage.

Reminder

Reminder: Order of operations, Signed arithmetic, Substitution, Composition order, Input-slot names
  • Order of operations. Square before subtracting: 52 − 5 = 25 − 5 = 20.
  • Signed arithmetic. (−4)2 = 16 and 16 − (−4) = 20.
  • Substitution. Both slots in t2 − t receive the same number: f(5) = 52 − 5.
  • Composition order. f(h(1)) starts with h(1), not f(1).
  • Input-slot names. h(x) = 3x + 2 and h(t) = 3t + 2 both say multiply the input by 3 and add 2. They define the same function.

3 Why

A variable in a function formula marks where an input will be inserted. Its name can change without changing the function's instructions. For example, t2 − t and u2 − u both say to square the input and subtract that same input. A composition specifies two substitutions: the original number fills the inner slots, and its resulting output fills every outer slot. Doing the arithmetic after each substitution follows exactly the function-machine definition and makes mistakes easier to locate.

4 The rule

For f(h(a)), calculate h(a) first; then substitute that entire numerical answer into every input slot of f.

The input-variable letter does not change the instructions.

The same idea, five ways

Say it

f of h of one

Write it

Put 1 into h’s formula, then put its resulting number into f’s formula.

In math
  • h(x) = 3x + 2
  • f(t)=t2−t
  • f(h(1)) = f(5) = 20
Like

The first recipe makes the ingredient measured into the second recipe.

See it
1h: 3x + 2f: t² − tfirstsecond520
The input letters differ, but the same number still fills every input place at each stage.

The same idea, other ways

As two recipe cards

Finish the first recipe before beginning the second. A finished intermediate value becomes the ingredient measured into the second recipe.

1triple, add 2f: t² − tfirstsecond520
The second recipe receives 5 rather than the original 1.
As labeled blanks

f(t) = t2 − t has two blanks holding the same input. At input 5 the blanks become 52 − 5. Calling the blanks u would not change either operation.

f(t)=t2−t

f(u)=u2−u

f(5)=52−5=20

Part 1: Number into the inner formula

First evaluate the formula closest to the starting number. A zero intermediate answer is allowed unless the next function rejects zero.

  • h(1) = 5 for h(x) = 3x + 2.
  • The intermediate answer is a complete input for the next function.
1h: 3x + 2inputoutput5
The inner formula completes its arithmetic before the handoff.

Worked example

A first-stage negative input

With h(x) = 3x + 2, evaluate h(−2). The input is −2; find the first-stage output. Plan: substitute the entire signed number in parentheses, then multiply before adding.

Show the steps and the answer
−23x + 2inputoutput−4
The minus sign stays with the input.
  1. h(−2)=3(−2)+2.Replace the input letter with −2 and keep its sign inside parentheses.
  2. =−6+2=−4.A positive times a negative is negative, and adding 2 moves two steps toward zero.
Answer
h(−2)=−4.
Double-check Undo the recipe: (−4 − 2) ÷ 3 = −6 ÷ 3 = −2, the starting input.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: h(−2)=3−2+2=3.
The 3 beside x means multiplication by the whole input, rather than adding 3 to it.
✓ Instead: h(−2)=3(−2)+2=−6+2=−4.
Tips and tricks
  • Keep a negative input inside parentheses until multiplication is complete.

Part 2: Intermediate answer into the outer formula

The outer recipe receives a new input. Insert that input in every position, even when it is negative. Parentheses show that the square acts on the negative number itself.

  • f(−4)=(−4)2−(−4).
  • The square happens before the subtraction.
−4f: t² − tinputoutput20
Subtracting the negative input adds 4 after the square.

Worked example

Finish a negative intermediate path

For f(t) = t2 − t and h(x) = 3x + 2, find f(h(−2)). You want both stages completed. Plan: compute h(−2) = −4, then replace both t slots in f with that entire signed answer.

Show the steps and the answer
−2hffirstsecond−420
−2 goes into h, then −4 into f: 20.
  1. h(−2)=−4, so f(h(−2))=f(−4).The inner output becomes the outer input.
  2. f(−4)=(−4)2−(−4)=16+4=20.A negative squared is positive, and subtracting a negative adds its opposite.
Answer
f(h(−2))=20.
Double-check The combined expression at −2 is (3(−2) + 2)2 − (3(−2) + 2) = (−4)2 − (−4) = 20.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: f(−4)=(−4)2−4=12.
The second input slot also receives −4. Writing +4 in that slot changes the input.
✓ Instead: f(−4)=(−4)2−(−4)=16+4=20.
Tips and tricks
  • Circle every occurrence of the outer input letter before substituting.

5 How

  1. Expand circle notation into parentheses if needed.
  2. Copy the inner formula and replace every input letter with the original number, using parentheses for negative numbers.
  3. Complete that arithmetic and write the intermediate output.
  4. Copy the outer formula and replace every input letter with that output.
  5. Complete the arithmetic and check by substituting into a combined formula.

Evaluate formulas at a numerical input

1
Is the inserted number negative?
YesUse parentheses around the entire number, including its minus sign.
NoInsert the whole number in every input place.
↓
2
Does the outer formula have more than one input place?
YesReplace every occurrence with the same in-between answer.
NoReplace its one input place, then carry out the arithmetic.
↓
3
Is a denominator zero or an even-root inside negative after substitution?
YesThat stage is undefined, so the composition has no value at this start.
NoComplete the arithmetic and continue to the next stage.
  1. Expand circle notation into parentheses if needed.
  2. Copy the inner formula and replace every input letter with the original number, using parentheses for negative numbers.
  3. Complete that arithmetic and write the intermediate output.
  4. Copy the outer formula and replace every input letter with that output.
  5. Complete the arithmetic and check by substituting into a combined formula.

6 Worked example

Worked example

Both orders at input 1

OpenStax problem

Let f(t) = t2 − t and h(x) = 3x + 2. Find f(h(1)) and h(f(1)). You start at 1 and want the final output in each order. Plan: finish the inner arithmetic, then insert its answer into every outer slot. The input letters t and x are slot names; their difference does not change the method.

Show the steps and the answer
1h: 3x + 2f(t) = t² − tfirstsecond520
1 goes into h: 3x + 2, then 5 into f(t) = t2 − t: 20.
1f(t) = t² − th: 3x + 2firstsecond02
1 goes into f(t) = t2 − t, then 0 into h: 3x + 2: 2.
  1. For f(h(1)), start with h(1)=3×1+2=5.h is the inner function for this order.
  2. f(h(1))=f(5)=52−5=25−5=20.The output 5 replaces both occurrences of t in f.
  3. For h(f(1)), start with f(1)=12−1=1−1=0.f is the inner function for the reversed order.
  4. h(f(1))=h(0)=3×0+2=2.The intermediate output 0 is a valid numerical input to h.
Answer
  • f(h(1)) = 20.
  • h(f(1)) = 2.
Double-check Using the combined formulas with one starting letter gives f(h(x)) = (3x + 2)2 − (3x + 2), which gives 25 − 5 = 20 at x = 1. The reversed formula h(f(t)) = 3(t2 − t) + 2 gives 0 + 2 = 2 at t = 1. Different input-slot letters describe the same instructions.

Ladder: from easy to exam-hard

Try each rung before you open its steps.

Rung 1 of 4

One slot in each formula

Let g(x) = x + 1 and f(x) = 2x. Find (f ∘ g)(2). The input is 2; add 1 first, then use that answer as the input to the doubling function. Plan: finish g first, then carry its whole answer into f.

Show the steps and the answer
2g: add 1f: doublefirstsecond36
The 3 coming out of g goes into f.
  1. (f∘g)(2)=f(g(2)).The circle means composition, so g is the inner function.
  2. g(2)=2+1=3.The original input goes into g first.
  3. f(g(2))=f(3)=2×3=6.The output 3 from g is the input to f.
Answer
(f ∘ g)(2) = 6.
Double-check Combining the rules gives f(g(x)) = 2(x + 1); at 2 this is 2(2 + 1) = 6. The separate product at 2 is f(2)g(2) = 4 × 3 = 12, confirming that the two operations differ.

Rung 2 of 4

Fill every outer slot and reverse the order

Let f(t) = t2 − t and h(x) = 3x + 2. Find f(h(1)) and h(f(1)). You start at 1 and want the final output in each order. Plan: finish the inner arithmetic, then insert its answer into every outer slot. The input letters t and x are slot names; their difference does not change the method.

Show the steps and the answer
1h: 3x + 2f(t) = t² − tfirstsecond520
The same picture again: 1 goes into h: 3x + 2, then 5 into f(t) = t2 − t: 20.
1f(t) = t² − th: 3x + 2firstsecond02
The same picture again: 1 goes into f(t) = t2 − t, then 0 into h: 3x + 2: 2.
  1. For f(h(1)), start with h(1)=3×1+2=5.h is the inner function for this order.
  2. f(h(1))=f(5)=52−5=25−5=20.The output 5 replaces both occurrences of t in f.
  3. For h(f(1)), start with f(1)=12−1=1−1=0.f is the inner function for the reversed order.
  4. h(f(1))=h(0)=3×0+2=2.The intermediate output 0 is a valid numerical input to h.
Answer
  • f(h(1)) = 20.
  • h(f(1)) = 2.
Double-check Using the combined formulas with one starting letter gives f(h(x)) = (3x + 2)2 − (3x + 2), which gives 25 − 5 = 20 at x = 1. The reversed formula h(f(t)) = 3(t2 − t) + 2 gives 0 + 2 = 2 at t = 1. Different input-slot letters describe the same instructions.

Rung 3 of 4

Carry a negative output

For f(t) = t2 − t and h(x) = 3x + 2, find f(h(−2)). You want both stages completed. Plan: compute h(−2) = −4, then replace both t slots in f with that entire signed answer.

Show the steps and the answer
−2hffirstsecond−420
The same picture again: −2 goes into h, then −4 into f: 20.
  1. h(−2)=3(−2)+2=−6+2=−4, so f(h(−2))=f(−4).The inner output becomes the outer input.
  2. f(−4)=(−4)2−(−4)=16+4=20.A negative squared is positive, and subtracting a negative adds its opposite.
Answer
f(h(−2))=20.
Double-check The combined expression at −2 is (3(−2) + 2)2 − (3(−2) + 2) = (−4)2 − (−4) = 20.

Rung 4 of 4

A fractional final answer

Let q(x) = 2x + 3 and p(u) = u+2u−2. Find p(q(1)). You start with 1 and want the output after the linear rule and then the fraction rule. Plan: compute q(1), replace both outer u slots with that answer, and divide only after computing the whole top and bottom.

Show the steps and the answer
1q: 2x + 3p: (u + 2)/(u− 2)firstsecond57/3
The first answer 5 fills both input places of the outer fraction.
  1. q(1)=2×1+3=5.The inner formula acts first, with multiplication before addition.
  2. p(q(1))=p(5)=5+25−2.Both u slots receive the same whole inner answer 5.
  3. 5+2=7 and 5−2=3, so p(q(1))=73.The top and bottom must each be completed before division; the bottom 3 is nonzero.
Answer
p(q(1))=73.
Double-check Substitute directly into the combined expression: (2×1+3)+2(2×1+3)−2 = 73. Multiplying the answer by the bottom gives 73 × 3 = 7, the original top.

Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: f(−4)=−42−4=−20.
This drops the input's parentheses and also changes the second input's sign. −42 means the opposite of 42, while (−4)2 squares the whole input.
✓ Instead: f(−4)=(−4)2−(−4)=16+4=20.

Tips and tricks

  • Write the intermediate output on its own line before the outer substitution.
  • Name the function before reading its formula. The letters inside formulas can be different and still represent input slots.
  • Know cold: one line per function, inner first. The output of the first line is the input of the second.

7 The trap

Replacing only the squared input in t2 − t. The same input goes into both positions, so f(5) is 52 − 5.

Problems marked OpenStax come from Precalculus 2e by Jay Abramson, published by OpenStax, under the CC BY-NC-SA 4.0 licence. Access for free at https://openstax.org/books/precalculus-2e/pages/1-introduction-to-functions.

Lesson 7 of 10

Substitute the whole inside expression

Subject: MathematicsLeans on: DistributionLeans on: Expanding a squareLeans on: Subtracting a packageLeans on: Like termsLeans on: Nonzero denominatorLeans on: Composition orderLeans on: Multiplying powersOpen this lesson
Leans on 0Comes back in 0

1 In plain words

Before filling a form with letters, run the two machines with numbers. Let g multiply by 3 and add 2, and let f square its input and subtract 6. Input 0 goes to 2 and then −2. Input 1 goes to 5 and then 19. Input 2 goes to 8 and then 58. A formula records all these trips at once. Each input letter in the outer rule is a blank on the form. Put the whole inner expression into every blank. Parentheses hold its pieces together until you multiply and combine them. This replacement is substitution. You can run the same rule twice or connect three rules with the same method.

2 Picture it

xg: 3x + 2f: u² − 6firstsecond3x + 2(3x + 2)² − 6
x goes into g: 3x + 2, then 3x + 2 into f: u2 − 6: (3x + 2)2 − 6.
input xoutput f(g(x))0−2119258
The formula 9x2 + 12x − 2 reproduces every output in this row.

Reminder

Reminder: Distribution, Expanding a square, Subtracting a package, Like terms, Nonzero denominator, Composition order, Multiplying powers
  • Distribution. 2(x − 4) = 2x − 8, because the factor multiplies both terms.
  • Expanding a square. (x+1)2=x2+x+x+1=x2+2x+1.
  • Subtracting a package. −(x+2)=−x−2.
  • Like terms. 2x + 2x = 4x, while x2 and x are different kinds of terms.
  • Nonzero denominator. 2x − 1 ≠ 0 means x ≠ 12.
  • Composition order. f(g(x)) replaces the input slots in f with g(x), not the other way around.
  • Multiplying powers. x × x2 = x × (x × x) = x3. The exponent counts three multiplied copies of x.

3 Why

A formula describes what to do to its input, regardless of whether the input is a number or an expression. If f squares its input, then f(g(x)) must square all of g(x). Squaring a sum multiplies the sum by itself, creating middle terms as well as squares. Those terms come from distributing each part across the other package. Parentheses preserve the intended input until this multiplication is finished, so they prevent lost signs and missing terms.

4 The rule

To form f(g(x)), replace every input-variable occurrence in f with the whole parenthesized expression g(x).

(a+b)2=a2+2ab+b2, because (a+b)(a+b) has two cross products ab.

The same idea, five ways

Say it

f of g of x; replace every outer input with the whole inner expression

Write it

The outer formula acts on the entire expression produced by the inner formula.

In math
  • f(g(x))=(3x+2)2−6
  • (f∘g)(x)=9x2+12x−2
  • f(u) = u2 − 6: u is the outer input place
Like

Put the same wrapped package into every blank on a form.

See it
xg: 3x + 2f: u² − 6firstsecond3x + 2(3x + 2)² − 6
The same picture again: x goes into g: 3x + 2, then 3x + 2 into f: u2 − 6: (3x + 2)2 − 6.

The same idea, other ways

As filling boxes

The outer formula x2 − x has two boxes. If the inner output is x + 2, fill both boxes with that package: (x + 2)2 − (x + 2).

f(input) = (input)2 − (input)

Input = x + 2

f(g(x))=(x+2)2−(x+2)

As a wrapped package

Parentheses are the wrapper. A square outside the wrapper applies to every part of the input. A minus outside the wrapper subtracts every part.

Square the package: (x + 2)2

Subtract the package: −(x + 2)

As a multiplication rectangle

Squaring 3x + 2 places that same group along both rectangle sides. Four products fill it: 9x2, 6x, 6x, and 4. Both middle rectangles contribute, so their total is 12x.

9x²6x3x6x423x2
Every rectangle contributes to the expanded square.
With a number check

At x = 1, the inner expression 3x + 2 gives 5, whose square is 25. The expansion gives 9 + 12 + 4 = 25. Dropping the middle term gives 13, so this test catches that mistake.

13x + 2squarefirstsecond525
The small-number route checks that the complete group was squared.

Part 1: A linear outside formula

If the outer function multiplies its input by a number, that number multiplies the whole inner expression. Put in the package first, then distribute.

  • For f(x) = 3x and g(x) = x − 4, f(g(x)) = 3(x − 4).
3x−123x−4
This is a multiplication bookkeeping grid.

Worked example

Triple the whole inside

Let f(x) = 3x and g(x) = x − 4. Find f(g(x)). You want to triple the entire g output. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.

Show the steps and the answer
5g: subtract 4f: triplefirstsecond13
The direct two-stage result matches the formula.
  1. f(g(x))=f(x−4)=3(x−4).The outer input slot receives x − 4.
  2. =3x−12.3 multiplies x and −4.
Answer
f(g(x)) = 3x − 12, for every real x.
Double-check At x = 5, g(5) = 1 and f(1) = 3; 3(5) − 12 = 3.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: 3(x−4)=3x−4.
This triples x while leaving the second part of the same input unchanged.
✓ Instead: 3(x−4)=3x−12.
Tips and tricks
  • Draw one multiplication arrow from the outside factor to each term inside.

Part 2: A square outside formula

A square means multiplying the input by itself. If the input is a sum, both copies of the whole sum must be multiplied. The middle term comes from two cross products.

  • (x+1)2=x2+2x+1.
  • A square does not distribute over addition.
x²xxx11x1
The two x products add to the middle term 2x.

Worked example

A first square composition

Let f(x) = x2 and g(x) = x + 1. Find f(g(x)). You want to square the complete inner output. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.

Show the steps and the answer
x²xxx11x1
All four products belong in the expanded square.
  1. f(g(x))=(x+1)2=(x+1)(x+1).Squaring multiplies the whole input by itself.
  2. =x2+x+x+1=x2+2x+1.The four products include two matching middle terms.
Answer
f(g(x))=x2+2x+1.
Double-check At x = 2, g(2) = 3 and f(3) = 9; 4 + 4 + 1 = 9.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: (x+1)2=x2+1.
It misses the products x × 1 and 1 × x.
✓ Instead: (x+1)2=x2+2x+1.
Tips and tricks
  • Multiply two written copies if the square formula is hard to remember.

Part 3: A fraction outside formula

A fraction's denominator may also contain an input slot. Replace that slot with the complete inner expression. Then check when the new denominator would be zero.

  • For f(x) = 1x−2, f(g(x)) = 1g(x)−2.
  • The original and intermediate restrictions still matter; the next lesson develops both gates.

f(x)=1x−2

g(x) = 3x + 1

f(g(x))=13x−1

Require x ≠ 13

Worked example

A linear output enters a denominator

Let f(x) = 1x−2 and g(x) = 3x + 1. Find f(g(x)). You want to subtract 2 from the g output, then take the reciprocal. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.

Show the steps and the answer
1gffirstsecond41/2
The inner output fills the denominator's input slot.
  1. f(g(x))=1(3x+1)−2.The whole inner expression replaces x in the denominator.
  2. =13x−1.The constants 1 − 2 combine to −1.
  3. Find the forbidden starting input by solving 3x−1=0: add 1 to get 3x=1, then divide by 3 to get x=13. Check: 3×13−1=0. Exclude that input.This finds and confirms the one start that makes the new denominator zero. The inner linear function itself accepts every real input.
Answer
f(g(x))=13x−1,x≠13.
Double-check At x = 1, g(1) = 4 and f(4) = 12, agreeing with 13−1.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: f(g(x))=13x+1−2.
The −2 belongs inside the denominator of f, so it must stay inside after substitution. At x = 1 the wrong version gives −74 instead of 12.
✓ Instead: f(g(x))=1(3x+1)−2=13x−1.
Tips and tricks
  • Copy the entire fraction first, then replace its input places.

Part 4: Compose a function with itself

A machine can send its answer back through the same rule. The second trip uses the first answer as its input. In j(j(x)), the two j names mean two separate applications of the same instructions. This operation is different from multiplying the first answer by itself.

  • (j ∘ j)(x) = j(j(x)).
  • j(j(x)) uses the output as a new input; j(x)2 squares the output instead.
1jjfirstsecond941
The second j receives the first j’s output.

Worked example

The same formula can receive its own output

Let j(x) = 4x + 5. Find j(j(x)) and its value at x = 1. You run j twice, using a new input the second time. Plan: put the whole first output 4x + 5 into j, distribute 4, and check with two separate number evaluations.

Show the steps and the answer
1j: 4x + 5j: 4u + 5firstsecond941
1 goes into j: 4x + 5, then 9 into j: 4u + 5: 41.
  1. j(j(x))=4(4x+5)+5.The outer copy of j receives 4x + 5 as its whole input.
  2. =16x+20+5=16x+25.Distribution multiplies both inner terms by 4, then combines the added constants.
  3. At x=1,j(j(1))=16×1+25=41.The composed formula gives the final output for starting input 1.
Answer
  • j(j(x)) = 16x + 25.
  • j(j(1)) = 41.
Double-check The direct two-stage route gives j(1) = 9 and j(9) = 4 × 9 + 5 = 41, agreeing with the new formula.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: j(j(1))=j(1)2=81.
This squares the first output 9 instead of feeding 9 back into j.
✓ Instead: j(1) = 9, then j(9) = 41.
Tips and tricks
  • Know cold: same name means same instructions again, with a new input.

Part 5: Connect three functions

Think of three stations in a kitchen. The first prepares something for the second, and the second prepares something for the third. In p(q(v(x))), v acts first, q second, and p last. Each completed answer replaces the next input. More functions mean more stages, while the inside-first method stays the same.

  • p(q(v(x))) runs v, then q, then p.
  • A chain is defined only when every stage accepts the answer handed to it.
2v: add 3q: squarefirstsecond525
Continue from 25 into p to obtain 43.

Worked example

Connect three formulas in order

Let v(x) = x + 3, q(x) = x2, and p(x) = 2x − 7. Find p(q(v(2))) and p(q(v(x))). You run three jobs, starting with the deepest parentheses. Plan: add 3, square the result, then double and subtract 7.

Show the steps and the answer
2v: add 3q: squarefirstsecond525
The same picture again: 2 goes into v: add 3, then 5 into q: square: 25.
5q: squarep: 2u − 7firstsecond2543
5 goes into q: square, then 25 into p: 2u − 7: 43.
  1. v(2)=2+3=5.v touches the starting input, so it acts first.
  2. q(v(2))=q(5)=25.The output 5 is now the input to the square.
  3. p(q(v(2)))=p(25)=2×25−7=43.The final rule receives 25, rather than the original 2.
  4. p(q(v(x)))=2(x+3)2−7.The inner expression is squared in full and handed to the last rule.
  5. (x+3)2=x2+3x+3x+9=x2+6x+9.All four products belong to the square.
  6. 2(x2+6x+9)−7=2x2+12x+18−7=2x2+12x+11.The outside factor multiplies each term, then the constants combine.
Answer
  • p(q(v(2))) = 43.
  • p(q(v(x)))=2x2+12x+11.
Double-check At x = 2, the expanded formula gives 2 × 4 + 12 × 2 + 11 = 8 + 24 + 11 = 43, agreeing with the three numerical stages.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: p(q(v(2))) means p(2) × q(2) × v(2).
That multiplies three independent outputs at the original input instead of passing each output to the next function.
✓ Instead: The connected path is 2 → 5 → 25 → 43.
Tips and tricks
  • Write one line for every function, starting with the innermost parentheses.

5 How

  1. Copy the outer formula and identify every input slot.
  2. Write the complete inner formula in parentheses in every slot.
  3. Keep powers outside those parentheses so they act on the entire input.
  4. Expand with distribution. For a square, multiply the two identical parentheses and keep both cross products.
  5. Combine like terms, preserve any domain restrictions, and check a small allowed input by the two-stage route.

Build one formula for a composition

1
Does the outer input occur more than once?
YesPut the complete inner expression, in parentheses, into every occurrence.
NoPut the complete expression in its one input place.
↓
2
Is a whole sum or difference squared?
YesWrite two copies and multiply all four term pairs before collecting terms.
NoApply the indicated operations in their original order.
↓
3
Does either original stage have a denominator or an even root?
YesKeep the original requirements, and check the substituted outer input as the next domain lessons teach.
NoThese arithmetic formulas accept every real starting input unless a restricted domain is supplied. Keep any stated restriction.
  1. Copy the outer formula and identify every input slot.
  2. Write the complete inner formula in parentheses in every slot.
  3. Keep powers outside those parentheses so they act on the entire input.
  4. Expand with distribution. For a square, multiply the two identical parentheses and keep both cross products.
  5. Combine like terms, preserve any domain restrictions, and check a small allowed input by the two-stage route.

6 Worked example

Worked example

A square makes the middle term

Let f(x) = x2 − 6 and g(x) = 3x + 2. Find (f ∘ g)(x) and (g ∘ f)(x). You want one formula for each order. Plan: put the complete inner formula into the outer input place, multiply out any square using four products, and collect matching terms.

Show the steps and the answer
9x²6x3x6x423x2
The two middle rectangles contribute 6x each, so the middle term is 12x.
1g: 3x + 2f: u² − 6firstsecond519
The input u names the entire number handed to f.
  1. (f∘g)(x)=f(3x+2)=(3x+2)2−6.The outer f squares its whole input before subtracting 6.
  2. (3x+2)2=(3x+2)(3x+2)=9x2+6x+6x+4.Each of the two terms in one copy multiplies each term in the other copy.
  3. (f∘g)(x)=9x2+12x+4−6=9x2+12x−2.The two middle products add to 12x, and 4 − 6 = −2.
  4. (g∘f)(x)=g(x2−6)=3(x2−6)+2.Now g multiplies f’s entire output by 3 and adds 2.
  5. (g∘f)(x)=3x2−18+2=3x2−16.The factor 3 multiplies both x2 and −6, then −18 + 2 = −16.
Answer
  • (f∘g)(x)=9x2+12x−2.
  • (g∘f)(x)=3x2−16.
  • Both domains are all real numbers.
Double-check At x = 1, g(1) = 5 and f(5) = 19, matching 9 + 12 − 2 = 19. Reversing gives f(1) = −5 and g(−5) = −13, matching 3 − 16 = −13.

Ladder: from easy to exam-hard

Try each rung before you open its steps.

Rung 1 of 7

A constant inner answer

Let g(x) = 4 and f(x) = x + 1. Find f(g(x)). Whatever input you start with, the first machine returns 4. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.

Show the steps and the answer
any xreturn 4add 1firstsecond45
The starting input does not change this inner output.
  1. f(g(x))=f(4).The inner output is always 4.
  2. f(4)=4+1=5.The outer function adds 1 to its input.
Answer
f(g(x)) = 5 for every real x.
Double-check At x = −7, g(−7) = 4 and f(4) = 5, matching the constant formula.

Rung 2 of 7

Distribute over an inner line

Let f(x) = 2x + 3 and g(x) = x − 4. Find f(g(x)). You want to double the complete inner answer and add 3. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.

Show the steps and the answer
2x−82x−4
The factor 2 multiplies both signed terms.
  1. f(g(x))=2(x−4)+3.x − 4 replaces the outer input slot.
  2. =2x−8+3=2x−5.Distribute 2 and then combine the constants.
Answer
2x−5.
Double-check At 0, g(0) = −4 and f(−4) = −5, agreeing with 2(0) − 5.

Rung 3 of 7

Fill repeated slots

Let f(x) = x2 − x and g(x) = x + 2. Find f(g(x)). You must use the whole g output twice. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.

Show the steps and the answer

(x+2)2−(x+2)

x2+4x+4−x−2

x2+3x+2

  1. f(g(x))=(x+2)2−(x+2).Both occurrences of the outer input receive x + 2.
  2. =x2+2x+2x+4−x−2.Multiplying the square produces four terms, and subtracting the last package changes both signs.
  3. =x2+3x+2.4x − x = 3x and 4 − 2 = 2.
Answer
x2+3x+2.
Double-check At 1, g(1) = 3 and f(3) = 6; 1 + 3 + 2 = 6.

Rung 4 of 7

A square with a negative term

Let f(x) = x2 + 1 and g(x) = 3x − 2. Find f(g(x)). You want to square the whole difference and then add 1. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.

Show the steps and the answer
9x²−6x3x−6x4−23x−2
The labels record signed products.
  1. f(g(x))=(3x−2)2+1.The square acts on all of g's output.
  2. (3x−2)2=9x2−6x−6x+4.Each cross product contains one negative factor, while (−2)(−2) is positive.
  3. f(g(x))=9x2−12x+5.The cross products add to −12x and 4 + 1 = 5.
Answer
9x2−12x+5.
Double-check At 1, g(1) = 1 and f(1) = 2; 9 − 12 + 5 = 2.

Rung 5 of 7

Slots on both sides of a fraction

Let f(x) = x+1x−1 and g(x) = 2x. Find f(g(x)). You replace the input on both top and bottom. Plan: put 2x into both places, then find the starting input that makes the entire denominator zero.

Show the steps and the answer
xg: 2xf: (u+1)/u−1firstsecond2x(2x + 1)/(2x − 1)
Both fraction slots receive the same inner output.
  1. f(g(x))=2x+12x−1.Each x slot in f receives the full expression 2x.
  2. Solve 2x−1=0 to locate the forbidden input: 2x=1, so x=12. Plug it back in: 2×12−1=0. Exclude 12.The denominator must not be zero. This equation finds the starting input at which that failure would occur; g itself has no restrictions.
Answer
2x+12x−1, with x ≠ 12.
Double-check At 2, g(2) = 4 and f(4) = 53; the combined formula gives 4+14−1 = 53.

Rung 6 of 7

The same function twice

Let j(x) = 4x + 5. Find j(j(x)) and its value at x = 1. You run j twice, using a new input the second time. Plan: put the whole first output 4x + 5 into j, distribute 4, and check with two separate number evaluations.

Show the steps and the answer
1j: 4x + 5j: 4u + 5firstsecond941
The same picture again: 1 goes into j: 4x + 5, then 9 into j: 4u + 5: 41.
  1. j(j(x))=4(4x+5)+5.The outer copy of j receives 4x + 5 as its whole input.
  2. =16x+20+5=16x+25.Distribution multiplies both inner terms by 4, then combines the added constants.
  3. At x=1,j(j(1))=16×1+25=41.The composed formula gives the final output for starting input 1.
Answer
  • j(j(x)) = 16x + 25.
  • j(j(1)) = 41.
Double-check The direct two-stage route gives j(1) = 9 and j(9) = 4 × 9 + 5 = 41, agreeing with the new formula.

Rung 7 of 7

A three-stage symbolic chain

Let v(x) = x + 3, q(x) = x2, and p(x) = 2x − 7. Find p(q(v(2))) and p(q(v(x))). You run three jobs, starting with the deepest parentheses. Plan: add 3, square the result, then double and subtract 7.

Show the steps and the answer
2v: add 3q: squarefirstsecond525
The same picture a third time: 2 goes into v: add 3, then 5 into q: square: 25.
5q: squarep: 2u − 7firstsecond2543
The same picture again: 5 goes into q: square, then 25 into p: 2u − 7: 43.
  1. v(2)=2+3=5.v touches the starting input, so it acts first.
  2. q(v(2))=q(5)=25.The output 5 is now the input to the square.
  3. p(q(v(2)))=p(25)=2×25−7=43.The final rule receives 25, rather than the original 2.
  4. p(q(v(x)))=2(x+3)2−7.The inner expression is squared in full and handed to the last rule.
  5. (x+3)2=x2+3x+3x+9=x2+6x+9.All four products belong to the square.
  6. 2(x2+6x+9)−7=2x2+12x+18−7=2x2+12x+11.The outside factor multiplies each term, then the constants combine.
Answer
  • p(q(v(2))) = 43.
  • p(q(v(x)))=2x2+12x+11.
Double-check At x = 2, the expanded formula gives 2 × 4 + 12 × 2 + 11 = 8 + 24 + 11 = 43, agreeing with the three numerical stages.

Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: f(g(x))=(3x+2)2−6=9x2−2.
This discards the two middle products, 6x and 6x. At x = 1 it gives 7 instead of 19.
✓ Instead: f(g(x))=9x2+12x−2.
✗ Not this: For f(x) = x2 − x, substituting x + 2 gives (x + 2)2 − x.
The second input slot was never replaced.
✓ Instead: Use (x + 2)2 − (x + 2).

Tips and tricks

  • Know cold: every slot gets the whole package. Circle each input-variable occurrence before replacing it.
  • Understand, then rebuild: the expanded formula. Parentheses and distribution can recreate it; memorizing the numbers in front of its variable terms is unnecessary.
  • Use x = 1 to check for a missing middle term. At x = 0 that term becomes zero and may hide the error.

7 The trap

Writing (2x + 1)2 = 4x2 + 1. The square multiplies two whole sums, so the two cross products must appear.

Lesson 8 of 10

A composite domain has two gates

Subject: MathematicsLeans on: Domain of a fractionLeans on: Solving a linear equationLeans on: Fraction equationLeans on: Interval notationLeans on: Dividing fractionsLeans on: Composition orderOpen this lesson
Leans on 1Comes back in 0

1 In plain words

Picture a trip with two ticket checks. The first gate checks your starting ticket. The second checks the ticket you receive after the first stage. Passing the first gate does not promise that you can pass the second. A composite domain is the list of starts that pass both checks. First, the inner function must accept your starting number x. Then the outer function must accept the answer g(x). These are the starts for which neither calculation stops. In the heating model, a day outside the calendar fails first; a temperature outside the cost chart fails second. Keep both checks before simplifying, because a shorter formula can hide a failed first stage.

2 Picture it

xg takes x?f takes g(x)?firstsecondg(x)answer
x goes into g takes x?, then g(x) into f takes g(x)?: answer.

Reminder

Reminder: Domain of a fraction, Solving a linear equation, Fraction equation, Interval notation, Dividing fractions, Composition order
  • Domain of a fraction. 43x−2 requires 3x − 2 ≠ 0, so x ≠ 23.
  • Solving a linear equation. 4 = 3x − 2 becomes 6 = 3x, then x = 2.
  • Fraction equation. 43x−2 = 1 permits multiplying by 3x − 2 only after requiring it nonzero.
  • Interval notation. Removing 2 gives (−∞, 2) ∪ (2, ∞); parentheses exclude the point.
  • Dividing fractions. 1 ÷ 14 = 4, because division multiplies by the reciprocal.
  • Composition order. f(g(x)) checks g at x first and f at the resulting number second.

3 Why

You cannot evaluate f(g(x)) if g gives no answer. You also cannot finish when g gives an answer that f cannot accept. These are separate ways the path can stop. The outer restriction applies to the in-between answer g(x), not directly to x. Solving for starts that produce forbidden answers converts the second gate into a restriction on x. Simplifying afterward does not create an answer at an earlier failed stage. This is why a composition can accept an x that f alone rejects, provided g changes it into an input f accepts.

4 The rule

The domain of f∘g consists of the x values allowed by g for which g(x) is allowed by f.

Keep original restrictions when simplifying the composite formula.

The same idea, five ways

Say it

x must get through g, then g of x must get through f.

Write it

The domain of f after g is every starting input that both stages can use in order.

In math
  • (f ∘ g)(x) = f(g(x))
  • {x | x is in the domain of g and g(x) is in the domain of f}
Like

Two ticket gates check different tickets.

See it
xg takes x?f takes g(x)?firstsecondg(x)answer
The same picture again: x goes into g takes x?, then g(x) into f takes g(x)?: answer.

The same idea, other ways

As two ticket gates

A valid starting ticket gets you through gate 1. Gate 2 checks a new ticket made by gate 1. You must check both, because they examine different things.

starting ticket xg checks xf checks newticketfirstsecondnew ticket g(x)complete trip
The second gate inspects the intermediate ticket.
As two questions

Ask: can I calculate g(x)? Then ask: can I calculate f at that answer? If either answer is no, the starting input is outside the composite domain.

Does g accept x?

Does f accept g(x)?

Keep x only if both answers are yes

With the two excluded numbers

At 23, the inner fraction has bottom zero. At 2, the inner fraction works and returns 1, but the outer fraction has bottom zero. These failures occur at different gates.

x = 23: g fails

x = 2: g(2) = 1, then f fails

Why a canceled restriction survives

If g(x) = 1x and f(x) = 1x, the composite simplifies to x. But the first machine still cannot start at zero, so the composite is x with x ≠ 0.

x ≠ 0reciprocalreciprocalfirstsecond1/xx
Two reciprocals undo each other only after the first one exists.
start xg(x)f(g(x))what happens
0−2−53both stages work
1453both stages work
23undefinedundefinedinner bottom is 0
21undefinedouter bottom is 0

Part 1: Watch each gate before solving

Try a few starting tickets first. Input 0 passes through −2 to −53. Input 1 passes through 4 to 53. Input 23 stops in the first machine. Input 2 produces 1, then stops in the second. Solving finds every start that stops, beyond the ones you happen to try.

  • These pictures use f(x) = 5x−1 and g(x) = 43x−2.
  • Undefined means a stage has no permitted answer.
input xoutput g(x)0−2142 ÷ 3undefined21↓ evaluate: input given, read the output below it
Read the g answer below each start.

Worked example

Four starting tickets

Trace starts 0, 1, 23, and 2 through the two functions. You want to see which stage succeeds or fails. Plan: calculate g first and calculate f only if g gives an answer.

Show the steps and the answer
input xoutput f(g(x))0−5 ÷ 315 ÷ 32 ÷ 3undefined2undefined↓ evaluate: input given, read the output below it
The final table records success only when both stages work.
  1. g(0)=4−2=−2; f(−2)=5−3=−53.Both bottoms are nonzero.
  2. g(1)=41=4; f(4)=53.The in-between input 4 is allowed by f.
  3. At 23, g has bottom 3×23−2=0, so stop.A failed first stage gives no answer to hand over.
  4. g(2)=44=1, then f(1) has bottom 0, so stop.An existing in-between answer can still be forbidden by the outer function.
Answer
  • 0 works.
  • 1 works.
  • 23 fails at gate 1.
  • 2 fails at gate 2.
Double-check For input 1, the final 53 multiplied by its outer bottom 3 returns the top 5.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: f accepts every start except 1, so the composite should exclude 1.
The composite sends g(1) = 4 into f, so start 1 works.
✓ Instead: Exclude start 2 because g(2) = 1.
Tips and tricks
  • The pictures show the handoff. Solving finds every starting input that creates a failed handoff.

Part 2: Gate 1: the inner function accepts x

Begin with the original inner formula. Its accepted inputs are the starting territory for the composition. A failure here means there is no intermediate answer to hand over.

  • Every composite input must be in the inner domain.
  • An unrestricted outer function cannot rescue a failed inner stage.
5excluded(−∞, 5) ∪ (5, ∞)
The inner denominator excludes input 5 before any outer operation.

Worked example

An unrestricted outer rule still needs an inner answer

Let g(x) = 1x−5 and f(x) = x + 2. Find the domain of f(g(x)). You want starting inputs that make the inner fraction exist. Plan: inspect the original inside rule, then inspect the outside rule at the inside answer, keeping both restrictions.

Show the steps and the answer
6g: 1/(x − 5)add 2firstsecond13
The outer addition cannot begin until the fraction produces an answer.
  1. Set x−5=0 to locate the failed inner start. Add 5: x=5. Plug back in: 5−5=0. Therefore require x≠5.The equation finds the input that would make the inner bottom zero, so we exclude it.
  2. There are no further restrictions from f.Adding 2 accepts every real intermediate answer.
Answer
(−∞,5)∪(5,∞).
Double-check At 6, g(6) = 1 and f(1) = 3; at 5, the first division has no value.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: f(x) = x + 2 accepts everything, so f(g(x)) accepts everything.
At start 5, g(5) = 10 has no value.
✓ Instead: The domain excludes 5 before f can act.
Tips and tricks
  • Begin with the original inner formula, even if the outer operation looks unrestricted.

Part 3: Gate 2: the outer function accepts g(x)

The outer function's forbidden numbers are intermediate outputs. Find which starting inputs would produce those numbers. The starting number itself may be allowed by the outer formula or forbidden by it; that alone does not decide the composition.

  • For f(x) = 1x−1, the second gate requires g(x) ≠ 1.
  • Do not merely intersect the two original domains as if both received x.
1/2g: doublef: 1/(u − 1)firstsecond1undefined
Starting at 12 causes an outer failure even though the inner rule works.

Worked example

A forbidden outer input changes its starting location

Let f(x) = 1x−1 and g(x) = 2x. Find the domain of f(g(x)). You want to avoid starting inputs whose doubled value is 1. Plan: inspect the original inside rule, then inspect the outside rule at the inside answer, keeping both restrictions.

Show the steps and the answer
1/2
The open point 0.5 is exactly 12. Start 1 is allowed because its handoff is 2.
  1. g accepts every real starting input.Doubling has no denominator or square root restriction.
  2. Find starts that hand f the forbidden input 1: solve 2x=1. Divide by 2: x=12. Plug back in: g(12)=1 and f(1)=10. Exclude 12.The solve step translates the outer forbidden input into the failed starting input.
Answer
(−∞,12)∪(12,∞).
Double-check Starting at 1 works: g(1) = 2 and f(2) = 1. Starting at 12 fails: g(12) = 1 and f(1) is undefined.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: Exclude x = 1 because f forbids 1.
Start 1 gives g(1) = 2 and f(2) = 1, so it passes both gates.
✓ Instead: Exclude 12, the start whose doubled value is 1.
Tips and tricks
  • Write g(x) beside the outer input requirement before solving.

Part 4: Record the domain before simplifying

A shorter formula can conceal the first gate. Keep the original restrictions next to the simplified answer. The formula together with its domain describes the function.

  • Simplification keeps outputs equal on the original domain.
  • It does not add starting inputs that the original composition rejected.
0still excluded(−∞, 0) ∪ (0, ∞)
The formula x returns its input, but the original reciprocal chain still excludes zero.

Worked example

Two reciprocals hide a hole

Let f(x) = 1x and g(x) = 1x. Find f(g(x)) and its domain. You want the result of taking the reciprocal twice, while respecting the first division. Plan: inspect the original inside rule, then inspect the outside rule at the inside answer, keeping both restrictions.

Show the steps and the answer
4reciprocalreciprocalfirstsecond1/44
The two stages return the original input only when the first stage exists.
  1. Require x≠0 for g(x).The inner reciprocal cannot divide by zero.
  2. The outer function requires g(x)≠0; this holds for every x≠0.1x cannot equal zero when its denominator is nonzero.
  3. f(g(x))=1÷1x=x, with x≠0.Dividing by a nonzero fraction multiplies by its reciprocal.
Answer
  • f(g(x)) = x with x ≠ 0.
  • Domain: (−∞, 0) ∪ (0, ∞).
Double-check At x = 4, g(4) = 14 and f(14) = 4. At 0 the first reciprocal fails even though the simplified expression x would have a value.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: Two reciprocals give x, so zero is now allowed.
The first reciprocal at zero is still 10.
✓ Instead: Keep x ≠ 0 beside the formula x.
Tips and tricks
  • A function answer includes its formula and the original allowed inputs.

Part 5: The inner range can settle the second gate

The range is the list of answers a machine can produce. If every answer on that list is accepted by the next machine, gate 2 needs no extra exclusions. If some answers fail, keep only starts that avoid them.

  • For g(x) = x2, its outputs are [0, ∞). The root f(x) = x accepts every one of them.
  • If g(x) = x − 5, its outputs include negatives, so an outer root requires x ≥ 5.
range−222468
The square only produces heights zero and above, which the next root accepts.

Worked example

All square outputs fit the root

Let g(x) = x2 and f(x) = x. Find f(g(x)) and its domain. You want to know whether every square answer can enter the root. Plan: compare g’s outputs with f’s accepted inputs.

Show the steps and the answer
−3squarerootfirstsecond93
Every square output is an accepted root input.
  1. Every real x can be squared, and x2≥0.A square of a real number never gives a negative answer.
  2. Every such output can enter f, so f(g(x))=x2=|x| for every real x.The root returns the nonnegative size of x.
Answer
  • f(g(x)) = |x|.
  • Domain: (−∞, ∞).
Double-check At x = −3, the path is −3 to 9 to 3. The answer is |−3| = 3, so the final output need not equal the signed start.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: Every g can be followed by a root on its whole domain.
For g(x) = x − 5, start 4 gives −1, which a real root rejects.
✓ Instead: For this g, solve x − 5 ≥ 0 to find allowed starts x ≥ 5; the domain is [5, ∞).
Tips and tricks
  • Compare the inner outputs to the outer accepted inputs; the two lists describe different stages.

5 How

  1. Find the inner domain. Record inputs making an inner denominator zero or violating any other inner requirement.
  2. Find what the outer function cannot accept. For an outer denominator, determine its forbidden input values.
  3. Set g(x) equal to each forbidden outer input and solve. Exclude the solutions that are in the inner domain.
  4. Keep only starting inputs passing both gates. For roots, use inequalities rather than only equations, as the next lesson explains.
  5. Write the result in interval notation and check a permitted input and each excluded input using the original stages.

Find the domain of f(g(x))

1
Does g have a fraction bottom that depends on x?
YesSet that bottom = 0, solve, plug back in, and exclude those starts at gate 1.
NoContinue to the root check.
↓
2
Does g have an even root?
YesRequire the inside ≥ 0, or > 0 when that root is a bottom. Solve for the allowed starts.
NoContinue to gate 2.
↓
3
Does f have a fraction bottom that depends on its input?
YesReplace its input with g(x). Set the resulting bottom = 0 and solve to locate starts to exclude at gate 2.
NoContinue to the outer root check.
↓
4
Does f have an even root?
YesReplace its input with g(x). Require its inside ≥ 0, or > 0 when that root is a bottom. Keep the starts satisfying this requirement.
NoGate 2 has no root requirement.
↓
5
Does a square-root output have to equal a negative forbidden input?
YesThere is no such start because a square root cannot give a negative answer. Do not exclude a candidate obtained by squaring that impossible equation.
NoSolve any remaining equation, then check its candidates in the original expression.
  1. Gate 1: begin with any stated input list or interval for the inner function, then write every requirement in its original formula. A bottom must be nonzero; an even root must have a nonnegative inside; a root in a bottom needs a positive inside.
  2. Gate 2: keep any stated outer input list or interval, and write the outer formula’s requirements with g(x) in every input slot. These requirements check the in-between answer.
  3. To locate a zero bottom, set it equal to 0 and solve. This finds starts that break the division. Substitute each candidate into the original stages to confirm which gate fails.
  4. For a root, solve an inequality for its inside. When removing a root by squaring, first check that both compared quantities are nonnegative.
  5. Keep only starting inputs that pass both gates. Write intervals with included endpoints closed and excluded endpoints open. Retain every original restriction after simplification.

6 Worked example

Worked example

Two different failures in a fraction composition

OpenStax problem

Let f(x) = 5x−1 and g(x) = 43x−2. Find the domain of (f ∘ g)(x). You want every starting number that can get through g and then f. Plan: find where the first bottom is zero, then find where g hands f the number 1; exclude both starts.

Show the steps and the answer
0.672
The open points exclude 23 and 2. The label 0.67 approximates 23; use the exact fraction in your answer.
  1. Gate 1: set 3x−2=0 to find the starting input that makes g divide by zero.A zero inner bottom prevents any in-between answer.
  2. Add 2: 3x=2. Divide by 3: x=23. Plug back in: 3×23−2=2−2=0. Exclude 23.Balanced operations find the failed start, and substitution confirms the zero bottom.
  3. Gate 2: f cannot accept 1, since 1−1=0. Find every start whose g answer is 1.The outer function receives g(x), so the forbidden number is a handoff value.
  4. Solve 43x−2=1. On the inner domain multiply by the nonzero 3x−2: 4=3x−2.This locates starts that reach the forbidden outer input. The first exclusion makes the multiplication legal.
  5. Add 2: 6=3x. Divide by 3: x=2.These operations find the start that causes the second failure.
  6. Plug back in: g(2)=46−2=1, and f(1)=50. Exclude 2.The first stage works at 2, but its answer breaks the second division.
  7. Keep x≠23 and x≠2. Split the line at these two excluded points.All remaining starts pass both original bottoms.
Answer
  • Domain: (−∞, 23) ∪ (23, 2) ∪ (2, ∞).
  • Set-builder: {x | x ≠ 23 and x ≠ 2}.
Double-check At x = 0, g(0) = −2 and f(−2) = −53, so a permitted input works. At x = 23, g fails. At x = 2, g(2) = 1 exists but f(1) fails. The two exclusions have different causes.

Ladder: from easy to exam-hard

Try each rung before you open its steps.

Rung 1 of 5

Both gates accept every real number

Let g(x) = x + 3 and f(x) = 2x. Find the domain of f(g(x)). You only need to decide which starting inputs can pass both rules. Plan: inspect the original inside rule, then inspect the outside rule at the inside answer, keeping both restrictions.

Show the steps and the answer
(−∞, ∞)
No starting inputs are excluded.
  1. g accepts every real x.Adding 3 has no restriction.
  2. f accepts every real intermediate output.Multiplying by 2 has no restriction.
Answer
(−∞,∞).
Double-check Even x = −10 works: g(−10) = −7 and f(−7) = −14; the same two arithmetic actions work for every real input.

Rung 2 of 5

One forbidden outer value

Let g(x) = x + 2 and f(x) = 1x. Find the domain of f(g(x)). You must prevent the intermediate answer from becoming zero. Plan: inspect the original inside rule, then inspect the outside rule at the inside answer, keeping both restrictions.

Show the steps and the answer
−2excluded(−∞, −2) ∪ (−2, ∞)
The forbidden intermediate zero comes from starting input −2.
  1. g accepts all real inputs, but f requires g(x)≠0.The reciprocal's denominator is its input.
  2. Set x+2=0 to locate the forbidden handoff zero. Subtract 2: x=−2. Plug back in: g(−2)=0, so f(g(−2))=10. Exclude −2.This solves for the starting input that breaks the outer division.
Answer
(−∞,−2)∪(−2,∞).
Double-check At 0 the path is 0 to 2 to 12. At −2, the path stops after producing 0.

Rung 3 of 5

An inner restriction only

Let g(x) = 2x+4 and f(x) = x2. Find the composite domain. You want a defined inner fraction followed by a square. Plan: inspect the original inside rule, then inspect the outside rule at the inside answer, keeping both restrictions.

Show the steps and the answer
−3gsquarefirstsecond24
Only the inner denominator limits this path.
  1. Set x+4=0 to locate the inner zero bottom. Subtract 4: x=−4. Plug back in: −4+4=0. Exclude −4.The equation identifies the failed first-stage input.
  2. No further exclusion is needed.The outer square accepts any real intermediate output.
Answer
(−∞,−4)∪(−4,∞).
Double-check At −3, g(−3) = 2 and f(2) = 4. At −4 the first stage divides by zero.

Rung 4 of 5

Two fraction exclusions

Let g(x) = 2x+1 and f(x) = 1x−3. Find the domain of f(g(x)). You must avoid an inner zero denominator and an intermediate value of 3. Plan: inspect the original inside rule, then inspect the outside rule at the inside answer, keeping both restrictions.

Show the steps and the answer
−1−0.33
Exclude −1 and −13. The plotted −0.33 approximates −13; keep the exact fraction in your answer.
  1. Gate 1: x+1=0 gives x=−1. Plug back in: −1+1=0. Exclude −1.This finds and confirms the inner zero bottom.
  2. At gate 2, solve 2x+1=3: 2=3(x+1).f rejects input 3, and x + 1 is nonzero on the inner domain.
  3. 2=3x+3, so −1=3x and x=−13. Plug back in: x+1=23; g(x)=2÷23=3, so f(3) has bottom 0. Exclude this start.This start makes the outer denominator zero.
Answer
(−∞,−1)∪(−1,−13)∪(−13,∞).
Double-check At 0, g(0) = 2 and f(2) = −1. At −1 g fails. At −13, g returns 3 and f fails.

Rung 5 of 5

The first restriction disappears from the formula

Let g(x) = 1x−5 and f(x) = 1x. Find the formula and domain of f(g(x)). Taking the reciprocal twice will shorten the formula, but both stages must first exist. Plan: inspect the original inside rule, then inspect the outside rule at the inside answer, keeping both restrictions.

Show the steps and the answer
5hidden restriction(−∞, 5) ∪ (5, ∞)
The domain preserves the missing starting input after simplification.
  1. Set x−5=0 to find the failed inner bottom. Add 5: x=5. Substitution gives 5−5=0. Exclude 5.The shorter final expression must retain this original failed input.
  2. The inner output is never zero on that domain.A fraction with numerator 1 and a nonzero denominator cannot be zero.
  3. f(g(x))=1÷1x−5=x−5, still with x≠5.The reciprocal undoes the first reciprocal only at allowed inputs.
Answer
  • f(g(x))=x−5,x≠5.
  • Domain: (−∞, 5) ∪ (5, ∞).
Double-check At 7 the path is 7 to 12 to 2, matching 7 − 5. At 5 the first step is undefined, so the apparent simplified value 0 cannot be used.

Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: Intersect the domains of f and g directly to find the composite domain.
The two functions receive different inputs: g receives x and f receives g(x).
✓ Instead: For f(x) = 1x−1 and g(x) = 2x, exclude x = 12, not x = 1.
✗ Not this: If the composition simplifies to x, its domain must be all real numbers.
The original inner reciprocal may fail at zero before simplification is possible.
✓ Instead: For two reciprocal functions, retain x ≠ 0.

Tips and tricks

  • Know cold: two gates, both must open. Write gate 1 and gate 2 as separate lines on the exam.
  • Put on the cheat sheet for study: x must be accepted by the inner function, and the inner output must be accepted by the outer function.
  • The whole inner range must fit the outer domain to compose on every inner input. If only some outputs fit, keep only the starting inputs that produce those outputs.
  • Set-builder conditions that remove two points use and: {x | x ≠ a and x ≠ b}. Interval pieces use ∪ because an input may belong to any one piece.
  • Gate 1 checks x. Gate 2 checks g(x).

7 The trap

Checking only the simplified final denominator. That can lose an inner restriction which disappeared during algebra.

Problems marked OpenStax come from Precalculus 2e by Jay Abramson, published by OpenStax, under the CC BY-NC-SA 4.0 licence. Access for free at https://openstax.org/books/precalculus-2e/pages/1-introduction-to-functions.

Lesson 9 of 10

Square roots add boundary checks

Subject: MathematicsLeans on: Square rootsLeans on: Inequality reversalLeans on: Squaring a nonnegative inequalityLeans on: Intersection of boundsLeans on: DenominatorLeans on: SubstitutionLeans on: Solve a root equationLeans on: Squares greater than a boundOpen this lesson
Leans on 0Comes back in 0

1 In plain words

Picture a square tile whose area you know. A square root asks for its nonnegative side length. The number under the root sign is the radicand. A negative area cannot make a real square tile, so a real square root needs a nonnegative radicand, meaning zero or more. Zero is allowed: 0 = 0. For a composition, a square root can appear at the first gate or the second gate, so check its radicand at the stage where it appears. Also notice whether a root sits on the bottom of a fraction. Then zero fails the division even though the root itself exists.

2 Picture it

no square ever lands below 0(−3, 9)(3, 9)(0, 0)−33−49
Squares of real numbers never fall below zero, so a real square root needs a nonnegative radicand.

Reminder

Reminder: Square roots, Inequality reversal, Squaring a nonnegative inequality, Intersection of bounds, Denominator, Substitution, Solve a root equation, Squares greater than a bound
  • Square roots. 9 = 3, 0 = 0, and −1 has no real value.
  • Inequality reversal. −x ≥ −3 becomes x ≤ 3 after multiplying by −1.
  • Squaring a nonnegative inequality. If u ≥ 0, then u ≤ 4 is equivalent to u ≤ 16; 4 is nonnegative too.
  • Intersection of bounds. x ≥ −1 and x ≤ 15 together give [−1, 15].
  • Denominator. 10 is undefined, even when that zero came from 0.
  • Substitution. For f(x) = x+2, replacing x with g(x) gives g(x)+2.
  • Solve a root equation. x+9 = 5 has nonnegative sides. Square to get x + 9 = 25, hence x = 16; plug back in to obtain 25 = 5. A negative right side would give no solution.
  • Squares greater than a bound. x2 > 36 means x < −6 or x > 6. For example, (−10)2 = 100 > 36, while 02 = 0 fails.

3 Why

Every real number squared is nonnegative, so no real number can square to a negative radicand. The root symbol chooses the nonnegative answer, which makes an inner root's range useful: its output can never be below zero. This may make an outer requirement automatic or may impose an upper bound. When squaring a root inequality, first establish that both sides are nonnegative; squaring preserves their order there, but can erase important sign information otherwise.

4 The rule

A(x) requires A(x)≥0.

A denominator A(x) requires A(x) > 0.
For f(g(x)), apply every root requirement at its own stage and keep both gates.

The same idea, five ways

Say it

A square root needs zero or more inside. A root on the bottom needs more than zero.

Write it

Every root must exist at the stage where you use it, and every bottom must be nonzero.

In math
  • A:A≥0
  • 1A:A>0
  • 0=0
  • [a, ∞) includes a; (a, ∞) excludes a
Like

A tile may have zero area, but you cannot divide by its zero side length.

See it
0[0, ∞)
The filled zero belongs to an ordinary root domain. Division by that root removes zero.

The same idea, other ways

As square tiles

A tile with area 9 has side length 3. Area zero has side length zero. A negative area does not have a real side length, because no real square has negative area.

933
A square of side 3 has area 9, so 9 = 3.
As the inner output's range

If g is a square root, every value coming out is at least zero. Then an outer root of g(x) + 2 always has a radicand at least 2, once g exists.

x ≤ 3g: √(3 − x)f: √(u + 2)firstsecondg(x) ≥ 0real answer
The inner range settles the second gate automatically.
With a root reaching a forbidden value

A root can hand the next fraction its zero-bottom input. For g(x) = x+9, start 16 gives 5. The fraction 3u−5 then fails. The first root exists, so you must inspect the second stage too.

16√(x + 9)3/(u − 5)firstsecond5undefined
The root works at 16, but its output 5 breaks the outer division.

Part 1: A root at the first gate

A root in the inner function restricts the starting inputs. An outer operation cannot remove that restriction, even when it squares the inner root and shortens the formula.

  • For g(x) = x−2, the first gate requires x ≥ 2.
  • Squaring an existing nonnegative root returns its radicand.
2included[2, ∞)
The first root accepts zero at input 2.

Worked example

Squaring a root preserves its starting restriction

Let g(x) = x−2 and f(x) = x2. Find the formula and domain of f(g(x)). You want to square the inner root after checking that it exists. Plan: require the inner radicand x − 2 to be nonnegative, then square the existing root while keeping its original restriction.

Show the steps and the answer
x ≥ 2√(x − 2)squarefirstsecondroot ≥ 0x − 2
The simpler formula keeps the original root's domain.
  1. Require x−2≥0, so x≥2.The inner square root must have a nonnegative radicand.
  2. f(g(x))=(x−2)2=x−2, on x≥2.Squaring undoes an existing square root but does not create values where that root failed.
Answer
  • f(g(x))=x−2.
  • Domain: [2, ∞).
Double-check At 2 the path is 2 to 0 to 0. At 1 the first root would require −1, so the simplified value −1 cannot be used.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: The formula simplifies to x − 2, so start 0 works.
The first stage would be −2, which has no real answer.
✓ Instead: Keep the original condition x ≥ 2 even after squaring.
Tips and tricks
  • A square can remove a root symbol, but it cannot repair a root that never existed.

Part 2: A root at the second gate

When the outer function is a square root, its input is the inner output. Check that output against the outer radicand condition. Sometimes an inner square root also needs to stay below a bound.

  • For f(x) = 4−x, the outer function requires its input ≤ 4.
  • If g(x) = x+1, both x ≥ −1 and g(x) ≤ 4 are required.
−115inner boundaryouter boundary[−1, 15]
The two gates create a closed interval of starting inputs.

Worked example

An outer root bounds the inner root

Let f(x) = 4−x and g(x) = x+1. Find the domain of f(g(x)). You want starting inputs that produce a real inner root no larger than 4. Plan: keep the inner root’s existence condition, bound its answer by 4 for the outer root, and square only after checking nonnegative sides.

Show the steps and the answer
−115includedincluded[−1, 15]
Both endpoints give valid roots, including outer output zero.
  1. Gate 1 requires x+1≥0, so x≥−1.The inner root must exist.
  2. Gate 2 requires 4−x+1≥0, so x+1≤4.The outer radicand cannot be negative.
  3. Square both sides: x+1≤16, so x≤15.The inner root is nonnegative and 4 is nonnegative, so squaring preserves order.
  4. Combine x≥−1 and x≤15.Both gates must work for the same starting input.
Answer
Domain: [−1, 15].
Double-check At −1 the path gives inner 0 then outer 2. At 15 it gives inner 4 then outer 0. At 16 the inner output 17 exceeds 4, so the outer radicand is negative.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: Only the inner bound x ≥ −1 matters.
Start 16 passes the inner root but gives 17 > 4, so the outer inside is negative.
✓ Instead: Keep both x ≥ −1 and x ≤ 15.
Tips and tricks
  • Write the inner lower bound before finding the outer upper bound.

Part 3: A root in a denominator

A root on the bottom must exist and must not be zero. Those two requirements combine into a positive radicand. The boundary that an ordinary root accepts is removed by division.

  • 1x−2 requires x − 2 > 0, so x > 2.
  • A zero numerator over a nonzero denominator is allowed; a zero denominator is not.
2excluded(2, ∞)
The open endpoint excludes a denominator equal to zero.

Worked example

Division removes the zero-root endpoint

Let f(x) = 1x and g(x) = x − 2. Find the domain of f(g(x)). You want the reciprocal of a root, so its denominator must be real and nonzero. Plan: substitute x − 2 into the outer input and require it to be positive, so the root exists and the denominator is nonzero.

Show the steps and the answer
2zero denominator(2, ∞)
The open point at 2 excludes a zero bottom; inputs farther right make the root positive.
  1. g accepts every real input.Subtracting 2 has no restriction.
  2. The outer rule requires g(x) > 0.A negative input has no real root, and zero would give denominator zero.
  3. x−2>0, so x > 2.Adding 2 preserves the inequality direction.
Answer
Domain: (2, ∞).
Double-check At 3 the denominator is 1 = 1. At 2 it is 0 = 0, so division fails; below 2 the radicand is negative.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: The domain is [2, ∞) because zero under a root is allowed.
The root exists at 2 but sits in a denominator, where zero is forbidden.
✓ Instead: The domain is (2, ∞).
Tips and tricks
  • Look for the fraction bar before choosing an open or closed endpoint.

5 How

  1. Write the inner radicand requirement before using the inner function's output.
  2. Substitute the inner output into the outer radicand and require it to be nonnegative.
  3. Use the inner range when possible. A real square root output is always at least zero.
  4. Before squaring an inequality, check that both compared sides are nonnegative. Then square and solve while preserving the earlier requirements.
  5. If a root is a denominator, replace its nonnegative condition with a greater than zero one.
  6. Combine the bounds and test endpoints in the original two-stage formula.

Apply the two gates to roots

1
Is a square root itself a bottom?
YesUse its inside > 0: this makes the root real and prevents its value being 0.
NoUse its inside ≥ 0; zero is allowed.
↓
2
Does an inner root need to equal a forbidden negative value?
YesNo start can produce that value; gate 2 removes nothing for this equation.
NoIf the forbidden value is nonnegative, square to locate the failed start and plug back in.
↓
3
Must a root be no larger than a nonnegative number?
YesKeep the root’s existence condition, then square both nonnegative sides to find the upper bound.
NoCheck the required sign before choosing another operation.
↓
4
Does a squared expression need to be greater than a positive number?
YesThe allowed starts can lie in two separated pieces. Use the distance-from-zero method taught in the refresher.
NoKeep all restrictions found from the two gates.
  1. Use the two-gate strategy from the preceding lesson. Write the original inner restrictions first.
  2. At every root require the whole inside ≥ 0. When that root is a bottom, require the inside > 0.
  3. An inner root gives only nonnegative answers. Check whether this makes an outer requirement automatic or impossible.
  4. If a forbidden outer value is nonnegative, solve the root equation by squaring both nonnegative sides, then substitute the candidate back into the original root.
  5. For an outer upper bound on a root, establish both sides nonnegative before squaring. Retain the inner lower bound.
  6. Combine every restriction and test included boundaries and excluded points in the original stages.

6 Worked example

Worked example

A root inside a root

OpenStax problem

Let f(x) = x+2 and g(x) = 3−x. Find (f ∘ g)(x) and its domain. You want a nested-root formula and the starting inputs for which both roots exist. Plan: find where the inner root exists, then use its nonnegative output to check the outer radicand after adding 2.

Show the steps and the answer
3included(−∞, 3]
Starting input 3 is included because an ordinary root accepts radicand zero.
  1. (f∘g)(x)=f(3−x)=3−x+2.The whole inner root replaces the outer input.
  2. The inner root requires 3−x≥0.A real square root cannot have a negative radicand.
  3. −x≥−3, so x≤3.Subtracting 3 gives the first inequality; multiplying by −1 reverses its direction.
  4. The outer root requires 3−x+2≥0. This adds no restriction.Where the inner root exists, it is at least zero, so adding 2 makes the outer radicand at least 2.
Answer
  • (f∘g)(x)=3−x+2.
  • Domain: (−∞, 3].
Double-check At x = 3, the inner output is 0 and the outer output is 2, so the endpoint is included. At x = 4, the inner radicand is −1, so that input fails. At x = −6, g(−6) = 3 and f(3) = 5, confirming that a composite input can lie outside f's own domain x ≥ −2.

Ladder: from easy to exam-hard

Try each rung before you open its steps.

Rung 1 of 7

An inner root and an unrestricted outer rule

Let g(x) = x and f(x) = x + 1. Find the composite domain. You want a real root followed by addition. Plan: require a real inner root, then check that adding 1 accepts every resulting output.

Show the steps and the answer
0[0, ∞)
An ordinary root includes input zero.
  1. The inner root requires x≥0.Its radicand is the starting input.
  2. The outer function adds no restriction.Any real inner output can have 1 added to it.
Answer
[0, ∞).
Double-check At 0, the path is 0 to 0 to 1, so the boundary is included.

Rung 2 of 7

A line feeds an outer root

Let g(x) = 5x − 15 and f(x) = x. Find the composite domain. You need the inner output to be nonnegative. Plan: require the line’s output 5x − 15 to be nonnegative before it enters the outer root.

Show the steps and the answer
3[3, ∞)
The outer root shifts the allowed starting boundary to 3.
  1. g accepts every real x; f requires 5x−15≥0.The outer root's radicand is the entire g output.
  2. 5x≥15, so x≥3.Add 15, then divide by the positive number 5 without reversing the sign.
Answer
[3, ∞).
Double-check At 3 the inner output is 0 and its root is 0; at 2 the inner output is −5 and the outer root fails.

Rung 3 of 7

The inner range makes gate 2 automatic

Let g(x) = 7−x and f(x) = x+5. Find the domain of f(g(x)). You want both roots to exist. Plan: find where the inner root exists, then use its nonnegative output to check the outer radicand after adding 5.

Show the steps and the answer
x ≤ 7√(7 − x)√(u + 5)firstsecondroot ≥ 0real answer
The inner root's range settles the outer condition.
  1. 7−x≥0 gives x≤7.This is the inner root requirement; reversing the sign when multiplying by −1 gives the bound.
  2. The inner output is at least 0, so g(x)+5 is at least 5.A square root's output is nonnegative.
  3. No further restriction is needed.The outer radicand is already positive whenever the inner function exists.
Answer
(−∞,7].
Double-check At 7 the inner root is 0 and the outer root is 5; at 8 the inner root fails.

Rung 4 of 7

An inner root reaches a forbidden outer input

Let g(x) = x+9 and f(x) = 3x−5. Find the domain of f(g(x)). You need the root to exist and its answer to avoid 5. Plan: keep the inner lower bound, solve x+9 = 5, then exclude the verified start.

Show the steps and the answer
−916[−9, 16) ∪ (16, ∞)
Include −9, where the inner root is zero. Exclude 16, where that root is 5 and the outer bottom is zero.
  1. Gate 1: x+9≥0 gives x≥−9.This finds the starting inputs where the inner root exists.
  2. Gate 2: f rejects input 5, since 5−5=0. Solve x+9=5 to find the start that hands f that value.The equation locates the failed outer handoff.
  3. Both sides are nonnegative. Square: x+9=25. Subtract 9: x=16.Squaring reverses the existing root here; subtraction isolates the failed start.
  4. Plug back in: g(16)=25=5 and f(5)=30. Exclude 16.The candidate truly breaks gate 2 and already lies in the inner domain.
  5. At the lower boundary −9,g(−9)=0 and f(0)=3−5=−35, so include −9.A zero root is permitted here because the outer bottom is −5, not zero.
Answer
Domain: [−9, 16) ∪ (16, ∞).
Double-check At x = 0, g(0) = 3 and f(3) = −32, so an input between the boundaries works. At 16 only the second stage fails.

Rung 5 of 7

Both a lower and an upper bound

Let g(x) = x+2 and f(x) = 3−x. Find the composite domain. The inner root must exist and its output must be no greater than 3. Plan: keep the inner lower bound, require its root output to be at most 3, then square the nonnegative comparison to find the upper bound.

Show the steps and the answer
−27[−2, 7]
The inner and outer roots impose different boundaries.
  1. x+2≥0 gives x≥−2.Gate 1 requires a real inner root.
  2. 3−x+2≥0 gives x+2≤3.Gate 2 requires a real outer root.
  3. Square to get x+2≤9, so x≤7.Both the existing root and 3 are nonnegative.
  4. Combine the two bounds.Both stages must exist.
Answer
[−2,7].
Double-check At −2 the outputs are 0 then 3. At 7 the outputs are 3 then 0. At 8 the outer radicand is negative.

Rung 6 of 7

A denominator makes the bound strict

Let g(x) = 3x − 9 and f(x) = 1x. Find the composite domain. You need a real square root that is also a nonzero denominator. Plan: require the line’s output to be positive, because its outer root is also a denominator.

Show the steps and the answer
3excluded(3, ∞)
A root in a denominator excludes the zero-radicand boundary.
  1. Require 3x−9>0.The outer input must be positive, not only nonnegative, to avoid a zero denominator.
  2. 3x > 9, so x > 3.Add 9 and divide by positive 3.
Answer
(3, ∞).
Double-check At 3 the denominator would be zero. At 6, the inner output is 9 and the final answer is 13, so an allowed input works.

Rung 7 of 7

A square feeds a root in a bottom

Let m(x) = x2 − 36 and p(x) = 1x. Find both p(m(x)) and m(p(x)), with their domains. You want to compare the two orders and keep any restriction hidden by simplification. Plan: first require x2 − 36 > 0 for p after m; then retain p’s positive-input requirement for the reverse order.

Show the steps and the answer
−66(−∞, −6) ∪ (6, ∞)
The first order accepts two outside pieces because squares grow on both sides of zero.
0(0, ∞)
The reverse order requires a positive start for its first reciprocal root.
  1. p(m(x))=1x2−36. Require x2−36>0.The root is a bottom, so its inside must be positive to make it real and nonzero.
  2. Add 36: x2>36. This means distance from zero greater than 6, so x<−6 or x > 6.Both positive and negative numbers can have squares larger than 36. The points 6 and −6 give a zero bottom.
  3. For the reverse order, p must act first, so require x > 0.An inner root on the bottom rejects negative starts and zero before m can act.
  4. m(p(x))=(1÷x)2−36=1x−36, still for x > 0.An existing root squares to x. The shorter expression retains the inner positive-input restriction.
Answer
  • p(m(x))=1x2−36.
  • Domain: (−∞, −6) ∪ (6, ∞).
  • m(p(x))=1x−36.
  • Domain: (0, ∞).
Double-check For p after m, starts 10 and −10 each give m = 64, then p = 18. Starts 6 and −6 give a zero bottom, and 0 gives a negative root inside. For m after p, start 1 gives p(1) = 1 then m(1) = −35, matching 1 − 36; a negative start still fails the first root.

Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: A square root's radicand must always be greater than zero.
0 = 0 is a valid real value unless a separate denominator restriction rejects it.
✓ Instead: Use radicand ≥ 0 for an ordinary root, and > 0 for a root denominator.
✗ Not this: Square x+1 ≤ −2 to get x + 1 ≤ 4.
A nonnegative root can never be ≤ a negative number. Squaring erased the sign obstruction.
✓ Instead: This inequality has no real solutions; check the signs before squaring.
✗ Not this: For f(x) = 3x+5 and g(x) = x+9, exclude 16 after squaring x+9 = −5.
The equation is impossible: a square-root answer never equals −5. At 16 the root is 5 and the outer bottom is 10, so that start works.
✓ Instead: Gate 2 removes nothing. Keep only the inner condition x ≥ −9, giving [−9, ∞).

Tips and tricks

  • Put on the cheat sheet for study: ordinary root means ≥ 0; root denominator means > 0.
  • Know cold: zero is allowed under a root but not under a fraction bar. Picture a filled endpoint for the root and an open endpoint for division.
  • Test boundary inputs in the original nested formula before choosing brackets.

7 The trap

Demanding a positive radicand for every square root. Ordinary roots allow zero; roots in denominators must avoid zero because of division.

Problems marked OpenStax come from Precalculus 2e by Jay Abramson, published by OpenStax, under the CC BY-NC-SA 4.0 licence. Access for free at https://openstax.org/books/precalculus-2e/pages/1-introduction-to-functions.

Lesson 10 of 10

Decompose by naming the inside and outside jobs

Subject: MathematicsLeans on: CompositionLeans on: SubstitutionLeans on: Squares and boundsLeans on: ReciprocalLeans on: Absolute valueLeans on: DomainLeans on: Input-slot namesOpen this lesson
Leans on 0Comes back in 0

1 In plain words

Imagine receiving a finished sandwich and describing its preparation in two jobs: assemble it, then wrap it. You can split a long calculation the same way. For h(1) = 5−12, you square 1, subtract that from 5 to get 4, then take the root to get 2. The last job, taking the root, becomes the outer function f. Everything before it becomes the inner function g. Naming these jobs is decomposition. The two named rules are component functions. This helps you calculate in two passes and see where a root or division limits the allowed starts. More than one split may rebuild the same function.

2 Picture it

xg: inside jobf: outside jobfirstsecondg(x)h(x)
x goes into g: inside job, then g(x) into f: outside job: h(x).

Reminder

Reminder: Composition, Substitution, Squares and bounds, Reciprocal, Absolute value, Domain, Input-slot names
  • Composition. f(g(x)) means calculate g first, then apply f to its whole output.
  • Substitution. Putting the whole input 5x − 4 into x3 gives (5x − 4)3.
  • Squares and bounds. x2 ≤ 5 means −5 ≤ x ≤ 5, because both signs can have that distance from zero.
  • Reciprocal. The reciprocal of 5 is 15; the reciprocal of 0 is undefined.
  • Absolute value. |−2| = 2, because distance from zero is nonnegative.
  • Domain. A decomposition must preserve accepted inputs; 5−x2 accepts [−5, 5].
  • Input-slot names. f(u) = u and f(x) = x describe the same rule. u helps separate the outer slot from the x inside g.

3 Why

Composition substitutes the inside rule into the outside input slot. Decomposition reverses that substitution by choosing an expression to treat as one complete input. The outside rule describes the remaining work. Different choices can work, so there need not be one unique split. Naming the stages makes a long calculation easier to follow and exposes which stage causes a restriction. Recomposition proves that your rules rebuild the original formula. Comparing domains checks that no newly introduced division has removed a start the original function accepted. These jobs also prepare you for calculus, which studies how an output changes when its input changes.

4 The rule

To write h(x)=f(g(x)), choose g as the inside job and f as the job applied to its output.

Check by substitution and preserve h's original domain.

The same idea, five ways

Say it

Split h into an inside job g and an outside job f.

Write it

Doing g first and then f must give back the original function h, with its original allowed starts.

In math
  • h(x) = f(g(x))
  • h = f ∘ g
  • g makes the inside; f performs the remaining outside work
Like

Assemble the sandwich, then wrap it.

See it
xg: inside jobf: outside jobfirstsecondg(x)h(x)
The same picture again: x goes into g: inside job, then g(x) into f: outside job: h(x).

The same idea, other ways

As preparing and wrapping

One job prepares the completed input. The next finishes it. For (5x − 4)3 at input 2, first build 10 − 4 = 6, then cube 6 to get 216. The finishing operation is the outer function.

25x − 4cubefirstsecond6216
The cube is the last job, so it belongs in the outer function.
As undoing substitution

Cover the expression 5 − x2 inside the root with the word input. The outside rule becomes input. The covered expression is g, and the remaining rule is f.

Start: 5−x2

Inside package: 5 − x2

Outside rule: input

As the last calculator step

For 5−12, your calculator first builds 4 and then takes its root. The last calculator step is f. The steps making 4 are g. This gives g(x) = 5 − x2 and f(u) = u.

15 − x²rootfirstsecond42
Watch your numerical steps to choose the two jobs.

Part 1: Square-root outside

If the last job is taking a square root, let the inner function build its radicand. The outer function can be the basic root rule x.

  • For h(x) = x+9, one choice is g(x) = x + 9 and f(x) = x.
  • The original radicand condition remains part of the function.
xadd 9rootfirstsecondx + 9√(x + 9)
The root operates on a completed radicand.

Worked example

Split a shifted root

Decompose h(x) = x+9. You want an inside expression and the root operation applied to it. Plan: identify the last operation, name the earlier work as g, then recompose and check the allowed starts.

Show the steps and the answer
0add 9rootfirstsecond93
A number check confirms the chosen order.
  1. Choose g(x)=x+9 and f(x)=x.Addition builds the radicand before the root is taken.
  2. f(g(x))=x+9, with x≥−9.Recomposition restores the original root and its nonnegative-radicand requirement.
Answer
  • g(x) = x + 9
  • f(x)=x.
  • Domain: [−9, ∞).
Double-check At 0, the inner output is 9 and the outer output is 3, matching h(0) = 9 = 3.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: For x+9, choose g(x) = x and f(u) = u + 9.
At start 16 this gives 4 + 9 = 13, whereas 16+9 = 5.
✓ Instead: Choose g(x) = x + 9 and f(u) = u.
Tips and tricks
  • Test a permitted small input after symbolically recomposing f(g(x)). At a start the original excludes, test a different number.

Part 2: Cube outside

A cube is the product of three copies of the complete input. The inner function makes the expression that will be cubed; the outer function does the cubing.

  • x3 means x × x × x.
  • For h(x) = (3x + 2)3, take g(x) = 3x + 2 and f(x) = x3.
x3x + 2cubefirstsecond3x + 2(3x + 2)³
The cube acts on the entire inner output.

Worked example

Split a cube without expanding it

Decompose h(x) = (3x + 2)3. You want two functions that produce this cube in sequence. Plan: identify the last operation, name the earlier work as g, then recompose and check the allowed starts.

Show the steps and the answer
13x + 2cubefirstsecond5125
Cubing is the finishing job.
  1. Choose g(x)=3x+2 and f(x)=x3.The parentheses show which whole expression is cubed.
  2. f(g(x))=(3x+2)3.Substitution places the inner expression into the cube's input slot.
Answer
  • g(x) = 3x + 2
  • f(x)=x3.
  • Domain: (−∞, ∞).
Double-check At 1, g(1) = 5 and f(5) = 5 × 5 × 5 = 125; h(1) gives the same cube.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: For (3x + 2)3, choose g(x) = x3 and f(u) = 3u + 2.
This gives 3x3 + 2. At start 1 it is 5, whereas the original is 125.
✓ Instead: Build 3x + 2 first, then cube the result.
Tips and tricks
  • Test a permitted small input after symbolically recomposing f(g(x)). At a start the original excludes, test a different number.

Part 3: Reciprocal outside

A reciprocal is 1 divided by the input. Build the denominator first, then take its reciprocal. Check which starting input would build a zero denominator.

  • For h(x) = 1x−6, take g(x) = x − 6 and f(x) = 1x.
x ≠ 6subtract 6reciprocalfirstsecondx − 61/(x − 6)
The denominator is the package sent into the reciprocal rule.

Worked example

Split a shifted reciprocal

Decompose h(x) = 1x−6. You want to identify the denominator-building job and the division job. Plan: identify the last operation, name the earlier work as g, then recompose and check the allowed starts.

Show the steps and the answer
8subtract 6reciprocalfirstsecond21/2
The original formula and its two jobs give the same output.
  1. Choose g(x)=x−6 and f(x)=1x.Subtraction builds the denominator before the reciprocal is taken.
  2. f(g(x))=1x−6, with x≠6.The outer reciprocal must not receive zero.
  3. Set x−6=0 to find the failed reciprocal input. Add 6: x=6. Plug back in: 6−6=0. Exclude 6.This solve step identifies the start whose inside job makes the outside bottom zero.
Answer
  • g(x)=x−6
  • f(x)=1x.
  • Domain: (−∞, 6) ∪ (6, ∞).
Double-check At 8 the path is 8 to 2 to 12, matching the original denominator 8 − 6 = 2.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: For 1x−6, choose g(x) = 1x and f(u) = u − 6.
At start 8 this gives 18 − 6 = −478, whereas the original is 12.
✓ Instead: Choose g(x) = x − 6 and f(u) = 1u.
Tips and tricks
  • Test a permitted small input after symbolically recomposing f(g(x)). At a start the original excludes, test a different number.

Part 4: Absolute-value outside

Absolute value gives the distance of a number from zero. Make the signed inside expression first, then find its distance. Negative intermediate numbers are allowed; their distances are nonnegative.

  • For h(x) = |3x + 1|, take g(x) = 3x + 1 and f(x) = |x|.
  • |−2| = 2 because −2 is two units from zero.
−13x + 1absolute valuefirstsecond−22
Absolute value is applied after the signed expression is finished.

Worked example

Split an absolute value

Decompose h(x) = |3x + 1|. You want a linear inside job followed by an absolute-value outside job. Plan: identify the last operation, name the earlier work as g, then recompose and check the allowed starts.

Show the steps and the answer
−1gabsolute valuefirstsecond−22
A negative inside output has a valid nonnegative distance.
  1. Choose g(x)=3x+1 and f(x)=|x|.The expression between the bars is the input to the distance rule.
  2. f(g(x))=|3x+1|.The whole inner output replaces f's input.
Answer
  • g(x) = 3x + 1
  • f(x) = |x|.
  • Domain: (−∞, ∞).
Double-check At −1, g(−1) = −2 and f(−2) = 2; the original function gives |3(−1) + 1| = |−2| = 2.
Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: For |3x + 1|, choose g(x) = |x| and f(u) = 3u + 1.
At start −1 this gives 4, whereas |−3 + 1| = 2.
✓ Instead: Build 3x + 1 first, then take its distance from zero.
Tips and tricks
  • Test a permitted small input after symbolically recomposing f(g(x)). At a start the original excludes, test a different number.

5 How

  1. Work out h at a permitted small input. The final job you perform suggests the outer function; everything before it suggests the inner function.
  2. Define g(x) as that package, which will be calculated first.
  3. Define f(x) as the operation applied to one input package.
  4. Substitute g(x) into f and show that f(g(x)) recreates h(x).
  5. Check the composite domain against the original domain. A formula match alone can hide a lost input.
  6. If another split is requested, choose a different package and repeat the same checks.

Find a useful inside and outside split

1
Is the final operation a root?
YesLet g build everything under the root and let f(u) take that root.
NoLook for a power or fraction.
↓
2
Is the final operation a power of a whole group?
YesLet g build the group and let f(u) raise it to that power.
NoLook for a reciprocal or absolute value.
↓
3
Is there a constant top divided by an expression?
YesLet g build the entire bottom and let f(u) divide that constant by u. This choice assumes the top is constant.
NoA changing top may need a different split; check the whole formula.
↓
4
Are absolute-value bars the final operation?
YesLet g build the expression between the bars and let f(u) = |u|.
NoTry a different dividing point between operations.
↓
5
Does f(g(x)) reproduce both the formula and its original domain?
YesThe split represents the original function. Check one permitted number too.
NoChange the split or explicitly state the smaller domain on which it works.
  1. Work out the given function at a permitted small input. Notice the final operation you perform.
  2. Choose g(x) to do the work before that final operation. Choose f(u) to perform the remaining job on one completed input u.
  3. Substitute g(x) into every u in f(u). The resulting expression must be exactly h(x).
  4. Compare the original domain with the two-stage domain. Test a permitted number as an arithmetic check.
  5. If you need a second split, move the dividing point between operations and repeat the same checks.

6 Worked example

Worked example

Three decompositions

Write each as f(g(x)): (a) h(x) = 5−x2; (b) h(x) = (5x − 4)3; (c) h(x) = 1x+8. You want an inside calculation followed by the finishing operation. Plan: name everything before the last operation as g, name the last operation as f, then recompose and compare domains.

Show the steps and the answer
15 − x²rootfirstsecond42
Part (a) builds the radicand before taking its root.
15x − 4cubefirstsecond11
Part (b) builds the whole expression before cubing it.
1x + 8reciprocalfirstsecond91/9
Part (c) builds a nonzero bottom before taking its reciprocal.
  1. (a) Choose g(x)=5−x2 and f(u)=u. Recompose: f(g(x))=5−x2.The inside builds the radicand; the outside takes its root. u is another name for f’s input slot.
  2. Require 5−x2≥0. Rearrange to x2≤5, so −5≤x≤5.This finds the starts whose radicand is nonnegative. Their distance from zero is at most 5 ≈ 2.24.
  3. Test x=2 and x=−2: both give radicand 5−4=1. Start 3 gives 5−9=−4 and fails.These tests show why both a lower and an upper boundary are needed.
  4. (b) Choose g(x) = 5x − 4 and f(u) = u3. Recompose: f(g(x))=(5x−4)3.Build the whole parenthesized expression first, then cube it. Neither stage restricts real starts.
  5. (c) Choose g(x)=x+8 and f(u)=1u. Recompose: f(g(x))=1x+8.Addition builds the bottom before taking the reciprocal.
  6. Locate the failed bottom by solving x+8=0: subtract 8, giving x=−8. Plug back in: −8+8=0. Exclude −8.This equation finds the one start whose inside answer cannot enter the reciprocal.
Answer
  • (a)g(x)=5−x2
  • f(u)=u.
  • Domain: [−5, 5].
  • (b)g(x)=5x−4
  • f(u)=u3.
  • Domain: (−∞, ∞).
  • (c) g(x) = x + 8
  • f(u)=1u.
  • Domain: (−∞, −8) ∪ (−8, ∞).
Double-check At start 1, (a) gives inside 4 then root 2; (b) gives inside 1 then cube 1; (c) gives inside 9 then reciprocal 19. Direct substitution into each original function gives the same answer. The symbolic recompositions verify every allowed start, and the domains match the original root and bottom requirements.

Ladder: from easy to exam-hard

Try each rung before you open its steps.

Rung 1 of 7

A shifted square

Decompose h(x) = (x + 3)2. You want addition followed by squaring. Plan: identify the last operation, name the earlier work as g, then recompose and check the allowed starts.

Show the steps and the answer
1add 3squarefirstsecond416
The addition comes before the square.
  1. Take g(x)=x+3 and f(x)=x2.The whole sum is squared.
  2. f(g(x))=(x+3)2.Replacing the outer input restores the formula.
Answer
  • g(x) = x + 3
  • f(x) = x2, with all real inputs.
Double-check At 1 the two stages give 4 then 16, matching (1 + 3)2.

Rung 2 of 7

A denominator package

Decompose h(x) = 1x+7. You want to build the denominator before division. Plan: identify the last operation, name the earlier work as g, then recompose and check the allowed starts.

Show the steps and the answer
1add 7reciprocalfirstsecond81/8
The inner output becomes the denominator.
  1. Take g(x)=x+7 and f(x)=1x.The reciprocal acts on the entire denominator.
  2. f(g(x))=1x+7, with x≠−7.The outer function must not receive zero.
  3. To locate the zero bottom, solve x+7=0: x=−7. Plug back in: −7+7=0.This identifies and confirms the one start the reciprocal must exclude.
Answer
  • g(x) = x + 7
  • f(x)=1x.
  • Exclude x = −7.
Double-check At 1 the inner output is 8 and the final output is 18, matching h(1).

Rung 3 of 7

A linear package under a cube

Decompose h(x) = (4x − 3)3. You want a linear inside function and a cube outside function. Plan: identify the last operation, name the earlier work as g, then recompose and check the allowed starts.

Show the steps and the answer
04x − 3cubefirstsecond−3−27
A negative package remains negative when cubed.
  1. Take g(x)=4x−3 and f(x)=x3.The parentheses mark the expression cubed as one unit.
  2. f(g(x))=(4x−3)3.The cube receives the complete inner output.
Answer
  • g(x)=4x−3
  • f(x) = x3, with all real inputs.
Double-check At 0 the inner output is −3 and its cube is −27, matching h(0).

Rung 4 of 7

A quadratic package under a root

Decompose h(x) = 10−x2 and give its domain. The expression 10 − x2 is quadratic: its highest input power is x2. You want the radicand-building job, the root job, and the permitted starts. Plan: identify the last operation, name the earlier work as g, then recompose and check the allowed starts.

Show the steps and the answer
allowed x10 − x²rootfirstsecond10 − x² ≥ 0√(10 − x²)
The quadratic package must remain nonnegative.
  1. Take g(x)=10−x2 and f(x)=x.The quadratic expression is the package inside the root.
  2. f(g(x))=10−x2.The entire radicand fills the outer input slot.
  3. Require 10−x2≥0, so x2≤10 and −10≤x≤10.The distance of x from zero must be no more than 10.
  4. Starts 3 and −3 give inside 10−9=1 and work. Starts 4 and −4 give 10−16=−6 and fail. Since 10≈3.16, both boundaries lie between those pairs.This makes the two-sided distance bound concrete.
Answer
  • g(x)=10−x2
  • f(x)=x.
  • Domain: [−10, 10].
Double-check At x = 1 the stages give 9 then 3, matching the original 10−1 = 9 = 3. At both endpoints x2 = 10 and the root is zero, so both are included.

Rung 5 of 7

A different valid split

Find another decomposition of h(x) = 10−x2. This time make squaring the whole first job. Plan: identify the last operation, name the earlier work as g, then recompose and check the allowed starts.

Show the steps and the answer
xsquare√(10 − u)firstsecondx²√(10 − x²)
A different intermediate package can produce the same original formula and domain.
  1. Take g(x)=x2 and f(x)=10−x.After squaring, the remaining operations are subtracting from 10 and taking a root.
  2. f(g(x))=10−x2.Replacing the input of f with x2 restores the original function.
  3. The inner square accepts all x, and the outer function requires x2≤10.The outer radicand is 10 minus the intermediate square.
Answer
  • g(x)=x2
  • f(x)=10−x.
  • Domain: [−10, 10], the same as the original.
Double-check At x = 1 the stages are 1 then 3. The previous split had intermediate 9 then 3; different middle answers can give the same final function.

Rung 6 of 7

A root inside a fraction bottom, two splits

Decompose h(x) = 36−x+1 in two ways and give its domain. You want different pairs of jobs that both rebuild the root in the bottom. Plan: first split after the root; then split after the whole bottom; verify both formulas and find where the root or division fails.

Show the steps and the answer
−135[−1, 35) ∪ (35, ∞)
Both splits include −1 and exclude 35, preserving the original root and division requirements.
8√(x + 1)3/(6 − u)firstsecond31
First split: the root answer is the handoff.
86 − √(x + 1)3/ufirstsecond31
Second split: the completed bottom is the handoff.
  1. First split: g1(x)=x+1 and f1(u)=36−u. Read g1 as g sub 1, the name of the first choice.The inside job takes the root; the outside subtracts its answer from 6 and divides 3 by that result.
  2. f1(g1(x))=36−x+1.Substitution rebuilds the entire original bottom, including its root.
  3. Second split: g2(x)=6−x+1 and f2(u)=3u. Here sub 2 labels the second choice.The inside builds the whole bottom and the outside divides 3 by it.
  4. f2(g2(x))=36−x+1.The second pair rebuilds the same original expression.
  5. The root requires x+1≥0, hence x≥−1. Locate a zero bottom: 6−x+1=0 gives x+1=6.This finds starts where the root exists, then starts where division fails.
  6. Both sides are nonnegative, so square: x+1=36. Subtract 1: x=35. Plug back in: 36=6 and the bottom is 6−6=0. Exclude 35.Squaring locates the candidate, and substitution confirms the original failure.
  7. At −1 the bottom is 6−0=6, so the root boundary is included. Both splits have the same restrictions.The root exists at zero and the resulting fraction bottom is nonzero.
Answer
  • First: g₁(x) = x+1
  • f₁(u)=36−u.
  • Second: g₂(x) = 6 − x+1
  • f₂(u)=3u.
  • Domain: [−1, 35) ∪ (35, ∞).
Double-check At start 8, the first split gives root 3 then 36−3 = 1. The second gives bottom 3 then 33 = 1. The original formula also gives 1, although the inside jobs differ.

Rung 7 of 7

The top also depends on the starting input

Decompose h(x) = 3x+7x−6 using g(x) = x − 6. You want an outside rule written only in its own input u. Plan: call the inside output u, express x in terms of u, rewrite both top and bottom in u, then recompose.

Show the steps and the answer
7g: x − 6(3u + 25)/ufirstsecond128
A changing top must be rewritten using the same outer input u as the bottom.
  1. Write u = x − 6. Add 6 to both sides: x=u+6.This solve step recovers the original start from the chosen inside answer, so the outside rule can use u alone.
  2. The top 3x+7 becomes 3(u+6)+7=3u+18+7=3u+25. The bottom x−6 becomes u.Both parts of the original fraction must be expressed through the same completed inside output.
  3. Choose f(u)=3u+25u. Then f(g(x))=3(x−6)+25x−6=3x−18+25x−6=3x+7x−6.The recomposition proves the outside rule rebuilds the whole original fraction.
  4. The original and recomposed bottoms both fail when x−6=0. Add 6 to find x=6. Plug back in: 6−6=0. Exclude 6.This locates and confirms the failed division, and shows the split preserves the original domain.
Answer
  • g(x)=x−6.
  • f(u)=3u+25u.
  • Domain: (−∞, 6) ∪ (6, ∞).
Double-check At start 7, the inside answer is u = 1. The outside gives 3+251 = 28. The original gives 21+77−6 = 28. The reconstruction x = u + 6 gives 1 + 6 = 7 as well.

Counterexamples

What it is not, and the tempting wrong moves.

✗ Not this: For (5x − 4)3, choose g(x) = x3 and f(u) = 5u − 4.
This gives 5x3 − 4. At start 2 it is 36, whereas (10 − 4)3 = 216.
✓ Instead: Choose g(x) = 5x − 4 and f(u) = u3.
✗ Not this: The unrestricted h(x) = x can be decomposed into two reciprocal functions on its entire domain.
Both reciprocal stages fail at zero, so the resulting composition loses an input of h.
✓ Instead: That split represents x only on x ≠ 0. A full-domain split is g(x) = x + 1 and f(x) = x − 1.
✗ Not this: For 36−x+1, choose g(x) = x + 1 and f(u) = 36−u.
This gives 35−x, losing the root. At start 8 it gives −1, while the original gives 1.
✓ Instead: Keep the root in one of the two jobs, as in either split above.
✗ Not this: For 3x+7x−6, choose g(x) = x − 6 and f(u) = 3x+7u.
The proposed outside rule still depends on the original x, so it does not describe a rule using its input u alone. Choosing the bottom as g requires rewriting a changing top too.
✓ Instead: From u = x − 6 obtain x = u + 6. Then choose f(u) = 3u+25u, as shown in the final rung.

Tips and tricks

  • Understand, then rebuild: cover the inside package and read what the outside operation does to one input.
  • Always write f(g(x)) as the check. Do not rely on recognizing the two pieces by sight.
  • More than one answer may be correct; formula and domain checks decide.
  • The last calculator step is the outer function. Use this memory cue to choose the finishing job.

7 The trap

Giving the two correct component formulas in the wrong order. Recompose f(g(x)) on paper before accepting your decomposition.