Composition of Functions
Compute f(g(x)) and g(f(x)), determine their domains, and decompose a given function into simpler component functions. Understand that composition is generally not commutative.
A lesson of Pre-Calculus, in Functions and Their Graphs, about 10 minutes.
By the end of this lesson, you will be able to compute $(f \circ g)(x)$ and $(g \circ f)(x)$, determine the domain of a composition, decompose a function into simpler components, and recognize composition as a key tool in calculus (chain rule).
The Big Idea
Function composition applies one function to the output of another: $(f \circ g)(x) = f(g(x))$. This "function of a function" concept is everywhere in mathematics — every complex formula in science is a composition. In calculus, the chain rule differentiates compositions. Understanding composition now makes chain rule intuitive later.
Notation and Definition
$$(f \circ g)(x) = f(g(x))$$
Apply $g$ first, then $f$. Think of it as feeding $x$ into $g$, then feeding $g$'s output into $f$.
Order matters: $(f \circ g)(x) \neq (g \circ f)(x)$ in general.
Domain of a Composition
$\text{Dom}(f \circ g)$ requires:
- $x$ must be in the domain of $g$
- $g(x)$ must be in the domain of $f$
Process: restrict the domain of $g$ to only those $x$ where $g(x)$ is in $\text{Dom}(f)$.
Example 1 — Computing Compositions
$f(x) = x^2 + 1$ and $g(x) = 3x - 2$:
$(f \circ g)(x) = f(3x-2) = (3x-2)^2 + 1 = 9x^2 - 12x + 5$
$(g \circ f)(x) = g(x^2+1) = 3(x^2+1) - 2 = 3x^2 + 1$
These are different — confirming composition is not commutative.
Example 2 — Domain of a Composition
$f(x) = \sqrt{x}$ and $g(x) = 2x - 8$:
$(f \circ g)(x) = \sqrt{2x - 8}$
Domain: $2x - 8 \geq 0 \implies x \geq 4$ → domain is $[4, \infty)$.
$(g \circ f)(x) = 2\sqrt{x} - 8$
Domain: $x \geq 0$ → domain is $[0, \infty)$.
Example 3 — Evaluating at a Point
$f(x) = x^3$ and $g(x) = \sin x$:
$(f \circ g)(\pi/2) = f(\sin(\pi/2)) = f(1) = 1$
$(g \circ f)(1) = g(1^3) = \sin(1) \approx 0.841$
Decomposing a Function
Given $h(x)$, find $f$ and $g$ such that $h(x) = f(g(x))$.
$h(x) = \sqrt{x^2 + 3}$: let $g(x) = x^2 + 3$ (inner) and $f(x) = \sqrt{x}$ (outer).
$h(x) = \sin^3(x)$: let $g(x) = \sin x$ and $f(x) = x^3$.
Decomposition is not unique — there are multiple valid answers.
Example 4 — Triple Composition
$f(x) = x+1$, $g(x) = x^2$, $h(x) = 3x$:
$(f \circ g \circ h)(x) = f(g(h(x))) = f(g(3x)) = f(9x^2) = 9x^2 + 1$
Apply innermost first: $h$, then $g$, then $f$.