Functions
A function is a rule that takes an input and produces an output. We will start with simple number machines, then learn a short way to write their rules.
Function machines, including working backwards to find an input, are Foundation and Higher skills. Formal function notation and composite/inverse functions form the Higher route for AQA/Pearson. OCR requires the corresponding concepts but asks without formal f(x) or gf(x) notation, so each method here is also explained in words.
What is a function?
Think of a function as a number machine. The input is the number you put in. The rule tells you what to do. The output is the result.
Input → rule → output. The arrows mean “go to the next step”.
Here is a one-step machine. Its rule is “add 4”. Follow the arrows from top to bottom.
The input is 3. Work out 3 + 4. The output is 7.
If you put 3 into this same machine again, the output is still 7. The same input must give the same output.
A machine can have more than one step. Always follow its instructions in order.
Example Question:
A machine says: multiply by 2, then add 3.
The input is 5. What is the output?
Try the two steps separately. Example 1 shows the working.
Exam Tip
First decide what the question gives you: the input or the output.
If you know the input, follow the rule forwards.
If you know the output, undo the steps in reverse order.
Method — Using a Function Machine
1. Read the input. This is your starting number.
2. Follow the first instruction. Write down the result.
3. Use that result in the next step. Keep the steps in the order given.
4. State the output. This is the number after the final step.
For “multiply by 2, then add 3”, multiplying comes first. Adding 3 first would give a different rule.
Worked Examples
Example 1 — Follow a two-step machine
Use the rule multiply by 2, then add 3, with input 5.
First multiply by 2. The symbol × means “multiply”.
5 × 2 = 10
Then add 3:
10 + 3 = 13
The output is 13.
Working backwards — Foundation & Higher
The machine multiplies by 2, then adds 3. If its output is 11, undo those steps in reverse: 11 − 3 = 8, then 8 ÷ 2 = 4. The input was 4. This does not require function notation.
Shared practice — A machine multiplies by 3, then subtracts 2. Its output is 13. Find the input.
Undo subtracting 2: 13 + 2 = 15. Then undo multiplying by 3: 15 ÷ 3 = 5.
Check forwards: 3 × 5 − 2 = 13.
Example 2 — Write the machine’s rule (Higher notation)
Now give the same machine a name: f. This letter is a label for the function.
Let x stand for the input. The input can be a different number each time we use the machine.
The rule is still “multiply by 2, then add 3”:
x × 2 + 3
We usually write this as 2x + 3. Here, 2x means 2 × x.
We write the output as f(x), read aloud as “f of x”. It means “the output of function f when the input is x”.
So the complete rule is:
f(x) = 2x + 3
f(x) does not mean f × x. The brackets show the input going into the function. This way of writing a rule is called function notation.
Example 3 — Find f(3)
Use f(x) = 2x + 3.
The question “find f(3)” means “use 3 as the input and find the output”.
Replace x with 3. This is substitution:
f(3) = 2 × 3 + 3
Multiply first:
f(3) = 6 + 3
Then add:
f(3) = 9
Example 4 — Use a negative input
Use the same rule, f(x) = 2x + 3. Find f(−2). The minus sign means the input is negative two.
Replace x with −2. Put brackets around the negative input to keep its sign clear:
f(−2) = 2 × (−2) + 3
Multiply first. Two lots of −2 make −4:
f(−2) = −4 + 3
Then add 3:
f(−2) = −1
Example 5 — Choose between two functions
We can name another function g. Just as f(x) is the output of f, g(x) is the output of g for input x.
Use these two rules:
f(x) = 2x + 3
g(x) = x − 4
Find f(5) and g(5). Both use input 5, but the rules are different.
For f, multiply by 2, then add 3:
f(5) = 2 × 5 + 3
f(5) = 10 + 3
f(5) = 13
For g, subtract 4:
g(5) = 5 − 4
g(5) = 1
Check the function’s name before choosing a rule. Different functions can give different outputs for the same input.
Example 6 — Find the input from an output
Use f(x) = 2x + 3. Solve f(x) = 11.
This means the output is 11. We need to find the input x.
The machine multiplies by 2, then adds 3. To work backwards, subtract 3 first, then divide by 2. These are inverse operations: operations that undo each other.
Write the equation using the rule:
2x + 3 = 11
Subtract 3 from both sides:
2x = 8
Divide both sides by 2. The symbol ÷ means “divide”:
x = 8 ÷ 2
x = 4
Compare these two instructions:
Find f(3): the input is 3. Find the output.
Solve f(x) = 3: the output is 3. Find the input.
2x + 3 = 3
Subtract 3 from both sides:
2x = 0
Divide both sides by 2:
x = 0
Example 7 — Higher extension: composite functions
A composite function uses two functions in a row. The output of the first becomes the input of the second.
Use f(x) = 2x + 3 and g(x) = x − 4.
The notation f(g(x)) means: do g first, then put its output into f. The inside function is carried out first.
You may also see this written as fg(x). It means the same thing here. It does not mean multiplying f(x) by g(x).
Find fg(5), which means f(g(5)).
Start with the inside function, g:
g(5) = 5 − 4
g(5) = 1
Now use 1 as the input to f:
f(1) = 2 × 1 + 3
f(1) = 2 + 3
f(1) = 5
fg(5) = 5
The input to f is 1, the answer from g. Do not use the original input 5 again.
The order matters. gf(5) means g(f(5)), so f goes first.
From Example 5, f(5) = 13. Then g(13) = 13 − 4 = 9.
gf(5) = 9, which is different from fg(5).
Key idea
f(3) asks for an output. Put 3 into the rule.
f(x) = 11 asks for an input. Find the number that gives output 11.
For f(x) = 2x + 3, these answers are f(3) = 9 and x = 4.
Check your input
In Example 6, we found x = 4 when the output was 11. Check by following the original rule forwards:
f(4) = 2 × 4 + 3
f(4) = 8 + 3
f(4) = 11
The output matches 11, so the input is correct.
Higher — inverse functions and composite rules
Worked example — Write an inverse function
An inverse function undoes a function. For f(x) = 3x − 4, the original steps are “multiply by 3, subtract 4”.
Reverse them: add 4, then divide by 3.
f⁻¹(x) = (x + 4)/3. Read this as “f inverse of x”. The −1 is inverse-function notation; it does not mean 1/f(x).
Find f⁻¹(11): (11 + 4)/3 = 5. Check forwards: f(5) = 3 × 5 − 4 = 11.
You can also rearrange y = 3x − 4 to x = (y + 4)/3. Rename the input y as x when writing f⁻¹(x).
Worked example — Find a composite rule
Let f(x) = 2x + 3 and g(x) = x − 4. Find fg(x), meaning f(g(x)).
Start with g(x) = x − 4. Put this whole expression into f in place of its input.
f(g(x)) = 2(x − 4) + 3.
Expand and simplify: 2x − 8 + 3 = 2x − 5.
In the other order, g(f(x)) = (2x + 3) − 4 = 2x − 1. The rules differ.
When an inverse needs a restriction
The rule h(x) = x² sends both 2 and −2 to 4. From output 4 alone, you cannot choose a unique original input.
If the allowed inputs are restricted to x ≥ 0, the inverse is h⁻¹(x) = √x, for x ≥ 0.
The allowed inputs are called the domain. An inverse function must return just one output for each allowed input. Use any restriction given in the question.
Think Like a Mathematician
Imagine putting 3 into the same machine twice. Could it give 9 the first time and 10 the second time?
No. A function uses a repeatable rule. One input must have one output for that function.
For f(x) = 2x + 3, the statement f(3) = 9 is just a short way to say: “input 3, multiply by 2, add 3, output 9”.
The name matters too. Using g instead of f means using a different rule.
Common mistakes to avoid
Reading f(x) as multiplication. It means the output of function f for input x.
Replacing only part of the rule. Replace every x with the input, then carry out every operation. In f(x) = 2x + 3, f(3) is 2 × 3 + 3, not just 2 × 3.
Losing a negative sign. Write 2 × (−2) when the input is −2. The brackets keep the whole negative number together.
Confusing f(3) with f(x) = 3. The first gives you the input. The second gives you the output.
Undoing steps in the original order. To undo “multiply by 2, then add 3”, subtract 3 first, then divide by 2.
Higher: doing the outside function first. In f(g(x)), do g first. Feed that answer into f.
Try it yourself
Work through the questions in order. Show each calculation on a new line. Question 1 uses Foundation and Higher function machines. Questions 2–9 practise Higher function notation, with composites in Questions 8–9.
1. Find the missing output from this machine.
Start with input 2. Multiply by 3:
2 × 3 = 6
Then subtract 1:
6 − 1 = 5
The output is 5.
2. A function named h multiplies its input by 4, then adds 1. Write its rule using h(x). Here, h(x) means the output of h for input x.
Start with input x. Multiplying by 4 gives 4x.
Then add 1, giving 4x + 1.
h(x) = 4x + 1
3. For f(x) = 2x + 3, find f(4).
Use input 4:
f(4) = 2 × 4 + 3
f(4) = 8 + 3
f(4) = 11
4. For f(x) = 2x + 3, find f(−3).
Use input −3, keeping the negative number in brackets:
f(−3) = 2 × (−3) + 3
f(−3) = −6 + 3
f(−3) = −3
5. Given f(x) = 2x + 3 and g(x) = x − 4, find f(2) and g(2).
For f, multiply by 2 and add 3:
f(2) = 2 × 2 + 3
f(2) = 4 + 3
f(2) = 7
For g, subtract 4:
g(2) = 2 − 4
g(2) = −2
6. For f(x) = 2x + 3, solve f(x) = 17.
The output is 17. Find the input:
2x + 3 = 17
Subtract 3 from both sides:
2x = 14
Divide both sides by 2:
x = 7
Check: 2 × 7 + 3 = 17.
7. A bike hire company uses C(x) = 3x + 2. Here, x is the hire time in hours and C(x) is the cost in pounds. Explain what C(4) means and find its value. Then find the hire time when the cost is £20.
C is the name of the cost function. C(4) is the cost of hiring the bike for 4 hours.
C(4) = 3 × 4 + 2
C(4) = 12 + 2
C(4) = 14, so the cost is £14.
For a cost of £20, solve C(x) = 20:
3x + 2 = 20
Subtract 2 from both sides:
3x = 18
Divide both sides by 3:
x = 6, so the hire time is 6 hours.
8. Higher extension: f(x) = 2x + 3 and g(x) = x − 4. Find fg(6), meaning f(g(6)).
Do g first:
g(6) = 6 − 4
g(6) = 2
Use 2 as the input to f:
f(2) = 2 × 2 + 3
f(2) = 4 + 3
fg(6) = 7
9. Higher extension: use the same rules to find gf(6), meaning g(f(6)). Explain why the answer differs from Question 8.
This time, do f first:
f(6) = 2 × 6 + 3
f(6) = 12 + 3
f(6) = 15
Use 15 as the input to g:
g(15) = 15 − 4
gf(6) = 11
Changing the order changes the calculation. In Question 8, g gave 2 to f. Here, f gives 15 to g.
Further practice — Higher functions
10. If f(x) = 4x + 7, find f⁻¹(x) and then f⁻¹(19).
Undo adding 7 by subtracting 7, then undo multiplying by 4 by dividing by 4.
f⁻¹(x) = (x − 7)/4.
f⁻¹(19) = (19 − 7)/4 = 3. Check: f(3) = 12 + 7 = 19.
11. If f(x) = 3x + 1 and g(x) = x − 2, find fg(x) and gf(x).
fg(x) = f(g(x)) = 3(x − 2) + 1 = 3x − 5.
gf(x) = g(f(x)) = (3x + 1) − 2 = 3x − 1.
Each time, the inside function is applied first.
12. The function h(x) = x² has allowed inputs x ≥ 0. Find h⁻¹(25) and explain why you do not give −5.
The inverse uses the non-negative square root: √25 = 5.
−5 also squares to 25, but it is not an allowed input of h. The restriction makes the inverse unambiguous.
Frequently Asked Questions
What does f(x) mean?
It means the output of function f when the input is x. Read it as “f of x”.
Does f(x) mean f multiplied by x?
No. The letter f names the rule. The brackets contain the input.
Can a function have a negative input?
Yes, if the rule allows it. For f(x) = 2x + 3, negative inputs work in exactly the same way. Keep their signs when substituting.
How do I know whether to find an input or an output?
In f(3), the input 3 is already given: find the output. In f(x) = 11, the output 11 is given: solve for the input x.
Why do we use different function names?
The names identify different rules. Always check the definition given in the question; f does not have one fixed rule across all maths questions.
Higher: which function goes first in fg(x)?
It means f(g(x)), so g goes first. Its output becomes the input to f. Writing the full brackets can help you see the order.
Continue Learning
Previous: Simultaneous Equations
Next: Numerical Methods and Iteration
Continue to Numerical Methods and Iteration for Higher methods of approximating solutions, or open Linear Graphs to start the graphs sequence.
