In this section we demonstrate that a relation requires context to be considered a function.
#1 | #2 | #3 | #4 | #5 | |
A | Pepsi | Pepsi | Pepsi | Pepsi | Pepsi |
B | Fanta | Fanta | Sierra Mist | Sierra Mist | Sierra Mist |
C | Gatorade Blue | Gatorade Blue | Gatorade Green | Gatorade Green | Gatorade Green |
D | Coke | Coke | Coke | Coke | Coke |
E | Sprite | Sprite | Sprite | Sunkist | Sunkist |
F | Crush | Root beer | Cream Soda | Water | Water |
If you punch in a letter and number combination you know exactly what you will get; for example if you enter C5 you know you will get a green Gatorade. However, if you approach the vending machine wanting a Pepsi, then there are several options you could enter to get one; A1, A2, A3, A4, or A5.
In this example, the relationship that inputs the location of the drink you request (such as C5) and outputs the drink you get as a result (green Gatorade) would be a function. In contrast, the relation whose input is what drink you want (such as Pepsi) and outputs the location you must enter to get that drink (A1 through A5) would not be a function, because there are multiple outputs for the same input.
Note that it is perfectly natural to ask what drink is in a given location, as well as asking what location you should type in for a particular drink you want. Both of these situations are perfectly natural, and yet one is a function and one is not.
The context required to define a function has a special set of terminology in mathematics; the domain, codomain, and range, which we discuss in the next section.