Relative entropy and data processing
Compare probability laws through divergence and explain why applying the same observation channel cannot increase distinguishability.
On this page
The question for today
What you’ll understand
- Compute KL divergence with its support convention and asymmetric orientation.
- Apply data processing to a shared stochastic observation map.
- Translate Pinsker's inequality correctly between bits and natural-log units.
Two models can assign different probabilities to the same outcomes. Relative entropy measures the expected log-likelihood advantage of one law against another, with the expectation taken under the first law. The order matters. A common transformation can hide distinctions between the laws but cannot create statistical evidence absent from the original observations. This monotonicity is useful for compressed data, sufficient statistics and testing, provided the transformation is the same under both models.
Divergence has an orientation and a support condition
For finite laws P and Q on one alphabet, define D(P||Q) as the P-weighted logarithm of their probability ratio. We use base two, so the value is in bits. A point with positive P probability and zero Q probability makes divergence infinite. Zero P terms contribute zero. Nonnegativity follows from the logarithm inequality or convexity; equality occurs exactly when the two probability laws agree, including their supported masses.
Interchanging P and Q changes both the weights and the ratio, so divergence is not generally symmetric. It also lacks a metric triangle inequality. Its coding interpretation is precise: using ideal lengths based on Q instead of the true P costs D(P||Q) expected bits beyond the entropy of P, before integer code-length overhead. That statement needs Q positive wherever P is positive; a proposed code assigning zero probability to an observed symbol has no finite ideal description length.
The same channel can only lose distinctions
Let K be one stochastic kernel applied to either input law. Summing over the unobserved input and using the log-sum inequality gives D(PK||QK) at most D(P||Q). The channel may be deterministic binning, randomized corruption or deletion of coordinates. The shared-kernel assumption is essential: choosing different transformations under the two hypotheses could manufacture different output distributions even from identical input laws.
Mutual-information data processing is the corresponding dependence statement. If X to Y to Z forms a Markov chain, meaning the conditional law of Z given X,Y only depends on Y, then I(X;Z) is at most I(X;Y). A randomized representation cannot gain information about X merely by further postprocessing. Equality is possible when the retained statistic preserves the relevant likelihood information; the theorem does not assert that every noninvertible transformation must lose a strictly positive amount.
Population identities are not plug-in guarantees
Divergence adds across independent samples because the log-likelihood ratio becomes a sum. With dependent data, the chain rule instead involves conditional divergences; multiplying a one-sample value by the sample size need not be correct. Similarly, applying a deterministic summary can collapse two distinct laws to the same output distribution and make the processed divergence zero. This is information loss relative to a particular pair of models, not a judgment that the summary is useless for every purpose.
The displayed quantities concern known probability laws. Replacing them by empirical frequencies introduces sampling error and support problems, especially when a finite sample misses outcomes. Smoothing can make an estimate finite but changes the estimated laws. Data processing still applies to the actual probability distributions and a fixed common kernel; it is not a general promise that arbitrary numerical estimators of divergence will satisfy every population inequality on every observed sample.
Work it through
Reverse the likelihood comparison deliberately
Take P=Bernoulli(0.75) and Q=Bernoulli(0.5). Compute both directed divergences and the forward divergence for two independent observations.
The forward value is 0.75log₂1.5+0.25log₂0.5≈0.188722 bits. The weights are the probabilities under P.
The reverse value is 0.5log₂(2/3)+0.5log₂2≈0.207519 bits, so the two directions differ.
Independent product laws double the forward value, giving approximately 0.377444 bits for two observations. Mapping every observation to one constant symbol instead gives identical processed laws and divergence zero.
Both orientation and the observation map change the result. The product identity uses independence, while the constant-map comparison is an exact data-processing example.
The living notebook
Explore the model
Interactive lab · markov
Watch a shared transition forget its starting law
Pause and reset, then set both controls to p = 0.25 and q = 0.25. From initial state zero, predict distribution (0.75,0.25) after one Step and (0.625,0.375) after two. Compare its divergence from the stationary law (0.5,0.5), computed on paper, with the initial one-bit divergence. For a fresh comparison, pause and reset, then set p = 0.5 and q = 0.5; one Step already gives the stationary law and zero divergence. The instrument displays exact two-state probabilities, not sampled paths or a general divergence estimator.
- P(state 1) at step 0
- 0%
- Stationary P(state 1)
- 60%
- Chain behavior
- Monotone convergence
Exact finite-step probabilities for a two-state chain starting in state 0, not sampled trajectories. Playback advances two transitions per second. When p = q = 0 every distribution is stationary; when p = q = 1 the chain alternates forever. A single zero transition creates an absorbing state. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA common stochastic map can contract model distinctions, including erasing them in one step.
Pause & reason
Check your understanding
Your turn
Try it yourself
Let P=(1/2,1/4,1/4) and Q=(1/4,1/4,1/2). Calculate D₂(P||Q), then merge the last two symbols and calculate the processed divergence.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Before merging the three log-ratios are one, zero and minus one bits. After merging, compare (1/2,1/2) with (1/4,3/4).
Compare with the solution
The original divergence is one half minus one quarter, hence one quarter bit. The merged value is 0.5log₂2+0.5log₂(2/3)≈0.207519 bits, which is smaller. Merging hides how the second and third symbols are apportioned within the combined category. It does not make the output laws equal, so a positive divergence remains. This calculation directly verifies the monotonicity for this deterministic common map without treating divergence as a symmetric distance.
Keep the idea
Take it with you
- KL divergence is directed and becomes infinite when the comparison law misses supported outcomes.
- A shared observation channel cannot increase divergence or Markov-chain mutual information.
- Pinsker constants and empirical estimates require explicit conventions and qualifications.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.