Composite Functions Explained

Composite Functions Explained: How to Work With f(g(x)

Composite Functions Explained: How to Work With f(g(x))

Composite functions are an important part of functions in H2 Mathematics. They appear when one function is applied to the result of another function, creating a new function from two existing ones.

Students often understand individual functions such as f(x) and g(x), but become confused when they see expressions such as f(g(x)), gf(x) or fg(x). The key is to recognise that composite functions are carried out in a specific order.

The key idea

In a composite function, the output of one function becomes the input of another function.

For f(g(x)), apply g first, then apply f to the result.

What Is a Composite Function?

Suppose we have two functions:

f(x) = 2x + 3

g(x) = x²

The composite function f(g(x)) means that we first calculate g(x), then substitute that result into f.

Since:

g(x) = x²

substitute x² wherever x appears in f(x):

f(g(x)) = 2(x²) + 3 = 2x² + 3
Diagram showing composite function f(g(x)), where x is passed through g(x) first and then into f to produce f(g(x))

Why the Order Matters

Composite functions are generally not interchangeable. In other words:

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

Using the same functions:

f(x) = 2x + 3

g(x) = x²

we already found:

f(g(x)) = 2x² + 3

But for g(f(x)), apply f first:

f(x) = 2x + 3

Then put the whole expression into g:

g(f(x)) = (2x + 3)²

Expanding:

g(f(x)) = 4x² + 12x + 9

These results are clearly different. This is why students should always identify which function is being applied first before beginning any calculation.

How to Read Composite Function Notation

Notation Meaning Order
f(g(x)) Apply g, then apply f g → f
g(f(x)) Apply f, then apply g f → g
fg(x) Usually means f(g(x)) g → f
gf(x) Usually means g(f(x)) f → g
Order Matters in Composite Functions)

A Step-by-Step Method for Composite Functions

01

Identify the inner function

Look at the function closest to x. In f(g(x)), the inner function is g(x).

02

Evaluate or simplify the inner function

Find the expression produced by the first function.

03

Substitute the entire result into the outer function

Replace every occurrence of x in the outer function with the complete expression from the inner function.

04

Simplify carefully

Expand brackets, collect terms or simplify fractions only after the substitution is correct.

Worked Example 1: Linear and Quadratic Functions

Given

f(x) = 3x - 2

g(x) = x² + 1

Find f(g(x)).

First:

g(x) = x² + 1

Now substitute the whole expression into f:

f(g(x)) = 3(x² + 1) - 2

Simplifying:

f(g(x)) = 3x² + 1

Worked Example 2: Finding g(f(x))

Using the same functions

f(x) = 3x - 2

g(x) = x² + 1

Find g(f(x)).

Since:

f(x) = 3x - 2

substitute this into g:

g(f(x)) = (3x - 2)² + 1

Expanding:

g(f(x)) = 9x² - 12x + 5

Once again, f(g(x)) and g(f(x)) produce different expressions.

Composite Functions With Numerical Values

Sometimes a question asks for a numerical value rather than an algebraic expression.

Example

f(x) = 2x + 5

g(x) = x² - 1

Find f(g(3)).

Work from the inside outward.

g(3) = 3² - 1 = 8

Then:

f(8) = 2(8) + 5 = 21

Therefore:

f(g(3)) = 21

Number Flow- Function Composition explained

Composite Functions and Domain Restrictions

At H2 Math level, composite functions can become more difficult when domains and ranges are involved.

For f(g(x)) to be defined, two conditions must be satisfied:

  1. The value of x must be allowed in the domain of g.
  2. The output of g(x) must lie within the domain of f.

This second condition is frequently overlooked.

Example involving a square root

f(x) = √x

g(x) = x - 4

Then:

f(g(x)) = √(x - 4)

For this expression to be real:

x - 4 ≥ 0

Therefore:

x ≥ 4

Range Can Affect Whether a Composite Function Exists

A useful way to think about composite functions is to compare the range of the inner function with the domain of the outer function.

Range of inner function must fit within the domain of outer function

If some outputs of the inner function are not valid inputs for the outer function, the composite function may require a restricted domain.

Illustration Slot 4 Suggested domain-range diagram showing Domain of g → Range of g → Domain of f → Range of f.

Composite Functions and Inverse Functions

Composite functions are closely connected to inverse functions.

If f-1 is the inverse of f, then composing the function with its inverse returns the original input:

f-1(f(x)) = x

and:

f(f-1(x)) = x

