Lesson 10: Making Histograms

Lesson 10: Making Histograms


Students will understand that a histogram represents observations grouped into bins, and that bars are drawn to show how many observations (or what proportion of the observations) lie in each bin, rather than representing individual observations, as in a dotplot.


  1. Peanut butter

  2. Jelly

  3. Loaf of sliced bread

  4. Butter knife

  5. Plate

  6. Sleep dotplots (from lesson 9)

  7. Poster paper

  8. Markers


algorithm, histogram, bin(s), bin widths, output, input, left-hand rule, right-hand rule

Essential Concepts:

Essential Concepts:

Histograms can be created through the use of an algorithm. The distributions displayed in a histogram can be classified using the technical terms for the shapes of distributions. Learning to describe routine tasks through an algorithm is an important component of computational thinking.


  1. Inform students that they will be telling us how to make a sandwich today. Giving clear, concise instructions to others is an important skill for students to learn. In this activity, students will practice using descriptive vocabulary, communicating ideas to others, recognizing steps in a process, and recognizing the importance of the use of clear language.

  2. Prepare for this task by gathering the necessary materials for making a peanut butter and jelly sandwich and arranging them in a way that makes them easy to use. You may want to wear an apron and have a trash bag smock —this can get messy but that’s most of the fun!

    Note: Be aware of peanut allergies! If any of your students are allergic to peanut butter, DO NOT ALLOW STUDENTS TO HANDLE THE PEANUT BUTTER! Peanut allergies can be very serious and children can have reactions without even eating it. So be aware and be careful!

  3. Ask your students if they have ever followed a recipe before.

    1. What kinds of things have they made?

    2. Does anyone know how to make a peanut butter and jelly sandwich?

    3. Would they teach you how?

    4. Would they give you all the steps to make a sandwich?

  4. Show your students the materials you have for making a sandwich. Have students take out paper and pencils and ask each student (or pair of students) to write down their instructions for making a peanut butter and jelly sandwich. We can also call these instructions an algorithm.

  5. Explain to students that precise instructions for any process are like a formula to follow in order to get the same results each time. Also, an algorithm is how we communicate with the computer. The teacher will function as the computer. Your job is to give him/her rules so that he/she can carry out and successfully make a PB&J sandwich.

  6. Every algorithm needs input and produces output. The output here will be a PB&J sandwich. What is the input? Steps, or actions to follow.

  7. Tell students that when they are done you will select someone to share their instructions and you will make a sandwich following the instructions.

  8. Select a student to read their instructions, and do EXACTLY what it says. For example, if it says “put the peanut butter on the bread,” you can literally put the jar of peanut butter on the bag of bread. There was no instruction to open the bread or the jar of peanut butter, no instruction to use the knife in any way, etc. Listen for other examples of unclear instructions and think of how you might act them out. If students are not clear about where to spread the peanut butter, put it on the crust. The more literal you are by doing exactly what the instructions say, the funnier the activity will be and the more likely you are to get your point across about the importance of clear instructions.

  9. After your first sandwich, ask you students if they think their instructions were clear or not. What are some things they might have done differently?

  10. Select another student to read his/her instructions. They will be sure to use clarifications of the instructions you acted upon before - this is a good thing!

  11. After your finish the sandwich, ask you students if they think clear instructions are important. Why?

  12. Let students know that they will now develop an algorithm for building a histogram to represent the sleep dotplots they created in the previous lesson.

  13. Explain that a histogram, rather than showing the frequency for each value, shows the frequency (or percent, but we will focus on frequency) of all the values that fall in a certain range, called a bin. For example, we might choose bins that go from 0-5, 5-10, 10-15, 15-20, 20-25. Bin widths will vary by class.

  14. Model how to create a histogram using the data from the dotplot “hours of sleep last night”. On a blank chart, create the x-axis with bin widths 0-3, 3-6, 6-9, etc. and place marks on the plot at those intervals and ask students: “What are the frequencies in each bin?”

    Notice that multiples of three appear in more than one bin. Let’s take the value of 6 hours as an example. Should those observations be included in the second bin (3-6) or the third bin (6-9)?

    • If students include the values of 6 hours in the second bin then they are using the left-hand rule.

    • If students include the values of 6 hours in the third bin then they are using the right-hand rule.

  15. Once the frequencies have been determined, draw the bars with corresponding heights. Do not include spaces between the bars as time is a continuous variable.

  16. Next, student teams will create an algorithm that gives directions for how to construct a histogram for the data from the dotplot for “hours of sleep they hope to get on Saturday.” Remember, an algorithm is a set of rules that can always be applied. Similar to the way they wrote a process for making a PB&J sandwich, students will write a process for creating a histogram. Tell students to continue thinking of the process to transform the data in the dotplot to create a histogram. The algorithm will produce an output, which will be a histogram. What's the input? Data, or maybe the dotplot.

  17. Inform the students that you will provide a piece of input: how wide the bin will be. For instance, it might be 5 hours, it might be 1 hour, or it might be 10 hours (or half an hour!). Whatever it is, their algorithm should work for any input value.

  18. Let students work for a bit. They should write out Step 1, Step 2, etc. Then choose a group and ask them to get you started. Give them a bin width of 4.

  19. Teachers should sketch the histogram on the board or chart paper as students read their algorithms. Again, teachers should take things very literally. For example, if they do not tell you exactly where the bins should start, start one way off to the left. If they are vague and say "divide the number line into groups of 10,” then make them arbitrary sizes. If they have to be the same size, ask them how to do that. Points to consider:

    1. Where do we start drawing the bins? Always at the location of the smallest dotplot? Always at the greatest? A little to the left?

    2. What do we do with points that fall exactly on a boundary? Do they go to the bin on the left or on the right? Does it matter? No.

    3. Can we do it differently every time? No. We need to be consistent. This is called either the left-hand rule or the right-hand rule, depending on which is chosen.

  20. After following 2 or 3 algorithms, ask students if they feel their algorithm is precise enough. Allow students time to revise their algorithms.

  21. Have a class discussion about the similarities and differences between the original dotplot and a histogram. Ask:

    1. What have we gained from the histogram? We now can see the shape of the distribution as a whole.

    2. What have we lost? We lost each individual observation by grouping them into bins.

Class Scribes:

One team of students will give a brief talk to discuss what they think the 3 most important topics of the day were.


Students should continue to collect nutritional facts data using the Food Habits Participatory Sensing campaign on their smart devices or via web browser.