A coin is hidden among four opaque cups. At each round, we ask yes/no questions to uncover the cup containing the coin. Multiple rounds are played and we aim to minimize the number of questions asked.
We first assume the coin has 1 in 4 chances to be under each cup. The best strategy is then a binary search asking 2 questions per round.
Suppose we notice the coin has in fact 1 in 2 chances to be in the first cup, 1 in 4 to be in the last one and 1 in 8 to be in the others. Using the questionnaire “Is the coin in the first cup? Is the coin in the last cup? Is the coin in this remaining cup?” we will ask on average only 21+41×2+(81+81)×3=1.75 questions per round.
Imagine now playing the same game using only two cups with a 70% chance for the coin to be in the first cup and 30% chance to be in the other. Here, we must ask one question per round.
But let’s change the rules of the game allowing questions relative to two simultaneous rounds. There is a 49% chance for the two coins to be in their first cups, 9% chance for them to be in their last cups and 21% for the two other cases. The best strategy will ask 21(0.49+0.21×2+(0.21+0.09)×3)=0.905 questions per coin.
Entropy and KL divergence
Given n cups and their probabilities to contain the coin p1,…,pn, as we increase the number of simultaneous rounds, the number of questions per coin of the best strategy will converge to, −i=1∑npilog2(pi)
This is the entropy of the distributionp and is denoted H(p). If a single-round optimal strategy exists, we can view it as a decision tree: −log2(pi) is the length of the branch we will follow with probability pi when the coin is found in the ith cup.
Now if we assume the wrong distribution q, the number of questions we ask on average is: −i=1∑npilog2(qi)
This is the cross-entropyH(p,q). As expected: H(p,q)≥H(p)
The difference is called Kullback-Leibler divergence and we note: DKL(p∥q)=H(p,q)−H(p)
and the expected value operator being linear, E[log2P(X,Y)]=E[log2P(X)]+E[log2P(Y∣X)]
we will note: H(XY)=H(X)+H(πX(Y))
πX(Y) can be interpreted as a random variable obtained from Y once X has been realized.
Similarly, given X1,…,Xn discrete random variables: H(X1…Xn)=i=1∑nH(πXj<i(Xi))
Note that H(X)+H(Y)−H(XY)=DKL(P(X,Y)∥P(X)⊗P(Y))≥0 where ⊗ denotes the tensor product.
This is 0 if and only if X and Y are independent, hence: H(XY)≥H(XπX(Y))≤H(X)+H(πX(Y))=H(XY)
The above formula is then an equality proving that X and πX(Y) are independent.
Source coding theorem (lower bound)
For a discrete random variable X, a binary encoding b of X is an injective function from the domain of X to the set of binary strings. Noting BX=b(X) and Bi the binary variable given by the ith bit when the length ∥BX∥⩾i. For a suchll binary encoding we have: E[∥BX∥]⩾H(X)
Indeed, since b is injective we get: H(X)=H(BX)=i=1∑max∥b∥P(∥BX∥=i)H(π∥BX∥=i(BX))=i=1∑max∥b∥P(∥BX∥=i)j=1∑iH(π∥BX∥=i(πBk<j(Bj)))≤i=1∑max∥b∥P(∥BX∥=i)×i≤E[∥BX∥]
Using the fact that for any B binary random variable H(B)≤1.
Source coding theorem (upper bound)
Given ϵ>0 and n>1, noting Xn a sequence of n random variables from a same distribution, there exists a binary encoding BXn such that: nH(X)≤E[∥BXn∥]≤n(H(X)+ϵ)
From the conditional entropy formula we have H(Xn)=nH(X), so the left inequality is given by our previous result.
For the right hand side, we will first show that given some naturals l1≤⋯≤ln where ∑2−li≤1 we can build binary strings of lengths l1,…,ln such that no string is the prefix of another.
Indeed, we notice that 1−∑2−li is a multiple of 2−ln, such that adding 2ln−∑2ln−li times ln to our set of lengths we get ∑2−li=1. Then, if we prune an infinite binary tree at these lengths, the set of paths from the root to the leafs described using left/right instructions will form a valid prefix-distinct set of binary strings.
Now if we pick the lengths as ⌈−log2P(Xn=(x1,…,xn))⌉ then: E[∥BXn∥]=∑P(Xn=(x1,…,xn))⌈−log2P(Xn=(x1,…,xn))⌉≤∑P(Xn=(x1,…,xn))(1−log2P(Xn=(x1,…,xn)))≤n(H(X)+n1)
And we obtain the right inequality for n>1/ϵ.
Asymptotic codelength property
Reusing previous notations, we have: 0≤E[∥BXn∥]−nH(X)≤1
Let’s denote this quantity θ and ϵ=θ/n. Given m a multiple of n and encoding Xm as concatenations of Xn encodings, Chebyshev’s inequality gives, P(∣∥BXm∥−mH(X)−ϵm∣>δmσn))<δ
Given two discrete random variables X and Y we note, I(X,Y)=H(X)+H(Y)−H(XY)
the mutual information between X and Y.
A communication channel is modeled by a source of input messages X transmitted and received as output messages Y on the other end of the channel. The conditional probability P(Y∣X) defines the reliability of the channel.
Given a fixed conditional distribution P(Y∣X), we can try to modify the distribution of the input messages P(X) to maximize the mutual information I(X,Y). This maximal mutual information is called the capacity of the channel.
Channel coding theorem
Given a joint probability distribution with mutual informationC and Xn,Yn sequences of n random variables sampled from it, there exist two sequences of functions (en) and (dn) such that, n→∞limP(en(Xn)=dn(Yn))=1
Before proving the theorem in a more general setting and to make things concrete, let’s look at an example: the bit flip channel. Inputs and outputs of this channel take binary values and the conditional probabilities are,
P(Y=0∣X=1)=p
P(Y=1∣X=0)=p
where 0≤p<21 and the two missing conditional probabilities can be deduced.
We can bound the mutual information: I(X,Y)=−H(Y∣X)+H(Y)=plog2p+(1−p)log2(1−p)+H(Y)≤plog2p+(1−p)log2(1−p)+1
And the bound is reached when P(Y=0)=1/2 that is when P(X=0)=1/2.
From now on, we will note h(p)=−plog2p−(1−p)log2(1−p).
Since we now have the capacity of the bit flip channel, we can try to prove the first half of the channel coding theorem in this specific case.
Bit flip channel (channel coding theorem)
The idea of the proof consists in taking a random set of binary strings of given length n and to show that if this set contains less than 2n(C−ϵ) strings, for any ϵ>0, we will be almost certain to recognize the strings after a transmission as n goes to infinity.
Let’s assume η>0 is our targeted probability of error. If we transmit a random string of length n chosen among a set of size 2nR, the number of bit flips F will follow a binomial distribution with parameters n and p.
Now assuming ∣F−np∣<kp(1−p)n, we must find a condition on R such that the probability of having an other transmitted string in a radius of np+kp(1−p)n flips is lower than η/2.
Since the set of strings is chosen uniformly at random, the number of flips F′ from the original transmitted string to any other transmitted string will follow a binomial distribution of parameters n and 1/2. So we need: perror=1−(1−P(F′<np+kp(1−p)n))2nR−1≤2η
Using the fact that for n>1, 1−(1−x)n is below its tangent nx at 0: perror≤(2nR−1)×P(F′<np+kp(1−p)n)≤(2nR−1)×i=0∑np+o(n)(in)2−n≤2n(R−1)i=0∑np+o(n)(in)≤2n(R−1)(np+o(n))(np+o(n)n)
Now, as a small interlude, let’s prove for k≤n, (kn)≤2nh(nk): (nk+1−nk)n(kn)(nk)k(1−nk)n−k(kn)=1≤1≤2nh(nk)
For our main inequality, we get, perror≤2n(R−1)(np+o(n))2nh(p+o(1))
and if R<1−h(p)=C, the perror goes to 0 as desired.