IB MATHEMATICS: ANALYSIS AND APPROACHES • FUNCTIONS

Function Composition — SL 2.9 Composition of functions and modeling with compositions

Learn how chaining functions together unlocks powerful ways to model real-world processes.

Historical Context & Motivation

Mathematics has always been about building complex ideas out of simpler pieces. Long before anyone wrote down the formal definition of function composition, mathematicians were already chaining processes together — converting units, then scaling results, then rounding to useful values. The idea of feeding the output of one function directly into another is so natural that it appears in almost every branch of mathematics and science.

The formal language of functions took centuries to develop. Early mathematicians worked with specific formulas and geometric constructions rather than the abstract concept of a function as a rule that maps inputs to outputs. As algebra matured, so did the need to express how two processes could be combined into a single, more powerful operation.

1694
Leibniz Introduces 'Function'
Gottfried Wilhelm Leibniz first used the Latin word functio to describe quantities that depend on a variable, laying the groundwork for treating processes as mathematical objects.
1837
Dirichlet's Modern Definition
Peter Gustav Lejeune Dirichlet proposed the modern idea of a function as a rule that assigns each input exactly one output, making composition formally meaningful.
1870s
Set Theory and Mappings
Georg Cantor's set theory gave mathematicians precise language for domains, codomains, and mappings — the backbone of rigorous function composition.
1930s
Composition in Abstract Algebra
The concept of composing functions became central to group theory and abstract algebra, revealing deep structural patterns across mathematics.
Today
Modeling and Computing
Function composition underpins everything from computer science pipelines to economic models, making it one of the most widely applied ideas in modern mathematics.

The key question that function composition answers is this: when you have two separate processes, how do you combine them into a single process? Whether you're converting Celsius to Fahrenheit and then rounding, or modeling how a discount is applied after tax, composition gives you a clean, algebraic way to chain these steps together.

Core Principles & Definitions

At its heart, function composition means applying one function to the result of another. If you have two functions, f and g, the composition (f ∘ g)(x) means you first evaluate g(x), then feed that result into f. The small circle symbol ∘ is read as "composed with" or simply "of." So f ∘ g is "f of g."

1

Notation

The composition of f and g is written (f ∘ g)(x) = f(g(x)). The function closest to x acts first.
2

Order Matters

In general, f ∘ g ≠ g ∘ f. Composition is not commutative. Changing the order usually produces a completely different function.
3

Domain Restrictions

For (f ∘ g)(x) to exist, the output of g(x) must lie in the domain of f. Always check that the range of the inner function fits into the domain of the outer function.
4

Associativity

Composition is associative: (f ∘ g) ∘ h = f ∘ (g ∘ h). You can group compositions in any order without changing the result.
5

Identity Function

The identity function I(x) = x acts as a neutral element: f ∘ I = I ∘ f = f for any function f.
KEY TAKEAWAY
Think of function composition like an assembly line in a factory. The first machine (g) takes raw material (x) and shapes it. The second machine (f) takes that shaped piece and finishes it. The order you run the machines matters — painting before cutting gives you a very different product than cutting before painting. In math, (f ∘ g)(x) = f(g(x)) means g runs first, then f.

Visual Explanation — The Composition Machine

The diagram above shows the composition pipeline. The inner function g processes the input first, and its output flows into the outer function f. The numerical example uses x = 2 with g(x) = x + 3 and f(x) = x², giving a final result of 25.

Notice the critical detail: even though we write f first in (f ∘ g)(x), the function g actually acts on x first. You read the notation from right to left, just as you would evaluate f(g(x)) by starting from the innermost parentheses and working outward. This is one of the most common sources of mistakes in composition problems, so always ask yourself: which function acts first?

Mathematical Framework

Let's formalize the definition and then explore the key algebraic skills you need for composition on the IB exam.

