0.4.3 Bits and Binary

A Bit Is One Binary Digit

The word bit comes from binary digit.

A bit can hold one of two values:

Plain text
0

or:

Plain text
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.

One Bit Can Represent Two Possibilities

With one bit, the available patterns are:

Plain text
0
1

That gives two possible states.

With two bits, the available patterns are:

Plain text
00
01
10
11

Now there are four possible patterns.

With three bits:

Plain text
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.

More Bits Create More Possible Patterns

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.

Bits Need an Interpretation

Consider:

Plain text
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.

Eight Bits Form a Byte

A group of eight bits is commonly called a byte.

For example:

Plain text
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.

Position Still Matters

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:

Plain text
128 64 32 16 8 4 2 1

For:

Plain text
00001101

the active places are:

Plain text
8 + 4 + 1

which gives decimal:

Plain text
13

The bit pattern and the numeric interpretation are connected through binary place value.

A Bit Is Not a Tiny Decimal Digit

A bit cannot contain:

Plain text
2
3
7
9

It has only two possible binary values:

Plain text
0
1

Larger numbers are represented by combining bits across several positions.

For example, decimal 5 is represented in binary as:

Plain text
101

The value comes from the combined places:

Plain text
4 + 0 + 1 = 5

Digital Information Is Built From Patterns

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.

Binary Gives the Pattern; Meaning Comes From Context

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.