Lesson 5: Representing Numbers

Widget

Overview

In this lesson, students learn about the binary number system. With a set of cards that represent the place values in a binary (base-2) number system by a collection of dots, students turn bits "on" or "off" by turning cards face up and face down, then observe the numbers that result from these different patterns. Eventually, students extend the pattern to a generic 4-bit system.

Purpose

Students learn how to use the binary system to represent integers. Unlike ASCII, which is presented as an arbitrary mapping of bit patterns to characters, binary numbers are introduced within the context of patterns of numbers. Students use the patterns to determine the binary representations of different numbers, rather than simply looking them up in a table.

This lesson borrows heavily from a similar activity in CS Unplugged.

Agenda

Warm Up (10 mins)

Activity (40 mins)

Wrap Up (10 mins)

View on Code Studio

Objectives

Students will be able to:

  • Use a binary system to represent numbers.
  • Extend a representation system based on patterns.

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the Teacher

For the Students

Teaching Guide

Warm Up (10 mins)

Discussion Goal

Goal: In this and the following lessons students will be learning a new system to represent numbers using on-off signals. Motivate this activity by thinking back to the kinds of information students eventually will want to represent with this system. If students need help brainstorming give them a couple examples, e.g. age, their height, their birthday, the number of friends they have, the cost of items, an item's rating, etc.

Prompt: Create a list of all the information you might want to represent to a computer as a number. Here's some ideas to get you started

  • An online store (what kinds of numbers does a store keep track of?)
  • A social media profile (what things about you or your friends are numbers?)

Discuss: Students should brainstorm independently, then share with a partner, then finally discuss as a whole class.

Remarks

Numbers are a really useful and important way to represent all kinds of information. If we want to represent numbers to a computer, we're going to have to learn a new system that allows us to do that.

Activity (40 mins)

Teaching Tip

For younger students, you may want to stop the activity after they have finshed the first page of the worksheet. This means that they will not need to go online for any of the lesson.

Group: Put students into pairs.

Distribute: Give each pair a copy of Representing Numbers - Activity Guide and a set of Number Cards - Manipulative.

Binary Cards

Teaching Tip

This activity models a base-2 number system for the student. However, it is not necessary for the students to understand the math behind the patterns that they are creating. Students should focus on the fact that they are using a binary system (face up/face down) to represent information.

Model: Go through the example problem as a class. Ask students to arrange cards face up and face down so that exactly thirteen dots are showing. (It is important that each group uses only one set of cards.) After some trial and error, students should see that the 8, 4, and 1 cards should be face up, and the 2 card should be face down. (U U D U)

Allow students to complete the rest of the page in pairs.

When all students have finished the page, ask them to come back together as a class and share their answers.

Prompt: Was there more than one possible answer for any of the problems?

Allow students to check with other pairs and try to find another way to represent the numbers.

Discussion Goal

Goal After some discussion, students should note that there is only one way to represent any particular number in this system. This is an important point to bring out because it would be confusing if two patterns meant the same thing.

The smallest number that students can make with the cards is 0 (not 1). This will be referenced in a later activity.

Prompt: What is the smallest number you can make? The largest number you can make?

Using the Pattern

Allow students to complete the second half of the worksheet.

For the second half of the page, student answers may vary. You can use the following guide to check their work.

Discussion Goal

Goal Students should recognize that the patterns of the numbers and the rules that they followed to get them allowed them to figure out how a number would be represented, without using a table, as they did in ASCII. If they extend the patterns, they should be able to get much higher numbers.

Prompt: When we learned ASCII, you had to use a table to look up each letter. For binary numbers, you were able to represent your numbers without a table. How did you do that? Could you figure out what the binary might be for a number higher than 15?

Allow students to discuss their ideas in pairs before bringing them back to the group.

Remarks

With these cards, we've created a binary system to represent numbers. Because we used a pattern that we can follow as our numbers get bigger, our system can work for as high as we can count. Of course, our cards will eventually run out of space to put the dots, so we're going look at a tool that will help us to use binary numbers in the hundreds.

