Recall, your gut answer first
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?
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.
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 in general, although some pairs do commute. A bijection from a set to itself paired with its inverse is one example, and translations provide another.
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$:
Always be clear about which composition you are forming, and always apply the functions in the correct order. Some pairs nevertheless commute: for translations $f(x)=x+a$ and $g(x)=x+b$, both composites equal $x+a+b$. A bijection from a set to itself also commutes with its inverse: both composites are the identity on that set.
Composition is not commutative in general, but some pairs commute. Examples include translations $f(x)=x+a$, $g(x)=x+b$, and a bijection from a set to itself paired with its inverse.
Pause, copy the non-commutativity rule into your book: $f(g(x)) \ne g(f(x))$ in general. Some pairs commute; for example, translations $f(x)=x+a$ and $g(x)=x+b$ compose to $x+a+b$ in either order, and a bijection from a set to itself commutes with its inverse.
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?
A printable worksheet to consolidate this lesson away from the screen.
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)
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].
A full module quiz covering every lesson in this module, not just this one. Set aside a decent block of time and treat it like a real assessment.
Start the module quiz →Tick when you've finished the practice and review.
Tell us what you would like help with. Register interest; support details will be confirmed before enrolment.
Register interest →