This happens because the inverse function reverses the effect of the original function.

Example

f(x) = 2x + 3

Its inverse is:

f-1(x) = (x - 3) / 2

Therefore:

f-1(f(x)) = [(2x + 3) - 3] / 2 = x

Common Mistakes Students Make With Composite Functions

1. Applying the functions in the wrong order

Students may see fg(x) and apply f first. In fact, fg(x) means f(g(x)), so g is applied first.

2. Substituting only part of the expression

If:

f(x) = x² + 4

and:

g(x) = 3x - 1

then:

f(g(x)) = (3x - 1)² + 4

The entire expression 3x - 1 must replace x.

3. Forgetting brackets

Brackets are especially important when the function contains powers, fractions or square roots.

Writing:

(3x - 1)²

is very different from:

3x - 1²

4. Ignoring domain restrictions

A correctly simplified expression may still be incomplete if the question requires the domain of the composite function.

5. Assuming fg = gf

Function composition is generally not commutative. Always calculate each order separately unless a result has already been established.

How Composite Functions Are Tested in H2 Math

Composite functions can appear as a short standalone question, but they are often combined with other ideas from the functions topic.

Students may be required to:

  • find fg(x) or gf(x);
  • state the domain or range of a composite function;
  • determine whether a particular composition exists;
  • solve equations involving composite functions;
  • combine composite functions with inverse functions;
  • interpret transformations through function composition; or
  • use composite functions as part of a longer functions problem.

This is why simply memorising the notation is usually insufficient. Students need to understand how the output of one function becomes the input of another.

A Quick Checklist for Composite Function Questions

Question to ask Why it matters
Which function is inside? This tells you which function to apply first.
Have I substituted the entire expression? Partial substitution is one of the most common errors.
Do I need brackets? Brackets protect the structure of the substituted expression.
Are there domain restrictions? The output of the inner function must be valid for the outer function.
Does the question ask for fg or gf? The two compositions usually produce different answers.

Practice Question

Try this

Given:

f(x) = 4x + 1

g(x) = x² - 2

Find:

  1. f(g(x))
  2. g(f(x))
  3. f(g(2))

Answers:

1. f(g(x)) = 4(x² - 2) + 1 = 4x² - 7

2. g(f(x)) = (4x + 1)² - 2 = 16x² + 8x - 1

3. g(2) = 2, therefore f(2) = 9

Frequently Asked Questions

What does fg(x) mean?

It usually means f(g(x)). The function g is applied first, followed by f.

Is fg(x) the same as f(x) × g(x)?

No. In the context of composite functions, fg(x) represents function composition rather than multiplication. Multiplication would normally be written explicitly as f(x)g(x).

Is f(g(x)) always equal to g(f(x))?

No. The order of composition usually changes the result.

Why are composite functions important in H2 Math?

They develop students' understanding of functions as mappings and connect closely with inverse functions, domains, ranges and transformations.

What is the easiest way to avoid mistakes?

Work from the inside outward. Identify the inner function, write its entire output clearly, place brackets around it and then substitute it into the outer function.

Final Takeaway

Composite functions become much easier once students stop treating the notation as a collection of symbols and instead see it as a sequence of operations.

For f(g(x)), the function g acts first. Its output then becomes the input of f. The same principle applies whether the functions involve linear expressions, quadratics, square roots, fractions or inverse functions.

As questions become more advanced, students should also pay attention to domains, ranges and whether the output of one function is valid as the input of the next.

Strengthen Your H2 Math Functions Foundation

At MuscleMath, students are guided through functions using worked examples, targeted practice and examination-style questions. Lessons focus on helping students recognise recurring question structures, choose appropriate methods and apply concepts independently.

Students who need additional support with composite functions, inverse functions and other H2 Math topics can explore MuscleMath's H2 Math tuition programmes and lesson options.

Explore H2 Math Tuition

Start Your Math Tuition Learning Adventure With Musclemath


At MuscleMath, we guide student to score well through O-level math tuition, A-level math tuition and H2 Math tuition. Our team consists of ex-MOE HOD’s, NIE teachers and full-time tutors.

As a leading and an MOE certified math tuition centre in Singapore, students will be provided with a wide range of options such as holiday tuition lessons, crash courses, free trials for all levels.

We provide fully customised lessons in conjunction with specialised notes and materials that are constantly updated. If you’re looking for math tuition or need help to figure out how to study maths, our team will be there for you to support your learning journey, start now and achieve better results!