Guide

Composite functions

By Viktor Lassen3 min readUpdated 3 September 2026

Composite functions are exactly what the name says: we put one function into another. Take the whole of g(x) and put it in x's place in f(x), and you have f(g(x)).

Composite functions are, as the name says a bit, when we put functions together. By "put together" we mean that we put one function into another. The hurdle is the order: putting gg into ff is not the same as putting ff into gg.

When do I use this?

Whenever a question gives you two functions and asks for fg(x)fg(x), gf(x)gf(x), fg(3)fg(3) or something similar. You need function notation to be second nature first, because a composite function is nothing more than function notation used twice.

The procedure

Let's start with an example. I have two functions:

f(x)=x2g(x)=2xf(x) = x^2 \qquad g(x) = 2x

If I put g(x)g(x) into f(x)f(x), I just have to take the whole function g(x)g(x) and put it in x's place in the other function, f(x)f(x), like this:

(2x)2(2x)^2

A composite function: f(g(x)) = (2x)² when f(x) = x² and g(x) = 2x

What we've done is just to put g(x)g(x) in x's place in f(x)f(x). If we did it the other way round, that is, put f(x)f(x) into g(x)g(x), it would look like this:

2x22x^2

These are composite functions. We just stuff one function into the other function.

How we write it

When we write composite functions, we do it like this:

f(g(x))f(g(x))

This says that we've put g(x)g(x) into f(x)f(x). The other way round would be

g(f(x))g(f(x))

which means that we've put f(x)f(x) into g(x)g(x). We say it as "f of g of x", or the other way round: "g of f of x".

The GCSE papers use a shorthand for exactly the same thing:

fg(x)=f(g(x))gf(x)=g(f(x))fg(x) = f(g(x)) \qquad gf(x) = g(f(x))

So when you see fg(x)fg(x), read it as f(g(x))f(g(x)): gg is the inner function, ff is the outer one, and you do the inner one first. It's just the brackets left out to save ink.

Worked example

Let's try taking one more example. We have the functions

f(x)=sin⁡(x)g(x)=x2f(x) = \sin(x) \qquad g(x) = x^2

where sin⁡\sin is the same sine you know from trigonometry.

If we had to find f(g(x))f(g(x)), that is, when we put g(x)g(x) into f(x)f(x), we get

sin⁡(x2)\sin(x^2)

because we've just put g(x)g(x) in x's place in f(x)f(x).

If we do it the other way, that is, find g(f(x))g(f(x)), we have to put f(x)f(x) in x's place in g(x)g(x), like this:

sin⁡(x)2\sin(x)^2

Two different functions from the same two ingredients. That's the whole point of keeping the order straight.

Common mistakes

  • "f(g(x)) is the same as g(f(x))." It isn't. In our first example f(g(x))=(2x)2f(g(x)) = (2x)^2 while g(f(x))=2x2g(f(x)) = 2x^2. Which function is inside decides everything.
  • "I only put part of the inner function in." You have to take the whole of the inner function and put all of it in x's place. Putting g(x)=2xg(x) = 2x into f(x)=x2f(x) = x^2 gives (2x)2(2x)^2, brackets and all.
  • "fg(x) means f times g." It means f(g(x))f(g(x)): gg first, then ff. It's function notation, not multiplication.

Frequently asked questions

Read next

Want to get good at maths?

Mathara explains every topic step by step with videos, exercises and personal feedback.

👉 Get started for free