01 / 21

Function
Composition

Learn how to combine functions by feeding the output of one into the input of another: mastering \( (f \circ g)(x) \) for modelling and problem solving.

IB Mathematics AA

What Is Function Composition?

Function composition creates a new function by applying one function to the result of another. If you have two functions \( f \) and \( g \), their composition is written:

Think of it as a two-step machine: input goes into \( g \), the output goes into \( f \), and the final result comes out.

The Function Machine Model

\( x \) \( g(x) \) \( g(x) \) \( f \) \( f(g(x)) \) \( (f \circ g)(x) \)

Why Does Composition Matter?

Modelling
Real-world processes are often chains: temperature depends on altitude, altitude depends on time. Composition models such chains as \( T(h(t)) \).
Calculus
The chain rule for differentiation is built on composition: \( \frac{d}{dx}[f(g(x))] = f'(g(x))\,g'(x) \).
Inverse Functions
A function and its inverse satisfy \( f(f^{-1}(x)) = x \), which is a composition equalling the identity.

The Formal Definition

Similarly, \( (g \circ f)(x) = g\!\bigl(f(x)\bigr) \). Note: composition is not commutative: in general, \( f \circ g \neq g \circ f \).

Domain of a Composite Function

Domain of g \( x \) \( g \) Range of g \( g(x) \) \( f \) Range of f \( f(g(x)) \)

\( f \circ g \) vs \( g \circ f \): Order Matters

Composition is not commutative. Switching the order usually gives a completely different function.

\( (f \circ g)(x) \) \( (g \circ f)(x) \)
Meaning \( f(g(x)) \) \( g(f(x)) \)
Inner function \( g \) \( f \)
Outer function \( f \) \( g \)
Example \( f(x)=x^2,\; g(x)=x+1 \)
\( (x+1)^2 \)
\( f(x)=x^2,\; g(x)=x+1 \)
\( x^2+1 \)

How to Evaluate a Composition

1
Identify inner and outer. In \( (f \circ g)(x) \), the inner function is \( g \) and the outer is \( f \).
2
Substitute the inner into the outer. Replace every \( x \) in the formula for \( f \) with the expression \( g(x) \).
3
Simplify. Expand, factor, or reduce the resulting expression.
4
State the domain. Exclude any \( x \) for which \( g(x) \) falls outside the domain of \( f \).

Example 1: Linear & Quadratic

Let \( f(x) = x^2 + 3 \) and \( g(x) = 2x - 1 \). Find \( (f \circ g)(x) \).

1
Write the composition: \( (f \circ g)(x) = f(g(x)) = f(2x-1) \)
2
Substitute into \( f \): Replace \( x \) with \( (2x-1) \):
\( (2x-1)^2 + 3 \)
3
Expand: \( 4x^2 - 4x + 1 + 3 = 4x^2 - 4x + 4 \)

Example 2: Evaluating at a Point

Using the same functions \( f(x) = x^2 + 3 \) and \( g(x) = 2x - 1 \), find \( (f \circ g)(3) \).

1
Evaluate the inner first: \( g(3) = 2(3) - 1 = 5 \)
2
Feed into the outer: \( f(5) = 5^2 + 3 = 28 \)

Example 3: Domain Restrictions

Let \( f(x) = \sqrt{x} \) and \( g(x) = 5 - x^2 \). Find \( (f \circ g)(x) \) and state its domain.

1
Compose: \( (f \circ g)(x) = f(g(x)) = \sqrt{5 - x^2} \)
2
Domain of \( f \): \( f(x) = \sqrt{x} \) requires \( x \geq 0 \), so we need \( g(x) \geq 0 \).
3
Solve: \( 5 - x^2 \geq 0 \;\Rightarrow\; x^2 \leq 5 \;\Rightarrow\; -\sqrt{5} \leq x \leq \sqrt{5} \)

Visualising \( \sqrt{5 - x^2} \)

x y \( -\!\sqrt{5} \) \( \sqrt{5} \) \( \sqrt{5} \) 0

Composition and Inverse Functions

If \( f \) and \( f^{-1} \) are inverse functions, their compositions yield the identity:

This is the defining property of inverse functions. To verify that two functions are inverses, show both compositions equal \( x \).

Example
\( f(x) = 3x + 2 \), \( f^{-1}(x) = \frac{x-2}{3} \)

\( f(f^{-1}(x)) = 3\!\left(\frac{x-2}{3}\right) + 2 = x \) ✓
Identity
The identity function \( I(x) = x \) acts as the "neutral element" for composition:

\( (f \circ I)(x) = f(x) \)

Decomposing a Composite Function

Sometimes you need to work backwards: given a composite function, identify what \( f \) and \( g \) could be.

1
Look for the "inner core": Identify the expression inside parentheses, under a radical, or inside another operation.
2
Let \( g(x) \) be the inner: For \( h(x) = (3x+1)^5 \), let \( g(x) = 3x + 1 \).
3
Let \( f(u) \) be the outer: Then \( f(u) = u^5 \), so \( h = f \circ g \).

Common Mistakes to Avoid

✕ Wrong Order
Evaluating \( (f \circ g)(x) \) as \( g(f(x)) \). Remember that in \( (f \circ g)(x) \), the function on the right (\(g\)) is applied first, as it is the "inner" function in \( f(g(x)) \).
✕ Multiplication
Treating \( (f \circ g)(x) \) as \( f(x) \cdot g(x) \). Composition means substitution, not multiplication. Use \( f(x) \cdot g(x) \) only when asked for the product.
✕ Forgetting the Domain
Simplifying without checking that \( g(x) \) stays in the domain of \( f \). Always state domain restrictions for the composite.

Summary of Key Ideas

Concept Key Fact
Notation \( (f \circ g)(x) = f(g(x)) \)
Order Not commutative: \( f \circ g \neq g \circ f \) in general
Domain \( x \in \text{dom}(g) \) and \( g(x) \in \text{dom}(f) \)
Inverses \( f(f^{-1}(x)) = f^{-1}(f(x)) = x \)
Decomposition Identify inner and outer to reverse-engineer a composition
Associativity \( (f \circ g) \circ h = f \circ (g \circ h) \)

Question 1 of 5

If \( f(x) = 3x + 1 \) and \( g(x) = x^2 \), what is \( (f \circ g)(2) \)?

Question 2 of 5

Given \( f(x) = x - 4 \) and \( g(x) = 2x + 5 \), find \( (f \circ g)(x) \).

Question 3 of 5

If \( h(x) = \sqrt{2x - 6} \), which decomposition represents \( h \) as \( f \circ g \)?

Question 4 of 5

What is the domain of \( (f \circ g)(x) \) if \( f(x) = \frac{1}{x} \) and \( g(x) = x - 3 \)?

Question 5 of 5

If \( f(x) = x + 7 \) and \( f^{-1}(x) = x - 7 \), what is \( (f \circ f^{-1})(5) \)?