Pīkau 16: Representing data in binary

arrow_downward

Introduction

Why this matters

Binary plays a pivotal role in all things digital. Everything digital is based on it. Data representation (using binary) is in computational thinking Progress Outcomes 3, 4, and 5, while binary digits are specifically mentioned in Progress Outcomes 3 and 4. Even though binary is not mentioned until Progress Outcome 3 it is a concept that can easily be taught to young students.

Links to existing knowledge

You might already know some of this

If you’ve ever played a game of 20 questions, you’ll be familiar with the idea of communicating information by simply giving yes/no answers. And if you carry a digital device you have probably noticed that exactly the same hardware can store a variety of information - text, images, sound, video, step counts and more. These are all ultimately stored as a binary representation, which means that you can use the same device to store - and transmit - all kinds of information.

The common point for all of these is that they are represented using just two symbols, or “states”. Because only two states are used, these two states are commonly referred to as binary (since the prefix “bi” means two).

Binary representation in the classroom

Watch the following video to see how relatively young students can engage with the idea of representing information using just two states - in this case, whether a card is face up or face down.

As you saw in this accelerated lesson, even students as young as 8-years-old can quite quickly understand the concept of using just two states to send many different kinds of information (data).

Quiz: Try this for yourself

Open the “cards” using the following link, and try the challenges below:

Work out which cards you need to flip over so that there are exactly 13 dots visible.

Now work out how to show 15 dots.

How about zero dots?

Try counting (show 1 dot, then 2, 3, 4, 5…). What patterns do you notice?

Is there any number from 0 to 31 that can’t be represented with these 5 cards?

Use this link to access a set with one more card (6 in total). What range of numbers is possible now?

Now try working out the range possible with 8 cards using the following link. It’s very common for binary digits, or bits, to be in groups of 8 like this - it’s called a byte.

Tip: Click on the black cards to flip them over

Answers

  • The range of numbers able to be shown with 6 binary cards is 0 to 63.
  • The range of numbers able to be shown with 8 binary cards is 0 to 253.

Optional extra resource

CS Unplugged - Binary digits (sample classroom lesson)

Video of how binary digits work being taught in a classroom situation:

Why is binary important?

Binary representation is used throughout digital technologies. This video shows how, including looking at the inside of a hard disk drive.

VIDEO: Why is binary important? (339037521)

(no transcript)

As we saw in this video everything digital uses binary in some form or another. This table shows how some different devices use binary.

DeviceBinary states
Hard drive Magnetism (North and South polarity)
CD Flat or uneven (reflects light or doesn’t)
Magnetic stripe card (e.g. bank card) Magnetism (North and South polarity)
Cell phone storage Lower and higher voltage in memory

Did you know that a whole book has been written using only two states? Jean-Dominique Bauby suffered from “locked-in syndrome” but by blinking (and not blinking), he was able to communicate, and write and edit a book.

Optional extra resources

Two videos about how binary data is stored and read by a CD player

"How does a CD work?" (6 mins):

Youtube video "How CD's work" (2 mins):

Video about how binary data is stored and read by a magnetic disk (hard disk drive)

Youtube video "How do hard drives work? - Kanawat Senanan" (5mins):

What do students need to know?

Students should understand how important the concept of binary digits is and how everything we do with digital devices really does rely on it. In this video find out how binary digits are used to represent pictures.

At Progress Outcome 3 students need to “...understand that digital devices store data using just two states represented by binary digits (bits).”

Progress Outcome 4 says “Students understand that digital devices represent data with binary digits…”

At Progress Outcome 5 students: “understand how computers store more complex types of data using binary digits.”

Optional extra resources

This Vimeo video demonstrates how audio is stored using just binary digits (2:54):

You can zoom in on your own photo using this web page (just drag your own photo on top of the one shown):

The RGB mixer used in the video is available here:

Using binary digits in the classroom

Binary digits can be used in the classroom in various ways. This video shows using beads and kōwhaiwhai patterns to represent binary digits.

Another way binary can be displayed in the classroom is with art. Students can create their names (and other messages) on posters.

 9nAii4ZS0uoWTj71v3XZ Screen Shot 2019 06 13 at 4.38.32 PM

Binary in Everyday Life

This video shows some places that students may encounter binary representation in everyday life.

As we saw in this video, binary representations come up in many situations that students will encounter, including the Braille writing system, storing musical notes with MIDI, and inputs and outputs from programmable devices such as the micro:bit.

The Limitations of Binary and Some Unexpected Consequences

This video shows some examples of what can go wrong when people don’t take account of the limitations of binary representations.

Everything from popular YouTube clips to aeroplanes can go wrong if insufficient bits are allocated to storing numbers.

Quiz: Representing data in binary

Activity - Q1: Representing data in binary

Instructions

Which number do these binary cards represent?

yBPU8YWmTUqyeO1yTNvU Screen Shot 2019 06 13 at 4.54.26 PM 

Feedback

The correct answer is 21.

Activity - Q2: Representing data in binary

Instructions

Which set of cards represents 91 in binary?

A)

LM4g42TnTUWi42euYk0C Screen Shot 2019 06 13 at 5.03.32 PM

B)

G7KQoiBQuakIAAyNngM5 Screen Shot 2019 06 13 at 5.04.53 PM

C)

ZSAmeBKQtW4Xlx4wzs5g Screen Shot 2019 06 13 at 5.06.49 PM

D)

AUn7leqEQUyMlfUioArP Screen Shot 2019 06 13 at 5.08.00 PM

Feedback

C is the correct answer.

Activity - Q3: Representing data in binary

Instructions

What is the largest decimal number that can be represented with 6 cards?

Feedback

The correct answer is 63.

Activity - Q4: Representing data in binary

Instructions

If A is 1, B is 2, C is 3 etc, what does this message say?

10100 00001 01101 00001 10010 01001 01011 01001

Feedback

The correct answer is Tamariki.

Link to programme design

Technological practice: students are able to work directly with binary representations for their own authentic contexts; for example, younger students can use the idea as the basis of artwork or hidden messages.

Technological knowledge: Understanding binary representation is a key concept that underpins how all digital systems work.

Nature of technology: The way that binary representation is used affects humans; for example, older systems with only 8-bit character representation excluded those whose language uses a different alphabet; and using too many bits to store an image can result in unacceptable download times.

There are several ideas for using ideas from binary representation for teaching and learning based around art, music and literacy here: CS Unplugged: Binary numbers

Wrapping up and where to next

We’ve seen that binary is the basis of everything digital, and that students can find it an engaging topic. But binary representations are generally hidden under the surface of digital systems, so do we really need to know about them? A short answer is that it would be the same as saying we don’t really need to know about atoms and molecules - they underpin all physical objects, but we don’t think about them in daily life. Like atoms, binary is behind the scenes in so many things we use that while we can get by without knowing specifically about it, it is good to have some understanding of how it works so that students can understand and influence the digital world.

Binary representation affects so many things that we do. If you’re interested, here's a longer article about ways that binary representation comes up in everyday life.

Representing data in binary is discussed in more detail here: CS Field Guide: Data representation

References

Image sources