Lite / Discovering How the World Works / Week 14
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?
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.
Predict
One lamp can show 2 messages (on, off). How many different patterns can 3 lamps show?
- 3
- 6
- 8
Guess first, then reveal
8. Each lamp doubles the count: 2 × 2 × 2 = 8 (000, 001, 010, 011, 100, 101, 110, 111). It grows much faster than adding.
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.
What the interactive shows (text version)
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.
Watch (optional)
Watch for: 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.
“Early Computing: Crash Course Computer Science #1” by CrashCourse (opens YouTube; streaming video uses a lot of data)
The video is optional. Everything you need is in this lesson's text.
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
Intuitive
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.
Technical
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.
Mathematical
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.
Applied
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.
Practice
Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.
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.
Reflect
Why do you think computers use only two symbols (0 and 1) instead of ten like we do?
Write your answer on paper or in your own notes. Lite never stores what you write.