Composition of Functions
Composing functions means feeding the output of one function into another. This guide evaluates compositions from formulas, tables and graphs, builds composite formulas with their domains, and takes complicated functions apart into simple pieces.
The composite function \(f \circ g\), written \((f \circ g)(x) = f(g(x))\), applies \(g\) first and then applies \(f\) to the result. Its domain is the inputs of \(g\) whose outputs are in the domain of \(f\). Composition is not commutative: \(f(g(x))\) and \(g(f(x))\) are usually different. The identity function \(x \mapsto x\) changes nothing when composed with any function, the way 0 changes nothing in addition and 1 changes nothing in multiplication.
1What composition means
Read \(f(g(x))\) from the inside out: start with \(x\), apply \(g\), then apply \(f\) to whatever \(g\) produced. The function written closest to \(x\) acts first. If \(g\) produces a value that \(f\) cannot accept, that \(x\) is left out of the composite’s domain.
2Evaluating compositions
Whatever form the functions are given in, the routine is the same: find the inner output, then use it as the outer input.
Use the tables to find \(f(g(2))\), \(g(f(2))\), \(f(f(0))\) and \(g(g(3))\).
| \(x\) | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| \(f(x)\) | 4 | 3 | 0 | 1 | 2 |
| \(g(x)\) | 2 | 4 | 3 | 0 | 1 |
- 1\(g(2) = 3\), then \(f(3) = 1\). \(f(2) = 0\), then \(g(0) = 2\).
- 2\(f(0) = 4\), then \(f(4) = 2\). \(g(3) = 0\), then \(g(0) = 2\).
Use Figure 1 to find \(f(g(-1))\), \(g(f(0))\) and \(f(g(1))\).
- 1\(g(-1) = 2\), and \(f(2) = 1\). So \(f(g(-1)) = 1\).
- 2\(f(0) = -1\), and \(g(-1) = 2\). So \(g(f(0)) = 2\).
- 3\(g(1) = 0\), and \(f(0) = -1\). So \(f(g(1)) = -1\).
\(f(g(x))\) is not \(f(x) \cdot g(x)\). With \(f(x) = x^2 - 1\) and \(g(x) = 3x + 2\), the product at \(x = 1\) is \(0 \cdot 5 = 0\), but \(f(g(1)) = 24\).
3Building the formula
To write \(f(g(x))\), replace every \(x\) in the formula for \(f\) with the entire expression \(g(x)\), in parentheses. Then work out the domain: start from the domain of \(g\) and remove any inputs whose outputs \(f\) cannot take.
\(f(x) = x^2 - 1\) and \(g(x) = 3x + 2\). Find \(f(g(1))\), \(g(f(1))\), and formulas for \(f(g(x))\) and \(g(f(x))\).
- 1\(g(1) = 5\), so \(f(g(1)) = f(5) = 24\). \(f(1) = 0\), so \(g(f(1)) = g(0) = 2\).
- 2\(f(g(x)) = (3x + 2)^2 - 1 = 9x^2 + 12x + 3\). Replace every \(x\) in \(f\) with the whole expression \(3x + 2\).
- 3\(g(f(x)) = 3(x^2 - 1) + 2 = 3x^2 - 1\).
\(f(x) = \sqrt{x - 4}\) and \(g(x) = x^2\). Find \(f(g(x))\) and \(g(f(x))\) with their domains.
- 1\(f(g(x)) = \sqrt{x^2 - 4}\). An input works when \(g(x) = x^2\) is in the domain of \(f\), meaning \(x^2 \ge 4\): \(x \le -2\) or \(x \ge 2\).
- 2\(g(f(x)) = \left(\sqrt{x - 4}\right)^2 = x - 4\), but only for inputs where \(f(x)\) exists: \(x \ge 4\).
- 3The simplified formula \(x - 4\) hides that restriction, so state it.
“\(g(f(x)) = x - 4\), with domain \(x \ge 4\), because \(f(x) = \sqrt{x - 4}\) is defined only for \(x \ge 4\).”
\(f(g(x))\) with \(f(x) = x^2 - 1\) is \((3x + 2)^2 - 1\), not \(3x + 2^2 - 1\). The whole inner expression gets squared.
An oil spill is a circle whose radius, in meters, is \(r(t) = 3t + 1\) after \(t\) hours. Its area is \(A(r) = \pi r^2\). Find the area after 2 hours.
- 1Chain the units: hours go into \(r\) and come out as meters; meters go into \(A\) and come out as square meters.
- 2\(A(r(t)) = \pi(3t + 1)^2\). At \(t = 2\): \(r = 7\), so \(A = 49\pi \approx 153.94\).
4Order and the identity function
Changing the order usually changes the result, as Worked Example 3 shows: \(9x^2 + 12x + 3\) against \(3x^2 - 1\). One function always commutes with everything: the identity \(i(x) = x\). For any \(g\), \(g(i(x)) = i(g(x)) = g(x)\).
The order is part of the instruction. “Socks, then shoes” and “shoes, then socks” use the same two steps with very different results. In Worked Example 3, swapping the order turned 24 into 2.
5Taking a function apart
A complicated function can often be split into an inner function and an outer function. Ask: what is computed first, and what is done to that result? Transformations are compositions too: \(f(x + k)\) is \(f\) composed after \(x \mapsto x + k\), and \(k \cdot f(x)\) is \(x \mapsto kx\) composed after \(f\).
Write \(h(x) = (2x + 5)^3\) and \(k(x) = \dfrac{1}{x^2 + 1}\) as compositions of simpler functions.
- 1\(h\): first double and add 5, then cube. \(g(x) = 2x + 5\) and \(f(x) = x^3\), so \(h(x) = f(g(x))\).
- 2\(k\): first square and add 1, then take the reciprocal. \(g(x) = x^2 + 1\) and \(f(x) = \frac1x\), so \(k(x) = f(g(x))\).
- 3Check: substituting \(g(x)\) into \(f\) replaces each \(x\) in \(f\) and gives back the original.
Quick reference
| Idea | In symbols |
|---|---|
| Composite | \((f \circ g)(x) = f(g(x))\): g first, then f |
| Domain | Inputs of \(g\) with \(g(x)\) in the domain of \(f\) |
| Order matters | \(f(g(x)) \ne g(f(x))\) in general |
| Identity | \(i(x) = x\); \(g(i(x)) = i(g(x)) = g(x)\) |
| Shift as composition | \(f(x + k) = f(s(x))\), \(s(x) = x + k\) |
| Stretch as composition | \(k f(x) = m(f(x))\), \(m(x) = kx\) |