Information Theory
Bits of surprise to the codes that reach them, the cost of a wrong model, and how many bits survive a noisy wire.
Math Foundations · Algorithms & Data Structures · How Computers Work
Before you start
Some lessons here build on lessons from other arcs: Heapsort, Counting with Switches, Codes and Distance.
- 1
Entropy: Measuring Informationin progress
Math · Information Theory · ~20 minA rare symbol tells you more than a common one. Price each symbol at minus log2 of its probability, weigh the prices by how often they are paid: the average is the entropy, the bits a source is worth.
- 2
Prefix Codes and the Entropy Boundin progress
Math · Information Theory · ~20 minCode words that decode without separators are paths in a tree. Kraft's inequality says which lengths fit, and the cost of any such code sits above the entropy; Shannon's lengths come within a bit.
- 3
Huffman Coding: Shorter Codes for Common Symbolsin progress
Algorithms · Compression · ~25 minCount the symbols, heap them, merge the two lightest until one root remains. The paths down the tree are the code words: short for common symbols, long for rare ones, never one a prefix of another.
- 4
Arithmetic Coding: One Number for the Whole Messagein progress
Algorithms · Compression · ~25 minGive each symbol a slice of the unit interval, keep each symbol's slice of what is left, and send the shortest fraction inside: the message costs its information plus two bits, never a bit a symbol.
- 5
KL Divergence: The Cost of the Wrong Modelin progress
Math · Information Theory · ~20 minA code built for the wrong distribution charges the wrong prices. The bits it wastes per symbol is the KL divergence: cross-entropy minus entropy, never negative, zero only when the model is right.
- 6
Mutual Informationin progress
Math · Information Theory · ~20 minHow far a joint table is from the product of its margins: the bits one variable tells you about another. Zero when they are independent, and the overlap of their entropies otherwise.
- 7
Noisy Channels and Capacityin progress
Math · Information Theory · ~20 minA wire that flips bits at random still carries information, and how much has a formula: the mutual information of input and output at its peak, 1 minus H(f) for a wire that flips with probability f.
- 8
Hamming Codes: Fixing a Flipped Bitin progress
Computers · Binary · ~20 minThree parity bits guard four data bits, each over a different group of positions. Any single flip fails exactly the groups that spell its position, so the receiver can put it back without asking.