Solution (source code)

= Solution

The <chain rule for information entropy>[entropy chain rule] gives
$$
I(X;Y)=H(X)-H(X\mid Y)=H(Y)-H(Y\mid X).
$$
<Conditional entropy> is nonnegative, so $I(X;Y)\le\min(H(X),H(Y))$. For finite <Shannon entropy>[entropies], if $H(X)\le H(Y)$, equality holds exactly when $H(X\mid Y)=0$, meaning \b[$X$ is a <function> of $Y$ almost surely]. If $H(Y)\le H(X)$, interchange the variables. When their <Shannon entropy>[entropies] are equal, equality requires both functional relations. Zero <conditional entropy> has this characterization because each conditional <probability distribution> must be a <point mass>.