Year 7 · Unit 3 Patterns, expressions and equations · Lesson 5 of 6

What goes in, and what comes out?

A function machine takes a number, does one or two steps to it and gives a number back. Run it forwards, then run it backwards to find what must have gone in.

Number and AlgebraNo calculator

Warm-up

Three quick ones from earlier work. Try each in your head or on paper before you open the answer.

  1. From Unit 3, lesson 2, letters and expressions. Work out 3n + 5 when n = 9.
    Answer32. 3 × 9 = 27, then 27 + 5.
  2. From Unit 3, lesson 4, collecting like terms. Simplify 4a + 3 + 2a.
    Answer6a + 3. 4a and 2a are like terms; the 3 is on its own.
  3. From Unit 1, factors and multiples. What is the greatest common factor (GCF) of 12 and 18?
    Answer6. The factors of 12 are 1, 2, 3, 4, 6, 12 and the factors of 18 are 1, 2, 3, 6, 9, 18.
Words used in this lesson
function machine
a rule that turns each input into one output. For example: multiply by 4, then add 3.
input
the number that goes in. For example: 5 in the machine multiply by 4 then add 3.
output
the number that comes out. For example: 23.
rule
what the machine does, written as an expression. For example: 4x + 3.
inverse
the step that undoes another. For example: subtract 3 undoes add 3.
order
which step comes first. For example: multiply then add is not add then multiply.

A rule with an input and an output

A kiosk in Dhaka sells mobile data: 40 taka for every gigabyte, plus a fixed 20 taka fee. Whatever number of gigabytes you ask for, the kiosk follows the same steps. A function machine is the maths picture of this. A number goes in, the machine does its steps in order, and one number comes out. The rule is the expression for what the machine does to the input.

Predict first: the machine multiplies by 4 and then adds 3. What comes out when 5 goes in? Then check, and try swapping the order of the steps.

4
3
5
20after the first step
23output

Input 5: × 4 gives 20, then + 3 gives 23.

Show me the steps
  1. Input 5 with × 4 then + 3: 5 × 4 = 20, then 20 + 3 = 23. The rule is 4x + 3.
  2. The same machine, input 0: 0 × 4 = 0, then 0 + 3 = 3. The output is just the second step.
  3. Input 12: 12 × 4 = 48, then 48 + 3 = 51.
  4. Swap the steps, + 3 then × 4, with input 5: 5 + 3 = 8, then 8 × 4 = 32. A different machine with a different rule, 4(x + 3).
  5. × 6 then + 9 with input 12: 12 × 6 = 72, then 72 + 9 = 81.

The order of the steps is part of the machine. Multiply by 4 then add 3 has the rule 4x + 3. Add 3 then multiply by 4 has the rule 4(x + 3). Same two steps, different machine.

To run a machine backwards, undo each step with its inverse (add and subtract undo each other, and so do multiply and divide), and undo them in the reverse order. The last step done is the first step undone.

A position rule is a machine too: n goes in, × 4, then + 1, and 4n + 1 comes out. “Which term is 41?” runs that machine backwards.

Finding the input

If you know the output, you can work out the input by running the machine backwards. Choose an output and see the two undoing steps.

4
3
27
24after undoing the add
6the input

Output 27: undo + 3 to get 24, then undo × 4 to get 6. Check: 6 × 4 + 3 = 27.

Show me the steps
  1. × 4 then + 3 with output 27: 27 − 3 = 24, then 24 ÷ 4 = 6. The input was 6.
  2. Output 3: 3 − 3 = 0, then 0 ÷ 4 = 0. The input was 0.
  3. Output 20: 20 − 3 = 17, then 17 ÷ 4 = 4.25. This is not a whole number, so no whole-number input gives 20.
  4. × 3 then + 5 with output 50: 50 − 5 = 45, then 45 ÷ 3 = 15. The input was 15.
  5. × 4 then + 3 with output 2: the + 3 alone gives at least 3, so no input of 0 or more gives 2.

A common mistake: “To undo multiply by 3 then add 2, divide by 3 then take away 2.” The inverse steps are right, but the order is wrong. The last step went in last, so it comes out first: take away 2, then divide by 3. Check by running the machine forwards.

Back to the kiosk. 3 GB costs 3 × 40 + 20 = 140 taka. A customer paid 220 taka, so run it backwards: 220 − 20 = 200, then 200 ÷ 40 = 5 GB.

Worked example: forwards and backwards

A machine multiplies by 6 then subtracts 4. What is the output for input 9, and what input gives output 50?

  1. Forwards, input 9: 9 × 6 = 54, then 54 − 4 = 50.
  2. Backwards, output 50: undo the last step first. Undo − 4 by adding 4: 50 + 4 = 54.
  3. Then undo × 6 by dividing by 6: 54 ÷ 6 = 9.
  4. The two answers agree: input 9 gives 50 and output 50 comes from 9.

Your go. The first step is given. A machine divides by 2 then adds 7. The output is 15. What was the input?

  1. Undo the last step first: the last step was + 7, so subtract 7 from 15.
  2. Now undo the first step, then check by running your input forwards.
Check the answer

15 − 7 = 8, and undoing ÷ 2 means × 2: 8 × 2 = 16. Check: 16 ÷ 2 = 8, and 8 + 7 = 15.

Check before you go on

1. A machine multiplies by 3 and then subtracts 4. What comes out when 6 goes in?

Your turn

Start at Level 1 and go as far as you can. A wrong answer gets a reason, not just a cross: read it, then try again.

Level 1 · Getting started

2. A machine multiplies by 5 and then adds 2. What is the output when the input is 7?

3. A machine multiplies by 4 and then subtracts 5. The output is 19. What was the input?

Level 2 · Building

4. A tailor in Lagos charges 800 naira for each metre of cloth and 1500 naira for the work. A suit uses 3 metres. How many naira is that?

5. A rule for estimating temperature counts the cricket chirps in 25 seconds, divides by 3 and then adds 4, giving degrees Celsius. How many degrees Celsius is it when there are 48 chirps?

6. Which machine undoes “multiply by 6, then add 5”?

Level 3 · Stretch

7. Machine P multiplies by 5 and then subtracts 3. Machine Q multiplies by 2 and then adds 9. For which input do P and Q give the same output? Try inputs from 1 upwards.

8. A machine multiplies by 4 and then adds a number. The input 6 gives the output 31. What number does the machine add?

Something to think about

Machine A adds 3 and then doubles. Machine B doubles and then adds 6. Try inputs 1, 5 and 10 in both. What do you notice, and can you say why?

One way to think about it

A gives 8, 16, 26 and B gives 8, 16, 26. They do the same job. Adding 3 and then doubling is 2(x + 3), which is 2x + 6: the same as doubling first and then adding the doubled 3, which is 6.

Exit ticket

9. A machine multiplies by 3 and then adds 2, and the output is 20. Priya writes the input as 20 ÷ 3 − 2. Which reply is right?