**Imagine a time when** you have been *really* thirsty, craving your favorite drink. You finally find a vending machine and insert the required fee, excited to receive that longed-for drink. You press the button for your beverage of choice, but alas, a different item is dispensed than that which you had expected! Or perhaps nothing at all was given. This might make you stop and think about how a vending machine works. How is it that we can predict—on the basis of the button pressed—which item will be released? As a matter of fact, vending machines are programed with functions that assign to each button pressed a particular item to dispense. Given that vending machines are a common experience for students in today's world, they provide a wonderful context on which to build the concept of function.

Functions are fundamental to mathematics. As such, they are explored repeatedly throughout upper elementary and middle school grades. Before having been formally introduced to the concept of function, students explore patterns and represent them using words, algebraic expressions, tables of values, and graphs. Once in eighth grade, students are expected to understand the concept of function, and they begin to develop a definition of function (NGA and CCSSO 2010, 8.F.A.1). Because this work lays the foundation for high school, Cooney, Beckman, and Lloyd (2010) explain that our goal as teachers should be to assist students in the development of an understanding that (1) functions are a single-valued mapping from the domain to the range, (2) functions apply to a wide range of situations, and (3) the domain and range of a function do not necessarily have to be numbers.

In this article, we demonstrate how removing algebraic representations and mathematical conventions, such as the vertical line test, and focusing on a real-world context can support students' development of essential understandings of the function concept. To do this, we present a lesson that engages students with a GeoGebra-based applet using a vending machine context that was implemented with eighth-grade students.

## FUNCTION MACHINES

Using a machine metaphor for introducing functions is not new. Previous NCTM publications have explored introducing the concept of function using “function machines” and “Guess My Rule” machine activities (Edwards and Nickell 2014; Huinker 2002; Reeves 2005). The machine metaphor generally follows the structure in which the user puts something into the machine (an input), then the machine uses a “rule” to determine and give to the user the result (the output). This machine metaphor for function not only appears in many textbooks (see figure 1), but has manifested in the construction of machines using milk cartons (see figure 2) and applets (see figure 3). What these manifestations of the machine metaphor have in common is the use of numbers for inputs and outputs and algebraic expressions for the machine “rule.” The machine metaphor and corresponding table of values are helpful representations of function, but they are limited if taken alone. As students progress through high school, they tend to view functions as equations or graphs (Carlson 1998) and rely heavily on the vertical line test to distinguish functions from nonfunctions (Fernández 2005). Furthermore, students tend to focus on individual coordinate points associated with the function rather than considering the domain and range as a whole, thus developing only a numerical representation of function (Vinner and Dreyfus 1989).

## THE VENDING MACHINE APPLET

