Exercises — Composition of functions — f(g(x)), g(f(x))
Before we start, one picture to fix the vocabulary of the whole page.

The blue box is the inner machine ; the yellow box is the outer machine . A number enters on the left, chews it, hands the result to , and produces the final output on the right. When we write , the innermost parentheses are what happen physically first — exactly like doing the deepest bracket first in arithmetic.
Level 1 — Recognition
Goal: read the notation correctly and evaluate at a point.
L1.1
Given and . Compute and .
Recall Solution
What "compose at a point" means: substitute a number, resolve the inner machine, then the outer.
. Inner first: . Now the outer: .
. Inner first: . Outer: .
Different answers () — that is non-commutativity happening right in front of you.
L1.2
Given and . Compute as a simplified formula, and explain why it is not .
Recall Solution
. Inner machine: . Feed it to : . Why it is NOT : that would be , the other order. Reading right-to-left, in the function sits on the right, so runs first (squaring), then subtracts 5 — giving , not the square of .
L1.3
Given the table below (each machine defined only on the listed inputs), compute .
| 1 | 2 | 5 |
| 2 | 0 | 9 |
| 0 | 1 | 3 |
Recall Solution
. From the table . Now : the table's -column at gives . The trap avoided: you must look up at the value produced (), not at the original input ().
Level 2 — Application
Goal: build the full composite formula and simplify.
L2.1
Given and . Find and as simplified formulas.
Recall Solution
: replace every in 's rule with the whole expression . : replace every in 's rule with .
L2.2
Given and . Find and state which single input it forbids.
Recall Solution
Forbidden input: division by zero is undefined, so we need , i.e. . See Domain and range of function.
L2.3
Given and . Show that .
Recall Solution
. Using the exponent law : Why a shift inside becomes a scale outside: adding 3 to the exponent multiplies by the fixed factor . This is a preview of Function transformations.
Level 3 — Analysis
Goal: reason about domains, restrictions, and when order does or doesn't matter.
L3.1
Given and . Find the domain of .
Recall Solution
Step 1 — the formula: . Step 2 — where does accept the input? works for all real , so no restriction from itself. Step 3 — where can eat 's output? needs a non-negative input, so we require : Key point: trace the whole chain, not just the outer machine. See Domain and range of function.
L3.2
Given and . Find and all excluded inputs.
Recall Solution
Formula: . Multiply top and bottom by : Two separate exclusions must both be honoured:
- must be defined: (the inner ).
- must accept 's output: , i.e. .
Note the simplified form blows up at (that survives), but it hides the hole at . You must keep both exclusions:
L3.3
Given and for constants . Prove that here , and explain why this pair is special.
Recall Solution
Both equal , so . Why special: both machines are pure shifts, and shifting by then lands you in the same place as then — total shift is either way (addition commutes). This is a rare pair; non-commutativity is the general rule, as L1.1 showed.
Level 4 — Synthesis
Goal: decompose, reverse, and chain three machines.
L4.1
Given . Find and with , using .
Recall Solution
We are told the outer machine is — the last thing done is the square root. So whatever sits under the root must be the inner machine's output: Check: ✓ Idea: to decompose, ask "what is the last operation performed?" — that is the outer function.
L4.2
Given , , . Compute , then find the general formula .
Recall Solution
Rightmost runs first: order is , then , then .
- General formula: Check at : ✓. Associativity guarantees the bracketing doesn't matter.
L4.3
Given . Find a function so that for all (an inverse from one side).
Recall Solution
We want , i.e. . Solve for : Check: ✓ Because composing gives the identity , this is . Such an inverse exists here because is a bijection.
Level 5 — Mastery
Goal: combine composition with abstract reasoning and the chain rule.
L5.1
Given (for ). Compute and simplify.
Recall Solution
Combine the denominator: So Valid where the chain is defined: (inner) and .
L5.2
Given and (for ). Show and state the domain.
Recall Solution
By definition, answers "which power of gives ?" and raises to that power — they undo each other: Domain caveat: although the result is , we needed defined first, so . The exp and log are inverses — but only on their proper domains.
L5.3
Given . Using with , , find via the chain rule.
Recall Solution
Why the chain rule and not the power rule alone? is a composite: an inner machine feeds an outer machine . The chain rule is the tool that measures how a small nudge in passes through both machines:
- Outer derivative: , so .
- Inner derivative: . Multiply: Check a value: at , .
Recall Self-test — say each aloud before revealing
In , which machine runs first? ::: (the rightmost / innermost) runs first. Why does simplifying a composite not restore excluded domain points? ::: Simplification hides the inner step that failed; the original chain was undefined there, so the exclusion stays. Which single extra factor does the chain rule add to the outer derivative? ::: The inner function's derivative . When is guaranteed for two shifts , ? ::: Always — total shift is the same either way.