Entropy & Mutual Information
Entropy measures average uncertainty in a probability distribution; conditional entropy measures what remains after observation; mutual information measures the expected reduction. These quantities concern statistical dependence and coding limits, not meaning, truth or usefulness by themselves.
Information theory begins with uncertainty over possible messages, not with their semantic meaning. If a discrete random variable has outcomes with probabilities , its entropy in bits is
The contribution is the self-information of observing : a rare outcome is more surprising than a common one. Entropy is its expectation.
Why the logarithm appears #
Independent events should add information. If events with probabilities and occur independently, their joint probability is . The logarithm is the continuous transformation satisfying
Changing log base changes units: base 2 gives bits, base nats. The minus sign makes information nonnegative because probabilities do not exceed one.
Entropy is zero when one outcome is certain. For equiprobable outcomes it is , the maximum possible entropy on that finite alphabet.
Worked example #
Let take values normal, slow, failed with probabilities , , :
There are three labels, but uncertainty is below bits because one label dominates. Entropy does not say whether “failed” is important; it only describes the distribution.
Joint and conditional entropy #
For variables and ,
Conditional entropy is
The chain rule follows by factoring :
It says the average description of the pair can be separated into the information needed for plus what remains for after is known.
Mutual information #
Mutual information is the expected reduction in uncertainty about one variable after observing the other:
Equivalently,
This is zero exactly when and are independent. It is symmetric and nonnegative. A perfect copy has .
Mutual information detects nonlinear statistical dependence that zero correlation can miss. It still does not establish causality: a common cause, selection effect or data leakage can produce high .
flowchart LR HX["H(X)"] --> I["shared uncertainty\nI(X;Y)"] HY["H(Y)"] --> I HX --> CX["remaining H(X|Y)"] HY --> CY["remaining H(Y|X)"]
KL divergence and cross-entropy #
For distributions and on the same support,
It is an expected excess log loss from using when data follow . It is not symmetric and is not a distance. If where , the divergence is infinite.
Cross-entropy is
When is fixed, minimizing cross-entropy over minimizes KL divergence. This identity is the foundation for many probabilistic learning losses.
Mutual information is itself a KL divergence:
It measures how far the joint distribution is from independence.
Continuous variables require care #
Replacing the sum with an integral yields differential entropy
Unlike discrete entropy, depends on coordinate scale and can be negative. It is not the number of bits needed to encode an exact real value. Mutual information and relative entropy remain coordinate-invariant under suitable invertible transformations, which is why they are usually safer continuous quantities.
Estimation is the hard part #
Plugging empirical frequencies into the formulas works for small, well-sampled discrete alphabets. With many categories or continuous/high-dimensional variables, estimates can be strongly biased and sensitive to binning, kernels or model choice. Always report estimator, sample size, smoothing, uncertainty and validation.
What entropy does not measure #
- semantic meaning or truth;
- practical value of a message;
- causal influence;
- algorithmic complexity of one individual object;
- thermodynamic entropy without a physical mapping and units;
- security merely because output entropy looks large.
Entropy answers a precise probabilistic question. Its power comes from keeping that question precise rather than treating “information” as one universal substance.
Sources
- bookTheory of Systems and Systems Analysis: Lecture Coursepdfnotes
- paperClaude E. Shannon — A Mathematical Theory of Communication