Skip to content
IGCSE·Tuition
Computer Science · Lesson

Relate bit depth to possible representations

One extra bit sounds like a tiny change, yet it doubles everything a computer can tell apart.

On this page
  1. Why does each extra bit double the number of values?
  2. How do you find the bits needed for a set of items?
  3. Worked example
  4. The mistake to watch for
  5. Check yourself
  6. Where this leads next

A group of n bits can make 2n different patterns. That single rule tells you how many numbers, characters or colours a given number of bits can represent, and how many bits you need for a given set of items.

This lesson ties together binary conversion, the limit behind overflow and the code sizes in character encoding. It closes Representing numbers and text.

Why does each extra bit double the number of values?

Start small and list every pattern.

BitsPatternsCount
10, 12
200, 01, 10, 114
3000, 001, 010, 011, 100, 101, 110, 1118
4the 8 patterns above with a 0 in front, plus the same 8 with a 1 in front16

Adding one bit gives every old pattern two versions: one ending in 0 and one ending in 1. So the count doubles each time: 2, 4, 8, 16, 32, 64, 128, 256. That is the same list as the binary place values, which is why 8 bits give 256 patterns and the largest number is 255.

How do you find the bits needed for a set of items?

  1. Count the items you must tell apart.
  2. Find the smallest n where 2n is greater than or equal to that count.
  3. State n and show the check: 2n is enough, and 2n−1 is not.

Worked example

A weather sensor reports one of 12 different weather codes, such as sunny, cloudy and rain. How many bits does each code need at least?

23 = 8, which is less than 12, so 3 bits are not enough.

24 = 16, which is at least 12, so 4 bits are enough.

The answer is 4 bits. Four of the 16 patterns stay unused, and that is fine.

Now a colour example. An image uses a colour depth of 8 bits per pixel. Colours available: 28 = 256.

If the colour depth is raised to 24 bits, the number of colours is 224 = 16 777 216. The bigger depth gives much richer colour, but each pixel now needs 24 bits instead of 8, so the file is three times larger for the same number of pixels (24 ÷ 8 = 3).

You can check powers of 2 quickly in the Python reasoning sandbox: print(2**8) gives 256 and print(2**24) gives 16777216.

The mistake to watch for

A common slip is multiplying the number of bits by 2 instead of using a power of 2.

Question: How many different values can 4 bits represent?

Mistaken answer: 4 × 2 = 8.

The number of bits is not multiplied by 2. Each extra bit doubles the count, so the right working is 2 × 2 × 2 × 2 = 16.

A second version of the slip is giving 256 as the largest 8-bit number. There are 256 patterns, but they start at 0, so the largest is 255. Ask yourself “how many patterns?” and “what is the largest number?” as separate questions.

Check yourself

1. How many different values can 6 bits represent?

Show answer

26 = 2 × 2 × 2 × 2 × 2 × 2 = 64. Check: 32 doubled is 64.

2. A library codes 40 book categories in binary. What is the smallest number of bits per code?

Show answer

25 = 32 is less than 40, so 5 bits are too few. 26 = 64 is at least 40. The answer is 6 bits.

3. An image has 16 colours. What colour depth does it need, and what happens to the number of colours if one more bit is added?

Show answer

16 = 24, so the depth is 4 bits. Adding one bit makes it 5 bits, and the number of colours doubles to 32.

Where this leads next

Bit depth returns when you study how images and sound are stored, in the Computer Science learning guide. Test everything in this module with the mixed practice set.

If you know the rule but lose marks on the wording of the explanation, a teacher can sharpen that in online one-to-one Computer Science tuition.

Questions people ask

How many values can n bits represent?

n bits can represent 2 to the power n different values. With 1 bit you get 2, with 2 bits 4, with 3 bits 8, and each extra bit doubles the number. For 8 bits that is 256 values, from 0 to 255 if you are counting numbers.

How do I find the number of bits needed for a set of items?

Find the smallest n for which 2 to the power n is at least the number of items. For 20 items, 2 to the power 4 is 16, which is too small, and 2 to the power 5 is 32, which is enough. So 5 bits are needed.

What does bit depth mean for an image?

Colour depth is the number of bits used to store the colour of each pixel. A larger bit depth allows more different colours, but it also makes the file bigger. The next module on images, sound and storage builds on this idea.

Why is the highest 8-bit value 255 and not 256?

There are 256 different patterns, but counting starts at 0. So the values run from 0 to 255. The largest value is always one less than the number of patterns, which is 2 to the power n, minus 1.

Sources

  1. Cambridge IGCSE Computer Science 0478 syllabus page

Updated:

Your next step

If the link between bits and the number of values only half-clicks, a one-to-one teacher can build it from tiny cases with you until you can explain it in your own words.

Paid one-hour trial at your assigned teacher’s confirmed rate, starting from RM80.

Tuition is arranged with a parent or guardian. Send them this page on WhatsApp and they can enquire for you.

Parents: enquire here

  • 9,000+ students helped through our service
  • 9+ years helping IGCSE students