Function Composition
Functions Inside Functions
What happens when the output of one function becomes the input of another? If a car travels at 60 mph and fuel efficiency drops with speed, how do you find fuel consumption as a function of time? You need to chain these relationships together; that’s composition.
Composition is everywhere: temperature depends on altitude, altitude depends on location, so temperature depends on location. Understanding composition is essential because the chain rule (one of the most important differentiation techniques) is entirely about derivatives of composed functions.
The notation $(f \circ g)(x)$ means “apply $g$ first, then apply $f$ to the result.” Think of it as a pipeline where data flows through $g$, then through $f$.
Prerequisite Map
Quick Reference
| Property | Value |
|---|---|
| Course | MATH 161 |
| Chapter | 1.3 |
| Difficulty | Intermediate |
| Time | ~20 minutes |
Key Concepts
The Definition
If $f$ and $g$ are functions, the composition of $f$ and $g$ is:
$$(f \circ g)(x) = f(g(x))$$
Read as: “$f$ composed with $g$” or “$f$ of $g$ of $x$”
The pipeline:
x → [ g ] → g(x) → [ f ] → f(g(x))
(inner) (outer)
$(f \circ g)(x)$ means multiply $f$ and $g$, or chain their outputs in any order.
This is the composition-is-not-chaining error. The notation $f \circ g$ is specifically defined as $f(g(x))$: apply $g$ first, then apply $f$ to the result. It does NOT mean $f(x) \cdot g(x)$ (that is the product $fg$, written without the circle) and it does NOT mean “apply them in any order.” The circle symbol specifically means the output of $g$ becomes the input of $f$. A concrete example: if $f(x) = x^2$ and $g(x) = x + 3$, then $(f \circ g)(2) = f(g(2)) = f(5) = 25$. Writing $(f \circ g)(x) = f(x) \cdot g(x) = x^2(x+3)$ gives 20, not 25. Writing $(g \circ f)(x)$ (applying $f$ first) gives $(2^2 + 3) = 7$, which is also not 25. Order and structure matter.
Order Matters!
$$f \circ g \neq g \circ f \text{ in general}$$
Example: Let $f(x) = x^2$ and $g(x) = x + 1$.
- $(f \circ g)(x) = f(g(x)) = f(x+1) = (x+1)^2$
- $(g \circ f)(x) = g(f(x)) = g(x^2) = x^2 + 1$
These are different functions! $(f \circ g)(2) = 9$ but $(g \circ f)(2) = 5$.
Finding the Domain
The domain of $f \circ g$ requires TWO conditions:
- $x$ must be in the domain of $g$ (so $g(x)$ exists)
- $g(x)$ must be in the domain of $f$ (so $f(g(x))$ exists)
Formula: $$\text{dom}(f \circ g) = \{x \in \text{dom}(g) : g(x) \in \text{dom}(f)\}$$
Example: If $f(x) = \sqrt{x}$ and $g(x) = 1 - x^2$, find the domain of $f \circ g$.
- Domain of $g$: all reals
- We need $g(x) \geq 0$ for the square root: $1 - x^2 \geq 0$
- This gives $x^2 \leq 1$, so $-1 \leq x \leq 1$
Domain: $[-1, 1]$
Decomposing Composite Functions
Given a complicated function, identify the “inner” and “outer” parts:
| Composite | Outer $f$ | Inner $g$ |
|---|---|---|
| $\sqrt{x^2 + 1}$ | $\sqrt{u}$ | $x^2 + 1$ |
| $(3x - 5)^7$ | $u^7$ | $3x - 5$ |
| $\sin(x^2)$ | $\sin u$ | $x^2$ |
| $\sin^2 x$ | $u^2$ | $\sin x$ |
Strategy: Ask “What’s the last operation performed?” That’s the outer function.
Visualizing Composition
COMPOSITION: (f ∘ g)(x) = f(g(x))
INPUT OUTPUT
│ │
▼ │
┌───┐ │
│ g │ ← INNER │
└─┬─┘ (applied first) │
│ │
▼ │
┌───┐ │
│ f │ ← OUTER │
└─┬─┘ (applied second)│
│ │
▼ │
RESULT ◄─────────────────┘
Multiple Compositions
You can compose more than two functions:
$$(f \circ g \circ h)(x) = f(g(h(x)))$$
Apply from right to left: first $h$, then $g$, then $f$.
Example: If $h(x) = x + 1$, $g(x) = x^2$, $f(x) = 3x$, then: $$(f \circ g \circ h)(x) = 3(x+1)^2$$
Connection to Transformations
Composition explains why horizontal transformations work “backwards”:
$$y = f(x - 3) = (f \circ g)(x) \text{ where } g(x) = x - 3$$
To get $f(0)$, you need to input $x = 3$ into $g$. That’s why “$-3$ inside” means “shift right.”
Practice Problems
If $f(x) = x^2$ and $g(x) = x + 3$, find $(f \circ g)(2)$.
Let $f(x) = \frac{1}{x}$ and $g(x) = x^2 - 4$. Find formulas for:
- $(f \circ g)(x)$
- $(g \circ f)(x)$
Let $f(x) = \sqrt{x}$ and $g(x) = 4 - x^2$. Find the domain of $(f \circ g)(x)$.
Express $H(x) = \sqrt[3]{\frac{x}{x+1}}$ as a composition $H = f \circ g$ where neither $f$ nor $g$ is the identity function.
Then find two different valid decompositions.
Let $f(x) = \frac{1}{1-x}$.
- Find $(f \circ f)(x)$.
- Find $(f \circ f \circ f)(x)$.
- What pattern do you notice? Prove your observation.
- A fixed point of $f$ is a value $x$ where $f(x) = x$. Find all fixed points of $f$.
Mastery Checklist
Mental Model
The Factory Pipeline: Think of composition as a factory with multiple stations. Raw material (input $x$) enters the first machine ($g$), which produces an intermediate product ($g(x)$). This intermediate product then enters the second machine ($f$), which produces the final output ($f(g(x))$).
The order matters: if you switch which machine comes first, you get a different product. And the pipeline only works if the intermediate product is compatible with the second machine (domain restrictions).
When you later learn the chain rule, you’ll see it as calculating how fast the final product changes based on how fast each machine transforms its input.
Connections
Looking back:
- Function Transformations: Every transformation is actually a composition (e.g., $y = f(x-3)$ is $f \circ g$ where $g(x) = x - 3$)
- Function Arithmetic: Composition is another way to build new functions, but with nesting instead of combining outputs
Looking ahead:
- Chain Rule: The derivative of $f(g(x))$ requires this skill
- Inverse Functions: If $f \circ g = \text{identity}$, then $g = f^{-1}$
| Previous | Up | Next |
|---|---|---|
| Function Arithmetic | Section 1.3 | The Tangent Line Problem |
Last updated: 2026-01-22