Sub topic 5
Breaking a Function into a Chain of Simpler Ones
This chapter assumes you can evaluate a composite such as (f∘g)(x) and know that g runs first. It also assumes you can read function notation and find the domain of a rational or square-root expression. Here you work in the opposite direction. You are given one formula and asked to find the pieces it was built from.
Decomposition is composition read backwards
Composition builds a function: you pick f and g and form f(g(x)). Decomposition starts from the finished function h(x) and asks for f and g with h(x) = f(g(x)).
Decomposition is useful for three reasons:
- It shows how a formula is evaluated, one step at a time.
- It prepares you to find inverses, because you undo a chain one link at a time.
- It prepares you for calculus, where the chain rule differentiates a composite by working through its layers.
The central question is: if I evaluated this expression by hand for a specific x, what would I compute first? That first computation is the inner function. Whatever is done to its result is the outer function.
The inside-out method
Take h(x) = (2x + 3)². To evaluate it at x = 4:
- Compute 2·4 + 3 = 11. This is the inner step.
- Square the result: 11² = 121. This is the outer step.
So g(x) = 2x + 3 and f(u) = u², and h = f∘g. The letter u is a placeholder name for "whatever the inner function produced." The outer function does not care that its input came from 2x + 3.
A reliable procedure:
- Pick a specific number and evaluate h by hand, noting each operation in order.
- Group the first operation or operations into the inner function g.
- Describe what is done to g(x) as the outer function f, written in terms of a fresh variable u.
- Check by substituting g(x) into f and simplifying.
Step 4 matters. It catches the most common error, which is swapping inner and outer.
Chains with more than two links
Some formulas contain three or more stages. Take
h(x) = 10 / (2x + 1)²
Evaluate at x = 2:
- 2·2 + 1 = 5
- 5² = 25
- 10 / 25 = 0.4
Each stage is a simple function:
- a(x) = 2x + 1
- b(u) = u²
- c(u) = 10 / u
Then h(x) = c(b(a(x))), or h = c∘b∘a. The functions are listed in reverse order of evaluation, as with any composite.
The diagram reads left to right in order of evaluation. The composite notation c∘b∘a reads right to left. Keeping both directions straight is a large part of the skill.
Checking a decomposition in code
Python makes this concrete. The compose helper below takes any number of functions and chains them, with the last argument applied first.
import math
from functools import reduce
def compose(*funcs):
"""compose(f, g, h)(x) == f(g(h(x)))"""
return reduce(lambda outer, inner: (lambda x: outer(inner(x))), funcs)
def h(x):
return 10 / (2 * x + 1) ** 2
def a(x):
return 2 * x + 1
def b(u):
return u ** 2
def c(u):
return 10 / u
chain = compose(c, b, a)
for x in [-3, 0, 2, 7.5]:
assert math.isclose(h(x), chain(x))
print(chain(2)) # 0.4The assertions test several inputs. They do not prove that the two formulas are equal, but a wrong decomposition usually fails at one of them. The algebraic check is the proof. Here c(b(a(x))) = 10 / (2x + 1)², which is h(x).
Decompositions are not unique
Many functions have several valid decompositions. Consider h(x) = (2x + 3)⁴. Both of these work:
- Two links: g(x) = 2x + 3 and f(u) = u⁴.
- Three links: g(x) = 2x + 3, then s(u) = u², then s again. Squaring twice gives the fourth power.
There is also a trivial decomposition: g(x) = h(x) and f(u) = u, the identity function. It is always valid and tells you nothing. A decomposition is useful when each piece is simpler than the whole and corresponds to one recognizable operation, such as adding a constant, scaling, squaring, taking a root, or taking a reciprocal.
A practical rule is to stop splitting when every piece is a single basic operation, or when further splitting would not help your task. For differentiation, you split until each layer is a function you already know how to handle. For finding an inverse, you split until each layer is easy to undo.
A table of common patterns
| Formula h(x) | Inner g(x) | Outer f(u) | Column | Column | Column | Column |
|---|---|---|---|---|---|---|
| (3x − 1)⁵ | 3x − 1 | u⁵ | ||||
| √(x² + 4) | x² + 4 | √u | ||||
| 1 / (x − 6) | x − 6 | 1 / u | ||||
| \ | 2x − 5\ | + 1 | 2x − 5 | \ | u\ | + 1 |
| (√x + 1)³ | √x + 1 | u³ |
The last row has a nested inner function. g(x) = √x + 1 is itself a composite of √x followed by adding 1. A full decomposition gives three links: √, then +1, then cube.
Domain considerations
The domain of h = f∘g contains only the x values where g(x) is defined and g(x) lies in the domain of f. A decomposition therefore also shows you where the formula breaks.
For h(x) = √(4 − x²), take g(x) = 4 − x² and f(u) = √u. Here g is defined for every real x, but f needs u ≥ 0. So we require 4 − x² ≥ 0, which gives −2 ≤ x ≤ 2.
For h(x) = 10 / (2x + 1)², the last link c(u) = 10 / u requires u ≠ 0. The middle link produces zero only when 2x + 1 = 0, so the domain excludes x = −1/2.
Each link places its own restriction on the stage before it. Collect these restrictions as you work backward through the chain.
Common mistakes
- Reversing inner and outer. If you write f(x) = 2x + 3 and g(x) = x² for h(x) = (2x + 3)², you have described g∘f only by accident of letter naming. Always test your answer by substituting the inner function into the outer one.
- Treating sums as chains. The expression x² + 3x adds two separate terms. Neither term is applied to the output of the other, so there is no natural inner function.
- Dropping part of the formula. In h(x) = √(x² + 4) + 1, the +1 is outside the root. The outer function is √u + 1, not √u.
- Ignoring the domain. Writing √(x² − 9) as a composite is fine, but you must still require x² − 9 ≥ 0, which means x ≤ −3 or x ≥ 3.
Exercises
Exercise
Decompose h(x) = √(4 − x²) into an inner function g and an outer function f with h = f∘g. State the domain of h.
Show answer
Take g(x) = 4 − x² and f(u) = √u. Then f(g(x)) = √(4 − x²). The square root needs 4 − x² ≥ 0, so x² ≤ 4 and the domain is −2 ≤ x ≤ 2.
Exercise
Write h(x) = 1 / (√x − 3)² as a chain of three or more simple functions listed in order of evaluation, then state which x values are excluded from the domain.
Show answer
Evaluate in order: p(x) = √x, then q(u) = u − 3, then r(u) = u², then s(u) = 1 / u. So h = s∘r∘q∘p. The square root requires x ≥ 0. The reciprocal requires √x − 3 ≠ 0, which excludes x = 9. The domain is x ≥ 0 with x ≠ 9.