Authentic Lessons for 21st Century Learning

Junk Food Junction: What's Your Function?

Functions (Domain and Range)

Brittany VanCleave, Amber Stokes | Published: May 31st, 2022 by K20 Center


This lesson breaks down the components of a function through the metaphor of a function "machine." Students will design their own function vending machines, identify the products they will sell and the prices of those products, and evaluate each others' machines to build a function from the information provided, identifying the domain and range and independent and dependent variables.

Essential Question(s)

How can you represent and describe functions?



Students brainstorm ideas for a vending machine.


Students discover patterns by playing the Function Machine game.


Students develop an understanding of the components of a function: domain, range, independent variables, and dependent variables.


Students create advertisements for their vending machines, incorporating the various function components.


Students engage in a Gallery Walk to view other students' advertisements and evaluate the functions for the various vending machines.


  • Lesson slides (attached)

  • 3-2-1 handouts (attached, cut so that each student receives a half sheet)

  • Devices with Internet access

  • Function Machine handouts (attached, one per student)

  • Markers or colored pencils

  • Copy paper, or copies of the Vending Machine Advertisement handout (attached, one sheet per student)

  • Sticky notes (one per student)

  • Vending Machine Gallery Walk handouts (attached, one per student)


Use the attached Lesson Slides to guide the lesson, beginning with slide 2. To start the activity, write the following question on the board: If you could create any vending machine, what would the product be, and how much would it cost?

Pass out a copy of the 3-2-1 handout to each student. Students will work individually to brainstorm ideas for their own vending machines, using the 3-2-1 prompts to help guide their thinking. Students should consider what products they want to sell and the cost of those products. They should also consider the more unique and creative aspects of the machine, such as the colors, lighting features, and payment methods.


Go to slide 3. Assign each student a partner, make sure each pair has access to an Internet-connected device, and pass out copies of the Function Machine handout. Have students access the Function Machine game from the Math Playground website. Walk students through how to set up the game, and play a round or two with them until they feel comfortable navigating the game independently and begin seeing the pattern. Give the pairs time to play three or four more rounds on their own. As they play, have them write their input and output and the function on the handout.


Go to slide 4. After students have had opportunities to play a few rounds of the Function Machine game, come back together for a whole-class discussion. Ask each pair to talk about the different functions they created, and then have them answer the question, "Based on your experience with the Function Machine activity, how would you define 'function'?"

Write student answers on the board, and then, as a whole class, narrow down the ideas into a few bullet points.

Now that you have a working definition of a function, it's time to dive into the components of a function. Go to slide 5, where there is a chart set up with one column being the domain and the other column being the range. As you did with the definition of a function, work with the class to develop definitions for "domain" and "range." To guide students toward the definitions, consider adding examples to the slide or using the function machine to find the domain and range for different functions.

Go to slide 6. Repeat a similar process to define "independent variable" and "dependent variable."


Go to slide 7. Students will now return to the vending machine ideas that they proposed on their 3-2-1 handouts and create advertisements for their vending machines. Advertisements should include all of the following:

  • The name of the vending machine

  • A picture of the vending machine

  • A description of the products being sold

  • The cost of the products

  • A pitch explaining why someone would want to buy the products

Emphasize the importance of the product and cost in students' advertisement design. Let them know that they will be identifying the domain and range and independent and dependent variables for their peers' (function) vending machines. So, they need to include enough information to enable other students to write a function based on their products. For example: "If I put one dollar in, I get two pieces of candy. If I put two dollars in, I get four pieces of candy."

After students have had time to work on their advertisements, pass out a sticky note to each student. Ask students to write down the function for their own machines, and then put the sticky note away for use as an answer key later in the lesson.


Go to slide 8 and pass out copies of the Vending Machine Gallery Walk handout. Have class members post their completed advertisements on the wall around the room (or display them on their devices). Students will complete a Gallery Walk to evaluate other students' vending machine creations by identifying the domain and range and independent and dependent variables. Students will also create a function based on the input and the output of each vending machine.

When students have finished filling in their handouts, conclude the lesson by having students get out their sticky notes and share the functions for their own vending machines in order for the other students to check their work.