## Overview

In this lesson, students will practice representing numbers in binary (base 2), transitioning from the circle-square representations they made in the last lesson. Students will create and use a "Flippy Do", a manipulative which helps students convert between binary (base 2) and decimal (base 10) numbers. They will practice converting numbers and explore the concept of place value in the context of binary numbers.

## Goals

Students will be able to:

• Represent decimal numbers using combinations of binary (base 2) digits 0 and 1
• Represent binary numbers using combinations of decimal (base 10) digits 0-9
• Explain how the position of each binary digit determines its place value and numeric value

## Purpose

This lesson is designed to give students as much time as possible using the Flippy Do to get comfortable with the relationship between binary and decimal numbers and the concept of place value.

## Getting Started

Prompt: Yesterday, you created your own number system using circles and squares. What can we communicate using only two symbols? Is there a limit?

Discuss: Students should quietly write an answer, then share with a partner, then discuss with the whole class.

#### Discussion Goal

In previous lessons, students represented information using two options. This is a quick thinking question to tap into students' prior knowledge and experiences. Once students have mentioned a few of the points below, they can move on.

• The answer to a yes/no or true/false question
• Flipping a switch on/off
• Combinations of yes/no answers by using multiple symbols in a row
• We can keep adding more of the same symbols, so the only limit is how much space we have to write or store those symbols

## Activity

Lecture: Today's activity is introducing students to the binary number system. As a visual aid, you can use Code.org's presentation slides for Unit 1, Lesson 4: Binary Numbers. These slides use a lot of animations. The lecture notes below describe when to move to the next slide or click through an animation -- if you aren't using the slides, you can ignore these prompts.

### Lecture

Slide: Binary Numbers

Say: Today we are going to explore how Binary Numbers work.

Slide: 1 place value - 2 possible patterns

Say: With only one place value, we only have two possible patterns: circle or square.

Click through animation.

Slide: 2 place values = 4 possible patterns

Click through animation.

Say: With two place values, we can make two sets of the previous patterns. Then, insert circles in front of the first set and squares in front of the second set. This makes four possible patterns.

Slide: 3 place values = 8 possible patterns

Click through animation.

Say: For three place value patterns, we can make two copies of the two place value patterns. Then, just like we did before, fill in the first set with circles in front and the second set with squares in front. This makes 8 arrangements.

Note: Computer scientists like to start counting at 0!

Slide: 1 place value = Ten 1-shape patterns

Click through animation.

Say: We could use more geometric shapes, or we could use letters, but the shapes we are used to are the numbers 0 through 9.

Slide: 2 places = one hundred 2-shape patterns

Say: With two places, we have one hundred 2-shape patterns. These are the numbers 00 through 99.

Click through animation.

Slide: Quiz: What comes next?

Say: What happens when we count up to the last shape?

Say: Suppose we have three value places, and the digits 0-9-9.

Do This: Quick quiz! What comes after this number?

Slide: Quiz: What comes next? (with answer to quiz)

Say: 100! When we run up to the last shape, 9, we roll over back to 0 and add one in the next place to the left. This is the place value that we have used all our lives.

Click through animation.

Slide: "Binary" is a number system with 2 shapes...

Say: Binary is a number system with two shapes.

Click through animation.

Slide: Making Organized Lists -> Counting in Binary

Click through animation.

Say: Instead of shapes, we use 0's and 1's. In this example, each pattern maps to a decimal number from 0 to 7.

Say: For today's activity, you will be creating your own Flippy Do. This is a tool that will allow you to quickly and easily translate between the decimal number base we are used to as humans and the binary number base that computers use.

Distribute: Hand out the Flippy Do templates - one per student.

Do This: Lead students through completing their Flippy Do's using the steps below, or following the slide as a guide. If you chose to give students already-completed Flippy Do's, explain the meaning of each row and how to use the Flippy Do.

1. In the top-right cell of the Flippy Do, write the first power of 2, 20. In the cell to left, write the next power of 2, 21. Do this until you've finished the entire top row. The last value should be 27.
2. In the second row, write the whole number equivalent of each power of two in the cell above. For example, the right-most cell in the second row should read "1", because that is the value of 20 in the cell just above it.
3. In the third row, write a "0" in each cell.
4. Write a "1" on the back of each flap on the bottom -- these will be flipped up over the zeroes in the third row. Make sure the ones aren't upside down when they're flipped!
5. Cut on the dotted lines at the bottom.

Slide: Each place value represents one "bit"...

Say: Each place value represents one "bit" which is short for "binary digit". A binary digit can be a zero or a one. Your flippy do has eight "bits".

Click through animation.

Say: Together, eight place values, or "bits", makes up one "byte". Since computers represent information digitally, the lowest level components of information are bits.

Slide: Try Out Your Flippy Do!

Do This: Use your Flippy Do to try out these problems:

Represent these decimal numbers in binary:

• 7
• 20

Represent these binary numbers in decimal:

• 0001 0010
• 0001 1111

