Function machines

A flow diagram (also called a function machine) takes an input number, does a rule to it and gives an output number. If you know any two of the input, the rule and the output, you can find the third.

Key facts

  • Input → rule → output: do the rule to the input to get the output.
  • A rule can have two steps, like × 3 then + 1. Do the steps in order, from left to right.
  • To find the input, work backwards from the output: undo each step with the inverse operation, last step first.
  • The inverse of + is −, and the inverse of × is ÷.
  • To find a rule, look at how each input changes into its output. Check the rule works for every pair.
  • A table of values lists inputs and their outputs. The rule must work for every column.
  • A rule can be written as a formula, like y = 3x + 1: x is the input and y is the output.

Worked examples

Example 1

The rule is × 4. The input is 6. What is the output?

  1. Put 6 into the flow diagram.
  2. Multiply by 4. 6 × 4 = 24
  3. The output is 24.

Answer: 24

Example 2

The rule is × 3 then + 2. The input is 5. What is the output?

  1. First step: multiply by 3. 5 × 3 = 15
  2. Second step: add 2. 15 + 2 = 17
  3. The output is 17.

Answer: 17

Example 3

The rule is × 3 then + 2. The output is 23. What was the input?

  1. Start at the output and undo the last step: + 2 becomes − 2. 23 − 2 = 21
  2. Undo × 3 with ÷ 3. 21 ÷ 3 = 7
  3. Check: 7 × 3 = 21 and 21 + 2 = 23. The input was 7.

Answer: 7

Example 4

A function machine turns 1 into 3, 2 into 6 and 4 into 12. What is the rule?

  1. Each output is 3 times its input. 1 × 3 = 3, 2 × 3 = 6, 4 × 3 = 12
  2. Adding does not work for every pair: 1 + 2 = 3 but 2 + 2 is not 6.
  3. So the rule is × 3.

Answer: × 3

Example 5

Complete the table for the rule × 2 then + 1. What output goes with the input 6?

  1. 1 × 2 + 1 = 3, 2 × 2 + 1 = 5, 3 × 2 + 1 = 7. 3 × 2 + 1 = 7
  2. For 6: 6 × 2 + 1 = 13. 6 × 2 + 1 = 13

Answer: 13

Example 6

The rule is y = 3x − 4. Find y when x = 5, and find x when y = 20.

  1. Put x = 5 into the formula. y = 3 × 5 − 4 = 11
  2. For y = 20, undo − 4 then × 3. 20 + 4 = 24, 24 ÷ 3 = 8
  3. So y = 11 when x = 5, and x = 8 when y = 20.

Answer: y = 11; x = 8