Pattern Tables and Function Machines as a First Taste of Algebra
Learn how input-output tables and function machines lead naturally to variables, rules, equations and graphs.
Key takeaways
- A function machine gives exactly one output for each input, which is the core idea of a function.
- When inputs go up by 1 and outputs rise by a constant amount, that amount is the multiplier in the rule.
- A table supports a guess, and testing new inputs or studying the structure is needed to trust it.
- Running a machine backward, one step at a time in reverse order, is the same as solving an equation.
- Several different rules can match a short table, so the situation behind the numbers matters.
A function machine is a picture of a rule: you put a number in, the machine does something to it and a number comes out. A pattern table records those pairs side by side. Together they let you practice the central ideas of algebra, such as variables, rules, equations and graphs, using only arithmetic.
The appeal is that you can see a rule at work before you have to write it. Guessing the rule from the pairs, testing the guess and then writing it with a letter is a small version of what algebra does everywhere.
Building a first machine
Say a machine multiplies by 3 and then adds 2. Feed it some inputs and record the results.
| Input n | Work | Output |
|---|---|---|
| 0 | 3 × 0 + 2 | 2 |
| 1 | 3 × 1 + 2 | 5 |
| 2 | 3 × 2 + 2 | 8 |
| 3 | 3 × 3 + 2 | 11 |
| 10 | 3 × 10 + 2 | 32 |
The middle column is the bridge to algebra. Only one number changes from row to row. Replace it with n and you have the rule: output = 3n + 2. Writing that column out, instead of jumping to the answer, helps the pattern show itself.
The letter n is a variable, a symbol that can stand for any of the allowed inputs. The output depends on n, which is why it is often called the dependent quantity.
Guessing the rule from the table
Now turn the game around. You see only these pairs: (1, 7), (2, 11), (3, 15), (4, 19). What does the machine do?
Look at how the outputs change. Each step of 1 in the input adds 4 to the output, so the rule contains 4n. Compare 4n with the actual output when n = 1: 4 versus 7. The difference is 3. The rule is 4n + 3, and a check with n = 4 gives 16 + 3 = 19.
This method works when the inputs are equally spaced and the differences are constant. If the inputs jump by 2 and the outputs jump by 10, the multiplier is 10 ÷ 2 = 5.
Patterns you can build
Shapes make the rule visible. Imagine a row of squares made from toothpicks, where neighbors share a side. One square takes 4 toothpicks, two squares take 7, three take 10.
The first square needs 4, and each further square adds 3. So n squares need 4 + 3(n - 1) toothpicks. Another person might see one starting toothpick followed by n groups of 3, giving 1 + 3n.
4 + 3(n - 1)
= 4 + 3n - 3 (distribute the 3)
= 3n + 1 Both descriptions are right, and algebra confirms that they agree. With n = 20, each gives 61. This is more convincing than a table alone, because the picture explains why every new square costs exactly 3. For more examples of the same kind, see writing a rule for a growing tile pattern.
One output for each input
A rule counts as a function when each allowed input produces exactly one output. Feed the "times 3, plus 2" machine a 4 and it returns 14 every time. A "machine" that answered 14 on one try and 15 on the next would not be a function.
The reverse is allowed. Different inputs may share an output, as when a squaring machine turns both 3 and -3 into 9. Some machines also refuse certain inputs. A rule that divides 12 by the input cannot accept 0, because division by zero is undefined. The set of inputs a machine accepts is called its domain, and the set of outputs it produces is its range.
Real situations narrow the domain further. In the toothpick pattern above, you can ask about 5 squares or 50, but 2.5 squares or -3 squares make no sense, even though the expression 3n + 1 would happily return a number. Asking "which inputs are sensible here?" is a good habit to start early.
Running the machine backward
If the machine "multiply by 3, then add 2" gave 44, what went in? Undo the steps in reverse order: subtract 2 to get 42, then divide by 3 to get 14.
That is exactly the solution of 3n + 2 = 44. The last thing done is the first thing undone, much as you take off your shoes before your socks.
Reversal does not always work. A machine that squares its input gives 25 for both 5 and -5, so an output of 25 cannot tell you which went in. A machine that multiplies by 0 loses the input entirely. These cases return later when you study inverse functions and equations with two solutions.
Finding the input where two machines agree
Set two machines side by side. Machine C multiplies by 5 and adds 1. Machine D multiplies by 2 and adds 13. For which input do they give the same output?
| Input | C: 5n + 1 | D: 2n + 13 |
|---|---|---|
| 1 | 6 | 15 |
| 2 | 11 | 17 |
| 3 | 16 | 19 |
| 4 | 21 | 21 |
| 5 | 26 | 23 |
They match at n = 4. Before that, D is ahead; afterward, C is ahead, because C gains 3 more than D with every step. The starting gap at n = 1 is 9, and closing 3 per step takes three steps.
In symbols, the question is 5n + 1 = 2n + 13, which gives 3n = 12 and n = 4. A table is a fine way to search, but it struggles if the answer is a fraction such as 2.75. Solving the equation finds it directly, which is a good reason to learn the symbolic method.
Chaining machines and changing the order
Connect two machines so the output of the first feeds the second. Let A add 4 and B double.
- A then B: n becomes n + 4, then 2(n + 4) = 2n + 8.
- B then A: n becomes 2n, then 2n + 4.
With n = 1, the first chain gives 10 and the second gives 6. Order matters. This explains why parentheses are needed, and it previews composition of functions.
Falling patterns and uneven inputs
Outputs can go down as well. Suppose a candle is 20 centimeters tall and, in a simplified model, burns down 2 centimeters each hour.
| Hours h | 0 | 1 | 3 | 6 |
|---|---|---|---|---|
| Height in cm | 20 | 18 | 14 | 8 |
From h = 1 to h = 3, the height falls by 4 over 2 hours, which is -2 per hour. From 3 to 6, it falls by 6 over 3 hours, again -2 per hour. The rule is height = 20 - 2h. The model reaches zero at h = 10 and means nothing after that.
Notice that the raw output differences, -2, -4 and -6, are not equal. You have to divide each by the change in input before comparing. That quotient, change in output divided by change in input, is the rate of change. On a graph of a straight-line rule it is the slope.
The starting value 20 is the output when the input is 0. If a table does not include 0, step backward from a known row using the rate.
Not every pattern is a straight climb
Some tables have changing differences. For inputs 1, 2, 3, 4 with outputs 1, 4, 9, 16, the differences are 3, 5, 7. They are not constant, so no rule of the form an + b fits. The rule is n². The differences of the differences are all 2, a clue that the rule involves a square.
In a table such as 2, 4, 8, 16, each output is double the one before. Here the constant thing is a ratio, which points to an exponential rule, 2ⁿ for n = 1, 2, 3, 4. A comparison of these behaviors appears in linear, quadratic and exponential patterns in tables.
Why a few rows cannot prove a rule
Take the pairs (1, 1), (2, 2), (3, 3). The obvious rule is "output equals input." But the rule n + (n - 1)(n - 2)(n - 3) fits those three rows too, because the added product is zero at n = 1, 2 and 3. At n = 4 it gives 4 + 3 × 2 × 1 = 10.
So a table can suggest a rule and can disprove one, but a handful of rows cannot settle it. A reason from the situation, such as how the toothpick shape grows, is what makes a rule trustworthy. In puzzle questions that ask for "the next number," the usual intention is the simplest rule, and it is fair to say which rule you assumed.
Trying it yourself
Here is a game for two people.
- One player invents a secret rule with at most two steps.
- The other suggests inputs, one at a time, and hears the outputs.
- The guesser records a table and proposes a rule in words, then with a letter.
- The inventor tests the proposed rule on a new input.
- Switch roles.
Smart inputs help: 0 reveals the constant term of a rule like 5n - 1, since the output is -1. Then input 1 gives 4, which is 5 more.
To graph a machine, treat each pair as a point. Constant differences produce points on a line, which leads to graphing from a table of values. For the meaning of the letter itself, see what a variable is, and for the larger change in outlook, read about moving from arithmetic to algebraic thinking.