Quiz Entry - updated: 2026.07.14
How many bits are needed to distinguish between $n$ equally likely characters?
Exactly $\log_2(n)$ bits are needed to distinguish between $n$ equally likely characters.
$$\text{bits} = \log_2(n)$$
| $n$ (characters) | Bits needed |
|---|---|
| 2 | 1 |
| 4 | 2 |
| 8 | 3 |
| 16 | 4 |
| 26 (alphabet) | 4.7 |
| 256 (byte) | 8 |
This follows directly from the entropy formula: when all characters are equally likely, $P(x_i) = \frac{1}{n}$, so:
$$H(x_i) = -\log_2\left(\frac{1}{n}\right) = \log_2(n)$$
Tip: This is also why computer scientists love powers of 2 — they align perfectly with binary encoding. 8 bits = 1 byte = 256 possible values.
Go deeper:
Entropy (information theory) — the log2(n) result as the uniform-distribution maximum.