A function machine (sometimes called a number machine) takes an input value, passes it through one or more operations in sequence, and produces an output. You need to work both forwards — following each operation in turn — and backwards using inverse operations. Both directions appear regularly in KS3 algebra.

What is a function machine?

A function machine is a diagram that shows a rule applied step by step to a number. It has three parts:

  • Input — the number you start with (given, or an unknown such as x).
  • Operations — one or more boxes, each containing a single arithmetic instruction (×4, −7, +3, and so on).
  • Output — the result after all the operations have been applied in order.

A two-step machine is written as:

[INPUT] → [×4] → [−7] → [OUTPUT]

A function machine is not a physical device — it is a notation that makes the order of operations visible and explicit. At KS3 it bridges arithmetic (working with specific numbers) and algebra (working with unknowns), and it lays the groundwork for understanding functions, formulae, and rearranging equations.

How do I work forwards through a function machine?

Working forwards means applying each operation left to right, starting from a known input, to produce the output.

Worked example 1

Machine: [×4] → [−7]. Input = 5. Find the output.

  1. Apply ×4: 5 × 4 = 20.
  2. Apply −7: 20 − 7 = 13.

Worked example 2

Machine: [×3] → [+8]. Input = 4. Find the output.

  1. Apply ×3: 4 × 3 = 12.
  2. Apply +8: 12 + 8 = 20.

Worked example 3 — algebraic output

Machine: [+3] → [×2] → [−1]. Input = x. Write the output in terms of x.

  1. Apply +3: x + 3.
  2. Apply ×2: (x + 3) × 2 = 2x + 6.
  3. Apply −1: 2x + 6 − 1 = 2x + 5.

How do I work backwards through a function machine?

Working backwards means starting from a known output and applying the inverse (opposite) of each operation, but in reverse order — right to left — to recover the input.

Worked example 4

Machine: [×4] → [−7]. Output = 13. Find the input.

Reverse machine: [+7] → [÷4] (invert each operation, reverse the order).

  1. Apply +7: 13 + 7 = 20.
  2. Apply ÷4: 20 ÷ 4 = 5.

Check (forwards): 5 × 4 − 7 = 20 − 7 = 13 ✓

Worked example 5

Machine: [×3] → [+8]. Output = 20. Find the input.

Reverse machine: [−8] → [÷3].

  1. Apply −8: 20 − 8 = 12.
  2. Apply ÷3: 12 ÷ 3 = 4.

Check (forwards): 4 × 3 + 8 = 12 + 8 = 20 ✓

How do I find the inverse operations?

Every arithmetic operation has exactly one inverse. The table below lists the six pairs you need at KS3.

Operation Inverse operation
Add n (+ n) Subtract n (− n)
Subtract n (− n) Add n (+ n)
Multiply by n (× n) Divide by n (÷ n)
Divide by n (÷ n) Multiply by n (× n)
Square (x²) Square root (√x)
Square root (√x) Square (x²)

When reversing a multi-step machine you must do two things together:

  1. Reverse the order of the operations (the last operation becomes the first).
  2. Replace each operation with its inverse.

Doing only one of these two steps produces the wrong answer. Both are always required.

Worked example 6 — build and verify an inverse machine

Forward machine: [×5] → [+2]. Build the inverse machine and verify it.

Inverse machine: [−2] → [÷5] (reversed order, each operation inverted).

Verify with input 3:

  • Forwards: 3 × 5 = 15; 15 + 2 = 17.
  • Inverse: 17 − 2 = 15; 15 ÷ 5 = 3

How do function machines connect to algebra?

A machine that applies [×2] then [+3] to an input x gives output y = 2x + 3. This is exactly the linear function f(x) = 2x + 3. Working backwards through the machine to find x from y is the same as solving the equation y = 2x + 3 for x:

x = (y − 3) ÷ 2

Function machines make the structure of a formula visible and concrete. They also show why changing the subject of a formula requires undoing operations in the correct reverse order — a skill that recurs throughout KS3 and GCSE algebra.

Worked example 7 — build a machine from a formula

Build a function machine for f(x) = 3(x − 2).

Reading the formula from inside out: first subtract 2, then multiply by 3.

Machine: [−2] → [×3]

Input x = 5: (5 − 2) × 3 = 3 × 3 = 9.

Check: f(5) = 3(5 − 2) = 3 × 3 = 9 ✓

Frequently asked questions

What is the difference between a number machine and a function machine?

The two terms are used interchangeably at KS3. "Number machine" is the earlier name, common in Year 7 and Year 8 resources. "Function machine" is more common from Year 8 upwards and reflects the algebraic connection to formal function notation f(x). They describe the same diagram — input → one or more operations → output — and questions using either name expect the same skills.

How many operations can a function machine have?

There is no fixed limit, but KS3 questions typically use two or three operation boxes. Each additional operation is simply another box in the diagram. The rule for working backwards stays the same however many boxes there are: reverse the order of all operations and replace each one with its inverse.

Why does the order matter when I reverse the machine?

Consider [×3] → [+2] with input 4: forwards gives 4 × 3 = 12; 12 + 2 = 14. If you reverse using [÷3] → [−2] (wrong order), you get 14 ÷ 3 ≈ 4.67; 4.67 − 2 ≈ 2.67 — not 4. The correct reversal is [−2] → [÷3]: 14 − 2 = 12; 12 ÷ 3 = 4 ✓. Reversing the order of the operations is just as important as inverting each one.

Can two different inputs give the same output?

For the linear and simple arithmetic machines seen at KS3, each input gives exactly one output and each output comes from exactly one input (a one-to-one relationship). A machine containing [x²] (squaring) can map two different inputs to the same output — for example, inputs 3 and −3 both give output 9. This is why taking the square root as an inverse requires care: you may need to consider both positive and negative square roots depending on context.


For guided KS3 algebra practice with function machines, forming equations, and sequences, try Professor Pi at aitutors.me.