Review · Find a commuting map
f(x) = 3x − 2 and g(x) = 2x + b on ℝ. Find b so fg = gf.
Hint
Compare the constant terms.
Worked solution
fg(x) = 6x + 3b − 2 and gf(x) = 6x + b − 4. Hence 2b = −2, so b = −1. Both composites then equal 6x − 5.
Understand · explore · practise
Learn composite functions fg(x), gf(x) and f²(x), find composite domains, and solve equations. Follow each function machine with a manual model and worked practice.
Before you startFunction notation, domain and range, substitution and basic equations
01 / Rightmost first
The notation fg(x) means f(g(x)): apply g, then feed its output into f. It does not mean f(x) multiplied by g(x). You may also see f ∘ g for the same composition.
x → g → g(x) → f → f(g(x))
Keep the intermediate value visible when you are learning the method. If any stage is undefined, the whole composite is undefined for that input.
02 / Build the composite
fg(x) = 2(x² + 3) − 1 = 2x² + 5
Insert the whole inner output into f.
gf(x) = (2x − 1)² + 3 = 4x² − 4x + 4
Now f acts first. Brackets are essential.
fg(2) = 13, but gf(2) = 12
The order usually changes the answer. Both domains here are all real numbers.
Some particular functions commute, so fg = gf is possible. It must be checked; it is not a general composition rule.
03 / Iteration and three functions
In composition notation f²(x) means f(f(x)), while [f(x)]² squares the output. Write the brackets if there is any ambiguity.
f²(x) = 2(2x − 1) − 1 = 4x − 3
Two applications of the same machine.
[f(x)]² = (2x − 1)² = 4x² − 4x + 1
One application, then square the result.
If h(x) = x + 4 and g(x) = x² + 3,
fgh(x) = 2((x + 4)² + 3) − 1
= 2(x + 4)² + 5
Apply h, then g, then f. Work from the inside out.
04 / Composite domains
For fg(x), the original input must lie in the domain of g, and the intermediate output g(x) must lie in the domain of f.
Domain of fg = {x in domain of g: g(x) is in domain of f}
Take f(x) = √x and g(x) = x − 2. Then fg(x) = √(x − 2) requires x ≥ 2. But gf(x) = √x − 2 requires only x ≥ 0. At x = 1 the first order fails while the second is valid.
f(x) = √x, defined for x ≥ 0.
g(x) = x − 2, defined for every real x.
Input 3 → g → 1 → f → 1
fg(3) = 1. Both stages are defined.
Domain of fg: x ≥ 2.
A failed stage stops the chain. An algebraic formula cannot make an excluded input valid.
Pause, replay or seek freely. The notes explain the same idea and stay in view.
05 / Keep original restrictions
f(x) = 1/x, with x ≠ 0
The reciprocal is undefined at zero.
f²(x) = 1/(1/x) = x
The formula simplifies, but the first reciprocal still requires x ≠ 0.
Domain of f²: x ≠ 0
Its range also excludes zero. It is the identity on the nonzero real numbers, not on all real numbers.
p(x) = x² for x ≥ 1; q(x) = x − 3 for x ≥ 0
Both specified domains matter.
pq(x) = (x − 3)², with x ≥ 0 and x − 3 ≥ 1
The original restriction on p survives even though its formula could be evaluated elsewhere.
Domain: x ≥ 4; range: y ≥ 1
Only the permitted right-hand branch is part of this composite.
06 / Solve composite equations
Solve fg(x) = 3:
√(x − 2) = 3 ⇒ x = 11
The domain x ≥ 2 is satisfied.
Solve gf(x) = −3:
√x − 2 = −3 ⇒ √x = −1
No real solution. Squaring would give the spurious candidate x = 1.
Solve gf(x) = 1:
√x = 3 ⇒ x = 9
Checking gives 3 − 2 = 1.
For a logarithmic example, let a(x) = ln x and b(x) = x² − 1. Then ab(x) = ln(x² − 1) has domain x < −1 or x > 1. The equation ab(x) = ln 8 gives x = ±3, and both satisfy that domain.
For e(x) = eˣ and a(x) = ln x, ae(x) = x for all real x, but ea(x) = x only for x > 0. Reversing operations can still leave different domains.
07 / Graphs and piecewise rules
When a function is given by a graph, read one output, use that as the next input, and read again. Do not simply multiply two graph heights.
pq(x) = p(x − 1)
The branch test is on x − 1, not on x.
For x < 1: pq(x) = (x − 1) + 2 = x + 1
The intermediate input is negative.
For x ≥ 1: pq(x) = (x − 1)²
The intermediate input is nonnegative. In particular pq(1) = p(0) = 0.
08 / Commuting functions and inverse order
fg(x) = 2ax + 2b + 3
Apply g first.
gf(x) = 2ax + 3a + b
Apply f first.
Equal for every x exactly when 2b + 3 = 3a + b
The x coefficients already match.
b = 3a − 3
This includes a = 0, b = −3: commuting does not itself require invertibility.
fh(x) = 10x − 5, so (fh)⁻¹(x) = (x + 5)/10
These maps are invertible on the real numbers.
h⁻¹f⁻¹(x) = [((x − 3)/2) + 4]/5 = (x + 5)/10
Undo f first, then h: inverse composition reverses the order.
f⁻¹h⁻¹(x) = [((x + 4)/5) − 3]/2 = (x − 11)/10
Keeping the original order gives the wrong inverse here.
For invertible functions with compatible domains and ranges, (fg)⁻¹ = g⁻¹f⁻¹. Keep those domains when applying this rule to restricted functions.
f(x) = 3x − 2 and g(x) = 2x + b on ℝ. Find b so fg = gf.
Compare the constant terms.
fg(x) = 6x + 3b − 2 and gf(x) = 6x + b − 4. Hence 2b = −2, so b = −1. Both composites then equal 6x − 5.
f(x) = 4x + 1 and g(x) = 2x − 3 on ℝ. Find (fg)⁻¹ and verify it by reversing the inverse order.
fg(x) = 8x − 11.
(fg)⁻¹(x) = (x + 11)/8. Also g⁻¹f⁻¹(x) = [((x − 1)/4) + 3]/2 = (x + 11)/8. Both inverse maps are defined for every real input.
09 / A rational function applied twice
First stage requires x ≠ 1
This condition survives any later cancellation.
Second stage requires h(x) ≠ 1
Solve (2x + 1)/(x − 1) = 1 to find the extra forbidden input.
2x + 1 = x − 1 gives x = −2
At −2 the first output is 1, where the second application fails.
h²(x) = [2(2x + 1)/(x − 1) + 1] / [(2x + 1)/(x − 1) − 1]
Substitute the entire fraction.
= (5x + 1)/(x + 2), for x ≠ 1, −2
At x = 1 the final formula is finite, but the original composition is still undefined.
The two exclusions have different causes: one blocks the first application; the other blocks the second. A simplified denominator shows only the latter.
r(x) = (3x + 1)/(x − 2). Find r² and its domain.
Require x ≠ 2 and r(x) ≠ 2.
r(x) = 2 would give 3x + 1 = 2x − 4, so exclude x = −5. Substitution and simplification give r²(x) = (10x + 1)/(x + 5), with x ≠ 2, −5.
t(x) = (x + 2)/(x − 1). Show that t²(x) = x on its domain, and state that domain.
Check whether t(x) can ever equal 1.
The first stage requires x ≠ 1. The equation (x + 2)/(x − 1) = 1 would imply 2 = −1, so no extra input is excluded. Simplifying t² gives x for x ≠ 1. It is the identity on that restricted domain.
10 / Your turn
Each question is independent. Keep exact roots where possible.
f(x) = 3x + 2 and g(x) = x² − 1, both on all real numbers. Find fg(x) and gf(x).
Insert one whole expression into the other.
fg(x) = 3(x² − 1) + 2 = 3x² − 1. gf(x) = (3x + 2)² − 1 = 9x² + 12x + 3. Both domains are all real numbers.
For f(x) = 3x + 2, find f²(x) and [f(x)]².
The first repeats the machine; the second squares its output.
f²(x) = 3(3x + 2) + 2 = 9x + 8. [f(x)]² = 9x² + 12x + 4.
For f(x) = 2x, g(x) = x² and h(x) = x − 3, find fgh(5).
Start with h(5).
5 → h → 2 → g → 4 → f → 8. Thus fgh(5) = 8.
f(x) = √(x + 1), x ≥ −1; g(x) = 2x. Find fg and gf, including domains.
Check the input to the square root in each order.
fg(x) = √(2x + 1), domain x ≥ −1/2. gf(x) = 2√(x + 1), domain x ≥ −1.
r(x) = 2/x for x ≠ 0. Find r²(x) and its domain.
Retain the original restriction through cancellation.
r²(x) = 2/(2/x) = x, but only for x ≠ 0. The inner output 2/x is never zero for these inputs, so there are no additional exclusions.
f(x) = √x and g(x) = x + 5. Solve fg(x) = 4.
First find fg and its domain.
fg(x) = √(x + 5), domain x ≥ −5. Squaring the nonnegative sides gives x + 5 = 16, so x = 11. It satisfies the domain and gives output 4.
a(x) = ln x and b(x) = 9 − x². State the domain of ab, and solve ab(x) = ln 5.
The logarithm argument must be strictly positive.
Require 9 − x² > 0, so −3 < x < 3. The equation gives 9 − x² = 5, hence x = ±2. Both are allowed.
p(t) = 2t for t < 1 and p(t) = t + 3 for t ≥ 1. If q(x) = x + 2, express pq as a piecewise function and find pq(−1).
Translate the test x + 2 < 1.
pq(x) = 2x + 4 for x < −1, and pq(x) = x + 5 for x ≥ −1. At x = −1 the second branch applies, giving pq(−1) = 4.
f(x) = x² for x ≥ 2 and g(x) = x − 1 for x ≥ 0. Find the domain and range of fg.
Require x ≥ 0 and x − 1 ≥ 2 simultaneously.
fg(x) = (x − 1)², with domain x ≥ 3. On this domain x − 1 ≥ 2, so the range is y ≥ 4.
e(x) = eˣ and a(x) = ln x. Are ae and ea the same function on their natural domains?
The simplified formulas agree. Do the domains?
No. ae(x) = ln(eˣ) = x for all real x, whereas ea(x) = e^(ln x) = x only for x > 0. A function includes its domain, so these are different functions despite sharing a simplified formula.
11 / Recap
Section 1 of 11 · Rightmost first