DEFINITION OF COMPOSITION
(f ∘ g)(x) = f(g(x))
g is the inner function (applied first), and f is the outer function (applied second). The domain of f ∘ g consists of all x in the domain of g such that g(x) is in the domain of f.
FINDING THE COMPOSED EXPRESSION
If f(x) = 2x + 1 and g(x) = x², then (f ∘ g)(x) = f(x²) = 2x² + 1
Replace every x in the formula for f with the entire expression for g(x). This substitution technique is the core algebraic move.
NON-COMMUTATIVITY
(g ∘ f)(x) = g(f(x)) = g(2x + 1) = (2x + 1)²
Compare: (f ∘ g)(x) = 2x² + 1 but (g ∘ f)(x) = (2x + 1)² = 4x² + 4x + 1. These are clearly different, confirming that order matters.
DOMAIN OF A COMPOSITION
Dom(f ∘ g) = { x ∈ Dom(g) : g(x) ∈ Dom(f) }
Start with all x-values that g can accept, then remove any for which g(x) falls outside the domain of f. For example, if f(x) = √x and g(x) = x − 5, then (f ∘ g)(x) = √(x − 5), and you need x − 5 ≥ 0, so x ≥ 5.
💡 IB Exam Tip
On the IB exam, you may be asked to find (f ∘ g)(x) or (g ∘ f)(x), evaluate a composition at a specific value, or determine the domain of a composition. Always start by identifying which function is the inner one (closer to x) and which is the outer one. Write out the substitution step explicitly before simplifying.

Modeling with Compositions

One of the most powerful applications of composition is modeling multi-step real-world processes. Whenever a quantity depends on a second quantity, which itself depends on a third, composition lets you express the entire chain as a single function. The IB syllabus at SL 2.9 specifically asks you to build and interpret such models.

This modeling diagram shows how an oil spill's area depends on time through composition. The radius function r(t) = 3t + 1 feeds into the area function A(r) = πr², producing the composed model (A ∘ r)(t) = π(3t + 1)², a quadratic function of time. The graph shows the parabolic growth of area over time.

This example illustrates a common IB pattern: you're given two functions that each model one step of a process, and you need to compose them to model the entire process. The key is identifying which variable links the two steps — here, the radius is the output of the first function and the input of the second. Whenever you see a chain of dependencies like "time affects radius, and radius affects area," think composition.

Table of values for the oil spill composition model
t (hours)r(t) = 3t + 1 (metres)(A ∘ r)(t) = π(3t + 1)² (m²)
01π ≈ 3.14
1416π ≈ 50.3
2749π ≈ 153.9
310100π ≈ 314.2
516256π ≈ 804.2

Worked Example

Let's work through a complete IB-style composition problem step by step.

Finding and Evaluating Compositions
1
Step 1 — State the Given FunctionsLet f(x) = 3x − 2 and g(x) = x² + 1. We need to find: (a) (f ∘ g)(x), (b) (g ∘ f)(x), and (c) (f ∘ g)(−2).
2
Step 2 — Find (f ∘ g)(x)By definition, (f ∘ g)(x) = f(g(x)). The inner function is g, so we first compute g(x) = x² + 1. Now substitute this entire expression into f in place of its input variable: f(x² + 1) = 3(x² + 1) − 2 = 3x² + 3 − 2 = 3x² + 1.
(f ∘ g)(x) = 3x² + 1
3
Step 3 — Find (g ∘ f)(x)Now (g ∘ f)(x) = g(f(x)). The inner function is f, so f(x) = 3x − 2. Substitute into g: g(3x − 2) = (3x − 2)² + 1 = 9x² − 12x + 4 + 1 = 9x² − 12x + 5.
(g ∘ f)(x) = 9x² − 12x + 5
4
Step 4 — Verify Non-CommutativityComparing the two results: (f ∘ g)(x) = 3x² + 1 and (g ∘ f)(x) = 9x² − 12x + 5. These are clearly different expressions, confirming that composition is not commutative.
5
Step 5 — Evaluate (f ∘ g)(−2)Using our expression from Step 2: (f ∘ g)(−2) = 3(−2)² + 1 = 3(4) + 1 = 12 + 1 = 13. Alternatively, you can compute step by step: g(−2) = (−2)² + 1 = 5, then f(5) = 3(5) − 2 = 13. Both approaches give the same answer.
(f ∘ g)(−2) = 13
🎯 Pro Strategy
When you need to evaluate a composition at a specific value (like (f ∘ g)(−2)), you have two paths: substitute into the composed expression, or evaluate the inner function first, then the outer. For checking your work on an exam, use both methods and confirm they match.

Common Pitfalls & Comparisons

Students often confuse composition with other operations on functions. The table below clarifies the differences and highlights common mistakes to avoid.

