Lesson 2 of 5 · Open
What a bit can do
Every extra bit doubles the number of possibilities.
A light switch has exactly two positions: off or on. Inside, a computer works with a huge number of tiny switches like this. The smallest unit it can store is called a bit. A bit has two states, which are the two positions it can be in. They are written as 0 and 1.
A single bit can only tell two things apart, such as no and yes. For more, several bits are placed side by side. Such a row is called a bit sequence, for example 01 or 110. Each different bit sequence can stand for something different. How many of them there are depends only on how many bits the sequence has.
New terms
- bit
- the smallest unit a computer stores, with exactly two states
- state
- one of the two positions of a bit, written as 0 or 1
- bit sequence
- several bits side by side, such as 110. Each different sequence can stand for something else
Two bits, four possibilities
Take two bits. The first can be 0 or 1. For each of these two cases, the second can again be 0 or 1. That makes 2 · 2 = 4 bit sequences: 00, 01, 10, and 11. So two bits are enough for four things, for example the four seasons: 00 for spring, 01 for summer, 10 for fall, 11 for winter.
Example
A third bit is added
The four sequences of two bits are already known. The third bit goes in front and can be 0 or 1 for each of them.
- With 0 in front: 000, 001, 010, 011
- With 1 in front: 100, 101, 110, 111
- Each of the 4 sequences now exists twice: 4 · 2 = 8
- The calculation has one 2 for each of the 3 bits: 2 · 2 · 2 = 8
What one more bit does
It goes on like this for any length. A new bit can be 0 or 1 for each bit sequence so far, so afterward each one exists twice. The number of possibilities is multiplied by 2. If a bit is removed, the number is cut in half again. For the calculation, write one 2 for each bit and multiply all the twos together.
| Bits | Calculation | Possibilities |
|---|---|---|
| 1 | 2 | 2 |
| 2 | 2 · 2 | 4 |
| 3 | 2 · 2 · 2 | 8 |
Typical mistake
Adding 2 for each bit instead of doubling. For 3 bits that would give 2 + 2 + 2 = 6. This cannot be right: with a 0 in front there are already 4 bit sequences, and with a 1 in front another 4. That makes 8.
Eight bits make a byte
Computers usually group bits in sets of eight. Such a group is called a byte. The calculation for a byte has eight twos, and the result is 256. That is enough to give every uppercase and lowercase letter from A to Z, every digit, and many punctuation marks a bit sequence of its own.
How many bits do you need?
Often the question is the other way around: a certain number of things must be told apart, and you want the smallest number of bits that is enough. Then you go on bit by bit and double until there are at least as many possibilities as things. Bit sequences may be left over. But no thing may be left without a bit sequence of its own.
Example
The seven days of the week
Each day of the week should get a bit sequence of its own. How many bits does that take at least?
- 1 bit: 2 possibilities, too few for 7 days
- 2 bits: 4 possibilities, still too few
- 3 bits: 8 possibilities, that is enough
- You need 3 bits. One of the 8 bit sequences is left over.
Remember
Tasks
Task 1 · Sorting
What is a single bit enough for?
6 cards left
Task 2 · Input
How many possibilities are there with 4 bits?
Task 3 · Choice
With 5 bits there are 32 possibilities. How many are there with 6 bits?
Go deeper
Task 4 · Input · optional
A school gives each of its 100 lockers a bit sequence of its own. How many bits does that take at least?
Task 5 · Pairs · optional
How does the number of possibilities change?
Task 6 · Order · optional
Order from the fewest to the most possibilities.
- 11 byte
- 22,000 possibilities
- 3500 possibilities
- 411 bits
- 510 bits