Quarry School

Follow a composition through tables

Explain it like I am five

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.

3g table2f table8firstsecond
A table composition changes input columns at the handoff.
Reminder
  • 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.
input xoutput f(x)16283341
The textbook puts both functions under one shared input row. These two pictures split that display into its f row and g row.
input xoutput g(x)13253247
Read g's input on top and its matching output directly below it.
Why it works. 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.
RuleTo 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 table2f table8firstsecond
A table composition changes input columns at the handoff.
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 3glabel 2f8firstsecond
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.

3g2f8firstsecond
Two labeled arrows replace crowded parentheses.
x1234
f(x)6831
g(x)3527
.1Read 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 exampleOne more f-after-g path

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↓ evaluate: input given, read the output below it
Read f's input on top and its matching output directly below it.
input xoutput g(x)13253247↓ evaluate: input given, read the output below it
Read g's input on top and its matching output directly below it.
  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.
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.
.2Read 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 exampleA g-after-f path

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↓ evaluate: input given, read the output below it
Read f's input on top and its matching output directly below it.
input xoutput g(x)13253247↓ evaluate: input given, read the output below it
Read g's input on top and its matching output directly below it.
  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.
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.
.3Build 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 exampleCollect 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.

input xoutput f(x)16283341
Read f's input on top and its matching output directly below it.
input xoutput g(x)13253247
Read g's input on top and its matching output directly below it.
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.
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.
.4The 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 table0p table2firstsecond
The same table is visited twice, with a new input for the second visit.
Worked exampleRung 3: 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↓ evaluate: input given, read the output below it
Read p's input on top and its matching output directly below it.
input xoutput q(x)01132031
Read q's input on top and its matching output directly below it.
  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.
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.
Strategy: step by step
  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.
Strategy
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. 1. Rewrite the composition with parentheses. Identify the function nearest the starting input.
  2. 2. For an evaluation, find the input in the inner table and read down to its output.
  3. 3. Locate that in-between number in the outer input row and read down again.
  4. 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. 5. Check by reading each claimed path forward. If a lookup is missing, distinguish a complete definition from selected samples.
Worked exampleBoth orders from the tables at input 3

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↓ 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.
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. Press Try it first on any rung to hide its steps and use them as hints.
Rung 1Rung 1: 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↓ evaluate: input given, read the output below it
Read p's input on top and its matching output directly below it.
input xoutput q(x)01132031↓ evaluate: input given, read the output below it
Read q's input on top and its matching output directly below it.
  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.
Check Read backward: output 4 in p belongs to input 1, and output 1 in q occurs under 0, confirming this path.
Rung 2Rung 2: 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↓ evaluate: input given, read the output below it
Read p's input on top and its matching output directly below it.
input xoutput q(x)01132031↓ evaluate: input given, read the output below it
Read q's input on top and its matching output directly below it.
  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.
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 3Rung 3: 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↓ evaluate: input given, read the output below it
Read p's input on top and its matching output directly below it.
input xoutput q(x)01132031
Read q's input on top and its matching output directly below it.
  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.
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 4Rung 4: 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↓ evaluate: input given, read the output below it
Read p's input on top and its matching output directly below it.
input xoutput q(x)01132031
Read q's input on top and its matching output directly below it.
  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.
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 5Rung 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↑ solve: output given, read every input above it
Read p's input on top and its matching output directly below it.
input xoutput q(x)01132031↑ solve: output given, read every input above it
Read q's input on top and its matching output directly below it.
  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}.
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.
Trap. Reading the same input column in both pictures. The outer lookup uses the inner output, which can move you to a new column.