Information Theory and Entropy
Information theory provides a language for uncertainty and the limits of communication. Build this branch in the following order:
- self-information and entropy;
- joint and conditional entropy;
- mutual information and independence;
- cross-entropy and Kullback–Leibler divergence;
- source coding and compression limits;
- noisy channels and channel capacity;
- connections to probabilistic modeling and machine-learning objectives.
This reference covers finite discrete distributions and their use in coding and prediction. Start with probability, conditional probability, and expectation. MIT OpenCourseWare 6.050J develops the broader communication and physical-system topics above.
Surprise and average uncertainty
If an outcome has probability , its self-information is bits. Independent outcomes have multiplying probabilities, so their information adds. A certain outcome carries zero bits; a probability- outcome carries 3 bits. This measures surprise under a model, not truth, usefulness, or meaning.
For a random variable with probabilities , entropy is expected self-information:
For possible outcomes, , with the maximum at the uniform distribution. A fair coin has entropy 1 bit; a coin with probabilities has bits. The rarer outcome carries 2 bits, but entropy averages over both outcomes.
Conditioning and shared information
Joint entropy measures uncertainty in the pair . Conditional entropy averages the uncertainty remaining in after observing :
Mutual information is nonnegative and is zero exactly when and are independent. Conditioning cannot increase entropy on average, although a particular observation can increase uncertainty. If for a fair coin, and bit. For two independent fair coins, and . Dependence alone does not establish causation.
For two finite discrete variables, read the overlap as shared information. On average, observing X removes that part of the uncertainty about Y; the remaining right-hand region is H(Y | X). The regions illustrate entropy identities, not sets of possible outcomes. The figure writes I(X, Y) for the same quantity denoted I(X; Y) here.
Cross-entropy and model mismatch
Let be the actual distribution and the predictive distribution on the same outcomes. Using base-2 logs,
Terms with contribute zero and are omitted. If where , these quantities are infinite. Otherwise KL divergence is nonnegative and vanishes exactly when the distributions agree. It is not a distance metric: it is generally asymmetric and does not satisfy the triangle inequality.
For and , cross-entropy is 1 bit and KL divergence is about bits. Minimizing cross-entropy over minimizes KL because is fixed. In classification, averaging over observed labels estimates an expected log loss; natural logs give nats rather than bits. Low training loss alone does not establish performance on new data.
What entropy says about compression
For a known finite source distribution, the optimal binary prefix code has expected length satisfying . Entropy is an average lower bound, not a fractional-length promise for each symbol. The biased coin still needs one bit per symbol with a one-symbol binary prefix code. For independent, identically distributed symbols, coding blocks of length reduces the possible overhead per symbol below bit. Correlated sources require conditional structure or entropy rates; their single-symbol entropy need not be the best per-symbol limit.
Continuous variables need a separate treatment: differential entropy depends on coordinates and can be negative, so it is not directly the number of bits needed to store a real value. Precision must be specified before discussing such storage costs.