Information and communication theory, circuits Source coding and data compression Theorem
Shannon's source coding theorem
Builds on Random variableExpected valueKraft–McMillan inequality
Statement
Let be a random variable with values in a finite set and law , and let be an integer. Assume that for every . Let be its entropy in base . For a code that maps each to a string over a -symbol alphabet, let be its expected length.
- Every uniquely decodable code for satisfies .
- There is a prefix code for with .
- Let be independent with the same law as . Let be the least expected length of a uniquely decodable code for . Then as .
Remarks
For part 1, the Kraft–McMillan inequality gives . Then is a relative entropy plus the non-negative number , so it is non-negative by Gibbs' inequality. For part 2, the lengths satisfy the Kraft inequality, so a prefix code with these lengths exists, and . Part 3 follows by applying parts 1 and 2 to the block, since its entropy is , which gives .
Equality holds in part 1 if and only if for every . Example: if takes the values with probabilities , then , and the binary prefix code , , has expected length exactly . Without unique decodability part 1 fails: the code , , has expected length , but it cannot be decoded without ambiguity.
Going deeper
For a student
Part 1 is the converse and part 2 the achievability; together they fix the optimal compression rate as per symbol. The Huffman code gives an optimal prefix code for each block, so it also achieves the bound of part 3. Shannon also stated a fixed-length version. Blocks of source symbols can be coded with about code symbols and an error probability tending to . This fails at any rate below code symbols per source symbol. That version rests on the asymptotic equipartition property. The theorem is the model for the channel coding theorem, which plays the same role for transmission over a noisy channel.
Reading path
To understand this page from the ground up, read these 4 pages in order. The foundations come first.
Show the path as a graph
- no evidence level
- Expected value concept
- Kraft–McMillan inequality statement
- Random variable concept
- Shannon's source coding theorem statement
Where this leads
2 pages build on this one.
Further reading
About this page
| Tag | PC8ASRWARE |
|---|---|
| URI | m2://PC8ASRWARE |
| Kind | statement, theorem |
| Writing | W0 stub |
| MSC | 94A29, 94A24, 68P30 |
| Status | This copy of the site has no build data. Run m2 status PC8ASRWARE. |
| Uses | Random variable, Expected value, Kraft–McMillan inequality |
| Same as | |
| Changed | 3 November 2026 |
Markdown · JSON · Edit on GitHub
What this page needs for W1
- an inventory row: the row of the inventory that the node accounts for (0 of 1)
- a source with a locator (0 of 1)
The writing levels say how complete the text of a page is. They do not measure its truth.