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:
g(x) = x²
The composite function f(g(x)) means that we first calculate g(x), then substitute that result into f.
Since:
substitute x² wherever x appears in f(x):
Why the Order Matters
Composite functions are generally not interchangeable. In other words:
Using the same functions:
g(x) = x²
we already found:
But for g(f(x)), apply f first:
Then put the whole expression into g:
Expanding:
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 |
A Step-by-Step Method for Composite Functions
Identify the inner function
Look at the function closest to x. In f(g(x)), the inner function is g(x).
Evaluate or simplify the inner function
Find the expression produced by the first function.
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.
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
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:
- The value of x must be allowed in the domain of g.
- 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.
If some outputs of the inner function are not valid inputs for the outer function, the composite function may require a restricted domain.
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:
and:
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:
and:
then:
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:
is very different from:
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:
- f(g(x))
- g(f(x))
- 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