Bits: how much can two lights say?
A lighthouse can only flash on or off. How many different messages could you send with three lamps?
About 25 min · 3 goals · Checked by automated tests; not yet reviewed by an educator
1.Why should I care?
Every photo, song, game and robot command is, deep down, a long line of bits. Knowing how many patterns a few bits can make tells engineers how many wires, lights or memory cells a machine needs.
- ◇ Define a bit as a single 0/1, on/off, yes/no choice.
- ◇ Show that each extra bit doubles the number of possible patterns.
- ◇ Design a simple code that maps bit patterns to messages.
2.Predict
One lamp can show 2 messages (on, off). How many different patterns can 3 lamps show?
Guess first. Being wrong here is how the surprise works.
3.Discover
Use the 4-bit register. Starting from all off, press 'Add 1' over and over and write down every pattern until it wraps back to 0000. How many patterns did you find? Now imagine adding a fifth switch.
Binary switches
Each switch is one bit. Its place value doubles from right to left: 1, 2, 4, 8… Add up the places that are ON to read the number.
Register size
Challenge: make 5
= 0
4 bits make 16 different patterns, from 0 up to 15.
0000 in binary = 0 = 0.
Can't use the interactive? Read a description instead
The binary switches diagram shows a row of 4 (or 8) switches, each showing 0 or 1. Pressing 'Add 1' repeatedly steps through every pattern: 0000, 0001, 0010, up to 1111, which is 16 patterns for 4 bits, and then wraps back to 0000.
4.Watch
→ Watch for how early machines stored information as holes or no holes in punched cards: bits before electronics.
From the abacus to punch cards: how people built machines to store and process information long before electronics.
Length: see YouTube · captions on YouTube · source
Nothing loads from YouTube until you press play.
5.Understand
A bit is one choice
A bit (short for binary digit) is the smallest piece of information: 0 or 1. Inside a machine it could be a switch off or on, a voltage low or high, a hole punched or not, a magnet pointing one way or the other.
Every bit doubles the patterns
1 bit: 2 patterns. 2 bits: 4 (00, 01, 10, 11). 3 bits: 8. 4 bits: 16. n bits give 2 × 2 × … × 2 (n times) = 2ⁿ patterns. That's why 8 bits (one byte) already give 256 patterns, enough for every letter, digit and symbol on a keyboard.
A code gives patterns meaning
Patterns mean nothing until people agree a code. A 2-bit code for a robot might be: 00 = stop, 01 = left, 10 = right, 11 = forward. The same pattern can mean different things in different codes, so the sender and receiver must use the same one.
Explain it another way
Each bit is a fork in a path: left or right. Two forks give 4 possible routes, three forks give 8. Every new fork doubles the number of places you could end up.
The number of distinct states of n independent binary elements is 2ⁿ. To encode M different messages you need at least ⌈log₂ M⌉ bits: 5 messages need 3 bits, because 2 bits give only 4.
2¹ = 2, 2² = 4, 2³ = 8, 2⁴ = 16, 2⁵ = 32, 2⁶ = 64, 2⁷ = 128, 2⁸ = 256. To find the bits needed for 20 messages: 2⁴ = 16 is too few, 2⁵ = 32 is enough, so 5 bits.
Traffic-light controllers, washing machine programs and robot modes are all stored as short bit codes. A washing machine with 12 programs needs at least 4 bits to remember which one you picked.
Worked example 1
A robot needs commands for: stop, forward, back, left, right and beep. What is the fewest bits per command?
6 commands. 2 bits give 4 patterns (too few). 3 bits give 8 (enough, with 2 spare). So 3 bits.
Common mix-ups
- Adding a bit adds 2 more patterns.
✓ Adding a bit doubles the number of patterns: 4 bits give 16, 5 bits give 32.
6.Practice
Practice, not a test. Wrong answers get a hint and another try.
Practice 1 · a fresh version every time
A machine sends messages using 6 on/off lights (6 bits). How many different patterns can it make?
Practice 2
A vending machine has 10 buttons. What is the smallest number of bits that can give each button its own pattern?
Practice 3
The pattern 10 means 'turn right' to one robot and 'beep' to another. Why?
Practice 4
How many bits are there in one byte?
7.Apply it
Invent a 3-bit code for a pet-feeding robot: up to 8 commands. Write the table, then 'send' a friend a message of three commands as bits (like 011 101 000) and see if they can decode it.
8.Reflect
Concepts: Binary, hexadecimal and digital signals · Digital input and output