Contents / Information Theory / Mutual Information and Relative Entropy
Chapter 2
Mutual Information and Relative Entropy
How much one variable says about another, how far one distribution sits from another, and the inequalities that tie the two together.
Introduction
How much one variable says about another, how far one distribution sits from another, and the inequalities that tie the two together.
2.1Mutual Information
Mutual information is the quantity that makes information theory a theory of communication rather than of storage alone. It measures how much observing one variable tells you about another, it is symmetric, and it is the maximand in the definition of channel capacity.
Definition 2.1 (Mutual information). For discrete random variables and with joint pmf and marginals , , the mutual information is
Proposition 2.2 (Equivalent forms).
and .
Proof. Split the logarithm in the definition: . Averaging the two terms against gives and respectively, proving the first form; exchanging the roles of and gives the second. Substituting the chain rule into the first gives the third. The fourth is the definition of relative entropy applied to the pair of distributions and on . Finally, , so .∎
Notation. The semicolon in separates the two sides of the information; the comma in joins variables into one. Thus is the information that the pair carries about , whereas is the information that carries about the pair. The two are different quantities.
Intuition. Take the total description cost of the pair. Describing and separately costs ; describing them jointly costs . The saving is the redundancy between them — information that appears twice in the separate description and once in the joint one. That saving is .
Because entropy is self-information, : everything a variable knows about itself is everything it is.
The three entropies and the mutual information partition the joint entropy into three non-overlapping pieces, a decomposition worth keeping at hand.
| Quantity | In terms of the pieces | Meaning |
|---|---|---|
| | left piece | in only |
| | middle piece | shared |
| | right piece | in only |
| | left middle | all of |
| | middle right | all of |
| | all three | the pair |
Example 2.3 (Two correlated bits). Let and . Compute two ways.
Solution. Both marginals are fair bits, so . From the earlier calculation, bits, so
By the divergence form, the product of marginals puts in each cell, so
The two routes agree. Sanity check: , as required for variables that are dependent but not deterministic functions of each other. □□
2.2Interpretation, and Information in the Presence of a Third Variable
In a communication setting is what was sent and is what was received; is the number of bits per use that actually got through. The two extremes read off immediately from Proposition Equivalent forms: when is independent of (nothing got through), and when , i.e. is recoverable from (everything got through).
Example 2.4 (Reading a channel's throughput). A source is uniform on symbols and the receiver's residual uncertainty is bits. How much information crosses per use, and what does Fano say about the decoder?
Solution. , so bits per use. Fano's inequality with gives
a vacuous bound — which is the right answer, since bits of residual uncertainty is consistent with a very good decoder. The sharp form gives , a real constraint. □□
Once a third variable is in play, the natural object is mutual information computed inside each slice of that variable.
Definition 2.5 (Conditional mutual information).
By the conditioning principle, , with equality exactly when and are conditionally independent given .
Theorem 2.6 (Chain rule for mutual information).
Proof. Write the left side as a difference of entropies and expand each by the chain rule:
Pairing the sums term by term, the -th difference is by the definition of conditional mutual information.∎
Pitfall. Conditioning can increase mutual information. Let and be independent fair bits and let . Then , but given the two bits determine each other, so bit. Conversely, conditioning on a common cause destroys mutual information. There is therefore no general inequality between and — unlike entropy, where conditioning always reduces.
Intuition. The exclusive-or example is the canonical warning. Two unrelated facts can become perfectly correlated once you learn a constraint that couples them — knowing the parity of two unknown bits turns each into the other's answer key. The "Venn diagram" picture of information, which suggests , is unreliable precisely here: the three-variable analogue can be negative.
2.3Non-negativity, Data Processing, and Convexity
Theorem 2.7 (Information inequality). , with equality if and only if and are independent.
Proof. By Proposition Equivalent forms, , and Gibbs' inequality gives with equality iff the two distributions coincide — that is, iff for all .∎
This single inequality is what turns the identities of the chapter into bounds: subadditivity, conditioning reduces entropy, and the independence bound are all restatements of .
Proposition 2.8 (Elementary properties). Mutual information is symmetric, ; satisfies ; equals when determines ; and is unchanged by relabelling, whenever and are injective on the respective supports.
Proof. Symmetry is visible in the definition, which is symmetric in and . The bound follows from since , and symmetrically for . If then . Invariance under injections holds because an injective relabelling leaves the joint pmf's list of values unchanged.∎
The central structural theorem is that information cannot be created by processing. Recall that is a Markov chain when is conditionally independent of given , i.e. — the situation whenever is computed from alone, possibly with independent randomness.
Theorem 2.9 (Data processing inequality). If is a Markov chain, then
Equality in the first holds if and only if is also a Markov chain.
Proof. Expand by the chain rule for mutual information in both orders:
The Markov property says and are conditionally independent given , so . Therefore
and since we get , with equality exactly when , i.e. when and are conditionally independent given . The second inequality follows by applying the first to the reversed chain , which is also Markov.∎
Corollary 2.10 (Processing your own data does not help). For any function , . Also, conditioning on a downstream variable cannot help: if , then .
Proof. For the first, is a Markov chain, so the data processing inequality applies. For the second, the displayed identity in the proof above rearranges to , since .∎
Intuition. No amount of cleverness applied to a received signal recovers information the channel destroyed. A denoiser, a decoder, a neural network — all are functions of , and all sit downstream of the bottleneck. This is why the data processing inequality is the backbone of converse proofs: it lets you replace the whole receiver by the single number .
Example 2.11 (Two noisy hops). A fair bit passes through a binary symmetric channel with crossover to give , then through a second independent such channel to give . Verify the data processing inequality numerically.
Solution. For a fair input into a binary symmetric channel with crossover , the output is also a fair bit, so . With , , so bits.
The two hops compose into one channel that flips the bit exactly when precisely one of the two hops flips it, so the effective crossover is . Hence bits.
Check: . ✓ The inequality is strict, as it must be whenever the second hop is genuinely noisy. □□
Finally, mutual information has a convexity structure that underlies the computation of capacity and of rate–distortion functions.
Theorem 2.12 (Concavity and convexity of mutual information). Write as a function of the input distribution and the channel . Then
- for fixed , is a concave function of ;
- for fixed , is a convex function of .
Proof. (1) Write . With the channel fixed, is linear in . The output distribution is also linear in , and is concave in a distribution (Theorem Concavity of entropy), so is a concave function of . A concave function minus a linear one is concave.
(2) Here we use the divergence form. Fix and let be two channels with output distributions ; for the mixed channel has output . Then , and relative entropy is jointly convex in its pair of arguments (Theorem Convexity of relative entropy). Since both arguments are affine in the channel, the composition is convex.∎
Note. Claim (1) is why capacity is a well-behaved optimisation: a concave function on the simplex has a unique maximum value, attainable by convex programming (the Blahut–Arimoto algorithm). Claim (2) says that mixing two channels is at least as bad as the mix of their informations — noise does not average favourably.
2.4Relative Entropy
Relative entropy, or Kullback–Leibler divergence, measures how far one distribution is from another. It is not a metric — it is asymmetric and violates the triangle inequality — but it is the correct notion of discrepancy for every question in this subject, because it is exactly the number of bits wasted by using the wrong model.
Definition 2.13 (Relative entropy (Kullback–Leibler divergence)). For probability mass functions and on a common alphabet ,
with the conventions and for . Thus unless is absolutely continuous with respect to , i.e. .
Intuition. You built a compressor believing the world follows . It actually follows . Then is the number of extra bits per symbol you spend — the fine for a wrong model, payable on every symbol forever. If your model assigns probability zero to something that actually happens, the fine is infinite, which is the information-theoretic statement of "never say never".
Pitfall. is not symmetric and the asymmetry is not a technicality; it changes what the divergence rewards. averages under , so it punishes a model that is too narrow (it must cover everything does). averages under and punishes a model that is too broad. In variational inference the choice between "forward" and "reverse" KL is exactly the choice between a mode-covering and a mode-seeking approximation.
Example 2.14 (A mismatched coin model). The true source is Bernoulli; the model is a fair coin. Compute and .
Solution. Forward:
Reverse:
The two differ, confirming asymmetry, and both are positive as Gibbs' inequality requires. Note also that there is a clean shortcut for the forward direction: , since coding every outcome at bit gives cross-entropy exactly . □□
2.5Cross-Entropy and Excess Code Length
Definition 2.15 (Cross-entropy). The cross-entropy of relative to is
the expected code length when the code lengths are the ideal lengths for the model but the data are drawn from .
Notation. The symbol for cross-entropy collides with for joint entropy. The arguments disambiguate: two distributions means cross-entropy, two random variables means joint entropy. Some authors write or to avoid the clash.
Theorem 2.16 (Relative entropy is excess code length).
Proof. Insert twice:
Combined with the source coding theorem this is a complete operational reading of . Coding -distributed data with a code matched to costs bits per symbol; the best possible is ; the gap is , and Gibbs' inequality says the gap is never negative. This is also exactly the statement that maximum-likelihood fitting is divergence minimisation: since does not depend on the model, minimising cross-entropy over minimises .
Intuition. Cross-entropy is what you actually pay; entropy is what you would pay with a perfect model; divergence is the surcharge. Training a classifier by minimising cross-entropy is, in these terms, buying down the surcharge on a code for the labels.
Example 2.17 (Reading the decomposition). The biased coin of the last example has bits. Confirm the excess-length identity against the fair-coin code.
Solution. Under the fair-coin model every outcome gets a -bit codeword, so bit exactly. Then
matching the direct computation. Interpretation: coding a million biased flips with a fair-coin code costs bits where would have sufficed — wasted bits, every one of them attributable to the model error. □□
2.6Gibbs, Log-Sum, Convexity, and Mutual Information
Theorem 2.18 (Gibbs' inequality / information inequality). For any distributions , on a common alphabet,
with equality if and only if for every .
Proof. Via Jensen. Let . Since is concave,
Strict concavity makes the first step an equality only when is constant on , and the second only when places no mass outside ; the two together force .
Via log-sum. Apply the log-sum inequality with and : the left side is and the right side is . The equality condition — constant ratio — again gives , since both sum to .∎
Corollary 2.19 (Uniform maximises entropy). For on a finite alphabet and the uniform distribution,
Proof. , and Gibbs' inequality gives the bound.∎
This is a second, cleaner proof of the upper bound in Theorem Range of entropy, and it exhibits the "distance from uniform" as exactly the entropy deficit — a quantity engineers call the redundancy of the source.
Theorem 2.20 (Convexity of relative entropy). is jointly convex in the pair : for ,
Proof. Fix and apply the log-sum inequality to the two-term lists and :
where the constants cancel inside each logarithm on the right. Summing over gives the claim.∎
Proposition 2.21 (Mutual information as a divergence).
so mutual information measures exactly how far the joint distribution sits from independence.
Proof. Immediate from the definitions: the summand is the divergence summand with the pair as the alphabet symbol.∎
Example 2.22 (Mutual information computed as a divergence). Take , again, and verify Proposition Mutual information as a divergence against the entropy route.
Solution. The marginals are fair bits, so in every cell. Then
Via entropies: and , so bits. ✓ Both routes agree, and when and are independent the joint is the product, making both zero. □□
Relative entropy also conditions and chains, exactly as entropy does.
Definition 2.23 (Conditional relative entropy). For joint distributions and ,
Theorem 2.24 (Chain rule for relative entropy).
Proof. Factor both joints and split the logarithm:
and the first sum collapses to because .∎
Corollary 2.25 (Data processing for divergence). If and are pushed through the same channel , producing and likewise, then .
Proof. Apply the chain rule in the two orders to the joints and . Expanding on first gives , since the conditional term vanishes. Expanding on first gives . Comparing the two expansions gives the result.∎
Theorem 2.26 (Pinsker's inequality (quoted)). With total variation distance ,
where is in bits. In particular, small divergence forces small total variation distance.
Note. We do not prove Pinsker's inequality here. The standard argument reduces to the binary case by the data processing inequality for divergence (Corollary Data processing for divergence, with the channel that reports whether lies in the set where ), and then verifies the two-point inequality by calculus. The reduction is within reach; the calculus step is a short but unilluminating computation.
Intuition. Pinsker is the reason divergence deserves the name "divergence": it dominates a genuine metric, so implies in the ordinary sense. The converse fails badly — two distributions can be within in total variation and have infinite divergence, if one of them assigns probability zero where the other does not.
- Thinking mutual information can be negative. always. The three-way quantity (the "interaction information") *can* be negative, which is why the Venn picture must be used with care.
- **Expecting . ** False in general; the exclusive-or example above is the standard counterexample.
- **Confusing with . ** The semicolon marks the split. Read it before computing.
- **Reading as "no relationship of any kind".** It means exactly statistical independence — which is strong, not weak. There is no residual "higher-order dependence" hiding behind for a pair.
- Inferring causation from mutual information. is symmetric; it cannot distinguish causing from causing from a common cause.
- Believing a better decoder can beat the data processing inequality. Every decoder is a function of the received signal and is therefore bound by it.
- **Treating as a distance.** It is asymmetric and fails the triangle inequality. Use it because of its coding meaning, not because it looks like a metric.
- Ignoring support mismatch. If while then . In practice this is what makes unsmoothed maximum-likelihood language models blow up on unseen words.
- **Confusing with . ** The difference of entropies can have either sign and is unrelated; involves the cross term .
- Forgetting which distribution supplies the weights. The expectation in is under . That is the entire source of the asymmetry.
- Minimising the wrong direction. Maximum likelihood minimises ; variational inference typically minimises . They have different optima and different failure modes.
- **Reading small as "the distributions agree everywhere".** is an average; a rare event can be badly mismodelled with little effect on and a large effect on a tail estimate.