IB Maths AA SL Paper 1 & 2 13 min read

Composite Functions

A composite function means putting one function inside another — using the output of one as the input of the next. The single most important rule: read inside-out and start with the function closest to x.

📘

What you need to know

  • (fg)(x) means f(g(x)) — apply g first, then f
  • Three equivalent notations: (fg)(x), fg(x), f(g(x))
  • Always read inside-out: start with the function closest to x
  • Order matters!  (fg)(x) is usually NOT the same as (gf)(x)
  • ff(x) means apply f twice — it’s not the same as [f(x)]2
  • For the domain of (fg): the outputs of g must be valid inputs of f

What is a Composite Function?

A composite function feeds the output of one function straight into another. You take an input, apply one function to it, then apply a second function to the result. There are three equivalent notations — all mean the same thing:

(fg)(x)

“f composed with g of x”

fg(x)

compact form

f(g(x))

expanded form (clearest)

The Inside-Out Rule

The trickiest part of composite functions is figuring out which function to apply first. The rule is simple: start with the function closest to x.

How (fg)(x) Works
Input
x
Step 1
apply g
Result
g(x)
Step 2
apply f
Output
f(g(x))

Read inside-out: the function next to x goes first.

Memory hook: in (fg)(x), the letter g is closer to x, so g goes first. Same with fg(x) — the rightmost function is touching x directly, so it acts first.

Order Matters

Swapping the order of composition usually changes the answer:

f ∘ g
(fg)(x) = f(g(x))

g first, then f

g ∘ f
(gf)(x) = g(f(x))

f first, then g

(fg)(x)  ≠  (gf)(x)  (in general)

Important: ff(x) = (ff)(x) means apply f twice — first to x, then to the result. It is not the same as squaring [f(x)]2. Don’t confuse them!

How to Build a Composite Function Expression

To find an expression for (fg)(x), follow these steps:

  1. Start with g(x) — the function closest to x.
  2. Substitute g(x) into f: wherever you see x in the formula for f, replace it with the entire expression for g(x).
  3. Simplify the result.

Domain and Range of a Composite Function

For (fg)(x), the input x first goes into g, and the output g(x) then becomes the input of f. So:

This means the domain of (fg) might be smaller than the domain of g on its own.

  1. Start with the domain of g.
  2. Find the outputs of g on that domain.
  3. Restrict so those outputs fit inside the domain of f. This may shrink the original domain.
  4. For the range, push the (now correct) domain through g, then through f in order.

Worked Examples

Example 1 — Numerical evaluation

Given f(x) = 3x and g(x) = x + 2, find (fg)(5).

Answer:

Apply g first (closest to input). g(5) = 5 + 2 = 7 Then apply f to that result. f(7) = 3 × 7 = 21 (f ∘ g)(5) = 21

Example 2 — Two-step evaluation

Given f(x) = √(x + 4) and g(x) = 3 + 2x, find the value of (gf)(12).

Answer:

Apply f first (closest to the input 12). f(12) = √(12 + 4) = √16 = 4 Then apply g to that result. g(4) = 3 + 2(4) = 11 (g ∘ f)(12) = 11

Example 3 — Building an expression

Given f(x) = √(x + 4) and g(x) = 3 + 2x, find an expression for (fg)(x).

Answer:

Apply g first — write down g(x). g(x) = 3 + 2x Substitute g(x) into f. Wherever f has “x”, put “(3 + 2x)” instead. f(g(x)) = f(3 + 2x) = √((3 + 2x) + 4) = √(7 + 2x) (f ∘ g)(x) = √(7 + 2x)

Example 4 — Same function twice

Given g(x) = 3 + 2x, find an expression for (gg)(x).

Answer:

Apply g once, then apply g to that result. g(g(x)) = g(3 + 2x) Substitute (3 + 2x) wherever g has “x”. = 3 + 2(3 + 2x) = 3 + 6 + 4x (g ∘ g)(x) = 9 + 4x Note: this is NOT the same as [g(x)]² = (3 + 2x)² = 9 + 12x + 4x².

Example 5 — Order matters: (f ∘ g) vs (g ∘ f)

Given f(x) = x2 and g(x) = x + 1, find expressions for both (fg)(x) and (gf)(x).

Answer:

(f ∘ g)(x): apply g first, then f. f(g(x)) = f(x + 1) = (x + 1)² = x² + 2x + 1 (f ∘ g)(x) = x² + 2x + 1 (g ∘ f)(x): apply f first, then g. g(f(x)) = g(x²) = x² + 1 (g ∘ f)(x) = x² + 1 Same f and g — different order — different answers.
💡

Tips

  • Always read inside-out. The function next to x acts first. This is the single rule that prevents most mistakes.
  • Use brackets generously when substituting. (x + 1)2 is very different from x + 12.
  • Check by substituting a number. If you find an expression for (fg)(x), pick a value like x = 2 and check both methods give the same answer.
  • For the domain of (fg), keep only the inputs whose g-output is allowed by f‘s domain.
  • Use the GDC on Paper 2 to plot the composite directly — saves time and confirms your algebra.

Common mistakes

  • Doing the wrong function first. In (fg)(x), g goes first — not f. The rightmost (closest to x) acts first.
  • Confusing ff(x) with [f(x)]2. ff(x) is f applied twice; [f(x)]2 is f(x) squared. Different operations entirely.
  • Forgetting brackets when substituting. If f(x) = x2 and g(x) = 2x + 1, then f(g(x)) = (2x + 1)2, NOT 2x + 12.
  • Assuming (fg) = (gf). They’re usually different. Compute both separately if asked.
  • Not restricting the domain. If f can’t take certain inputs, the domain of fg may need to shrink.
  • Skipping the simplification step. Always simplify your final expression — examiners expect a clean answer.

Final word: Composite functions are about order and substitution. Read inside-out, work step by step, and brackets are your best friend.

Need help with Functions?

Get 1-on-1 help from an IB examiner who knows exactly what Paper 1 & 2 are looking for.

Book Free Session →