Drop a number in the top. A rule grabs it, does its one job, and a brand-new number pops out the bottom. That little in → rule → out box is one of the most powerful ideas in maths — and the doorway to algebra.
Start feeding itA function machine takes an input — a number you feed in — applies one fixed rule, and hands you back an output. Feed in 4, the rule says “× 3,” and out pops 12.
Let's name the three pieces, because you'll use these words all the way through. The input is whatever you drop in: 4, or 10, or a million. The rule is the single job the machine does to every number it meets — multiply by 3, add 5, double then take away 1. The output is what comes out the other end after the rule has done its work.
Here's the part that makes it special, and it has a fancy name worth knowing. When a machine gives you exactly one output for each input — never two answers, never a surprise — mathematicians call that machine a function. That reliability is the whole point. Feed a function the same number twice and it must hand back the same answer both times, like a vending machine that always drops the same snack for the same button.
Why bother picturing maths this way? Because nearly everything you'll meet in algebra is secretly a machine. A formula, an expression, an equation, a graph — peek inside and you'll find a number going in, a rule doing its job, and an answer coming out. Learn to think in machines now, and the rest of algebra stops feeling like a wall of symbols and starts feeling like a set of friendly little boxes. Let's build one.
This is your machine. First set its rule with the buttons and slider — say, × 3. Then choose a number and press Drop it in. Watch it fall through the rule and pop out changed. Every number you feed gets written into the table below, building an input → output record as you go. When you're ready, flip on a second step to make a two-step rule like × 3 then + 1.
| Input | The rule | Output |
|---|---|---|
| No numbers fed yet — drop one in. | ||
Notice the machine never changes its mind. With the rule set to × 3, every single input gets tripled — 4 becomes 12, 5 becomes 15, 0 stays 0. That steadiness is exactly what makes it a function: same number in, same number out, every time.
Play for a minute and a habit forms. The rule is a promise the machine makes to every number, not a special move it invents for each one. Feed it 1, 2, 3, 4, 5 with the Feed 1 → 5 button and watch the outputs march out in perfect step. That marching column of answers is your first glimpse of something huge: a single rule quietly controlling an endless line of numbers.
A rule doesn't have to be a single move. Switch on the second step in the machine above and you get a two-step rule like × 3 then + 1. The order matters, and that surprises a lot of people — so let's slow it down.
Feed 4 into × 3 then + 1. First the machine triples it: 4 becomes 12. Then it adds one: 12 becomes 13. The output is 13. But swap the order to + 1 then × 3 and the same input gives a different answer: 4 + 1 = 5, then 5 × 3 = 15. Same two jobs, different sequence, different output. A machine always does its steps in the order they're wired, top to bottom — never in whatever order feels easiest.
This is why mathematicians are so fussy about order of operations. A two-step machine is really just a careful instruction sheet: do this first, then do that. Get the order right and the answer is rock-solid every time.
And there's nothing magic about stopping at two. A machine can do three steps, or ten — multiply, add, subtract, multiply again. As long as the steps run in a fixed order, every input still has exactly one trustworthy output. Real rules in science and money are often long chains like this, which is exactly why thinking in neat little steps keeps even a complicated rule from feeling overwhelming.
A two-step rule is two jobs done in a fixed order — and the order is part of the rule.
Here's where it gets clever. Instead of one machine doing two steps, line up two whole machines so the output of the first becomes the input of the second. Set a rule for Machine A and Machine B, pick a starting number, and press Send it through to watch it flow A → B.
Two machines back-to-back behave like one bigger machine. That's the secret behind two-step rules: × 2 then + 3 is just Machine A (× 2) wired straight into Machine B (+ 3). Chaining is how mathematicians build complicated rules out of simple ones.
Try a chain that simplifies. Set both machines to multiply — say × 2 then × 3 — and the pair acts like a single × 6 machine, because tripling something you've already doubled multiplies it by six. Two adds collapse the same way: + 4 then + 5 is just + 9. Spotting when a chain folds into one simple rule is a real algebra superpower.
So far you've set rules with buttons. But mathematicians need to write a rule down so they can talk about it, share it, and use it. The trick is beautifully simple — and it's the moment maths turns into algebra.
Instead of saying “whatever number you feed in,” we just call that number a letter — usually n (for “number”) or x. Then the rule × 3 becomes 3 × n, which mathematicians shorten to just 3n. That little bundle of symbols, 3n, is called an expression: a rule frozen into writing. It means exactly what your machine does — “take the input and triple it.”
Feed numbers into the expression and you get the same outputs as the machine: when n = 4, then 3n = 12; when n = 10, then 3n = 30. The expression 3n is the machine, just written on paper. A two-step machine writes down just as neatly: × 3 then + 1 becomes the expression 3n + 1. Read it left to right and you can almost hear the machine working.
An expression like 3n + 1 is a function machine you can hold in your hand.
This is why algebra is worth the effort. A single short expression captures a rule that works for every number at once — no endless tables, no “and so on.” Once you see expressions as machines, those letters stop being scary. The n isn't a mystery to solve; it's just the slot where your input goes.
It's worth noticing the small but important difference between an expression and an equation. An expression like 3n + 1 is the machine itself, sitting quietly, ready for any input. An equation happens when you say what the output must be — for example 3n + 1 = 16 — and ask which input produced it. So an expression describes the machine, and an equation asks the machine a question. Spotting that one difference clears up a surprising amount of confusion later on.
Every machine has a mirror twin: a machine that undoes it. If the forward machine does × a then + b, the inverse machine takes the output back to the input by doing the opposite steps in the opposite order — − b then ÷ a. Set a rule and a starting number, then press Run it backwards and watch the output find its way home.
To undo a chain you reverse both the steps and their order: a machine wraps its socks then its shoes, so its inverse takes off shoes then socks. Multiply becomes divide; add becomes subtract; and the last step done is the first step undone.
Here's the quiet bombshell: running a machine backwards is exactly what solving an equation means. When a teacher writes 3n + 1 = 16, find n, they're really asking “the machine 3n + 1 spat out 16 — what did I feed in?” You undo it: take away 1 to get 15, then divide by 3 to get 5. So n = 5. You've been solving equations this whole page; the inverse machine just shows you the moves.
Now flip the whole thing around. A secret machine has fed some numbers through, and you can only see the input → output pairs it left behind. Your job: read the table like a detective and work out the hidden rule. Look at how the output changes as the input grows — that's your biggest clue.
| Input | → | Output |
|---|
Detective tip: if the output jumps by the same amount each time the input goes up by 1, there's a multiply hiding inside (the jump tells you by how much). Then check what's left over to find any add or subtract. This is the exact skill behind finding the rule for a number pattern.
This is the slip that catches almost everyone at first, so it's worth meeting head-on. It's the difference between using a machine and just memorising a few answers.
It's tempting to think “4 turned into 12, and 5 turned into 15, so the machine has a special trick for each number.” But it doesn't. It used the same single rule — × 3 — on both. A function machine never plays favourites: whatever you feed it, it does the identical job. If the rule changed from number to number, it wouldn't be a function at all — it'd just be a random list.
A true function gives exactly one output for each input. Feed 4 into a × 3 machine and you must get 12 — not 12 today and 13 tomorrow. That dependability is the whole reason functions are useful: they're a promise you can build on. One input, one answer, always.
It really does matter. “× 3 then + 1” sends 4 to 13, but “+ 1 then × 3” sends 4 to 15. Same two jobs, different sequence, different output. A machine always runs its steps top to bottom — so the order is part of what makes the rule the rule.
Function machines aren't a school invention — they're how the everyday world turns one number into another. Each card below is a real machine with a rule quietly running inside.
Start at $3, add $2 a kilometre. Distance goes in, price comes out: the rule is 2n + 3.
Buy n notebooks at $4 each. Quantity in, total out — a pure × 4 machine: 4n.
Swapping dollars for another currency multiplies by the rate. Dollars in, new money out.
A two-step machine: multiply by 1.8, then add 32. Celsius in, Fahrenheit out.
$8 a pizza plus a $5 delivery fee. Number of pizzas in, bill out: 8n + 5.
Each coin is worth 10 points. Coins in, score out — the machine just runs 10n.
Spot the pattern across all six? Every one takes an input, applies a fixed rule, and returns an output — and most can be written as a tidy expression like 2n + 3. The next time an app tells you a total, a price, or a converted measurement, picture the little machine humming behind the screen. Once you start seeing functions, you'll find them everywhere.
An input goes in — any number you choose to feed the machine.
One fixed rule does its job, the same way for every input.
One output pops out — and that rule, written down, is algebra.