Lean, informalized

Nielsen & Chuang · Chapter 11, Entropy and information · p. 501

Exercise 11.1 - The entropy of a fair coin and a fair die in bits, and its drop under any bias

A fair coin or die has the most entropy.

Hover over a blue or green term in the text, or a node in the graph, to find it in the other. Select it to read its declaration both in Lean and in words.

The Exercise

Toss a coin and note which side lands up; roll a die and note the face that shows. Before the toss or the roll the outcome is uncertain, and the Shannon entropy of its probability distribution measures that uncertainty in bits. The exercise asks for this entropy for a fair coin and for a fair die, and how it behaves when the coin or the die is biased.

Coins, Dice and Entropy

A probability distribution pp on nn outcomes is a list of real numbers p1,…,pnp_1, \dots, p_n with every pi≥0p_i \ge 0 and ∑ipi=1\sum_i p_i = 1. A coin has two outcomes, a die six.

The fair coin u2u_2 is the probability distribution on two outcomes that gives each outcome probability one half, u2=(12,12).u_2 = \bigl(\tfrac12, \tfrac12\bigr).(1)✦ The fair die u6u_6 is the probability distribution on six outcomes that gives each face probability one sixth, u6=(16,16,16,16,16,16).u_6 = \bigl(\tfrac16, \tfrac16, \tfrac16, \tfrac16, \tfrac16, \tfrac16\bigr).(2)✦

The Shannon entropy of a distribution pp on nn outcomes is the real number H(p)=−∑i=1npiln⁡pi,H(p) = -\sum_{i=1}^{n} p_i \ln p_i ,(3)✦ where a term with pi=0p_i = 0 counts as zero. With the natural logarithm it is measured in nats. Divided by ln⁡2\ln 2 it becomes −∑ipilog⁡2pi-\sum_i p_i \log_2 p_i, the entropy in bits.

The Claim

Theorem 1. The fair coin carries one bit of entropy and the fair die log⁡26\log_2 6 bits: H(u2)ln⁡2=1,\frac{H(u_2)}{\ln 2} = 1,(4)✦ H(u6)ln⁡2=log⁡26.\frac{H(u_6)}{\ln 2} = \log_2 6.(5)✦

Theorem 2. Let pp be a probability distribution on two outcomes other than the fair coin u2u_2. Then H(p)<H(u2).H(p) < H(u_2).(6)✦ Let qq be a probability distribution on six outcomes other than the fair die u6u_6. Then H(q)<H(u6).H(q) < H(u_6).(7)✦

What Is Checked

The claims are stated over the entropy (3) of distributions on two and on six outcomes, and over the two fair distributions, the coin (1) and the die (2). What is proved about these two is their entropy in bits, (4) and (5), and that each is the one distribution of largest entropy on its outcomes, (6) and (7).