Shannon's noiseless source coding theorem
Statement
For a source with entropy , every prefix code has average codeword length satisfying , and there exists a prefix code with .
Why is it true?
The lower bound says entropy is a hard floor: no lossless prefix code can, on average, beat bits per symbol, because doing better would require the code-induced distribution to differ from 's true distribution in a way Gibbs' inequality forbids. The upper bound says this floor is nearly achievable: rounding each ideal length up to an integer wastes less than one bit on average.
Proof sketch
For the lower bound, let be the lengths of any prefix code, so . Define where , so is a probability distribution. By Gibbs' inequality, . Since , , so , which rearranges to .
For the upper bound (achievability), choose for each (round the ideal length up to the nearest integer). These lengths satisfy Kraft's inequality since , so ; by the Kraft–McMillan construction such lengths can always be realized as an actual prefix code (build the code by assigning binary strings level by level in a binary tree).
By definition of ceiling, . Multiplying by and summing over gives .
Combining both parts, this construction achieves .
Topics that use this theorem
Step-by-step proofs
No step-by-step proof yet for this theorem.
References
- Claude E. Shannon (1948). A Mathematical Theory of Communication
- Thomas M. Cover, Joy A. Thomas (2006). Elements of Information Theory
- David J. C. MacKay (2003). Information Theory, Inference, and Learning Algorithms
- Erdal Arıkan (2009). Channel Polarization: A Method for Constructing Capacity-Achieving Codes for Symmetric Binary-Input Memoryless Channels · arXiv:0807.3917