Menu

Binary and Hexadecimal Basics

Number of States in a Bit Pattern

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.

Working it out

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.

Why one extra bit doubles the count

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.

A tree splits into 0 and 1 at each level: 1 bit gives 2 patterns, 2 bits give 4 and 3 bits give 8, from 000 to 111. Each extra bit doubles the count.

The all-zero pattern counts as one of the states, so count every pattern, not just the ones with a 1 in them.

Practise this