The word bit comes from binary digit.
A bit can hold one of two values:
0
or:
1
One bit therefore represents one two-state distinction.
Examples of two-state ideas include:
The exact physical implementation inside hardware is more complicated than these everyday comparisons, but the binary model gives digital systems a consistent way to represent information.
With one bit, the available patterns are:
0
1
That gives two possible states.
With two bits, the available patterns are:
00
01
10
11
Now there are four possible patterns.
With three bits:
000
001
010
011
100
101
110
111
there are eight possible patterns.
Adding bits increases the number of distinct patterns that can be represented.
The number of possible patterns grows as powers of 2.
| Number of bits | Possible patterns |
|---|---|
| 1 | 2 |
| 2 | 4 |
| 3 | 8 |
| 4 | 16 |
| 8 | 256 |
This does not mean an 8-bit pattern always represents a number from 0 through 255 in every context.
It means there are 256 distinct bit patterns available.
A system decides what those patterns mean.
Consider:
01000001
That is a pattern of eight bits.
By itself, the pattern does not tell you its purpose.
Depending on the system and encoding, a bit pattern can be interpreted as:
Bits provide the representation.
The surrounding format or data type provides the meaning.
A group of eight bits is commonly called a byte.
For example:
10110010
contains eight bits and therefore occupies one byte in the usual sense of the term.
Bytes are a common unit for discussing digital information and storage.
Larger quantities of data are built from many bytes.
When a bit pattern is interpreted as an unsigned binary number, each bit position has a place value.
For an 8-bit pattern, the place values are:
128 64 32 16 8 4 2 1
For:
00001101
the active places are:
8 + 4 + 1
which gives decimal:
13
The bit pattern and the numeric interpretation are connected through binary place value.
A bit cannot contain:
2
3
7
9
It has only two possible binary values:
0
1
Larger numbers are represented by combining bits across several positions.
For example, decimal 5 is represented in binary as:
101
The value comes from the combined places:
4 + 0 + 1 = 5
The important idea is broader than number conversion.
Computers represent information through patterns of bits.
Those patterns gain meaning because software and hardware agree on how to interpret them.
The same general principle appeared earlier with models:
representation is not the same thing as the thing being represented.
A bit pattern is a representation.
The context tells us whether that pattern represents a number, character, instruction, color, or something else.
Keep these ideas separate:
Bit
One binary digit: 0 or 1.
Bit pattern
Several bits arranged together.
Byte
A group of eight bits.
Interpretation
The meaning assigned to a bit pattern by a data format, data type, or system.
This distinction will become more important when you begin connecting number systems to data types and storage.