Note: It may be necessary to demonstrate how values can be calculated by flipping up a "1" for each value required to arrive at the sum of values equal to the decimal number.

For example, To convert the decimal number 10, I would flip up a one in the 8's position, because eight can fit in 10 (The next bit to the left is 16, which is too big). Then I have 2 left. I flip up a one in the 2's position. This gives me the binary number "1010", which means 10 in decimal.

If students are having a difficult time understanding the rules of the system, remind them of the concept of place value and relate to base 10.

Slide: Flippy Do Activity Guide

Say: Let's continue to practice with our own two number bases, decimal and binary. After you finish each of the four parts of the Activity Guide, I want you to check your work with your partner. Feel free to use your Flippy Do as you work.

Distribute: Activity Guide

Note: Encourage students to use their Flippy Do as a resource.

• Challenge 1 - All 4-bit Numbers: Students should produce all binary numbers with a length of 4 bits, from 0000 to 1111. They should see that all odd numbers end in 1 and even numbers end in 0. Students may also notice that the binary digits increasingly "roll-over" to 1's (from right to left) as numbers become larger and larger.
• Challenge 2 - Binary Numbers with Exactly One 1: The goal here is for students to systematically find all binary numbers that have all zeros, except for one bit. Students should notice that the resulting decimal values are all powers of 2.
• Challenge 3 - Conversion Practice: This section gives students more practice converting between number bases. The last two decimal numbers, 256 and 513, are too big to represent using the Flippy Do, however students should make the connection that more bits could be added to the left of the Flippy Do using increasing powers of 2.
• Challenge 4 - Putting it all Together: The last three questions on the Activity Guide ask students to apply their understanding to new situations. The first question asks them to consider odd values. The last two questions ask students to think about how many bits are required to represent specific values in binary.

Note: As you circulate, take an opportunity to be a Lead Learner. Help students discover the items below using the suggested questions:

• Reading a number vs. Placing a Number: Do we fill in the places on the Flippy Do starting on the left or right? Does it matter? (Yes. If we have a 5-bit number, we actually use the 5 bits on the far right. If we were to use the bits on the far left, this changes the value of the number. This is similar to adding more zeros to a decimal number.)
• Highest value possible with a given number of bits: What is the largest number we can make with 4 bits? Is the last number we can make always odd? (A meaningful pattern is that we can count as high as one less than the next bit on the left. If we have four bits, we can count up to the number 15, because the next bit has a value of 16.)
• Number of numbers we can make: How many total unique numbers are possible with 4 bits? (This is a base 2 number system. With each new bit, we double the amount of unique numbers we can make. With four bits, we can make the decimal numbers 0 to 15 (0000 to 1111), for a total of 16 unique numbers.)

## Wrap Up

#### Remarks

• It's important to know the differences between binary and decimal number systems. As a review, the decimal number system is base-10. There are ten different symbols used to represent numbers (0-9). The binary numbers system is base-2. There are two different symbols used to represent numbers (0-1). Using our Flippy Do, we can convert between Binary and Decimal number systems.
• While it is easier for humans to use the decimal number system in our everyday lives, we will see later in this unit how electrical signals inside computers can be best represented by using the the binary number system.

#### Teaching Tip

Number Bases: Number bases help us express data and reason about quantities. With ten digits on our hands and feet, the decimal (base 10) number base was natural for humans to develop. The ten symbols we use for this number base are the digits 0-9. For a computer, however, it makes more sense that data be represented in binary (base 2), as this can easily be interpreted with electrical switches set to two states: ON or OFF. The two symbols we use for this number base are the digits 0 and 1.

Both number bases take advantage of the concept of place value. In decimal, numbers are composed of powers of 10, increasing in value from right to left. Binary is similar, however we use powers of 2 (1, 2, 4, 8, 16, etc.). Expressed in binary, these values are 1, 10, 100, 1000, 10000, and so on. These make up the incremental place values in the binary number system.

Why Binary?: Students will see in a later lesson how computers use binary numbers as a representation of electrical signals on a wire. The wire is always set to one of two different options: on or off. Off can be reprsented with a 0 and on with a 1.

Prompt: Now that we've had a chance to practice, let's find out what we've learned and what we still have questions about. Write down:

• 3 things you learned today
• 2 things you found interesting
• 1 question you still have.

###### Discussion Goal

Use this exercise to help assess what students learned and what needs to be clarified.

## Assessment: Check for Understanding

Question: How many bits would be needed to count all of the students in class today?

Question: Each time we add another bit, what happens to the amount of numbers we can make?

Question: What are the similarities and differences between the binary and decimal systems?

## Standards Alignment

• CSTA K-12 Computer Science Standards (2017): DA - Data & Analysis: 3A-DA-09 - Translate between different bit representations of real-world phenomena, such as characters, numbers, and images.
• CSP2021: DAT-1.A.2, DAT-1.A.3, DAT-1.A.4, DAT-1.C.1, DAT-1.C.2, DAT-1.C.3, DAT-1.C.4, DAT-1.C.5