Entropy, chain rules and mutual information
Measure finite-alphabet uncertainty in bits and distinguish information shared with a whole variable from information shared with its individual components.
On this page
The question for today
What you’ll understand
- Compute discrete entropy and conditional entropy with explicit logarithm units.
- Apply joint and conditional chain rules to finite random variables.
- Interpret mutual information as dependence without assigning causal meaning.
A surprising outcome carries more information than a predictable one, but the information of a random variable is an average over its probability law. Entropy makes that average precise. Conditional entropy asks how much uncertainty remains after another variable is observed, and mutual information measures the resulting reduction. These quantities depend on a joint distribution and a logarithm convention. They do not automatically measure usefulness, physical energy, causal influence or the difficulty of learning the distribution from a finite sample.
Choose a probability law and a unit
For a finite random variable X with probabilities p(x), the information of a supported outcome is minus log-base-two p(x). Its expectation is H(X), measured in bits. We interpret zero times log zero as zero when summing. An impossible outcome has no contribution to that expectation; it is not an ordinary observation with a finite surprise. Replacing base two by the natural logarithm produces nats, and multiplies every information value by ln two.
Entropy is nonnegative and at most the logarithm of the support size, with equality at the uniform law. A deterministic variable has entropy zero even if its alphabet contains many unused labels. Splitting one label into distinguishable sublabels can change the random variable and its entropy; merely renaming labels bijectively does not. This is one reason to specify exactly what the outcome represents before comparing two numerical entropy values.
Conditioning averages over the observed context
For each supported y, calculate the conditional distribution of X given Y=y, find its entropy, and average over y. The chain rule follows by writing a joint probability as a marginal times a conditional probability and expanding the logarithm. Repeating that identity yields a sum of sequential conditional entropies for a whole vector. The order of the expansion can change the individual conditional terms while leaving the joint entropy unchanged.
Conditioning reduces entropy on average: H(X given Y) is at most H(X). A particular rare conditional event can nevertheless have a more uncertain distribution than the original marginal. The theorem compares the weighted average, not every conditional slice separately. For discrete variables, conditional entropy is also nonnegative. These familiar inequalities should not be transferred unchanged to differential entropy, which uses densities and can take negative values after a change of measurement scale.
Dependence can live in combinations
For finite variables, mutual information is zero exactly when the joint law factors into the product of its marginals. This is a stronger condition than zero covariance, which only tests a particular moment. Conversely, a deterministic function Y of X has conditional entropy zero and mutual information H(Y), even when the function discards much of X. Retaining every detail of X and retaining every detail relevant to Y are therefore different compression objectives.
The information in a pair of observations is not generally the sum of two separate information values. The observations may be redundant or may reveal a relationship only when combined. Conditional mutual information supplies the correct chain-rule correction. A statistical dependence identified this way can arise from a common cause, selection or direct influence; the information calculation alone does not choose among those mechanisms. It quantifies the supplied observational distribution.
Work it through
Parity reveals a relationship between two bits
Let A and B be independent fair bits, X=(A,B), and Y=A xor B. Find H(X), H(Y), I(X;Y) and I(A;Y).
The four pairs are equally likely, so H(X)=2. Parity is fair, giving H(Y)=1, and it is determined by X, giving H(Y given X)=0.
The chain rule gives H(X,Y)=2 and I(X;Y)=H(Y)−H(Y given X)=1. Knowing parity leaves two equally likely pairs, so H(X given Y)=1.
For either fixed value of A, the independent fair B makes parity fair. Thus A and Y are independent and I(A;Y)=0, although their joint pair X carries one bit about Y.
A combination can contain information absent from either component considered alone. The mutual-information chain rule handles this without assuming additivity.
The living notebook
Explore the model
Interactive lab · probability
Read a binary law before computing its entropy
Pause and reset, then set both controls to p = 0.5 and n = 1. Predict two equal bars, mean 0.5, variance 0.25 and entropy one bit. For a fresh comparison, pause and reset, then set p = 0.2 and n = 1; predict mean 0.2, variance 0.16 and entropy about 0.7219 bits. Compute entropy from the displayed probabilities on paper; the instrument reports binomial probabilities and moments, not an information estimator.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. 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 probability law determines its entropy, while moments and entropy describe different features of that law.
Pause & reason
Check your understanding
Your turn
Try it yourself
A pair of bits has probabilities P(0,0)=P(1,1)=0.4 and P(0,1)=P(1,0)=0.1. Compute its marginal entropies, conditional entropy and mutual information, in bits.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Both marginals are fair. Given either first bit, the other disagrees with probability 0.2.
Compare with the solution
Each marginal entropy is one. The conditional entropy is h₂(0.2)=−0.2log₂0.2−0.8log₂0.8≈0.721928. Consequently the joint entropy is 1.721928 and the mutual information is 1−h₂(0.2)≈0.278072 bits. The off-diagonal outcomes still have positive probability, so the second bit is not a deterministic function of the first. The calculation measures their dependence under this table, without establishing how that dependence was generated.
Keep the idea
Take it with you
- Specify the random variable and use log₂ for bits or ln for nats consistently.
- Chain rules connect joint, conditional and shared information.
- Mutual information detects dependence, including dependence visible only in combinations.
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.