Composite Functions
A temperature sensor feeds into an alarm system. A currency conversion feeds into a tax calculator. Everywhere in the real world, functions chain together — the output of one becomes the input of another. In this lesson you'll master the notation $(f \circ g)(x) = f(g(x))$, discover why order matters, and learn to find the domain of a composite function step by step.
If $f(x) = x + 1$ and $g(x) = x^2$, compute $f(g(2))$ and $g(f(2))$. Without simplifying the general form — just substitute $x = 2$ and work step by step. Are they the same?
Everything in this lesson reduces to two moves: evaluate the inner function first, then restrict the domain carefully.
Every composite function question asks one of two things: find the formula for $f(g(x))$ by substituting $g(x)$ into $f$, or find the domain by checking where both functions are defined. Master these two moves and no composite question can catch you off guard.
Key facts
- $(f \circ g)(x) = f(g(x))$ — apply $g$ first, then $f$
- Composition is generally not commutative: $f(g(x)) \ne g(f(x))$
- Domain of $f \circ g$: all $x \in \text{dom}(g)$ with $g(x) \in \text{dom}(f)$
Concepts
- Why $f(g(x))$ is read "right to left" — inner function acts first
- How the domain of the composite is restricted by both functions
- Why a composite function can be decomposed in multiple ways
Skills
- Evaluate and simplify $f(g(x))$ and $g(f(x))$ algebraically
- Find the domain of a composite function from first principles
- Decompose a given function into a composite $f \circ g$
The composition of $f$ with $g$ is the function obtained by applying $g$ first, then $f$:
Read the notation carefully: $f(g(x))$ means substitute the entire expression $g(x)$ in place of $x$ in $f$. The function on the right ($g$) acts first; the function on the left ($f$) acts second.
Domain of $f \circ g$: the set of all $x$ in the domain of $g$ such that $g(x)$ is in the domain of $f$:
$x$ enters $g$, producing $g(x)$. That output enters $f$, producing $f(g(x))$. The whole pipeline is $(f \circ g)(x)$.
(f g)(x) = f(g(x)) — substitute g(x) into f in place of x; Read right to left: the rightmost function acts first
Pause — copy the composition definition into your book: $(f \circ g)(x) = f(g(x))$ — substitute $g(x)$ into $f$ in place of every $x$; read right-to-left so $g$ acts first, then $f$ acts on the result.
Quick check: If $f(x) = 2x + 1$ and $g(x) = x^2$, what is $f(g(3))$?
We just saw that $(f \circ g)(x) = f(g(x))$ means $g$ acts first on $x$, then $f$ acts on that result. That raises a question: does swapping the order of $f$ and $g$ give the same answer, or does the order always matter? This card answers it → composition is not commutative: $f(g(x)) \ne g(f(x))$ in general; the exception is when $f$ and $g$ are mutual inverses.
Unlike multiplication, function composition is not commutative: in general, $f(g(x)) \ne g(f(x))$.
Example: Let $f(x) = 2x + 1$ and $g(x) = x^2$.
These are clearly different polynomials. The hook question at the start used $x = 2$:
- $f(g(2)) = f(4) = 9$
- $g(f(2)) = g(5) = 25$
Always be clear about which composition you are forming, and always apply the functions in the correct order.
f(g(x)) g(f(x)) in general — composition is NOT commutative; Exception: f and g commute when f = g^{-1} (they are inverses of each other)
Pause — copy the non-commutativity rule into your book: $f(g(x)) \ne g(f(x))$ in general; the only exception is when $f = g^{-1}$, in which case both compositions equal $x$.
Did you get this? True or false: for any two functions $f$ and $g$, $f(g(x)) = g(f(x))$.
Worked examples · 3 in a row, reveal as you go
If $f(x) = 2x + 1$ and $g(x) = x^2$, find $f(g(x))$ and $g(f(x))$.
If $f(x) = \sqrt{x}$ and $g(x) = x - 4$, find $f(g(x))$ and its domain.
Given $h(x) = (3x + 1)^4$, find functions $f$ and $g$ such that $h = f \circ g$.
Fill the gap: If $f(x) = \dfrac{1}{x}$ and $g(x) = x + 3$, then $f(g(x)) = \dfrac{1}{x +}$ .
Misconceptions to fix · the 3 traps that cost marks
Did you get this? True or false: if $f(x) = \sqrt{x}$ and $g(x) = x - 9$, then the domain of $f(g(x))$ is $x \geq 9$.
Activities · practice with the ideas
If $f(x) = x^2 + 1$ and $g(x) = 3x - 2$, find $f(g(x))$ and $g(f(x))$.
If $f(x) = \dfrac{1}{x + 1}$ and $g(x) = x^2$, find $f(g(x))$ and state its domain.
Find functions $f$ and $g$ such that $f(g(x)) = \sqrt{x^2 + 4}$.
If $h(x) = \dfrac{1}{\sqrt{x - 2}}$, find $f$ and $g$ such that $h = f \circ g$, then state the domain of $h$.
Give an example of two functions $f$ and $g$ for which $f(g(x)) = g(f(x))$ for all $x$. Explain why they commute.
Odd one out: Three of these are valid decompositions of $h(x) = (2x+3)^5$. Which one is NOT a valid decomposition?
Earlier you computed $f(g(2))$ and $g(f(2))$ for $f(x) = x+1$ and $g(x) = x^2$.
$f(g(2)) = f(4) = 5$, but $g(f(2)) = g(3) = 9$. They differ because composition is not commutative — applying $g$ (squaring) before $f$ (adding 1) gives a different result than the other way around. The order of function application matters just like the order of dressing yourself matters (socks before shoes, not the reverse).
Pick your answer, then rate your confidence — that tells the system what to drill next. Each retry pulls a fresh mix from the bank.
Q1. If $f(x) = x^2 + 1$ and $g(x) = 3x - 2$, find $f(g(x))$ and $g(f(x))$. (2 marks)
Q2. If $f(x) = \dfrac{1}{x + 1}$ and $g(x) = x^2$, find $f(g(x))$ and state its domain. (2 marks)
Q3. Find functions $f$ and $g$ such that $f(g(x)) = \sqrt{x^2 + 4}$. (2 marks)
Comprehensive answers (click to reveal)
Activities: 1. $f(g(x)) = (3x-2)^2+1 = 9x^2-12x+5$; $g(f(x)) = 3(x^2+1)-2 = 3x^2+1$ · 2. $f(g(x)) = \frac{1}{x^2+1}$; domain $x^2+1 \ne 0$ means domain is all reals $\mathbb{R}$ (since $x^2+1 \geq 1 > 0$ always) · 3. $g(x) = x^2+4$, $f(x) = \sqrt{x}$ · 4. $g(x) = x-2$, $f(x) = \frac{1}{\sqrt{x}}$; domain: $x - 2 > 0 \Rightarrow x > 2$ · 5. Any pair of inverse functions commute, e.g. $f(x) = 2x$, $g(x) = \frac{x}{2}$; they commute because $f(g(x)) = x = g(f(x))$.
Q1 (2 marks): $f(g(x)) = f(3x-2) = (3x-2)^2 + 1 = 9x^2 - 12x + 4 + 1 = 9x^2 - 12x + 5$ [1]. $g(f(x)) = g(x^2+1) = 3(x^2+1) - 2 = 3x^2 + 3 - 2 = 3x^2 + 1$ [1].
Q2 (2 marks): $f(g(x)) = f(x^2) = \dfrac{1}{x^2 + 1}$ [1]. Domain: $x^2 + 1 \ne 0$. Since $x^2 \geq 0$, we have $x^2 + 1 \geq 1 > 0$ for all real $x$. Domain is $\mathbb{R}$ (all real numbers) [1].
Q3 (2 marks): Let $g(x) = x^2 + 4$ (inner: the expression under the root) and $f(x) = \sqrt{x}$ (outer: the square root) [1]. Verify: $f(g(x)) = f(x^2+4) = \sqrt{x^2+4} = h(x)$ ✓ [1].
Five timed questions on composite functions, domains, and decompositions. Beat the boss to bank a tier — gold (90% + speed), silver (75%), or bronze (50%). Replays welcome.
⚔ Enter the arenaClimb platforms by answering composite function questions. A lighter alternative to the boss.
Mark lesson as complete
Tick when you've finished the practice and review.