= Chain rule for information entropy
{title2=$H(X,Y)=H(X)+H(Y\mid X)$}
For finite <discrete random variables>, the chain rule counts uncertainty in two stages:
$$
H(X,Y)=H(X)+H(Y\mid X).
$$
The <joint entropy> equals the first variable's <information entropy> plus the average <conditional entropy> left in the second. All <logarithms> here have base two, so the unit is the <bit>; zero-probability terms contribute zero. The identity holds without assuming <independence>.<A Mathematical Theory of Communication by Claude Shannon>[section 6, property 5, reprint p. 12: joint entropy as first entropy plus average conditional entropy]{ref}
Iterating gives $H(X_1,\ldots,X_n)=\sum_iH(X_i\mid X_1,\ldots,X_{i-1})$. The first summand means $H(X_1)$, with no earlier observations. Each later summand counts only the new uncertainty after the preceding <random variables> are known. For <independent random variables>, every term is its ordinary <information entropy>; for dependent ones, adding those ordinary <information entropies> can count shared uncertainty repeatedly. This is the reason the <chain rule for information entropy> is useful in <lossless source coding> and in calculating an <entropy rate>.
A short proof starts from the factorization of the <joint probability mass function> into a <marginal distribution> and a <conditional probability>:
$$
p_{X,Y}(x,y)=p_X(x)p_{Y\mid X}(y\mid x),\qquad
-\log_2 p_{X,Y}(x,y)=-\log_2 p_X(x)-\log_2p_{Y\mid X}(y\mid x).
$$
Use this only where $p_{X,Y}(x,y)>0$, then average with those joint <probabilities>. Summing over $y$ in the first term gives $H(X)$; the second is precisely $H(Y\mid X)$. Repeating the same step with a longer <random vector> proves the iterated identity. Reversing the order also gives $H(X,Y)=H(Y)+H(X\mid Y)$: the two contributions can change with the order, but their total cannot.
Back to article page