In this video, we’ll learn how to use a function machine to calculate outputs, inputs, and missing operations and how function machines link to writing algebraic expressions and solving equations.
A function machine is a way of writing rules using a flow diagram. These flow diagrams might only contain one operation such as multiply or add. But they can equally contain as many operations as is required. When inputting values to function machines, you go from left to right and apply the operations in order. Let’s see what that might look like.
Use the function machine to find the output when the input is four.
Here, we have a function machine represented by two operations. We follow the directions of the arrow, so left to right. And it tells us that we take an input, add two to it, then multiply by three, and we get the output. We want to work out the output when the input is four. So, let’s follow these steps.
Since our input is four, we do four plus two, which is six. We then multiply this value by three to get the output. Six multiplied by three is 18. So, with this function machine, when the input is four, the output is 18.
We’ll now look at how we can work out unknown operations, given a function machine.
Jennifer has drawn a function machine with two different inputs as seen in the figure. Work out the missing operation that she has left out of the first box.
Here, we have the same function machine with two different inputs. When we input a value of seven, do something to it, then add seven, we get 21. And when we input a value of three, do something to it, and add seven, we get 13. So, we could use a bit of trial and error to find the missing input. But if we’re clever, we can save ourselves a little bit of time.
Notice how the final operation is add seven. So, can we work out what the middle value would have been before this operation was applied? Well, yes, we’re going to perform an inverse or opposite operation. The opposite to adding seven is to subtract seven. So, we begin by subtracting seven from each of our outputs.
21 minus seven is 14. So, the intermediate value in our first function machine must be 14. 13 minus seven is six. So, the intermediate step when we use an input of three is six. We can now ignore the second operation. And we see we have a much simpler function machine with an input of seven and three and outputs of 14 and six, respectively.
Can you spot what single operation has been applied to both the seven and the three to get their respective outputs? In fact, they’ve both been multiplied by two. Seven times two is 14, and three times two is six. And so, the missing operation here is multiplied by two. Let’s check this solution by running seven back again through the full machine.
We multiply seven by two to get 14. We then add seven to the 14, and we get 21, which is the output we were expecting. So, the missing operation is times two.
In our next example, we’ll look at the link between function machines and algebraic expressions.
The diagram below shows the operation of a number machine. Which of the following expressions describes 𝑘, the output of the number machine? Is it (A) 𝑐 plus 20 minus 15 times two, (B) 𝑐 plus 20 times two minus 15, (C) 𝑐 plus 20 minus 15 times two? Is it (D) 𝑐 minus 15 times two plus 20 or (E) 𝑐 plus 20 times two minus 15?
Here, we have a function machine representing three operations. We input a number and then follow the directions of the arrow, so left to right. And it tells us that we add 20, timesed by two, and then subtract 15 to get our output. Now, we want to evaluate the output when the input is 𝑐. So, let’s follow those steps. And we won’t panic that we have a letter instead of a number; we’ll treat 𝑐 just as if it is a number.
We begin by taking 𝑐 and adding 20 to it. That gives us 𝑐 plus 20. We then multiply by two. Now, a common mistake here would be to write 𝑐 plus 20 times two as shown. But this would mean only the 20 is being multiplied. In fact, we want the entirety of 𝑐 plus 20 to be multiplied by two. So, we add a pair of parentheses. It’s 𝑐 plus 20 all multiplied by two.
Our final step is to subtract 15. We don’t need to add any further parentheses since the order of operations tells us to multiply before subtracting. And so, we have our expression for 𝑘. It’s 𝑐 plus 20 all multiplied by two minus 15. And the correct answer that matches this is (E). Note that it might be more usual to write this as two times 𝑐 plus 20 minus 15. In this case though, either way will give us the correct answer.
In our next example, we’ll consider how we can find an input, given a specific output.
Use the function machine to find the input which gives an output of 21.
Here, we have a function machine represented by two operations. We follow the directions of the arrow, so left to right. And what this tells us is we take an input, add two to it, then multiply by three, and we get our output. Now, we’re given a specific output. So, to work out the input, given this output, we need to go backwards. We need to reverse this.
We’re going to take our output of 21 and do the opposite, the inverse operation, of multiplying by three. The opposite of multiplying by three is dividing by three. And 21 divided by three is seven. Next, we take our seven, and we do the inverse or the opposite of adding two. The opposite of adding two is subtracting two. So, we subtract two from this seven to give us five. And the input must, therefore, have been equal to five.
Now, of course, we can check our answer by running this input through the original machine and checking we do indeed get 21. We add two to the input, which is five, so five add two, which is seven. And we then multiply that seven by three, which does indeed give us 21 as required. The input which gives an output of 21 is five.
In fact, what we’ve just done is represented the inverse of our function machine. The inverse of our function machine is divide by three and then subtract two.
So, let’s have a look at another example.
Callie has drawn a function machine as shown in the figure. She wants to create an inverse function machine. Fill in the missing operations. Hence, solve the equation three 𝑥 minus four equals 62.
So, we have a simple function machine represented by two operations. Now, we shouldn’t worry about the terminology here. We take the input, which we’re saying is 𝑥. We multiply it by three and then subtract four. We then get the output, which is some function in 𝑥, 𝑓 of 𝑥.
She wants to create an inverse. Remember, that means opposite function machine. So, we need to work out the missing operations that will take us from the function 𝑓 of 𝑥 back to the original input. Remember, we’re going to be working backwards, so we’ll begin by looking at the second operation.
The second operation is to subtract four. So, what is the opposite of subtracting four? The opposite of subtracting four is adding four. So, to reverse this step, we need to put a plus four in this box. Now, let’s consider the first operation. Remember, this will be the second operation in our inverse function machine since we’re working backwards.
The first operation here is to multiply by three. So, what’s the opposite of multiplying by three. The opposite of timesing by three is dividing by three. So, the inverse function machine is as shown. We take our original function or our output. We add four to it then divide by three, and we get our original input.
The second part of this question says, hence, solve the equation three 𝑥 minus four equals 62. Now, this might seem like a little bit of a leap. But let’s just go back to our original function machine. Let’s take our input of 𝑥 and times it by three. When we do, we get three times 𝑥, which is three 𝑥. The next operation is to subtract four. When we subtract four, we get our function 𝑓 of 𝑥. Well, three 𝑥 take away four is just three 𝑥 minus four, as shown. Notice, this is the same as the algebraic expression in our equation.
And so, what this question’s really asking us is, what value of 𝑥 for the input will give us 62 as our output? And so, this means we can use our inverse function machine to calculate this value. Remember, 62 is our output. We’re going to follow the arrows on our inverse function machine. And this means we’re going to add four to 62. That gives us 66. We then follow the next arrow. And that tells us to take our value of 66 and divide it by three. Well, 66 divided by three is 22.
And so, this tells us that 𝑥 must be 22 for an output of 62. So, we can check this result by putting 𝑥 back into our original function machine. This time, we let our input be 22. And then, we multiply that by three. That gives us 66. Next, we take away four from 66, and we get 62 as required. The solution to the equation three 𝑥 minus four equals 62 is, therefore, 𝑥 equals 22.
In this video, we’ve seen that a function machine is a way of representing a series of rules or operations using a flow diagram. We’ve seen that when inputting values into function machines, you go from left to right and apply the operations in order. Very occasionally, function machines will be top down, so you’ll start at the top and apply the operations in a downwards manner. We also saw that we can reverse these steps to find inputs, given a specific output. This is called finding the inverse function machine.