Send students to the online lesson.

Wrap Up (10 mins)

Prompt: So far, we've looked at how we could represent text, images, and numbers in binary. Are there any other types of data that you use on your computer that need to be represented?

All students to call out different types of data, such as music, videos, etc.

Remarks

Those are all types of data that need to be represented in binary. We're going to watch a video that explains a little bit more about how this works.

Display: Play the "Binary and Data" video.

View on Code Studio

Teaching Tip

Answers for this level can be found in the exemplar linked on Level 1.

Student Instructions

5-Bit Number

When you only had four bits, the highest number that you could make was fifteen. Now you'll have a chance to work with more bits to make higher numbers.

In this activity, the dots are replaced with numbers, but you still add up everything that's showing to see what number the binary code stands for. The left-most bit doesn't have a number yet, so you'll have to give it one.

Do This

  • Click on the bits to turn them on and off, and see the different numbers you can make.
  • With your partner, discuss the pattern in the numbers. Decide what number you think should go in the left most box.
  • Click "Edit" to change the value of the left most bit.
  • Once you've decided on the value, try to make the following numbers: 16, 27, 31
View on Code Studio

Teaching Tip

Answers for this level can be found in the exemplar linked on Level 1.

Student Instructions

6-Bit Number

This widget helps you to calculate 6-bit binary numbers.

Do This

  • With your partner, answer the following questions:
  • What's the biggest number you can make with this widget?
  • The record for most skips by a dog and person in one minute is 59. How would you encode 59 in binary?
View on Code Studio

Teaching Tip

Answers for this level can be found in the exemplar linked on Level 1.

Student Instructions

Decoding multiple numbers

Here's a widget that can calculate numbers of 4, 5, or 6 bits. You can use it to find the two world records encoded in the binary string below.

  1. Most number of people lifted and thrown in two minutes. (4 bits)
  2. Most canned drinks opened by a parrot in one minute. (6 bits)

Do This

  • Decode the two numbers from the binary string.
View on Code Studio

Teaching Tip

Answers for this level can be found in the exemplar linked on Level 1.

Student Instructions

Decoding multiple numbers

Here's a widget that can calculate numbers up to to eight bits. You can use it to find the values of the two world records below.

Don't forget to make sure that the "1" bit is always the right most bit. If you have extra bits on the left side of the widget, just keep them turned off.

  1. Longest tail on a dog (in inches) (5 bits)
  2. Most spoons balanced on someone's face (5 bits)

Do This

  • Decode the two numbers from a the binary string.
  • Hint: You'll need to read the numbers in order, with the first answer using the first five bits, and the second answer using the five bits after that.
View on Code Studio

Teaching Tip

Without knowing the length of each of the numbers, students will not be certain of their answers, but they should be able to at least find one possible solution. Allow students to discuss any differences in their answers. They should eventually see that they need to know the bit length of each number to answer the question.

Student Instructions

Decoding multiple numbers

Here's a new bit string. This time, you don't know the bit length of the two numbers. Try to decode the numbers without knowing the bit length.

  1. Largest wind chime, in feet (? bits)
  2. Furthest arrow shot with someone's feet (in feet) (? bits)

Do This

  • Try to decode the two numbers from the binary string.
  • Discuss with your partner why you cannot know for sure whether your answer is correct.
View on Code Studio

Teaching Tip

Answers for this level can be found in the exemplar linked on Level 1.

Student Instructions

Bit Length

If you don't know how many bits long each number is, you won't be able to decode a string of numbers.

For example, the following binary string could be decoded many different ways.

If you split the string like this, the string reads 10, 84.

If you split it like this, the string reads 42, 20.

To solve this problem, people agree on a fixed length for every number. The following string uses the same two numbers, but each number takes up exactly eight bits, no matter how many bits it actually needs.

Do This

  • Use the binary widget to decode the string that uses eight bit numbers.
  • Check you answer with a partner to see whether you got the same answer.

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

DA - Data & Analysis
  • 2-DA-07 - Represent data using multiple encoding schemes.