Typical sequences and asymptotic equipartition
Derive iid typical-set probability and cardinality from the law of large numbers without treating a finite type class as the whole typical set.
On this page
The question for today
What you’ll understand
- Apply the law of large numbers to finite-alphabet iid self-information.
- Derive both typical-set cardinality bounds from probability bounds.
- Distinguish an entropy-typical band, one exact empirical type and a finite-sample guarantee.
An iid source does not make all length-n strings equally likely. Yet most of its probability eventually lies on strings whose probabilities have approximately the same exponential scale. The asymptotic equipartition property makes this precise through average self-information. The approximation is logarithmic and asymptotic: probabilities may differ substantially within the allowed exponential band, and a small block may place little mass on one exact empirical composition. These distinctions matter when turning typicality into a coding argument.
Average surprise is an empirical average
Let X₁,X₂ and so on be iid on a finite alphabet with fixed law P. Restrict attention to its positive-probability support. The negative logarithm of the block probability is the sum of the individual negative logarithms. These summands have mean H(X) and finite variance, so the weak law of large numbers sends average self-information to H in probability. Fix a positive epsilon before taking the block length to infinity.
Define the entropy-typical set by requiring that this average lie within epsilon of H. Its probability tends to one. Each typical string has probability between two to the minus n times H plus epsilon and two to the minus n times H minus epsilon. This is an exponential-scale comparison, not exact uniformity. Strings with zero source probability are never observed and need not be assigned a finite self-information when forming this argument.
Probability and cardinality are different bounds
Since each typical string has probability at least two to the minus n times H plus epsilon, their total number cannot exceed two to the n times H plus epsilon. Conversely, if the typical set has probability at least one minus delta and each of its probabilities is at most two to the minus n times H minus epsilon, its cardinality must be at least one minus delta times two to the n times H minus epsilon. Both inequalities follow by summing, with the directions carefully reversed.
The estimates suggest a nearly lossless compression scheme: enumerate the typical strings using roughly nH bits and declare an error on the complement. They do not provide a zero-error code for every supported input. Nor does an entropy alone determine how large n must be before the complement probability is small. A finite-n guarantee requires an explicit concentration bound, exact probability calculation or another quantitative estimate for the chosen source.
One exact type is not the entire band
For a binary source, an empirical type is the number of ones divided by n. All strings of one type have equal probability, but different nearby types have different multiplicities and probabilities. The typical band usually includes many types. Even when the mean type is exactly representable, the probability of that one type need not tend to one; for a nondegenerate Bernoulli source it decreases on the order of one over the square root of n.
Independence is the mechanism used in this proof. A stationary ergodic finite-alphabet source has a broader equipartition theorem involving its entropy rate, but replacing an arbitrary dependent sequence by an iid model is unjustified. For example, repeatedly copying a single fair bit yields only two possible blocks, regardless of length. Its one-symbol entropy is one bit while its per-symbol block entropy tends to zero. The joint law, rather than the marginal label distribution, controls compressibility.
Work it through
A mean type can have modest finite-block mass
For iid Bernoulli(1/4) symbols and n=8, find the probability of a particular string with two ones, its self-information, and the total mass of that exact type.
Each such string has probability (1/4)²(3/4)⁶=729/65536, independent of where its two ones occur.
Its self-information is −log₂(729/65536)=8h₂(1/4), approximately 6.490225 bits, because its empirical frequency equals the source mean.
There are binomial(8,2)=28 strings of that type. Their combined probability is 20412/65536, approximately 0.311462, far below one despite the exact mean composition.
The exact mean type is a subset of every positive-width entropy-typical band here. Its finite mass is not the asymptotic probability of the whole band.
The living notebook
Explore the model
Interactive lab · sampling
Relate empirical frequency to self-information
Pause and reset, then set both controls to p = 0.25 and n = 20. Predict mean sample frequency 0.25 and variance 0.009375. For a fresh comparison, pause and reset, then set p = 0.25 and n = 80; predict the same mean and one-quarter the variance, 0.00234375. For this source, self-information per symbol differs from entropy by log₂3 times the frequency deviation. The bars are exact binomial probabilities; playback highlights outcomes and does not generate independent samples.
- Mean sample proportion
- 0.5
- Sample-mean variance
- 0.0125
- Uniform CDF error bound
- ≤ 0.1062
Exact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forConcentration of empirical frequency gives concentration of self-information for this Bernoulli model.
Pause & reason
Check your understanding
Your turn
Try it yourself
For iid fair bits and any block length n, find the entropy-typical set for ε>0. Compare it with the exact type containing n/2 ones when n is even. Then contrast a process that repeats one initial fair bit forever.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Every fair iid block has the same probability. The copied-bit process has only two supported blocks.
Compare with the solution
Every fair iid string has probability 2^(−n) and self-information n, so all 2ⁿ strings lie in the entropy-typical set. The exact half-ones type has only binomial(n,n/2) strings and is a strict subset for positive even n. For the copied-bit process, the two supported blocks each have probability one half, so joint entropy is one and entropy per symbol is 1/n. Its one-symbol fair marginal does not make its block law iid; applying n times the marginal entropy would overstate its information.
Keep the idea
Take it with you
- Iid average self-information converges to entropy under a fixed source law.
- Typical-set size bounds and its probability bound are related but distinct statements.
- Exact types, finite-block errors and dependent sources require their own analysis.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.