Skip to content
spmaddmath.com.my
Tuition

Study

SyllabusFormulasMethodsExam & PapersTools
LocationsPricingBlogOur TeachersContact
EN

Method · Functions

How to Find a Composite Function

A composite function feeds the output of one function into another. In Add Math, fg(x)fg(x) means f(g(x))f(g(x)), apply gg first, then ff.

To find it, substitute the inner function into the outer function and simplify.

What a composite function is for

A composite function combines two functions into a single new function by using the output of one as the input of the other. In Add Math we write the composite of ff after gg as fg(x)fg(x), which means f(g(x))f(g(x)), the inner function gg acts first, then ff acts on that result.

The composite fgfg is a genuinely new function with its own rule and its own graph, not a product of the two. This method answers questions such as "given ff and gg, find fg(x)fg(x)", "evaluate gf(3)gf(3)", or "if fg(x)fg(x) is known, find the missing function".

It is a core Form 4 Functions skill, and it also underpins inverse functions, because a function composed with its inverse returns the input unchanged.

Understanding composition well is what lets you read the notation confidently. Two functions written side by side with no operation sign always mean composition, so fgfg is never "ff times gg".

Getting this straight early makes the whole Functions chapter far less confusing.

When to use this method

Reach for composition whenever a question gives you two functions and asks for a combined one written as fg(x)fg(x), gf(x)gf(x), f2(x)f^2(x), or asks you to evaluate a stacked expression like fg(2)fg(2). The tell-tale sign is two function definitions followed by a request that places one function inside another.

You also use composition when a question defines fg(x)fg(x) directly and asks you to find one of the original functions, or to solve an equation such as fg(x)=kfg(x)=k. Because Functions opens the syllabus and composition appears in both Paper 1 and Paper 2, recognising the notation quickly saves time.

Whenever you see two function letters together with no plus, minus or multiplication sign between them, read it as composition and decide which function acts first.

The steps

Work in this order so the substitution never goes wrong:

  1. 1

    Identify the inner and outer function

    In fg(x)fg(x), the inner function is gg (it acts first) and the outer function is ff. Read the letters right to left.

  2. 2

    Write out the outer function

    Write the outer rule with its input shown clearly, for example f()=2+1f(\square)=2\square+1, so you can see every slot the input goes into.

  3. 3

    Substitute the whole inner function

    Replace every input slot of the outer function with the entire inner expression, keeping it inside brackets.

  4. 4

    Expand and simplify

    Multiply out the brackets and collect like terms until you have one tidy expression in xx.

  5. 5

    Evaluate if a number is asked

    For a value like fg(2)fg(2), either substitute x=2x=2 into your composite, or work inside-out: compute g(2)g(2) first, then apply ff.

Order matters

In almost every case fg(x)gf(x)fg(x)\neq gf(x). Always check which function is written closest to xx, that one acts first.

Worked example

Try this yourself first, then check each line against the solution.

Q1[5 marks]

The functions ff and gg are defined by f(x)=2x+1f(x)=2x+1 and g(x)=x23g(x)=x^2-3. Find (a) fg(x)fg(x), (b) gf(x)gf(x), and hence (c) the value of fg(2)fg(2).

Show worked solution

(a) fg(x)fg(x) means f(g(x))f(g(x)), so gg is the inner function. Replace the input of ff with the whole of g(x)=x23g(x)=x^2-3:

fg(x)=2(x23)+1=2x26+1=2x25fg(x)=2(x^2-3)+1=2x^2-6+1=2x^2-5

(b) gf(x)gf(x) means g(f(x))g(f(x)), so now ff is the inner function. Replace the input of gg with the whole of f(x)=2x+1f(x)=2x+1:

gf(x)=(2x+1)23=4x2+4x+13=4x2+4x2gf(x)=(2x+1)^2-3=4x^2+4x+1-3=4x^2+4x-2

Notice that fg(x)=2x25fg(x)=2x^2-5 and gf(x)=4x2+4x2gf(x)=4x^2+4x-2 are different, this confirms that the order of composition matters.

(c) For fg(2)fg(2), substitute x=2x=2 into fg(x)=2x25fg(x)=2x^2-5:

fg(2)=2(2)25=2(4)5=85=3fg(2)=2(2)^2-5=2(4)-5=8-5=3

Answer

fg(x)=2x25fg(x)=2x^2-5, gf(x)=4x2+4x2gf(x)=4x^2+4x-2, and fg(2)=3fg(2)=3. Check inside-out: g(2)=223=1g(2)=2^2-3=1, then f(1)=2(1)+1=3f(1)=2(1)+1=3, which matches.

The inside-out check in the note is worth building into a habit. Computing g(2)g(2) first and then applying ff is a completely independent route to the same answer, so if the two methods disagree you know at once that a bracket or a sign has slipped somewhere.

Common mistakes to avoid

  • Reading fg(x)fg(x) as f(x)×g(x)f(x)\times g(x). It means f(g(x))f(g(x)), a substitution, never a product.
  • Getting the order backwards. In fg(x)fg(x) the function gg acts first, so substitute gg into ff, not the other way round.
  • Substituting into only some of the xx terms. Every input slot of the outer function must be replaced by the whole inner expression.
  • Dropping the brackets around the inner function, for example writing 2x23+12x^2-3+1 instead of 2(x23)+12(x^2-3)+1.
  • Assuming fg=gffg=gf. They are usually different functions, so always compute the one the question actually asks for.

How a teacher helps you get it right

Most lost marks in composition come from a single decision, which function acts first, and from dropping the brackets in the very next line. In a one-to-one lesson our teacher watches you set up fg(x)fg(x) and stops the moment the wrong function goes inside, so the habit is corrected before it hardens.

Because our teachers are experienced, you get someone who explains why gg acts first, not just tells you to memorise it. Lessons are online and taught in English, while SPM papers are set in both Malay and English, so we make sure the notation reads the same to you in either version.

We also drill the inside-out check so a slip never survives to the final line.

Get 1-to-1 help.

Book a Trial Class

Frequently asked questions

What does fg(x)fg(x) actually mean?

It means f(g(x))f(g(x)): apply the inner function gg first, then apply ff to the result. The function written closest to xx always acts first.

It is not f(x)×g(x)f(x)\times g(x).

Is fg(x)fg(x) the same as gf(x)gf(x)?

Usually no. Composition is not commutative, so fgfg and gfgf are normally different functions.

Always compute the exact one the question asks for, and never assume they are equal.

How do I evaluate something like fg(2)fg(2)?

Two ways give the same answer. Either find fg(x)fg(x) first and substitute x=2x=2, or work inside-out: compute g(2)g(2), then apply ff to that value.

Doing both is a quick way to check your work.

What does f2(x)f^2(x) mean in this chapter?

In Functions, f2(x)f^2(x) means ff(x)=f(f(x))ff(x)=f(f(x)), the function composed with itself, not [f(x)]2[f(x)]^2. So if f(x)=2x+1f(x)=2x+1, then f2(x)=2(2x+1)+1=4x+3f^2(x)=2(2x+1)+1=4x+3.

How is composition connected to inverse functions?

A function and its inverse undo each other, so ff1(x)=xff^{-1}(x)=x and f1f(x)=xf^{-1}f(x)=x. That identity is a reliable way to confirm you have found an inverse correctly.

Source:SRC-DSKP-EN

Written by the spmaddmath.com.my editorial team.· Last updated 5 September 2026

Ready to get started?

Book a Trial Classfrom RM50/hr · One-hour paid trial · Same-day reply
Book a Trial ClassOne-hour paid trial · Same-day reply