The Cafeteria Vending Machine Analogy

The Cafeteria Vending Machine Analogy
When you buy snacks from a vending machine, you push a button (your input) and out comes your snack (your output).
Let’s pretend that C4 corresponds to Goldfish. If you input C4, you would expect to get a pack of Goldfish crackers as
your output. If you entered C4 and sometimes the machine spits out Popcorn and other times it spits out Goldfish, you
would say the machine is “not functioning” – one input (C4) corresponds to two different outputs (Goldfish and Popcorn).
input
C4
output
Goldfish
Popcorn
Not a function!
Let’s look at what a diagram might look like for a machine that is “functioning” properly:
input
B2
C4
D6
independent variable
output
Popcorn
Goldfish
Poptart
A Function!
dependent variable
In this situation, each input corresponds to exactly one output.
Function: A rule that assigns to each input exactly one output.
Input: the number or independent variable that is put into a function (the button pushed on vending machine)
Output: the number or dependent variable that is the result of an input of a function (the snack you get)
Let’s look at some scenarios with a Candy machine. This can be represented by the following diagram:
input
E3
A4
D6
output
Twix
It is a FUNCTION!
pushed button
A6
B4
C3
D5
candy
Almond Joy
M & M’s
Butterfinger
It is NOT a FUNCTION!
independent
H10
J8
K3
L2
dependent
Mounds
Snickers
Twix
It is a FUNCTION!
There are times that different inputs will lead to the same output. In the case of the candy machines,
companies often stock popular items in multiple locations in the machine. However, if each input has only one
output, it is still considered a function.