Entropy & Information Content
Volume I, Chapter 3 — Part III. Shannon entropy from axioms, uniqueness theorem, chain rule, conditional entropy, differential entropy, maximum entropy principle, source coding, and connections to cross-entropy loss and perplexity in machine learning.
Prerequisites
Table of Contents
- Learning Objectives
- Prerequisites
- Notation
- Core Intuition
- Information Content of an Event
- The Uniqueness Theorem for Self-Information
- Shannon Entropy: Definition and Derivation
- Properties of Entropy: Proofs
- Conditional Entropy and the Chain Rule
- Mutual Information
- Differential Entropy for Continuous Variables
- Maximum Entropy Principle
- Source Coding and the Entropy Lower Bound
- Connection to Machine Learning
- Common Pitfalls and Misconceptions
- Research Perspective
- Summary of Takeaways
- Exercises
Learning Objectives
After reading this chapter, you should be able to:
- State the axioms for self-information and prove that is the unique solution (up to base).
- Define Shannon entropy and prove non-negativity, the upper bound , and when equality holds.
- Derive and apply the chain rule for joint entropy and conditional entropy.
- Define mutual information and prove the identity .
- Distinguish discrete entropy from differential entropy and explain why differential entropy can be negative.
- State the maximum entropy principle for discrete and continuous settings.
- Explain how cross-entropy loss, perplexity, and the information bottleneck arise from entropy concepts.
Prerequisites
- Bayes' Theorem: conditional probability, product rule, conditioning reduces uncertainty.
- Vectors, Spans & Linear Independence: Jensen's inequality (concave ) appears in entropy bounds.
Later connections:
- KL Divergence: entropy difference defines divergence.
- The Multivariate Gaussian: Gaussian achieves maximum differential entropy for fixed variance.
Notation
- — Shannon entropy (nats or bits)
- — Conditional entropy
- — Mutual information
- — Mass or density functions
- — Natural logarithm unless stated otherwise
Core Intuition
How much information does a random event carry? A fair coin flip () is more informative than a biased coin () because the outcome is more uncertain. Shannon's insight (1948) was to quantify this intuition axiomatically: information should be non-negative, zero for certain events, and additive for independent events. The unique measure is .
The entropy is the average information content — the expected surprise when sampling from . It answers: How many bits (on average) are needed to encode outcomes of using an optimal code?
In machine learning, entropy is everywhere:
- Cross-entropy loss measures how many extra bits our model uses compared to the true distribution.
- Perplexity exponentiates cross-entropy to give an effective "branching factor" for language models.
- Mutual information quantifies how much a representation tells us about the target — the foundation of the information bottleneck.
Series context. This is Part III of Chapter 3 in Volume I. It precedes KL Divergence, where .
Interactive: Entropy & Information Content
Surprise of most likely
-log₂(0.30) = 1.74 bits
Efficiency
91.3% of max
Information Content of an Event
Definition 1 (Self-Information). The information content (self-information, surprisal) of an event with probability is:
where is the log base. We use for bits and for nats ().
Example 1. For a fair die outcome (): bits. For a certain event (): bits.
Axioms for Self-Information. A function should satisfy:
- Non-negativity: .
- Zero for certainty: .
- Continuity: is continuous on .
- Additivity for independence: when two events with probabilities are independent (joint probability ).
Interpretation of (4). Learning that two independent events occurred should convey the sum of their individual information contents — information is additive for independent surprises.
The Uniqueness Theorem for Self-Information
Theorem 1 (Uniqueness of Self-Information). The only function satisfying axioms 1–4 is for some constant .
Proof. Axiom 4 states . Define for . This is Cauchy's functional equation on the multiplicative group .
Step 1 — Reduction to additive form. Let for . Then for :
So satisfies the additive Cauchy equation on .
Step 2 — Continuity implies linearity. By axiom 3, is continuous, hence is continuous. The only continuous solution to on is for some .
Step 3 — Back-substitution. . Non-negativity (axiom 1) and monotonicity (axiom 2: , and decreases as increases) require .
Remark. The choice of base is conventional: gives bits; gives nats. All bases differ by a constant factor .
Shannon Entropy: Definition and Derivation
Definition 2 (Shannon Entropy — Discrete). For discrete random variable with PMF :
Convention. Define , ensuring events with zero probability contribute nothing.
Definition 3 (Joint and Conditional Entropy). For joint PMF :
Example 2 (Binary Entropy). For :
This is symmetric about , where bit (maximum). At , .
Example 3 (Uniform Distribution). For uniform on : bits.
Properties of Entropy: Proofs
Property 1 (Non-Negativity). , with equality iff is deterministic (supported on a single value).
Proof. Each term since implies . Equality requires for all , with exactly one .
Property 2 (Upper Bound). For taking at most distinct values:
with equality iff is uniform on values.
Proof. By Jensen's inequality, since is convex (equivalently, is concave):
Equality in Jensen holds iff is constant a.e., i.e., for all in the support.
Property 3 (Invariance under bijection). If for a bijection , then .
Proof. , and the sum (3) is unchanged under relabeling.
Property 4 (Concavity in the distribution). is concave in the probability vector .
This implies that mixing distributions increases entropy — uncertainty is maximized at the "center" of the probability simplex.
Conditional Entropy and the Chain Rule
Theorem 2 (Chain Rule for Entropy). For any random variables and :
Proof. Using :
Splitting the sum:
The first term is . For the second: , so .
Theorem 3 (Conditioning Reduces Entropy). , with equality iff and are independent.
Proof. From (9): and . Alternatively, directly:
since iff — the log-sum inequality gives non-negativity. Equality when everywhere.
Interpretation. Observing cannot increase average uncertainty about . Side information helps (or at least does not hurt) prediction.
Corollary 1 (General Chain Rule). For :
This decomposition is fundamental to sequential coding and autoregressive language models.
Mutual Information
Definition 4 (Mutual Information). The mutual information between and is:
Theorem 4. , with equality iff and are independent.
Proof. From (12), .
Interpretation. measures how much knowing reduces uncertainty about (equivalently, how much knowing reduces uncertainty about ). It is symmetric: .
Definition 5 (KL Connection — Preview).
the KL divergence between the joint distribution and the product of marginals. Developed fully in KL Divergence.
Differential Entropy for Continuous Variables
Definition 6 (Differential Entropy). For continuous with PDF :
Key differences from discrete entropy:
- Can be negative. Example: has .
- Not invariant to coordinate changes. Under , .
- Not a direct coding bound (unlike discrete ), but differences of differential entropies are meaningful.
Theorem 5 (Gaussian Maximum Entropy — Univariate). For fixed variance , the Gaussian maximizes :
with equality iff .
Proof sketch. Lagrange multipliers on subject to and . The optimizer satisfies , i.e., is Gaussian.
Multivariate extension: see The Multivariate Gaussian, Theorem 9.
Maximum Entropy Principle
Principle (Maximum Entropy). Given constraints (e.g., known mean, variance, support), choose the distribution that maximizes entropy subject to those constraints. This is the least informative (most agnostic) distribution consistent with what is known.
Theorem 6 (Discrete Maximum Entropy). Among distributions on points with no further constraints, the uniform distribution maximizes at .
Theorem 7 (Continuous — Fixed Mean and Variance). Among distributions on with given mean and variance , the Gaussian maximizes .
Theorem 8 (Exponential Family). Maximum entropy subject to constraints for sufficient statistics yields an exponential family distribution:
ML significance. Logistic regression arises from max-entropy with fixed mean constraints on features; Gaussian noise models arise from max-entropy with fixed variance. Prior selection in Bayes' Theorem often uses max-entropy reasoning.
Source Coding and the Entropy Lower Bound
Theorem 9 (Shannon's Source Coding Theorem — Informal). The expected code length for any lossless encoding of i.i.d. samples from is bounded below by bits per symbol. There exist codes (e.g., Huffman, arithmetic) achieving .
Proof sketch (lower bound). For code lengths with Kraft inequality , define . Then:
since .
Interpretation. Entropy is the fundamental limit of compression. Language models that achieve low cross-entropy are approaching the entropy of natural language — the irreducible randomness in text.
Connection to Machine Learning
Cross-Entropy Loss
For true distribution and model :
Since is constant w.r.t. model parameters, minimizing cross-entropy minimizing KL divergence Maximum Likelihood Estimation.
For one-hot labels and softmax output :
the standard classification loss.
Perplexity
For language models:
Perplexity means the model assigns on average the same probability as choosing uniformly among options. GPT-class models achieve perplexity – on diverse corpora; the entropy of English text is estimated at – bits per character.
Information Bottleneck
Find representation of input that maximizes (relevant to target ) while minimizing (compression):
This provides a theoretical framework for understanding what deep networks extract — task-relevant information at minimal complexity.
Decision Trees and Information Gain
Splitting a node on feature maximizes information gain — the reduction in label entropy. ID3 and C4.5 use this criterion.
Common Pitfalls and Misconceptions
Pitfall 1: Treating differential entropy like discrete entropy. Negative differential entropy does not mean "negative information." Only differences (e.g., KL divergence) are invariant and interpretable in the continuous case.
Pitfall 2: Confusing entropy with variance. High variance does not always mean high entropy (e.g., a deterministic function of a high-entropy variable can have low entropy). Entropy depends on the full distribution, not just second moments.
Pitfall 3: Assuming means is a function of . It means is determined given , but could still be random if is unobserved.
Pitfall 4: Ignoring the base of the logarithm. Entropy in bits vs nats differs by . Cross-entropy loss in deep learning typically uses nats (); perplexity uses bits ().
Pitfall 5: Equating low training cross-entropy with good generalization. on training data can be minimized while remains high — overfitting. See Bias–Variance Tradeoff.
Research Perspective
Claude Shannon's "A Mathematical Theory of Communication" (1948) established entropy, channel capacity, and source coding — founding information theory. Jaynes (1957) extended maximum entropy to statistical mechanics and Bayesian inference. The connection to ML emerged gradually: cross-entropy as classification loss (Bridle, 1990), the information bottleneck (Tishby et al., 1999), and modern use in language modeling evaluation.
Current research uses mutual information for representation learning (MINE, InfoNCE), studies entropy of neural network outputs for calibration, and applies information-theoretic bounds to generalization. The entropy of LLM-generated text and its relationship to human text entropy is an active measurement problem.
Summary of Takeaways
- Self-information — — Per-sample surprisal
- Entropy — — Average uncertainty
- Conditional entropy — — Remaining uncertainty
- Chain rule — — Autoregressive decomposition
- Mutual information — — Feature relevance
- Cross-entropy — — Classification loss
- Perplexity — — LM evaluation
- Max entropy — Uniform (discrete), Gaussian (continuous) — Prior / noise selection
Next article: KL Divergence → — measuring discrepancy between distributions.
Exercises
Exercise 1 (Uniqueness). Verify that satisfies all four axioms for self-information.
Exercise 2 (Binary entropy). Plot and prove it is maximized at by differentiation.
Exercise 3 (Chain rule). Prove (13) by induction on .
Exercise 4 (Mutual information). Show using definitions.
Exercise 5 (Differential entropy). Compute for and verify (17) at equality when .
Exercise 6 (Coding). For with , construct a prefix code and compare its expected length to .
Exercise 7 (Conceptual). Why does minimizing cross-entropy not guarantee good test performance?
Exercise 8 (Proof). Complete the proof of Theorem 3 (conditioning reduces entropy) using the log-sum inequality.