Information Theory: Entropy and Mutual Information
One-line statement: Entropy measures the average uncertainty (in bits) of a random variable, while mutual information measures how much knowing one variable reduces uncertainty about another. Key result in words: A source with entropy bits per symbol cannot be losslessly compressed below bits/symbol on average; the maximum reliable communication rate over a noisy channel equals the channel's maximal mutual information. Where it applies: Data compression, communication theory, cryptography, machine learning, statistics, neuroscience, and statistical physics. Who/when: Claude E. Shannon, A Mathematical Theory of Communication (1948).Information theory quantifies information using probability. Shannon entropy assigns to each random variable a number — measured in bits when the logarithm is base 2 — equal to the average number of yes/no questions needed to determine its value optimally. Mutual information measures the statistical dependence between two variables: the reduction in uncertainty about achieved by observing . These quantities matter because they set absolute, unbeatable limits on compression and communication that no engineering cleverness can surpass. The surprising fact: information content depends only on the probability distribution, not on the meaning or physical form of the data — and a perfectly random source of bits is genuinely incompressible.
The Core Insight
Information equals surprise. A certain event (probability 1) carries zero information; a rare event carries much. The right measure of the surprise of an event with probability is , because surprise should be additive for independent events and decreasing in probability. Entropy is the expected surprise, and every other quantity — joint entropy, conditional entropy, mutual information, relative entropy — is built from this single primitive.
Formal Statement
Self-Information (Surprisal)
For an event with probability , the self-information or surprisal is
The base fixes the unit: gives bits (shannons), gives nats, gives hartleys (dits). We use base 2 throughout unless noted.
Shannon Entropy
For a discrete random variable with alphabet and probability mass function , the entropy is
Joint and Conditional Entropy
For two random variables with joint pmf :
Chain Rule for Entropy
More generally, .
Mutual Information
The mutual information between and is
Equivalent forms, all derivable from and :
Relative Entropy (Kullback–Leibler Divergence)
For two pmfs on the same alphabet,
Mutual information is the special case .
Why It Holds / Derivation
Mutual Information is Nonnegative and Symmetric
We show with equality iff .
Step 1. By definition , , a KL divergence. Step 2. Write . Step 3. Apply Jensen's inequality to the concave function (expectation moves inside):Bounds on Entropy
For a variable on an alphabet of size ,
Binary entropy function $H(p) = -p\log_2 p - (1-p)\log_2(1-p)$
Claude Elwood Shannon | 1916–2001
An American mathematician and electrical engineer at Bell Labs, Shannon single-handedly founded information theory with his 1948 paper. He chose the name "entropy" on the suggestion of John von Neumann, who reputedly told him: "No one knows what entropy really is, so in a debate you will always have the advantage." The mathematical form of Shannon entropy is identical to the Gibbs entropy of statistical mechanics, a coincidence Shannon exploited deliberately. Beyond information theory, Shannon contributed to cryptography (proving the one-time pad's perfect secrecy), digital circuit design (his master's thesis applied Boolean algebra to switching), and built whimsical machines including a maze-solving mechanical mouse and a juggling robot.
Building Intuition
Think of entropy as the average number of yes/no questions in an optimal guessing game. If a horse race has 8 equally likely winners, you need questions ("Is it in the first half?" etc.), so bits. But if one horse wins half the time and others are rare, a smart questioner asks "Is it the favorite?" first — most games end in one question, and the average number of questions drops below 3. That average is exactly the entropy.
Mutual information is how much a hint helps. Suppose you must guess , but a friend whispers a related variable . The reduction in your expected number of questions — from down to — is . If tells you everything, ; if is irrelevant, .
The Venn diagram picture. Draw two overlapping circles for and . The overlap is ; the union is ; the left crescent is ; the right crescent is . Every identity in and becomes obvious set arithmetic. Caution: this picture works beautifully for two variables but breaks for three or more, where "triple intersections" can be negative and have no set-theoretic meaning.Worked Examples
Entropy of a Biased Coin
Given: A coin with , . Find: The entropy . Steps:Mutual Information of a Binary Symmetric Channel
Given: Send uniformly ( each) through a channel that flips the bit with probability . Output is . Find: . Steps: By symmetry, is also uniform: , so bit. The noise is independent of the input, so the conditional entropy is the entropy of the flip:Common Misconceptions
Conditioning reduces entropy only on average. The inequality holds for the average conditional entropy . For a specific outcome , it is entirely possible that — a particular observation can leave you more confused than before. Only the weighted average is guaranteed to drop. Entropy is not "the amount of disorder you can see." depends only on the probability distribution, not on the meaning, structure, or perceptual disorder of outcomes. A perfectly ordered-looking deterministic sequence has zero entropy; a uniformly random sequence has maximal entropy. The famous text "to be or not to be" and a random scramble of the same letters can have very different entropies depending only on the assumed source distribution.Mutual information is not transitive
One might guess that if shares information with , and shares information with , then and must share information. False. Let be independent fair bits and define (XOR). Then:
- and : each of alone is independent of (knowing only tells you nothing about the XOR, since is still random).
- Yet bit: the pair fully determines .
Information can hide in joint structure invisible to any single variable, contradicting naive transitivity intuitions.
Connections
Mutual information is the bridge between Probability Theory and communication. The KL divergence underlies hypothesis testing and the Maximum Likelihood Estimation framework, where minimizing equals maximizing likelihood. In machine learning, the cross-entropy loss used to train classifiers equals , so minimizing it minimizes the KL divergence to the true labels. Entropy connects directly to Statistical Mechanics: Shannon's equals the Gibbs–Boltzmann entropy , and the maximum entropy principle derives equilibrium distributions (e.g. the Boltzmann distribution) as the least-biased choice given known constraints. Mutual information also generalizes Correlation and Covariance: unlike correlation, captures all dependence, including nonlinear, and is zero iff variables are truly independent.
Real-World Applications
- Lossless data compression — Huffman coding, arithmetic coding, and the formats ZIP, PNG, and FLAC approach the entropy bound ; no scheme beats bits/symbol on average (Shannon's source coding theorem).
- Reliable communication — The channel capacity sets the maximum error-free data rate; modern LDPC and turbo codes used in 5G, Wi-Fi, and deep-space probes operate within a fraction of a dB of this Shannon limit.
- Cryptography — Shannon's notion of perfect secrecy requires the key entropy to equal the message entropy, proving the one-time pad unbreakable and bounding all ciphers.
- Machine learning — Decision trees split on the feature maximizing information gain (mutual information); cross-entropy is the standard loss for classification and language models.
- Neuroscience — Mutual information quantifies how much a neuron's spike train tells you about a stimulus, measuring the efficiency of neural coding.
- Genomics & bioinformatics — Mutual information detects co-evolving residues and gene-regulatory dependencies that linear correlation misses.
- Feature selection & medical diagnosis — Tests and biomarkers are ranked by the mutual information they carry about a disease state.
Historical Development
- 1850s–1870s — Rudolf Clausius and Ludwig Boltzmann develop thermodynamic and statistical entropy; Boltzmann's foreshadows Shannon's formula.
- 1928 — Ralph Hartley (Bell Labs) proposes as a measure of information for equally likely messages, anticipating the uniform-case entropy.
- 1948 — Claude Shannon publishes A Mathematical Theory of Communication in the Bell System Technical Journal, defining entropy, mutual information, channel capacity, and proving the source and channel coding theorems.
- 1949 — Shannon's Communication Theory of Secrecy Systems establishes information-theoretic cryptography and perfect secrecy.
- 1951 — Solomon Kullback and Richard Leibler introduce relative entropy (KL divergence), unifying it with statistical inference.
- 1957 — E. T. Jaynes formulates the maximum entropy principle, recasting statistical mechanics as inference and influencing Bayesian statistics.
- 1959 — Shannon proves the rate–distortion theorem, extending the theory to lossy compression.
- 1961 — Rolf Landauer establishes Landauer's principle: erasing one bit dissipates at least of heat, physically grounding information.
- 1991 — Thomas Cover and Joy Thomas publish Elements of Information Theory, the canonical modern textbook.