Lesson 5: Representing Numbers
Overview
Question of the Day: What system do computers use to represent numbers?
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.
Assessment Opportunities
-
Use a binary system to represent numbers.
Activity Guide, page 1: Student answers should match the key, noting that the last three questions may have different answers student to student.
-
Extend a representation system based on patterns.
Activity Guide, page 1: On the bottom of the page, students should correctly extend the pattern to 5- and 6-bit numbers.
Agenda
Warm Up (5 mins)
Activity (35 mins)
Wrap Up (5 min)
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 Teachers
- Unit 5 Data & Society - Slides
- Representing Numbers 2021 - Exemplar
- Number Cards - Digital Manipulative
For the Students
- How Computers Work - Data and Binary - Video (download)
- Representing Numbers 2021 - Activity Guide
- Number Cards - Manipulative
Teaching Guide
Warm Up (5 mins)
Journal
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.
Question of the Day: What system do computers use to represent numbers?
Activity (35 mins)
Teaching Tip
For younger students, you may want to stop the activity after they have finished the first page of the worksheet. This means that they will not need to go online for any part of the lesson.
Group: Put students into pairs.
Distribute: Give each student a copy of the activity guide and a set of number cards.
Representing Numbers Activity Guide
Teaching Tip
Digital Manipulatives: A digital version of the binary cards are provided in the teacher resources for you to make your own copy. To use with students: have the presentation open but not in “present” mode - this will let you move the cards as if you are covering or uncovering different cards.
Focus on Binary System: 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)
Do This: Allow students to complete the rest of the front page of the activity in pairs. Instruct students to check with you before moving to the back page.
Circulate: Monitor students as they progress through the activity, looking for students working well in pairs. If students get stuck, suggest they use the number card manipulatives to help themselves out.
Share-Out: Ask students to share out their responses as a way of checking their answers. In particular, make sure the entire class agrees on the last few questions where they predict the pattern for 5-bit and 6-bit 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.
Prompt: Was there more than one possible answer for any of the problems?
Discuss: Allow students to check with other pairs and try to find another way to represent the numbers before regrouping and discussing as a class.
Display: Have students flip to the back of their worksheet. In the top section, students will create a Binary Profile by answering a few questions and encoding their answers as binary numbers. Once completed, they will trade with a partner and use the widget to decode their binary profile to reveal the answers so humans can understand them.
Code Studio: Send students to the Binary Number widget.
Circulate: Allow students to complete the top half of the worksheet with the support of the widget. When both students in a pair have finished, have them trade papers to decode the other person's profile. When they finish, have them trade back and verify the answers were correct.
Challenge: If students have finished encoding and decoding their Binary profiles, have them create a new question that they can trade with another student in the room.
Discussion Goal
Goal Students should recognize that the patterns of the numbers and the rules that they follow can help them determine the next numbers in the sequence. For an 8-bit number, starting from the left, the pattern goes 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1.
Prompt: The last question on this activity guide uses an 8-bit number, even though we haven't talked about how to represent these numbers yet. Do you think we can figure out what numbers are needed for 8-bit numbers? How?
Allow students to discuss their ideas in pairs before bringing them back to the group.
Wrap Up (5 min)
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?
Allow 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.
- Lesson Overview
- Teacher Overview
- Student Overview
- Representing Numbers - Exemplar (PDF | DOCX)
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
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?
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.
- Most number of people lifted and thrown in two minutes. (4 bits)
- Most canned drinks opened by a parrot in one minute. (6 bits)
Do This
- Decode the two numbers from the binary string.
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.
- Longest tail on a dog (in inches) (5 bits)
- 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.
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.
- Largest wind chime, in feet (? bits)
- 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.
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.
- Binary and Data
- Teacher Overview
- Student Overview
Discussion Goals
Th goal of this discussion is to have the students think more deeply about the purpose of binary. For the first question, they may want to return to their ASCII character sheets and see how the computer would interpret the same binary sequence as a number. For their image representation, they may wonder whether it is even useful to interpret the binary sequences as numbers. In the end, the purpose of defining all data as numbers is less about the "reality" of what the ones and zeros represent, and more about how binary is traditionally interpreted.
For the second question, allow students to think of different ways that the computer would distinguish between different types of data. While it's not necessary for students to come up with any specific answer, challenge them on any ways that involve human interpretation of context, such as knowing that a name is most likely text and an age is most likely a number. Assure them that they will look at the problem again in a couple of lessons.
Questions to Consider
- Why are all the types of data on the computer stored as numbers?
- If everything is stored as a number, how do you think the computer tell the difference between numbers, letters, images, and sound?
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.