Binary and Hexadecimal Basics
A bit is one binary digit, and a bit pattern is a row of bits. With n bits you can make 2 to the power of n different patterns, written 2 ** n. Each pattern is a separate state, so each one can be given a different meaning or value.
Two bits give four patterns: 00, 01, 10 and 11, so 2 ** 2 is 4. Five bits give 2 ** 5 = 32 patterns, and ten bits give 2 ** 10 = 1024. That is enough for every pupil in a very large school to have their own different ten-bit code.
Start with the four two-bit patterns and put a 0 on the front of each one: 000, 001, 010 and 011. Now repeat with a 1 on the front: 100, 101, 110 and 111. You now have eight three-bit patterns, twice as many as before, because every old pattern produced two new ones. Add a fourth bit and the count doubles again to 16.
The all-zero pattern counts as one of the states, so count every pattern, not just the ones with a 1 in them.
Edexcel GCSE Computer Science · Binary and Hexadecimal Basics
Edexcel GCSE Computer Science · Character Sets