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.

  1. With 0 in front: 000, 001, 010, 011
  2. With 1 in front: 100, 101, 110, 111
  3. Each of the 4 sequences now exists twice: 4 · 2 = 8
  4. 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.

BitsCalculationPossibilities
122
22 · 24
32 · 2 · 28

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.

One byte: eight bits, eight twos, 256 possibilities.

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. 1 bit: 2 possibilities, too few for 7 days
  2. 2 bits: 4 possibilities, still too few
  3. 3 bits: 8 possibilities, that is enough
  4. You need 3 bits. One of the 8 bit sequences is left over.

Remember

A bit has two states. Every extra bit doubles the possibilities: 1 bit 2, 2 bits 4, 3 bits 8, 8 bits 256.

Tasks

Three tasks complete the lesson. The order does not matter, the text above stays where it is.

Task 1 · Sorting

What is a single bit enough for?

Drag every card into its group, or tap the group.

6 cards left

Seat: free or taken

Task 2 · Input

How many possibilities are there with 4 bits?

Enter the result.

2 · 2 · 2 · 2 =

Task 3 · Choice

With 5 bits there are 32 possibilities. How many are there with 6 bits?

One answer is right.

Go deeper

Three more tasks, optional. They do not count for completing the lesson.

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?

Enter the result.

bits

Task 5 · Pairs · optional

How does the number of possibilities change?

Drag every card to its place, or tap it and then the place.

  • 1 bit is added
  • 2 bits are added
  • 1 bit is removed
  • 2 bits are removed

Task 6 · Order · optional

Order from the fewest to the most possibilities.

Drag the rows into the right order.

  1. 11 byte
  2. 22,000 possibilities
  3. 3500 possibilities
  4. 411 bits
  5. 510 bits

Back to the chapter