3
How many patterns can n bits make?
ICT Secondary 3 Term 1, Unit 1, Topic 1: pp. 11–13
GoalUse 2ⁿ to count the patterns of n bits and to find how many bits a menu needs.
New words
pattern · one particular row of 0s and 1spower of two · 2 multiplied by itself some number of times, for example 2³ = 2 × 2 × 2 = 8doubling · multiplying by 2
Explanation
One bit can be 0 or 1, so it makes 2 patterns. Two bits make 4 patterns: 00, 01, 10 and 11. Three bits make 8. Each extra bit doubles the number of patterns, because we can put a 0 or a 1 in front of every old pattern. So n bits make 2ⁿ patterns, where 2ⁿ means 2 multiplied by itself n times. One byte, 8 bits, makes 2⁸ = 256 patterns, enough for the numbers 0 to 255. To find how many bits a menu needs, look for the smallest n for which 2ⁿ is at least the number of choices. Five choices need 3 bits, because 2² = 4 is too small and 2³ = 8 is enough.
| Bits n | Patterns 2ⁿ |
|---|---|
| 1 | 2 |
| 2 | 4 |
| 3 | 8 |
| 4 | 16 |
| 5 | 32 |
| 6 | 64 |
| 7 | 128 |
| 8 | 256 |
| 10 | 1024 |
Worked examples
| A | B | C |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 0 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
| 1 | 1 | 1 |
| Bits | Patterns | Enough for 6 choices? |
|---|---|---|
| 2 | 4 | no |
| 3 | 8 | yes |
Class activity
Write on paper the 16 patterns of four bits in the order 0000, 0001, 0010 and so on. Check that you have 2⁴ patterns and that the first eight begin with 0 and the last eight begin with 1.
Practice
1
How many patterns can 6 bits make?
2⁶ = 64.
2
What is the smallest number of bits that gives a different pattern to each of 20 choices?
5 bits: 2⁴ = 16 is too few, 2⁵ = 32 is enough.
3
How many patterns does a byte make, and why?
256, because it has 8 bits and 2⁸ = 256.
4
A pattern of 7 bits is made one bit longer. How many patterns are there before and after?
128 before (2⁷) and 256 after (2⁸): the number doubles.
5
How many bits are enough to give a different pattern to the answers “yes” and “no”?
1 bit: it makes 2 patterns.