Unit 1 · Digital Information · Lesson 1.1

Two Symbols Are Enough

A computer has an alphabet of two characters. Today you find out why that isn't a limitation.

Big Idea 2 — Data

Before this lesson — read on Runestone

You skimmed this one back in 0.2. Re-read it — it lands differently now that you've encoded a picture by hand. Enrolled in our Runestone course? Open it from there so your progress counts.

1

Where We Are

People→ Bits→ Programs→ Internet→ Security→ Big Data→ Impact

First lesson of Bits. Unit 0 told you that everything becomes 0s and 1s. That was the claim. Unit 1 is where you prove it — starting with the question you should have asked in 0.2 and probably didn't: how do you count past 1?

2

The Hook

on · off You're across the room from a partner. You have a flashlight. No talking, no gestures, no writing — the light is on, or the light is off, and that is your entire vocabulary.

Send them a number. Any number. Now send them a bigger one. What's the minimum you need in order to say anything at all? Most people's first instinct is that two symbols isn't enough for anything interesting. Most people are wrong, and by the end of this page you'll be counting to 31 on one hand.

3

The Idea

Two symbols is not a poverty problem. It's a length problem. One flash of the flashlight can only say two things — but two flashes in a row can say four, and three can say eight. You don't get more meaning by inventing more symbols. You get it by using more positions.

Watch three positions do it:

PatternMeansPatternMeans
00001004
00111015
01021106
01131117

Eight patterns from three positions. Add a fourth position and you don't get one more pattern — you get double, because every old pattern can now be preceded by a 0 or a 1. That doubling is the whole engine.

A bit is one position: a single 0 or 1. With n bits there are 2n possible patterns.

Now, which pattern means which number? You already know the rule — you've used it since first grade, just with a different number. In decimal, the columns are worth 1, 10, 100, 1000: each column is ten times the one to its right, because you have ten symbols. Binary has two symbols, so each column is twice the one to its right: 1, 2, 4, 8, 16, 32…

To read a binary number, add up the column values wherever there's a 1. So 10011 is 16 + 2 + 1 = 19. That's it. That's the entire conversion, and you'll drill it properly in 1.2.

Why two and not ten? Because a wire is good at two things and bad at ten. Voltage is either above a threshold or below it, and that's easy to build, easy to check, and hard to get wrong even when the signal is a little noisy. A ten-symbol wire would need ten distinguishable voltage levels, and a small amount of interference would turn a 6 into a 7. Binary isn't chosen because it's elegant. It's chosen because it's reliable.

One last piece of vocabulary, and it's the one people quietly get wrong for years. Bits are almost never handled one at a time. They're grouped into eights, and a group of eight bits is a byte. Eight bits means 28 = 256 patterns — enough for every letter, digit, and punctuation mark on a keyboard with room to spare, which is exactly why the grouping stuck.

You saw a byte in 0.2 without being told: 01001000 is the letter H, and it's eight bits because that's one byte.

4

Try It

Count to 31 on one hand

Hold up one hand, palm toward you. Your thumb is 1, index finger is 2, middle is 4, ring is 8, pinky is 16. A finger up is a 1; a finger down is a 0.

Now count out loud from 0, raising and lowering fingers as you go. 1 is the thumb. 2 is index alone — drop the thumb. 3 is thumb and index. 4 is middle alone. That drop-and-carry moment is the same thing that happens when 9 rolls over to 10 in decimal.

Keep going until you hit all five fingers up. Write down what number that is before you check it below. Then answer this: with a second hand, how high could you count?

Do the fingers first — that's the part that sticks. Then use this to check yourself. Click a column to flip its bit.

Width:
0
decimal 0  /  highest possible 31

Python will show you the same patterns, and you'll write this yourself in 1.10. For now just read it:

# How many patterns do n bits give you?
print(2 ** 3)      → 8       # the table above
print(2 ** 5)      → 32      # one hand: 0 through 31
print(2 ** 8)      → 256     # one byte

# Show a number in binary:
print(bin(19))     → '0b10011'  # the 0b just means "binary"

Notice 2 ** 5 is 32 but the highest you can count to is 31. Thirty-two patterns, and one of them is spent on zero. That off-by-one is the single most common mistake on this topic, and it comes back with a vengeance in 1.3.

5

Vocabulary

You just used all three of these. Now they get names.

bit Bits
A single 0 or 1 — the smallest unit of information there is. Short for binary digit.
byte Bits
A group of 8 bits, which can hold 28 = 256 different patterns. The standard chunk size for storing and moving data.
binary number system Bits
A base-2 number system using only the symbols 0 and 1, where each column is worth twice the column to its right.
6

Check

Five questions in AP format. Pick an answer to see feedback immediately.

0 of 5 answered
7

Impact Check

The copy that costs nothing

Reducing everything to two symbols did something nobody designed on purpose: it made perfect copies free.

Photocopy a photograph and you get a worse photograph. Dub a cassette and you get a hissier cassette. Every analog copy is a little further from the original, because you're copying a physical thing and physical things smear. But copying a file means copying a list of 0s and 1s, and a 1 copied is just… a 1. There is no "slightly blurry" version of the number 1. Copy number ten thousand is bit-for-bit identical to the original.

That one property is why the music industry was restructured between 1999 and 2003, why software can be sold to a million people without manufacturing a million of anything, and why a photo you regret sending cannot be recalled — not because someone is being cruel, but because there is no longer a meaningful difference between the original and the copy.

8

Connections

Came from 0.2 — you already encoded a picture as 64 bits by hand. You just didn't have the word "bit" yet, and you weren't asked what the columns were worth.
Next in 1.2 — conversion both directions, until powers of 2 up to 256 are automatic. This is guaranteed exam material, so we drill it.
Returns in 1.3 — "2n patterns, 0 through 2n−1" stops being an observation and becomes the reason real programs break.
Returns in Unit 6 — bytes are the unit the internet moves things in. Bandwidth is measured in bits per second; file size in bytes. Mixing those up is a classic error.
← 0.5 How This Course Works