To help students develop an understanding of the concept of function without focusing on specific representations, we developed a nonnumerical machine to examine functions and nonfunctions. By removing the numeric and algebraic representations, we intended that students attend to the nature of and relationship between input and output, without forming a reliance on algebraic procedures absent an understanding. Our machine uses a vending machine metaphor, because this is something that students are familiar with from their daily lives (see figure 4). The vending machine applet Introduction to Function is a GeoGebra book consisting of eight pages (https://ggbm.at/uR9uFreX [see Appendix A in the supplement online for links to and coding for individual pages]). Each vending machine contains four buttons (Red Cola, Diet Blue, Silver Mist, and Green Dew). When a button is pressed, it produces none, one, or more than one of the four different colored cans (red, blue, silver, and green). Instructions on the screen direct students to press the Take Can button each time a can is dispensed. The design of each page of the applet, the directions for each page, and the mapping of inputs and outputs for each machine is displayed in table 1.

Design of a Vending Machine Applet

This One Is a Function | This One Is Not a Function | |||

Page 1 | A | Red Cola → red Diet Blue → blue Silver Mist → silver Green Dew → green | B | Red Cola → red Diet Blue → blue Silver Mist → random color Green Dew → green |

This One Is a Function | This One Is Not a Function | |||

Page 2 | C | Red Cola → blue Diet Blue → red Silver Mist → silver Green Dew → green | D | Red Cola → red Diet Blue → random color Silver Mist → silver Green Dew → green |

Which One Is a Function? | ||||

Page 3 | E | Red Cola → red Diet Blue → blue Silver Mist → silver Green Dew → random color | F | Red Cola → silver Diet Blue → green Silver Mist → red Green Dew → blue |

Which One Is a Function? | ||||

Page 4 | G | Red Cola → random color Diet Blue → random color Silver Mist → random color Green Dew → random color | H | Red Cola → blue Diet Blue → silver Silver Mist → green Green Dew → red |

Which One Is a Function? | ||||

Page 5 | I | Red Cola → 2 silver cans Diet Blue → green Silver Mist → red Green Dew → blue | J | Red Cola → red Diet Blue → blue and random color Silver Mist → silver Green Dew → green |

Which One Is a Function? | ||||

Page 6 | K | Red Cola → pair of random color Diet Blue → blue Silver Mist → silver Green Dew → green | L | Red Cola → green Diet Blue → green Silver Mist → green Green Dew → green |

Page 7 |
| |||

Are these functions? | ||||

Page 8 | M | Red Cola → red Diet Blue → red Silver Mist → silver Green Dew → silver | N | Red Cola → red Diet Blue → blue Silver Mist → silver Green Dew → red and green |

The first two pages of the GeoGebra applet each display one vending machine that is a function and one vending machine that is not a function, and each is labeled accordingly. These pages were designed to give students examples of functions and nonfunctions to help them begin to form an understanding of the difference between the two. These pages are essential because middle school students have had little or no previous experience with the term *function*. On the next four pages, the directions change and ask the student to identify which machine is a function. These pages continue to include two vending machines on each page, one machine modeling a function and one, a nonfunction.

## IN THE CLASSROOM

We implemented this vending machine applet task in an eighth-grade mathematics classroom during one 45-minute class period (see figure 5). To launch the vending machine applet task, one must ensure that students understand both the *key contextual features and mathematical ideas* on which they will be focusing (Jackson et al. 2012). To do so, we took students to look at a vending machine down the hall and talked about how it works (i.e., you press a button; depending on which button you press, something happens inside the machine; and then an object is dispensed).

Next we opened up the vending machine applet and took a few minutes to talk about the mathematical ideas represented in the applet. Students were invited to press the buttons and observe what happened. We reminded students to be sure to press the Take Can button after each cola selection so the machine would not jam and so they could clearly see what happens when they make their next selection. As students continued to explore, we asked them to share what they noticed and what they wondered about. Within this brief conversation, we were careful to introduce some mathematical language. As a class, we came to an agreement that pressing a button on the vending machine would be referred to as an *input* and that the object(s) dispensed based on that button press would be referred to as *outputs*. We explained to students that they were being given the task of exploring the two machines on the page and determining why one machine was labeled *function* and the other, *not a function*.

Once everyone had examined the first two pages of the applet (machines A, B, C, and D) and recorded their ideas on the activity sheet (see https://ggbm.at/uR9uFreX [see Appendix B online), we led a whole-class discussion during which students shared their initial conjectures. In each class, these conjectures differed. In some classes, students focused on the machines that were functions as they noticed a certain pattern or rule being observed. In other classes, students' conjectures focused on the “randomness” of one of the machines in the pair given. Examples of student conjectures include the following:

- “If there isn't a rule, it isn't a function.”
- “If the output is always the same when you press a button, then it is a function.”
- “It is a function if it is proportional. I mean, if you put in the same money, you get your money's worth out.”

As students shared their conjectures, we prompted them to include explanations of what actions they took with the machine and what they noticed when they did so that led to the conjecture. This brief discussion was intended to give students access to their classmates' ideas, compare them to their own, reinforce their use of mathematical language (i.e., input, output), and ensure that everyone was fully exploring the machines (i.e., pressing each button more than once).

From this point on, students continued working in pairs to test their conjectures with each machine and record their answers on the activity sheet. After page 6 of the applet, students were prompted to stop and write a definition of function on the basis of their exploration. For those students who had worked more quickly than their peers, two additional challenge machines were provided for further exploration. These extra machines allowed for all students to be engaged in thinking about function until everyone had an opportunity to write a definition of function.

Once all student pairs had recorded their definition of function, we held a whole-class discussion in which carefully selected definitions were shared and tested against various machines in the applet. We finally came to a class consensus of our “official” definition (Smith et al. 2009): “A function is a rule that for each input, there is consistent output.” This definition was recorded and used by everyone as we progressed in our function unit.

## STUDENTS' STRATEGIES WITH THE APPLET

While students worked through this task, a variety of common strategies and behaviors occurred. To investigate why machine A was a function and machine B was a nonfunction, students would often click each button (e.g., Red Cola) only once. However, they quickly realized that they were unable to determine why machine B was not a function. Students then began testing the machines in one of two ways: (1) They pressed a single button repeatedly (e.g., Red Cola) and observed whether the same color of can was produced each time, or (2) they pressed each one of the four buttons once in a sequence and looked holistically for a consistent pattern of cans. In both cases, students would often click each button several times before being completely convinced.

After determining a productive method by which to test the machines, students often used context to form an initial understanding of the applet. If a machine did not produce the “correct” output (e.g., Red Cola → blue), some students initially claimed that the machine did not represent a function. However, as students progressed through the task, this context played less of a role in their problem-solving process, and students focused more on the consistency of the outputs. If a machine produced two cans for a given button, some students initially believed that this could not be a function because they envisioned two cans as representing two outputs.

To get a sense of how students made sense of the early pages of the applet, we considered machines C and D. Students were initially confused by the behavior of machine C (Red Cola → blue, Diet Blue → red) as they noticed that Red Cola and Diet Blue appeared to be mismatched. One student even claimed that “you should get what you want” while pressing the buttons on machine C. Given this dilemma, most students moved on to machine D to compare. Some students initially said that machine D represented a function because all the buttons appeared to “work” when they were pressed. (To “work” in this sense meant that the buttons produced the color of cans that matched the buttons.) However, after pressing all the buttons a few more times, students noticed that Diet Blue was producing random cans. Using the idea of randomness to support why machine D was labeled “not a function,” they tended to return to machine C to give it more thought. Typically, students would then progress to the conclusion that machine C does, in fact, represent a function. By the time we gathered students together to discuss their conclusions, all were convinced that machine C was a function, explaining that “each button produces the same can every time it is pressed.”

Another interesting moment in the task was when students were confronted with machine L. This machine initially caused confusion for most students because every button pressed resulted in a green can. We anticipated that this machine would be troubling because it is consistent with the misconception that constant relations are not functions. Nevertheless, after returning to their conjectures about functions, most students concluded that machine L does, in fact, represent a function, because “everything is Green Dew—you just always get green.”

## DEVELOPING AN INFORMAL DEFINITION OF FUNCTION

After each student pair had written a definition of function, we had to decide how to facilitate the class discussion. As we examined students' definitions, we realized that most were incomplete in some sense. This was not surprising to us because this applet was designed to be the students' first experience with the concept of function. Even so, all the student pairs had captured certain important characteristics of functions. Five samples of student definitions are shown in figure 6. Although we could have taken this discussion in many directions, we chose to focus on one particular aspect of the student definitions—namely, attention to output—that we recognized as often misunderstood yet important in the formalization of the definition of function. As such, we highlighted such phrases as *same output, same output every time*, and *the input is consistent with the output* and discussed the similarities and differences in these phrases and how they would be used to make sense of machines like I and L. This discussion resulted in a collaboratively created class definition of function that stated, “A function is a rule that for each input, there is consistent output.”

## TRANSITIONING TO AN ALGEBRAIC CONTEXT

To encourage continued development of a deep understanding of the concept of function, we followed up the Vending Machine task with two other activities before examining graphical representations of functions. The first activity was a “function sort” (see figure 7). Each mapping was printed on a card. Students were asked to sort the mappings into functions and nonfunctions. This allowed students to consider and apply their definition of function to other contexts and representations beyond the vending machine context. Because students' initial experiences were with dynamic representations via the applet, these mappings helped students understand how a consistent output can be demonstrated in a static representation. We then engaged students with a typical function machine (see figure 3) and asked them to determine the rule for each function machine given. We feel these experiences deepened students' understanding of function and introduced students to mapping representations before introducing graphical representations of functions.

## CONCLUSION

The purpose of this lesson was to introduce students to the concept of function in a context in which they had no algebraic conventions to fall back on. We chose a vending machine context so that we could capitalize on students' shared experiences. Although it did not use algebraic representations, the vending machine applet was designed to align with Cooney, Beckman, and Lloyd's (2010) *essential understandings* of the function concept. This allowed us to use it to support students as they developed a conceptual understanding of what it means to be a function before students had yet begun to focus on procedures typically associated with algebraic representations, such as the vertical line test.

The vending machine analogy provides a strong foundation for developing an initial recognition of function, yet it is not a model on which we can continue to build an understanding of different characteristics of function, function families, and other related concepts. At some point, the model becomes insufficient, necessitating the use of standard representations. Even so, we believe that the benefits of this lesson outweigh the limitations. Further, we believe that this lesson provides a solid foundation on which the transition to function machines using algebraic representations will build (e.g., Edwards and Nickell 2014; Huinker 2002; Reeves 2005), supporting students as they continue their journey with functions.

## REFERENCES

Carlson, Marilyn P. 1998. “A Cross-Sectional Investigation of the Development of the Function Concept.”

*Research in Collegiate Mathematics Education III, Issues in Mathematics Education*7, no. 1 (February): 115–62.Cooney, Thomas J., Sybilla Beckman, and Gwendolyn M. Lloyd. 2010.

*Developing Essential Understanding of Functions for Teaching Mathematics in Grades 9–12*. Reston, VA: National Council of Teachers of Mathematics.Edwards, Michael Todd, and Jennifer Nickell. 2014. “Teaching Students about Functions with Dynagraphs.”

*Mathematics Teaching in the Middle School Blogarithm*. August 16, 2014. http://www.nctm.org/Publications/Mathematics-Teaching-in-Middle-School/Blog/Teaching-Students-about-Functions-with-Dynagraphs/.Fernández, Eileen. 2005. “Understanding Functions without Using the Vertical Line Test.”

*Mathematics Teacher*99, no. 2 (September): 96–100.Huinker, DeAnn. 2002. “Calculators as Learning Tools for Young Children's Explorations of Number.”

*Teaching Children Mathematics*8, no. 6 (February): 316–21.Jackson, Kara J., Emily C. Shahan, Lynsey K. Gibbons, and Paul A. Cobb. 2012. “Launching Complex Tasks.”

*Mathematics Teaching in the Middle School*18, no. 1 (August): 24–29.National Governors Association Center for Best Practices (NGA Center) and Council of Chief State School Officers (CCSSO). 2010.

*Common Core State Standards for Mathematics*. Washington, DC: NGA Center and CCSSO. http://www.corestandards.org.Reeves, Charles A. “Putting Fun into Function.” 2005/2006.

*Teaching Children Mathematics*12, no. 5 (December/January): 250–59.Smith, Margaret S., Elizabeth K. Hughes, Randi A. Engle, and Mary Kay Stein. 2009. “Orchestrating Discussions.”

*Mathematics Teaching in the Middle School*14, no. 9 (May): 548–56.Vinner, Shlomo, and Tommy Dreyfus. 1989. “Images and Definitions for the Concept of Function.”

*Journal for Research in Mathematics Education*20, no. 4 (July): 356–66.

**Jennifer N. Lovett**, jennifer.lovett@mtsu.edu, is an assistant professor of mathematics education at Middle Tennessee State University in Murfreesboro.

**Allison W. McCulloch**, amccul11@uncc.edu, is an assistant professor of mathematics education at the University of North Carolina at Charlotte. She and Lovett are interested in helping teachers implement tasks that incorporate technology effectively in their classrooms.

**Blain A. Patterson**, pattersonba@vmi.edu, is an assistant professor of applied mathematics at Virginia Military Institute. He is interested in how teacher knowledge of advanced mathematics informs teaching practices.

**Patrick S. Martin**, martinp@rcschools.net, is a high school mathematics teacher in Murfreesboro, Tennessee. He is interested in enhancing the statistical literacy of high school students.