Entropy measures the average surprise of one observation. What does it tell us about a long sequence of observations? Suppose a coin lands heads 90% of the time. The all-heads sequence is the most likely individual outcome, yet a long run usually contains some tails. To understand what we will actually observe, we need to consider whole collections of sequences and their combined probability.
The asymptotic equipartition property (AEP) explains what happens when we draw many independent observations from the same distribution. For a long sequence of observations, the total surprise is usually close to . Equivalently, the probability of the sequence we observe is usually around .
These sequences form the typical set, which contains almost all the probability. Roughly speaking, if each sequence contributes probability , we need about of them for their probabilities to add up to one. To encode a typical sequence, we can send its index in this set. Choosing among about indices takes about bits. The bounds below make these approximations precise.
We will derive the AEP, count typical sequences, and use that count to explain compression and the size of high-probability sets.
Assumptions and notation
Let be independent and identically distributed (i.i.d.) with PMF on a finite alphabet . Write for the random block and for a realization. All logarithms are base 2, so means and entropy and surprise are measured in bits. We restrict attention to symbols with positive probability.
1. From Average Surprise to the AEP
The probability of a particular sequence factors as
Taking a negative logarithm turns this product into a sum:
The expression on the left is random: we first draw a sequence, then evaluate the probability assigned to that sequence. On the right, we average the surprise of its individual symbols.
Define . The are i.i.d., with
The weak law of large numbers therefore gives the asymptotic equipartition property:
Explicitly, for every fixed ,
The proof is short because the main idea is the change of variables: apply the law of large numbers to surprise, rather than to the source symbols themselves.
The name now has a precise meaning: asymptotic refers to long blocks, and equipartition refers to the nearly equal surprise per symbol of blocks that carry most of the probability. It does not make every possible block equally likely.
Problem 1: AEP-like limit
Problem. Let be i.i.d. drawn according to probability mass function . Does the following sequence converge in probability as ? If so, what does it converge to?
Hint. You may use the Continuous Mapping Theorem in this and subsequent problems.
Solution.
The AEP gives . Apply the continuous function :
This is convergence of the probability’s th root; the probability of a whole block generally becomes small as its length increases.
Problem 2: Repeated cake cuts
Problem. A cake is sliced roughly in half, the largest piece being chosen each time and the other pieces discarded. Assume that a random cut creates pieces of proportions
For example, the first cut and choice of the largest piece may result in a piece of size . Cutting and choosing from this piece might reduce its size to at time 2, and so on. Roughly how large is the piece of cake after cuts?
Solution.
Assume successive cuts are independent, and let be the fraction retained at cut : with probability and with probability . If the starting size is one, . Taking logarithms lets us use the law of large numbers:
Thus . The typical size decays like on the logarithmic scale. This does not claim that converges to one.
Problem 3: Geometric mean of a product
Problem. Let
Suppose are drawn i.i.d. according to this distribution. Find the limiting behavior in probability of the product
Solution.
Average the logarithms, then exponentiate:
Therefore . The geometric mean appears because the quantity being averaged is , rather than .
Problem 4: AEP with two probability models
Problem. Let be independent and identically distributed random variables drawn according to the probability mass function , where . Thus
We know that in probability. Let
where is another probability mass function on .
(a) Evaluate the limit in probability of , where are i.i.d. .
(b) Evaluate the limit in probability of the log-likelihood ratio
when are i.i.d. .
Solution.
If whenever , the law of large numbers gives
Subtracting the AEP limit for gives
Here . The true distribution determines the averaging weights. See the coding interpretation of relative entropy.
If but for some symbol, a long block contains such a symbol with probability tending to one. The limits are then and , respectively, in the extended sense.
2. The Typical Set
For , define the typical set
Equivalently, a sequence is typical when
The AEP says . It does not say that most sequences are typical when we count every possible sequence equally. Probability mass and the number of sequences are different quantities.
2.1 Why typical sequences are “almost equiprobable”
Every typical sequence has normalized surprise within of . This motivates the shorthand
The probability bounds specify what this approximation means: the normalized surprise of every typical sequence lies between and .
2.2 How many typical sequences are there?
For sufficiently large , the AEP gives . Combining this with the probability bounds gives
Proof of the cardinality bounds
Each typical sequence has probability at least . Thus
proving the upper bound. For the lower bound, use the upper probability bound for each sequence:
The upper bound holds for every ; the lower bound requires sufficiently large .
The typical set has probability close to one, its sequences have probabilities close to on the exponential scale, and its size is bounded by exponents near . These three properties make it useful for coding.
Problem 5: Counting a high-probability set
Problem. A discrete memoryless source emits a sequence of statistically independent binary digits with probabilities and . The digits are taken 100 at a time, and a binary codeword is provided for every sequence of 100 digits containing three or fewer ones.
(a) Assuming that all codewords are the same length, find the minimum length required to provide codewords for all sequences with three or fewer ones.
(b) Calculate the probability of observing a source sequence for which no codeword has been assigned.
Solution.
A block with exactly ones can place those ones in positions. Thus the selected set has size
For part (a), distinct labels of length require . Hence bits.
For part (b), the number of ones is , so
This illustrates the difference between cardinality and probability: 166751 blocks out of possibilities carry about 99.833% of the probability. is a high-probability set defined by a count cutoff, rather than the two-sided typicality criterion.
3. A Biased-Coin Example
Consider a Bernoulli source. Let and write . A particular block containing ones has probability
Its probability depends on the number of ones, not their positions. With high probability, the proportion of ones is close to . The normalized surprise is then close to the binary entropy
and these typical sequences have probabilities near .
Now take . The typical sequences have a proportion of ones close to 0.9. The most likely individual sequence, however, is the all-ones sequence. It falls outside a sufficiently narrow typical band.
This distinction matters: the most likely individual outcome need not belong to the collection of outcomes that carries most of the probability. We will use this distinction to compare typical sets with the smallest high-probability sets.
Problem 5: Probability of a biased-coin count range
Problem. A discrete memoryless source emits a sequence of statistically independent binary digits with probabilities and . The digits are taken 100 at a time, and a binary codeword is provided for every sequence of 100 digits containing three or fewer ones.
(a) Assuming that all codewords are the same length, find the minimum length required to provide codewords for all sequences with three or fewer ones.
(b) Calculate the probability of observing a source sequence for which no codeword has been assigned.
Solution.
For a particular block with ones,
There are such blocks. To find the total probability of a count, multiply the probability of one block by the number of blocks with that count.
For part (a), , so the minimum length is bits.
For part (b), add the probabilities of all excluded counts:
Here is binomial with parameters 100 and 0.005. The selected count range has probability about 0.99832673. This calculation shows why the probability of one sequence and the probability of a whole collection must be distinguished.
4. Why AEP Enables Compression
If both encoder and decoder know , , and , they can agree on an ordering of the typical set. A typical sequence can then be represented by its index, requiring at most
bits. This is the operational meaning of the typical-set size bound.
To encode every possible block, we need to handle both typical and atypical sequences. Use a leading flag bit to distinguish two cases:
| Input block | Encoding |
|---|---|
| Typical | 0 followed by its fixed-width typical-set index |
| Atypical | 1 followed by a fixed-width index in the atypical set |
The decoder reads the flag, then knows how many bits to read. The mapping is one-to-one and reconstructs every block exactly.
Allowing for the flag and rounding, typical codewords have length at most . Atypical codewords have length at most , because there are no more than atypical blocks.
For sufficiently large , . Splitting the expected codeword length between the two sets gives
Thus
First choose small, then choose large. The terms beyond can be made arbitrarily small. Consequently, for any positive rate tolerance, sufficiently long i.i.d. blocks have a one-to-one binary code whose expected bits per symbol are at most entropy plus that tolerance.
The essential idea is that typical sequences receive short descriptions of approximately bits. Atypical sequences may receive longer descriptions, but their small total probability keeps their contribution to the average small.
Problem 5: Encoding blocks with at most three ones
Problem. A discrete memoryless source emits a sequence of statistically independent binary digits with probabilities and . The digits are taken 100 at a time, and a binary codeword is provided for every sequence of 100 digits containing three or fewer ones.
(a) Assuming that all codewords are the same length, find the minimum length required to provide codewords for all sequences with three or fewer ones.
(b) Calculate the probability of observing a source sequence for which no codeword has been assigned.
Solution.
There are
eligible blocks. Distinct fixed-length binary labels require , so bits.
If counts ones, then . The probability of having no assigned codeword is
Thus the selected set covers about 99.833% of the probability. It is a high-probability set selected by a count cutoff; it is not defined by the two-sided typical-set criterion. Unlike the flag construction, this code leaves some blocks unencoded.
5. Could a Much Smaller Set Carry the Same Probability?
The typical set is one way to capture most of the probability, but it need not be the smallest such set. Could a better choice change the exponential size?
Let be a smallest set of blocks satisfying
The lower bound is as follows: for and any , a set with probability greater than satisfies
for sufficiently large . To see why, note that the typical set has probability approaching one. Any set with probability greater than must therefore share substantial probability with it. Each sequence in that intersection has probability at most , so carrying that shared probability requires exponentially many sequences.
The typical set has size between exponents near , and a smallest high-probability set cannot have a substantially smaller exponent. We express this using equality to first order in the exponent:
For a fixed , the smallest-set result is
The two sets can nevertheless differ in membership. For the Bernoulli source with parameter 0.9, a smallest high-probability set is obtained by taking the most probable individual sequences first, including all ones. The typical set instead selects sequences whose proportion of ones is close to 0.9. Their different selection rules still lead to the same leading entropy exponent as the typicality tolerance is made small.
Entropy therefore connects three quantities: the surprise per symbol of a long random block, the exponential size of a high-probability set, and the average number of bits needed to describe a block.
Problem 5: Selecting the most probable blocks
Problem. A discrete memoryless source emits a sequence of statistically independent binary digits with probabilities and . The digits are taken 100 at a time, and a binary codeword is provided for every sequence of 100 digits containing three or fewer ones.
(a) Assuming that all codewords are the same length, find the minimum length required to provide codewords for all sequences with three or fewer ones.
(b) Calculate the probability of observing a source sequence for which no codeword has been assigned.
Solution.
For part (a), the selected set has blocks, requiring bits per label.
For part (b), its missing probability is
so .
The probability of an individual block decreases with its number of ones: increasing that count by one multiplies its probability by . Thus contains the most probable individual blocks, down to the cutoff of three ones.
This makes a smallest-cardinality set for this exact coverage target. Any set with fewer than elements has total probability at most that of the most probable blocks, which is strictly below . This is a finite-block illustration of selecting a smallest high-probability set; the asymptotic result above describes its leading size as block length grows with a fixed probability target.
6. Takeaways
- Average surprise becomes predictable. For i.i.d. symbols, converges in probability to .
- Typicality concerns total probability. The typical set carries almost all the probability, even though a particular typical sequence can be very unlikely. The most likely individual sequence need not be typical.
- Entropy controls the number of descriptions. Typical-set size is bounded by exponents near , so a typical block needs about bits to identify.
- Compression guarantees matter. The flag construction recovers every block exactly and approaches entropy in expected bits per symbol. Problem 5 instead uses fixed-length labels for a selected set and leaves a small probability of unencoded blocks.
- For products, take logarithms first. Problems 1–4 turn multiplicative quantities into averages, apply the law of large numbers, and transform back when needed.