Comparison of operations on functions
OperationNotationWhat It Means
Composition(f ∘ g)(x) = f(g(x))Feed the output of g into f. The functions are chained, not multiplied.
Multiplication(f · g)(x) = f(x) × g(x)Evaluate both functions at x, then multiply the two results together.
Addition(f + g)(x) = f(x) + g(x)Evaluate both functions at x, then add the two results.
Inversef⁻¹(x)The function that undoes f. Note: f⁻¹ ≠ 1/f. Composition with inverse: (f ∘ f⁻¹)(x) = x.
⚠️ AVOID THIS MISTAKE
The biggest trap is confusing (f ∘ g)(x) with f(x) × g(x). Think of it this way: when you use a language translator app to go from English to Spanish, and then another app from Spanish to Japanese, you're composing the translations. You're not multiplying two translated texts together — that wouldn't make sense! Composition means sequential processing, not simultaneous evaluation.
  • Pitfall 1: Wrong order. In (f ∘ g)(x), g acts first, not f. Read from right to left or from inside out.
  • Pitfall 2: Forgetting to substitute fully. Replace every instance of the variable in the outer function with the entire inner expression, not just part of it.
  • Pitfall 3: Ignoring domain restrictions. If the inner function can produce values outside the outer function's domain, those x-values must be excluded.
  • Pitfall 4: Assuming commutativity. f ∘ g ≠ g ∘ f in general. Always check which composition is being asked for.

Connection to Advanced Topics

Function composition at SL 2.9 is a gateway to several deeper ideas that you'll encounter if you continue with HL Mathematics or university-level courses. Understanding composition now builds a strong foundation for these advanced concepts.

How SL 2.9 connects to advanced topics
SL 2.9 ConceptAdvanced ExtensionWhere You'll See It
(f ∘ g)(x) = f(g(x))Chain rule: d/dx [f(g(x))] = f′(g(x)) × g′(x)HL Calculus — differentiation of composite functions
f ∘ f⁻¹ = identityGroup theory: function groups under compositionUniversity abstract algebra
Domain of f ∘ gComposite function continuity and limitsHL Analysis — limits and continuity
Modeling with compositionsIterated maps, fractals, dynamical systemsUniversity mathematics and physics

Perhaps the most immediate connection is to the chain rule in calculus. When you differentiate a composite function like f(g(x)), you need to recognize the composition structure first. If you can comfortably identify the inner and outer functions now, the chain rule will feel much more natural when you encounter it. Additionally, the concept of iteration — composing a function with itself repeatedly, like f(f(f(x))) — leads to fascinating topics in chaos theory and fractals.

🔭 LOOKING AHEAD
Mastering composition is like learning to connect LEGO bricks. Once you can snap functions together confidently, you unlock the ability to build increasingly complex mathematical structures — from the chain rule in calculus to iterative algorithms in computer science. Every time you compose, you're practicing the fundamental skill of modular thinking.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain in your own words why (f ∘ g)(x) is generally not equal to (g ∘ f)(x). Give a simple example with f(x) = x + 5 and g(x) = 2x to support your explanation.
PROBLEM 2BASIC CALCULATION
Let f(x) = 4x − 1 and g(x) = x² + 3. Find (f ∘ g)(x) and evaluate (f ∘ g)(2).
PROBLEM 3INTERMEDIATE
Let f(x) = √(x − 1) and g(x) = x² + 5. (a) Find the expression for (f ∘ g)(x). (b) State the domain of (f ∘ g). (c) Is the domain all real numbers? Justify your answer.
PROBLEM 4APPLIED
A store offers a 20% discount, and a separate coupon gives $15 off. Let D(x) = 0.80x (the discount function) and C(x) = x − 15 (the coupon function), where x is the original price in dollars. (a) Find (C ∘ D)(x) and (D ∘ C)(x). (b) Which order saves the customer more money on a $100 item? (c) Explain why the order matters in this real-world context.
PROBLEM 5CRITICAL THINKING
Let f(x) = 2x + b and g(x) = ax − 3. Find values of the constants a and b such that (f ∘ g)(x) = (g ∘ f)(x) for all x. What does this tell you about the relationship between f and g?

Lesson Summary

Function composition means applying one function to the output of another. The notation (f ∘ g)(x) = f(g(x)) tells you to evaluate the inner function g first, then pass its result into the outer function f. To find the composed expression algebraically, replace every instance of the variable in the outer function's formula with the entire expression for the inner function. The domain of the composition requires that x be in the domain of g and that g(x) be in the domain of f.

Key properties to remember: composition is not commutative (f ∘ g ≠ g ∘ f in general), but it is associative. In modeling contexts, composition lets you chain two real-world processes — such as time → radius → area — into a single function. This skill connects directly to the chain rule in calculus and to powerful techniques in applied mathematics and computer science.

Varsity Tutors • IB Mathematics: Analysis and Approaches • Function Composition — SL 2.9