Quarry School

Composition passes one answer into the next function

Explain it like I am five

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.

xgg(x)ff(g(x))firstsecond
The machines run left to right, g then f. The written f(g(x)) puts f on the left; read from the innermost parentheses outward.
Reminder
  • 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.
Why it works. 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.
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 13f: double6firstsecond
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)).

xgg(x)ff(g(x))firstsecond
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 dTtemperatureCcostfirstsecond
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 13double6firstsecond
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
The parentheses identify the first action.
.1Inner 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 + 13inputoutput
The inner machine receives the original 2.
Reminder
  • 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 + 13inputoutput
The inner machine receives the original 2.
Worked exampleFind 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.

2add 13inputoutput
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.
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.
.2Outer 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) = 2x6inputoutput
The outer machine receives the intermediate 3.
Reminder
  • 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) = 2x6inputoutput
The outer machine receives the intermediate 3.
Worked exampleFinish 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.

3double6inputoutput
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.
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.
.3Composition 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
A raised dot, an open circle between functions and a degree sign have different jobs.
Reminder
  • 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
A raised dot, an open circle between functions and a degree sign have different jobs.
Worked exampleCircle 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.

2g3f6firstsecond
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.
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.
Strategy: step by step
  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.
Strategy
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.
Worked exampleAdd 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.

2g: add 13f: double6firstsecond
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.
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.
Trap. Starting with f because its name appears first. In f ∘ g, g receives the original input. Expand the circle notation before calculating.