Entropy, Joint Entropy, Conditional Entropy, and the Chain Rule
Anchor (Master): Cover & Thomas 2006 Elements of Information Theory 2e (Wiley) §2.1-2.5; Csiszár & Körner 2011 Information Theory: Coding Theorems for Discrete Memoryless Systems 2e (Cambridge) §1.1-1.3; Shannon 1948 A Mathematical Theory of Communication §§6-7 (the foundational axioms and the uniqueness theorem)
Intuition Beginner
Flip a fair coin. Before it lands, you are uncertain about the outcome. If I told you the result, I would remove that uncertainty. The amount of information in a single coin flip is one bit. That word already does the right thing: a "bit" is the information content of a binary choice between two equally likely outcomes.
Now flip a biased coin that lands heads 99 times out of 100. You are almost sure it will be heads. If I tell you it was heads, I barely told you anything — you already knew. If I tell you it was tails, you learned a lot, because that was genuinely surprising. Information content is large for surprising outcomes and small for expected ones.
Shannon entropy is the average information content. For the fair coin, the average surprise is one bit. For the 99/1 coin, the average surprise is much less — around 0.08 bits — because most of the time the unsurprising thing happens. Entropy measures how much uncertainty a random variable contains on average, before you observe it.
Why does this matter? Because entropy tells you how well you can compress data. If a coin is almost always heads, you can describe a long sequence of flips very compactly: "99 heads, then one tails" instead of writing out every flip. The entropy gives the compression limit — you cannot compress below it without losing information. This is Shannon's source coding theorem, and it makes entropy the central quantity of information theory.
The chain rule is the last piece. If you have two random variables and , the total uncertainty equals the uncertainty in plus the remaining uncertainty in once you know . Written as , it says: total surprise decomposes into the surprise of the first variable plus the surprise of the second given that you already saw the first. This decomposition is the workhorse of every proof in the subject.
Visual Beginner
Figure: a bar chart of the probability distribution of a loaded die. The die has faces 1 through 6 with probabilities . Below the chart, a single number: the entropy bits. A second bar chart next to it shows a uniform die (all faces ) with entropy bits. The more concentrated distribution has lower entropy.
| Distribution | Entropy (bits) | Visual intuition |
|---|---|---|
| Fair coin (50/50) | 1.00 | Maximum uncertainty for 2 outcomes |
| Biased coin (99/1) | 0.08 | Almost no uncertainty |
| Fair die (1/6 each) | 2.58 | Maximum for 6 outcomes |
| Loaded die (40/25/15/10/7/3) | 2.14 | Less than fair — some outcomes are predictable |
| Deterministic (100/0) | 0.00 | No uncertainty at all |
The pattern: spread-out distributions have high entropy; concentrated distributions have low entropy. The maximum is the uniform distribution; the minimum is zero, at a point mass.
Worked example Beginner
A weather station classifies each day as sunny, cloudy, or rainy with probabilities , , . What is the entropy of tomorrow's weather?
Step 1. Compute the information content of each outcome: .
- Sunny: bit.
- Cloudy: bits.
- Rainy: bits.
Rain is the most surprising outcome (lowest probability, highest information). Sunny is the least surprising.
Step 2. Take the average, weighted by how likely each outcome is:
Step 3. Compare. The maximum entropy for three outcomes is bits (uniform distribution). Our weather has bits, which is less — sunny days are somewhat predictable.
What this tells us. Each day's weather carries about 1.5 bits of information. Over a year of 365 days, the total information is roughly bits. A compression scheme cannot describe a year of weather using fewer than about 542 bits on average; the entropy is the fundamental limit.
Check your understanding Beginner
Formal definition Intermediate+
Let be a discrete random variable taking values in a finite set with probability mass function .
Definition (Shannon entropy). The entropy of is
where is defined by its continuous extension to be . The unit is bits (base-2 logarithm). Changing the base to gives entropy in nats; to 10, in dits.
The logarithm of is the information content (or surprisal) of outcome :
Entropy is the expected information content: .
Definition (Joint entropy). For a pair with joint pmf on :
Definition (Conditional entropy). The conditional entropy of given is
Equivalently, .
Counterexamples to common slips
Entropy depends on the distribution, not the values. is determined entirely by the probability vector , not by the labels of the outcomes. A die labelled and one labelled have the same entropy if their probability vectors match.
Conditional entropy is not . The quantity is the average of over all values of weighted by . It is a single number, not a function of .
Entropy can be zero but not negative. if and only if is deterministic. Since each term and the sum is non-negative, entropy is always at least zero.
Key theorem with proof Intermediate+
Theorem (Chain rule for entropy). For any collection of discrete random variables with joint pmf :
Proof. By induction on . The base case is . For the inductive step, write the joint entropy of variables as the joint entropy of the first plus the conditional entropy of the -th given the first :
This is the two-variable identity with and , which follows directly from the definition:
Bridge. The chain rule is the structural identity that organises the entire subject. It builds toward the asymptotic equipartition property in 46.02.01 by letting us decompose the entropy of a sequence into a sum of conditional entropies that, for stationary ergodic sources, converges to the entropy rate . It appears again in the Fano inequality 46.03.03 as , the foundational reason why conditional entropy controls the probability of guessing from . The decomposition is exactly the mechanism by which source coding, channel coding, and rate-distortion theorems extract their operational quantities from the entropy function.
Exercises Intermediate+
Lean formalization Intermediate+
Mathlib does not define Shannon entropy on discrete distributions. The PMF type for probability mass functions exists (ProbabilityTheory.PMF), but there is no functional , no joint-entropy definition for product distributions, no conditional entropy, and no chain-rule proof. The elementary inequalities (non-negativity, maximality at the uniform, conditioning reduces entropy) are absent. The uniqueness theorem (Khinchin's axioms) is unformalised. A Codex.InformationTheory.Entropy module defining on PMF and proving the chain rule from the product expansion would be the load-bearing first step; this unit ships without it.
Advanced results Master
Shannon's axiomatic characterisation
Shannon's 1948 paper introduced entropy not by definition alone but by a set of axioms that pin it down uniquely. For a function on finite probability distributions, the four axioms are:
- Continuity: is continuous in each .
- Symmetry: is invariant under permutation of .
- Maximality: .
- Grouping: If for a partition of the -th outcome into two sub-outcomes, then
The grouping axiom is the load-bearing requirement. It says: if you refine an outcome into two sub-outcomes, the entropy increases by the entropy of the refinement weighted by the probability of the refined event. Shannon proved that the unique (up to a multiplicative constant, fixed by the log base) function satisfying all four axioms is .
Khinchin (1953) independently gave a cleaner set: continuity, symmetry, maximality at the uniform, and additivity ( for independent distributions). Either set characterises entropy, and the uniqueness theorem tells you that no other functional can play the same role.
The Han inequality and Shearer-style bounds
The chain rule implies a family of inequalities that constrain the joint entropy of collections of variables. The most useful is the Han inequality: for any random variables ,
This follows from subadditivity: each (where denotes all variables except ), and summing over gives . Combined with (subadditivity), the result follows.
A more general form, Shearer's lemma, states: if is a collection of subsets of such that each element appears in at least members of , then . This is a workhorse in combinatorial applications of entropy and cross-refers the probabilistic method in 40.07.01.
Strong concavity and the entropy metric
The function is strictly concave on the simplex . This means that for any two distributions and any :
with equality iff . The concavity has a direct operational meaning: mixing two sources (drawing from with probability and from with probability ) creates more uncertainty than either source alone, weighted by the mixing proportions.
Synthesis. Entropy is the unique functional on probability distributions satisfying Shannon's four axioms; the chain rule decomposes joint uncertainty into a telescoping sum of conditional uncertainties; subadditivity is the shadow of independence, with equality iff the variables are independent; and the Han and Shearer inequalities provide combinatorial leverage by constraining how entropy distributes across subsets. The central insight builds toward the AEP 46.02.01, where entropy becomes the exponent governing the size of the typical set, and generalises to the relative entropy 46.01.02, where the asymmetry between two distributions is measured by the same logarithmic structure.
Full proof set Master
Proposition (Entropy of a function). Let for a deterministic function . Then , with equality iff is injective on the support of .
Proof. Since , the value of determines , so . By the chain rule, . Also , since . Therefore .
Equality holds iff , meaning is a function of . But , so this says is a function of , which holds iff is injective on the support.
Proposition (Fano's inequality, preliminary form). If takes values in and is an estimator of with error probability , then
where is the binary entropy.
Proof. Define the error indicator . By the chain rule,
Since is binary, . For : when (correct guess), is determined, contributing . When (wrong guess), is among the remaining values, contributing at most . Weighted by :
Connections Master
37.01.01— The probability-space formalism on which entropy is built; entropy is a functional on distributions, which are defined on measurable spaces.46.01.02— Mutual information and KL divergence are constructed from entropy and conditional entropy; the chain rule proved here is the algebraic engine for their calculus.46.02.01— The AEP uses the chain rule to decompose and shows that i.i.d. draws concentrate in a typical set of size .46.02.02— Shannon's source coding theorem proves the operational meaning of entropy: the minimum achievable compression rate equals .37.07.05— Sanov's theorem in large deviations measures the rarity of empirical distributions by the KL divergence from the true distribution; entropy is the zero point of this landscape.40.07.01— The probabilistic method uses entropy-based counting arguments (Shearer's lemma, the Loomis-Whitney inequality) to bound the size of combinatorial objects.
Historical & philosophical context Master
Claude Shannon introduced entropy in his 1948 paper "A Mathematical Theory of Communication" (Bell System Technical Journal 27, 379-423 and 623-656). The paper's title was expanded to "The Mathematical Theory of Communication" when republished as a book with Warren Weaver in 1949. Shannon was working at Bell Labs on the fundamental limits of signal transmission; his insight was that information could be quantified independently of its meaning, purely in terms of the statistics of the source.
The formula was not new — it had appeared in statistical mechanics as Boltzmann's -theorem (1872) and in Gibbs' entropy for thermodynamic ensembles. Shannon's contribution was the axiomatic derivation (the four axioms above), the operational interpretation (compression limit), and the channel coding theorem that gives entropy a second operational meaning as the maximum reliable communication rate. John von Neumann, upon seeing the formula, reportedly told Shannon to call it "entropy" because "nobody knows what entropy really is, so in a debate you will always have the advantage" (an anecdote relayed by McIrvine and Tribus in their 1971 Energy and Information).
Aleksandr Khinchin gave a cleaner axiomatic treatment in 1953 (Uspekhi Mat. Nauk 8, translated by Silverman as Mathematical Foundations of Information Theory, Dover 1957), establishing the uniqueness theorem under the symmetry-maximality-additivity axioms. Imre Csiszár extended the framework to an I-measure representation in the 1970s, showing that information quantities for collections of random variables satisfy the same inclusion-exclusion identities as signed measures on an abstract space, making the Venn diagram for entropy, conditional entropy, and mutual information not merely an analogy but a theorem.
Bibliography Master
@article{shannon1948,
author = {Shannon, C. E.},
title = {A Mathematical Theory of Communication},
journal = {Bell System Technical Journal},
volume = {27},
pages = {379--423 and 623--656},
year = {1948},
}
@book{cover-thomas2006,
author = {Cover, T. M. and Thomas, J. A.},
title = {Elements of Information Theory},
edition = {2nd},
publisher = {Wiley},
year = {2006},
}
@book{csiszar-korner2011,
author = {Csisz{\'a}r, I. and K{\"o}rner, J.},
title = {Information Theory: Coding Theorems for Discrete Memoryless Systems},
edition = {2nd},
publisher = {Cambridge University Press},
year = {2011},
}
@book{khinchin1957,
author = {Khinchin, A. I.},
title = {Mathematical Foundations of Information Theory},
publisher = {Dover},
year = {1957},
note = {Translated by R. A. Silverman from the 1953 Russian edition},
}
@article{han1975,
author = {Han, T. S.},
title = {Nonnegative Entropy Measures of Multivariate Symmetric Correlations},
journal = {Information and Control},
volume = {36},
pages = {133--156},
year = {1975},
}
@article{chung-graham-wilson-1989,
author = {Chung, F. R. K. and Graham, R. L. and Wilson, R. M.},
title = {Quasi-Random Graphs},
journal = {Combinatorica},
volume = {9},
pages = {345--362},
year = {1989},
note = {Contains the entropy-based quasi-random characterisations},
}