lacunary - Mathnotes

Capacity of a Discrete Channel

Definition: Discrete Channel \@{discrete-channel}

A system whereby a sequence of choices from a finite set of elementary symbols S1,,Sn can be transmitted from one point to another. Each of the symbols Si is assumed to have a certain duration in time ti seconds (not necessarily the same for different Si).

Referenced by (1 direct, 3 transitive)

Direct references:

Definition: Capacity (also: channel-capacity) \@{capacity}

The capacity C of a discrete channel is given by

C=limtlogN(t)t,

where N(t) is the number of allowed @signals of duration t.

Referenced by (3 direct)
Note \@{note-3}

Given an information source where all symbols are of the same time duration, and each symbol represents s bits of information (because it is chosen freely among 2s symbols), and the channel can transmit n symbols per second then the capacity C of the channel is defined to be ns bits per second.

In the more general case we have to deal with symbols of various lengths that take different amounts of time to transmit, and so capacity measures not the number of symbols transmitted per second but the amount of information transmitted per second, retaining bits per second as its unit.

If N(t) represents the number of sequences of duration t, then

N(t)=N(tt1)+N(tt2)++N(ttn).

This number is equal to the sum of the numbers of sequences ending in S1,S2,,Sn. This is a recursive definition - if the last symbol is Si, and then we have tti time remaining for the previous symbols in the sequence, and we repeat the same question on that remainder.

A "well-known result" in finite differences tells us that

N(t)AW0tas t,

where A is constant and W0 is the largest real solution of the characteristic equation:

Wt1+Wt2++Wtn=1,

and therefore

C=limtlogAW0tt=logW0.

Example \@{example-4}

Consider Morse code as used in telegraph. We have the following rules:

  • A dot symbol consists of one time unit of line closure followed by one time unit of line open.
  • A dash symbol consists of three time units of line closure followed by one time unit of line open.
  • A letter space symbol consists of three time units of line open.
  • A word space symbol consists of six time units of line open.

We're never allowed to send two space symbols in a row, because two sequential letter space symbols are indistinguishable from a word space symbol.

Now, our possible terminating states are

Symbol Composition Duration (time units)
Dot 1 unit closed + 1 unit open 2
Dash 3 units closed + 1 unit open 4
Letter space preceded by dot 1 unit closed + 4 units open 5
Letter space preceded by dash 3 units closed + 4 units open 7
Word space preceded by dot 1 unit closed + 7 units open 8
Word space preceded by dash 3 units closed + 7 units open 10

Note that we had to consider the last two symbols in the case of the last symbol being a space in order to deal with our "no sequential spaces" constraint.

Now we have

N(t)=N(t2)+N(t4)+N(t5)+N(t7)+N(t8)+N(t10).

So, our characteristic equation is

W2+W4+W5+W7+W8+W10=1.(a)

With a substitution of w=1/W we get

w2+w4+w5+w7+w8+w10=1,

and w0, the largest positive root of this equation, found numerically, is about 0.6882, and so

C=log(w0)0.539 bits per unit of time.

Note that in this Morse telegraphy system, we have two states that the channel can be in, based on what the previous symbol transmitted was.

  • If the previous symbol transmitted was a space, we're in state 1, and the next symbol can only be a dot or a dash, and the state will change.
  • If the previous symbol transmitted was not a space, we're in state 2, and the next symbol can be anything, and the state may or may not change depending on what the next symbol is.

We can think of these states being the @nodes of a @directed-graph with the transitions between them being the @edges. A generalization of this is given in the theorem below.

Theorem \@{theorem-5}

Let bij(s) be the duration of the s-th symbol which is allowable in state i and leads to state j. Then the channel-capacity C is equal to logW where W is the largest real root of the @determinantal-equation

|sWbij(s)δij|=0,

where δij is the @Kronecker-delta.

Example \@{example-6}

For example, for our Morse telegraphy example, we have

|1W2+W4W3+W6W2+W41|=0.

Expanding the @determinant on the LHS gives the characteristic equation (a) above.

Information and Entropy in a Discrete Channel

Remark \@{remark-8}

We can view self-information as an alternative casting of probability, like how odds are, with some desirable properties:

  • An event with probability 1 provides no information - we knew it was going to happen so it happening tells us nothing new.
  • The less probable an event is, the more surprisal it yields.
  • self-information is @additive - if two individual events are measured separately, the total amount of information is the sum of the self-informations of the individual events.

The function given above is the unique function of probability (up to a multiplicative scaling factor) that satisfies these three properties.

Remark \@{remark-9}

In a related vein we can develop a function that asks how much choice is involved in the selection of an event, or equivalently, how much uncertainty there is in the outcome. If p1,p2,,pn are the probabilities of events occurring, we want a measure H(p1,p2,,pn) that has the following properties:

  1. H should be continuous in the pi. That is, a small change in a pi should result in a small change in H.
  1. If all the pi are equal, pi=1n, then H should be a @monotonic @increasing function of n. With equally likely events there is more choice, or uncertainty, when there are more possible events.
  1. If a choice is broken down into two successive choices, the original H should be the weighted sum of the individual values of H. For example, we should have that

H(12,13,16)=H(12,12)+12H(23,13).

Definition: Entropy (also: uncertainty) \@{entropy}

Given a discrete random variable X, which may be any element x within the set X, and is distributed according to p:X[0,1], the entropy is

H(X):=xXp(x)logp(x).

We can choose different bases for the logarithm; throughout these notes a bare log means log2, giving the unit of @bits.

An alternative, equivalent definition is that entropy is the expected value of the self-information of a random variable:

H(X)=E[I(X)]=E[logp(X)].

The unit for entropy is bits per symbol.

Definition: Commensurable (also: commeasurable) \@{commensurable}

Real numbers a1,,an are commensurable if there exists a common measure mR>0 such that each ai is an integer multiple of it: ai=kim,kiZ,i=1,,n. Equivalently, all pairwise ratios are rational: ai/ajQ for all i,j (with aj0).

Referenced by (1 direct)

Direct references:

Theorem \@{theorem-12}

The only H satisfying the three required properties above is the entropy function defined above, up to multiplication by a constant.

Proof \@{proof-of-theorem-12}

Assume we have a function A(n) that satisfies the three properties listed above, such that

A(n)=H(1n,1n,,1n).

Then, by property (3) above, we can decompose a choice from sm equally likely possibilities into a sequence of m choices each from s equally likely possibilities. For example, if we have 24 equally likely possibilities, the probability of any given event is 1/16. If we instead we have a series of 4 choices each with 1/2 probability, we end up with 1/16 as the probability of any specific sequence of events. So, we have that A(sm)=mA(s).

Now, with arbitrarily large n, we can also have tn such that A(tn)=nA(t), by the same logic, and we can pick m such that

smtn<sm+1.

Now, we can take the logarithm of each term to get

mlogsnlogt<(m+1)logs,

and dividing by nlogs gives

mnlogtlogs<mn+1n,

and because n is arbitrarily large,

|mnlogtlogs|<ϵ,

where ϵ is arbitrarily small.

By property (2) of A(n) (it is a @monotonically-increasing function of n,)

A(sm)A(tn)A(sm+1)mA(s)nA(t)(m+1)A(s).

Then, dividing by nA(s) gives

mnA(t)A(s)mn+1n or |mnA(t)A(s)|<ϵ,

Now, by the @triangle-inequality, we have that

|A(t)A(s)logtlogs|2ϵ|A(t)A(s)logslogt|2ϵA(s).

Since ϵ can be arbitrarily small, we have that A(t)=Klog(t), with K>0 so that property (2) holds. Now we know what A(n) is, and thus what H is when we have equal probabilities for all events.

Now let's say that we have a choice from n possible events with commensurable probabilities pi=nini. We can break down a choice from ni possibilities into a choice from n possibilities with probabilities p1,,pn and then, if the ith possibility was chosen, ni choices of equal probability pi. We do this because above, we found how to find H when all events are equally likely, and property (3) of our desired function lets us break down our overall choice from ni possibilities. This gives us

Klogni=H(p1,,pn)+piA(ni)=H(p1,,pn)+piKlogni=H(p1,,pn)+Kpilogni.

Then, H(p1,,pn)=KlogniKpilogni=K[lognipilogni]=K[pi(logni)pi(logni)] because pi=1=K[pi(lognilogni)]=K[pi(lognini)]=Kpilogpi.

If the pi are incommensurable, we can approximate them as closely as we'd like with rationals, since The rationals are dense in the reals.. By the first property we assumed for H, it is continuous in the pi, and so its value at the incommensurable pi equals its limit as we approach via the rationals, and so our expression holds in general. K is left to us to pick, picking it is equivalent to picking a base for the logarithm.

Remark \@{remark-14}

The entropy of a random variable quantifies the average level of uncertainty or information associated with the variable's possible outcomes. It measures the expected amount of information needed to describe the state of the variable, considering the distribution of probabilities across all potential states.

Note \@{note-15}

When we decrease the probability of an element occurring, its self-information increases only logarithmically, while its weight in the entropy sum decreases linearly.

The demo below makes these quantities concrete. It uses a discrete alphabet of N symbols whose probabilities follow a Zipfian distribution,

p(n)=nαk=1Nkα,n=1,2,,N,

where the skew α controls how unevenly probability mass is spread across symbols. At α=0 every symbol is equally likely (the uniform distribution), so entropy is maximal at logN. As α grows the distribution concentrates on the first few symbols, the rare symbols carry ever more self-information, and the entropy falls toward 0. The bar chart shows the probability of each symbol alongside its self-information; the second chart traces the entropy as α sweeps from uniform to highly skewed.

Examples to cover: [https://claude.ai/chat/0702d3b2-a181-4b5b-a572-e5464d9d24d5]

Example: Coin Flip

For a fair coin flip, X={h,t} and p(h)=p(t)=0.5. Then, I(h)=I(t)=log(0.5)=1 bit, and

H(X)=p(h)I(h)+p(t)I(t)=0.51+0.51=1 bit.

Let's say we have an unfair coin and p(h)=0.9,p(t)=0.1. Then

I(h)=log(0.9)0.152 bits,I(t)=log(0.1)3.32 bits,

and for entropy of X we get

H(X)=p(h)I(h)+p(t)I(t)0.90.152+0.13.320.469 bits.

Example: Six-Sided Die

For a fair six-sided die, X={1,2,3,4,5,6} and p(x)=1/6 for all x. Then, I(x)=log(1/6)=log(6)2.58 bits, and

H(X)=616I(x)=I(x)2.58 bits.

Let's say we have an unfair die and p(1)=0.5 and p(x)=0.1 for x{2,3,4,5,6}. Then

I(1)=log(0.5)=1 bit,I(x)=log(0.1)3.32 bits for x1,

and for entropy of X we get

H(X)=p(1)I(1)+x=26p(x)I(x)0.51+50.13.322.16 bits.

Some Theorems on Entropy

Theorem \@{theorem-16}

When a random variable is uniformly distributed over an alphabet of n elements, the self-information of any given element equals the entropy of the random variable and is logn.

Lemma: Nonnegativity of Entropy \@{nonnegativity-of-entropy}

H(X)0.

Proof \@{proof-of-nonnegativity-of-entropy}

0p(x)1logp(x)0logp(x)0.

Lemma: Change of Logarithm Base \@{change-of-logarithm-base}

Hb(X)=(logba)Ha(X).

Proof \@{proof-of-change-of-logarithm-base}

We use the Logarithm Change of Base here.

Hb(x)=xXp(x)logbx=(logba)xXp(x)logbxlogba=(logba)xXp(x)logax=(logba)Ha(X)

Theorem \@{theorem-21}

H=0 iff all the pi but one are zero, this one having the value of one.

Proof \@{proof-of-theorem-21}

Suppose H(p1,,pn)=0. Then, 0=i=1npilogpi. Note that because 0pi1, we have logpi0, and pilogpi0 (with the convention 0log0=0, since limp0+plogp=0). Assume for contradiction that more than one pi is non-zero. Then, because pi=1, each non-zero pi is in (0,1) and therefore its pilogpi>0, and the sum of these terms is therefore non-zero, a contradiction. Now, since all probabilities are required to sum to 1, it can't be the case that all probabilities are zero, which means that exactly one probability must be non-zero and that probability must be 1.

Joint and Conditional Entropy

Definition: Joint Entropy \@{joint-entropy}

The joint entropy H(X,Y) of a pair of @discrete random variables (X,Y) with a joint distribution p(x,y) is defined as

H(X,Y)=xXyYp(x,y)logp(x,y),

which can also be expressed as

H(X,Y)=E[logp(X,Y)].

Definition: Conditional Entropy \@{conditional-entropy}

Let X and Y be random variables, not necessarily independent. The probability that Y takes the value y when X takes the value x (for any specific xX,yY) is called the conditional probability p(y|x) and is given by:

p(y|x)=p(x,y)p(x),p(x)=yp(x,y).

(Note that p(x,y) is the joint probability of X=x,Y=y.)

We define the conditional entropy of Y given X, H(Y|X), as the average of the entropy of Y for each value x of X weighted according to the probability of getting that particular x. That is,

H(Y|X)=xX,yYp(x,y)logp(y|x).

Referenced by (1 direct)

Direct references:

Note \@{note-25}

We can obtain the above formula for conditional entropy as follows. First, if X=x, then our entropy for Y is

H(Y|X=x)=yp(y|x)logp(y|x).

Now, summing across X gives:

H(Y|X)=xp(x)H(Y|X=x)=xp(x)[yp(y|x)logp(y|x)]=xy[p(x)p(y|x)logp(y|x)]=x,yp(x,y)logp(y|x).

Theorem: Chain rule for joint entropy \@{joint-entropy-is-base-plus-conditional}

The entropy (joint entropy) of the joint event X,Y is the entropy of X plus the entropy of Y when X is known, that is,

H(X,Y)=H(X)+H(Y|X).

Proof \@{proof-of-joint-entropy-is-base-plus-conditional}

Note that

H(Y|X)=x,yp(x,y)logp(x,y)p(x)=x,yp(x,y)logp(x,y)+x,yp(x,y)logp(x).

The first term on the RHS is just x,yp(x,y)logp(x,y)=H(X,Y). The second is

x,yp(x,y)logp(x)=x[yp(x,y)]logp(x)=xp(x)logp(x)=H(X).

Altogether, we have that H(Y|X)=H(X,Y)H(X), or

H(X,Y)=H(X)+H(Y|X).

Corollary: Chain Rule for Conditional Joint Entropy \@{chain-rule-for-conditional-joint-entropy}

H(X,Y|Z)=H(X|Z)+H(Y|X,Z).

Proof \@{proof-of-chain-rule-for-conditional-joint-entropy}

H(X,Y|Z)=zZp(z)H(X,Y|Z=z)=zZp(z)(H(X|Z=z)+H(Y|X,Z=z))=zZp(z)H(X|Z=z)+zZp(z)H(Y|X,Z=z)=H(X|Z)+H(Y|X,Z).

Referenced by (1 direct)

Relative Entropy and Mutual Information

Definition: Cross-Entropy \@{cross-entropy}

Given two discrete probability distributions, p and q, that share a support X, cross-entropy measures the average number of bits needed to represent an event drawn from X when the coding scheme is optimized for an estimated distribution q rather than the true distribution p. Its formula is very similar to that of entropy, except surprisal is calculated using q while expectation uses p:

H(p,q)=xXp(x)logq(x).

We can write it in expectation form as

H(p,q)=Ep[logq],

where Ep is expectation under p.

Note that when p=q, cross-entropy equals entropy. The symbol H is overloaded: H(p,q) with distributions as arguments means cross-entropy, while H(X,Y) with random variables as arguments means joint entropy.

Definition: KL Divergence (also: relative-entropy, Kullback-Leibler divergence) \@{kl-divergence}

For discrete probability distributions, p and q, on a common alphabet X, the relative entropy from q to p is defined to be

DKL(pq)=xXp(x)logp(x)q(x),

which is just cross-entropy minus entropy:

D(pq)=H(p,q)H(p).

Note that we don't always use the KL subscript where it's obvious from the context.

We can also write it as

D(pq)=Ep[logq]Ep[logp]=Ep[logpq],

which makes it clear that it's the expected inefficiency in an encoding optimized for q rather than p.

Referenced by (1 direct)

Direct references:

Remark \@{remark-32}

kl divergence tells us how different an approximating distribution q is from a true probability distribution p. It's not a true distance metric - it's asymmetric, but it does behave like distance in that it gets smaller as q gets more like p and is zero when q=p. It is a sort of directed distance.

Another way to think about it is as a measure of how inefficient a coding scheme optimized for q is when the actual distribution is p. If q says some event is rare, and so we use a longer symbol for it (more bits), but the event actually occurs frequently, we'll waste bits representing the event when we could have used a shorter symbol for it.

Definition: Mutual Information \@{mutual-information}

Consider two random variables X and Y with joint probability mass function p(x,y) and marginal probability mass functions p(x) and p(y). The mutual information I(X;Y) is the relative-entropy between the joint distribution and the product distribution p(x)p(y):

I(X;Y)=xXyYp(x,y)logp(x,y)p(x)p(y)=D(p(x,y)p(x)p(y))=Ep(x,y)logp(X,Y)p(X)p(Y).

Referenced by (1 direct)

Relationship Between Entropy and Mutual Information

Theorem: Mutual Information and Entropy \@{mutual-information-and-entropy}

I(X;Y)=H(X)H(X|Y)(a)I(X;Y)=H(Y)H(Y|X)(b)I(X;Y)=H(X)+H(Y)H(X,Y)(c)I(X;Y)=I(Y;X)(d)I(X;X)=H(X).(e)

Proof \@{proof-of-mutual-information-and-entropy}

We'll prove (c) first:

I(X;Y)=xXyYp(x,y)logp(x,y)p(x)p(y)=xXyYp(x,y)(logp(x,y)logp(x)p(y))=H(X,Y)xXyYp(x,y)logp(x)p(y)=H(X,Y)xXyYp(x,y)(logp(x)+logp(y))=H(X,Y)xXyYp(x,y)logp(x)xXyYp(x,y)logp(y)=H(X)+H(Y)H(X,Y)

Now, from Chain rule for joint entropy we prove (a) and (b) with

H(X)+H(Y)H(X,Y)=H(X)+H(Y)H(Y)H(X|Y)=H(X)H(X|Y).

and

H(X)+H(Y)H(X,Y)=H(X)+H(Y)H(X)H(Y|X)=H(Y)H(Y|X).

(d) is trivial from symmetry of p(a,b)=p(b,a) and ab=ba.

To prove (e) we use our result from (a): I(X;X)=H(X)+H(X)H(X,X)=H(X)+H(X)H(X)=H(X).

Referenced by (1 direct)

Chain Rules

Theorem: Chain Rule for Entropy \@{chain-rule-for-entropy}

Let X1,X2,,Xn be drawn according to p(x1,x2,,xn). Then

H(X1,X2,,Xn)=i=1nH(Xi|Xi1,,X1).

Proof \@{proof-of-chain-rule-for-entropy}

From Chain rule for joint entropy, we have

H(X1,X2)=H(X1)+H(X2|X1),H(X1,X2,X3)=H(X1)+H(X2,X3|X1)=H(X1)+H(X2|X1)+H(X3|X2,X1), H(X1,X2,,Xn)=H(X1)+H(X2|X1)++H(Xn|Xn1,,X1)=i=1nH(Xi|Xi1,,X1).

Referenced by (1 direct)
Definition: Conditional Mutual Information \@{conditional-mutual-information}

The conditional mutual information of random variables X and Y given Z is defined by

I(X;Y|Z)=H(X|Z)H(X|Y,Z)=Ep(x,y,z)logp(X,Y|Z)p(X|Z)p(Y|Z).

It is the uncertainty about X after learning Z minus the uncertainty about X after learning Y and Z.

Referenced by (1 direct)
Theorem: Chain Rule for Mutual Information \@{chain-rule-for-mutual-information}

I(X1,X2,,Xn;Y)=i=1nI(Xi;Y|Xi1,Xi2,,X1)

Proof \@{proof-of-chain-rule-for-mutual-information}

From Mutual Information and Entropy we have

I(X1,X2,,Xn;Y)=H(X1,X2,,Xn)H(X1,X2,,Xn|Y)

Then, from Chain Rule for Entropy and Chain Rule for Conditional Joint Entropy we have, simplifying,

H(X1,X2,,Xn)H(X1,X2,,Xn|Y)=i=1nH(Xi|Xi1,,X1)i=1nH(Xi|Xi1,,X1,Y)=i=1nH(Xi|Xi1,,X1)H(Xi|Y,Xi1,,X1).

Now, from our definition of conditional mutual information we get

i=1nH(Xi|Xi1,,X1)H(Xi|Y,Xi1,,X1)=i=1nI(Xi;Y|X1,X2,,Xi1).

Definition: Conditional Relative Entropy \@{conditional-relative-entropy}

For joint probability mass functions p(x,y) and q(x,y), the conditional relative entropy

D(p(y|x)q(y|x))

is the @average of the relative-entropies between the conditional probability mass functions p(y|x) and q(y|x) averaged over the probability mass function p(x). More formally,

D(p(y|x)q(y|x))=xXp(x)yYp(y|x)logp(y|x)q(y|x)=Ep(x,y)logp(Y|X)q(Y|X).

Theorem: Chain Rule for Relative Entropy \@{chain-rule-for-relative-entropy}

D(p(x,y)q(x,y))=D(p(x)q(x))+D(p(y|x)q(y|x)).

Proof \@{proof-of-chain-rule-for-relative-entropy}

Using relative-entropy, Multiplication Rule for Distributions, Product Rule for Logarithms, and conditional relative entropy:

D(p(x,y)q(x,y))=xyp(x,y)logp(x,y)q(x,y)defn. of relative entropy=xyp(x,y)logp(x)p(y|x)q(x)q(y|x)multiplication ruleby the product rule for logarithms:=xyp(x,y)logp(x)q(x)+xyp(x,y)logp(y|x)q(y|x)=D(p(x)q(x))+D(p(y|x)q(y|x))defns. of relative and conditional relative entropy

Inequalities

Theorem: Gibbs' Inequality \@{gibbs-inequality}

For discrete probability distributions p and q that share a support X,

D(pq)0,

with equality iff p=q. Equivalently, cross-entropy is never less than entropy: H(p,q)H(p), with equality iff q=p.

Proof \@{proof-of-gibbs-inequality}

Because Log is Concave, by Jensen's Inequality we have that

Ep[logqipi]log(Ep[qipi])=log(i[piqipi])=log(iqi)=log1=0.

Then, since Ep[logqipi]=D(pq), we have that D(pq)0.

Now, note that if p=q, qipi=1 and D(pq)=0. Conversely, suppose D(pq)=0. Since log is strictly concave, it is not @affine, and Jensen's Inequality condition for equality gives us that qipi=c. Now, iqi=icpi=1, and since p is a probability distribution, c=1, and therefore pi=qi and p=q.

Corollary: Nonnegativity of Mutual Information \@{nonnegativity-of-mutual-information}

For any two random variables, X,Y, I(X;Y)0, with equality if and only if X and Y are independent.

Proof \@{proof-of-nonnegativity-of-mutual-information}

Using the definition of mutual information and Gibbs' Inequality, we have I(X;Y)=D(p(x,y)p(x)p(y))0, with equality if and only if p(x,y)=p(x)p(y), i.e. X and Y are independent.

Corollary: Nonnegativity of Conditional Relative Entropy \@{nonnegativity-of-conditional-relative-entropy}

D(p(y|x)q(y|x)0,

with equality if and only if p(y|x)=q(y|x) for all y and x such that p(x)>0.

Proof \@{proof-of-nonnegativity-of-conditional-relative-entropy}

From the definition of conditional relative entropy we have

D(p(y|x)q(y|x))=xXp(x)yYp(y|x)logp(y|x)q(y|x)=xXp(x)D(p(|x)q(|x)).

This is just the average of the relative-entropy over distributions over y for each fixed x. For p(x)>0, each is 0 if and only if p(y|x)=q(y|x), by Gibbs' Inequality, and positive otherwise.

Corollary: Nonnegativity of Conditional Mutual Information \@{nonnegativity-of-conditional-mutual-information}

I(X;Y|Z)0,

with equality if and only if X and Y are conditionally independent given Z.

Proof \@{proof-of-nonnegativity-of-conditional-mutual-information}

We have that I(X;Y|Z)=zZp(z)I(X;Y|Z=z),

and for each fixed z,

I(X;Y|Z=z)=D(p(x,y|z)p(x|z)p(y|z))0.

By Gibbs' Inequality, the quantity for each fixed z is non-negative, so the sum weighted by the probability of each z is also non-negative.

For equality, the average is 0 if and only if for each z with p(z)>0,

I(X;Y|Z=z)=0,

why by Gibbs' Inequality means

p(x,y|z)=p(x|z)p(y|z)

for all x,y, i.e. X and Y are conditionally independent given Z.

Theorem: Uniform distribution maximizes entropy \@{uniform-distribution-maximizes-entropy}

A random variable has the most entropy when the elements of its alphabet are all equally likely to occur.

Proof \@{proof-of-uniform-distribution-maximizes-entropy}

We will use a @Lagrangian function of entropy to show this. Let

L(p,λ)=i[pilnpi]λ[(ipi)1].

Then, for any pi we want

Lpi=lnpi1λ=0pi=e1λ.

But, this means pi doesn't depend on i, and so is the same for each i and therefore pi=1n.

It remains to show that this extreme of H is a maximum. This follows from the facts that the domain is a convex, compact set and that the entropy function is strictly concave. TODO: more details on these.

Referenced by (1 direct)
Theorem \@{theorem-54}

The uncertainty of Y is never increased by knowledge of X. It will be decreased unless X and Y are independent events, in which case it is not changed.

Proof \@{proof-of-theorem-54}

From Let X and Y be discrete random... and Chain rule for joint entropy, we have

H(X)+H(Y)H(X,Y)=H(X)+H(Y|X),

hence H(Y)H(Y|X).

Theorem \@{joint-entropy-is-less-than-or-equal-to-entropy-of-parts}

Let X and Y be discrete random variables with alphabets X and Y, and let p(x,y) be the probability of the joint occurrence of X=x and Y=y.

The entropy of the joint event (the joint entropy), H(X,Y), is less than or equal to the sum of the individual entropies, i.e.

H(X,Y)H(X)+H(Y),

with equality iff X and Y are independent, that is, iff p(x,y)=p(x)p(y).

Proof \@{proof-of-joint-entropy-is-less-than-or-equal-to-entropy-of-parts}

The entropy of the joint event is

H(X,Y)=x,yp(x,y)logp(x,y).

This is just treating each possible pair of individual outcomes as its own outcome, i.e. we have |X|×|Y| possible outcomes. Writing p(x)=yp(x,y) and p(y)=xp(x,y) for the marginals (the argument names the distribution), we have

H(X)=x,yp(x,y)logyp(x,y),H(Y)=x,yp(x,y)logxp(x,y).

So,

H(X)+H(Y)H(X,Y)=x,yp(x,y)logyp(x,y)x,yp(x,y)logxp(x,y)+x,yp(x,y)logp(x,y)=x,yp(x,y)(logp(x,y)logyp(x,y)logxp(x,y))=x,yp(x,y)(logp(x,y)logp(x)logp(y))=x,yp(x,y)(logp(x,y)p(x)p(y))=x,yp(x,y)(logp(x)p(y)p(x,y))

Now, let's define a new random variable for convenience, Z=p(X)p(Y)p(X,Y). We now have that

H(X)+H(Y)H(X,Y)=x,yp(x,y)(logp(x)p(y)p(x,y))=x,yp(x,y)(logZ)=E[logZ].

Now, by Jensen's Inequality, because Log is Concave, we have that E[logZ]logE[Z]. Now,

E[Z]=x,yp(x,y)p(x)p(y)p(x,y)=x,yp(x)p(y)=(xp(x))(yp(y))=11=1. Therefore logE[Z]=log1=0, and we have that E[logZ]0E[logZ]0, and

H(X)+H(Y)H(X,Y)0H(X,Y)H(X)H(Y)H(X,Y)H(X)+H(Y).

Now, for the equality part. Suppose H(X)+H(Y)=H(X,Y). Then, E[logZ]=0, and recalling that E[Z]=1, E[logZ]=logE[Z]=0. In Jensen's Inequality, equality holds only if our function is @affine or if Z is constant; since log is @affine on no interval, Z must be constant, and since E[Z]=1, Z=p(x)p(y)p(x,y)=1p(x)p(y)=p(x,y).

Now, suppose p(x)p(y)=p(x,y). Then Z=1 and

H(X)+H(Y)H(X,Y)=x,yp(x,y)(log1)=0,

so H(X)+H(Y)=H(X,Y).

Referenced by (1 direct)

Direct references:

Theorem: Doubly stochastic maps increase entropy \@{doubly-stochastic-maps-increase-entropy}

Take a @doubly-stochastic matrix A and probability vector p, let q=Ap. Then H(q)H(p), with equality iff q is a @rearrangement of p.

Proof \@{proof-of-doubly-stochastic-maps-increase-entropy}

Note that qi=jAijpj, by the definition of vector matrix multiplication. Now we'll define a couple of joint distributions:

rij=Aijpj,sij=Aijqi.

Now we find the relative-entropy from s to r:

D(rs)=i,jrijlogrijsij=i,jAijpjlogAijpjAijqi=i,jAijpjlogpjqi=i,jAijpj(logpjlogqi)=i,jAijpjlogpji,jAijpjlogqi

Now, addressing the first term on the RHS of the last line:

i,jAijpjlogpj=j[pjlogpjiAij]=j[pjlogpj1]=jpjlogpj=H(p).

And the second term on the RHS of the last line:

i,jAijpjlogqi=i[logqijAijpj]=i[logqiqi]=H(q).

So, we end up with D(rs)=H(q)H(p). Since D(rs)0 by Gibbs' Inequality, we have H(q)H(p)0, which implies that H(q)H(p), which is what we wanted to show.

Now, the equivalence case. If q is just a rearrangement of p, then obviously it has the same entropy as we can just re-index to recover p. Now assume H(p)=H(q). Then, H(q)H(p)=0D(rs)=0r=sAijpj=Aijqipj=qi whenever Aij>0. Now, for each value c appearing in p or q, let

Jc={j:pj=c},Ic={i:qi=c},

that is Jc is the set of indices of p where pj=c, and similarly with Ic and q. Now, consider row iIc. For any Aij>0, we have pj=qi, so jJc, i.e. every nonzero entry of row i lies in a column of Jc, so the columns jJc have the entire mass of row i. Similarly, for column jJc, for nonzero Aij, qi=pj=c, so iIc, and the rows Ic contain all of column j's mass. Taking 1S as the @indicator-vector of a set S, we have that

A1Jc=1Ic,

that is, rows in Ic sum to 1 over the columns Jc, while rows outside Ic have no mass in the columns Jc at all. Now we count the mass:

|Ic|=11Iccount entries via dot product=1(A1Jc)identity from above=(1A)1Jcassociativity=11Jccolumn-stochasticity=|Jc|count entries via dot product.

Therefore, |Ic|=|Jc| for all c, so each c appears equally often in p and in q, and q is therefore a rearrangement of p.

Intuition \@{doubly-stochastic-maps-increase-entropy-intuition}

Averaging (well, replacing each probability with a convex combination of all the probabilities in a way that retains their summing to 1) the probabilities in p can only bring them closer to each other (if it doesn't just rearrange them), which increases entropy.

Log Sum Inequality and Its Applications

Theorem: Log Sum Inequality \@{log-sum-inequality}

For non-negative numbers, a1,a2,,an and b1,b2,,bn,

i=1nailogaibi(i=1nai)log(i=1naii=1nbi),

with equality if and only if aibi=const.

We use the conventions that 0log0=0,aloga0= if a>0, and 0log00=0, all of which follow from @continuity.

Proof \@{proof-of-log-sum-inequality}

We can assume without loss of generality, due to the 0-handling conventions specified above, that ai>0 and bi>0. Now, note that the function f(t)=tlogt is @strictly convex, since f(t)=1tloge>0 for all positive t. Then, by Jensen's Inequality we have

αif(ti)f(αiti).

as long as αi>0,iαi=1, i.e. if the αi form a @discrete probability distribution.

If we let αi=bij=1nbj, i.e. αi is the @probability mass assigned to index i, then this condition is met. We can then pick ti=aibi and we get

i=1nαif(ti)f(i=1nαiti)i=1nαitilogti(i=1nαiti)log(i=1nαiti)i=1nbij=1nbjaibilogaibi(i=1nbij=1nbjaibi)log(i=1nbij=1nbjaibi)i=1naij=1nbjlogaibi(i=1naij=1nbj)log(i=1naij=1nbj)1j=1nbji=1nailogaibi1j=1nbj(i=1nai)log(i=1naii=1nbj)i=1nailogaibi(i=1nai)log(i=1naii=1nbj).

Theorem: Nonnegativity of Relative Entropy \@{nonnegativity-of-relative-entropy}

For discrete probability distributions p and q that share a support X,

D(pq)0,

with equality if and only if p=q.

Proof \@{proof-of-nonnegativity-of-relative-entropy}

This restates Gibbs' Inequality, which the Log Sum Inequality proves more directly. D(pq)=xXp(x)logp(x)q(x)(xXp(x))log(xp(x)xq(x))=1log(11)=0,

with equality if and only if p(x)q(x)=c. Both p and q are probability mass functions, so c=1 (otherwise they wouldn't both sum to 1) and hence we have D(pq)=0 if and only if p(x)=q(x) for all x.

Theorem: Convexity of Relative Entropy \@{convexity-of-relative-entropy}

TODO: Cover & Thomas Theorem 2.7.2.

D(pq) is convex in the pair (p,q); that is, if (p1,q1) and (p2,q2) are two pairs of probability mass functions, then

D(λp1+(1λ)p2λq1+(1λ)q2)λD(p1q1)+(1λ)D(p2q2)

for all 0λ1.

Proof \@{proof-of-convexity-of-relative-entropy}

First, note that the set of probability mass functions on X is the set of probability vectors in Rn, where n=|X|, and thus is a convex set. D takes a pair (p,q)Rn×Rn, which is again convex, so D is defined on a convex set.

Now we'll apply Log Sum Inequality to the one term with a fixed x left-hand side of the inequality in the theorem, but we'll do some replacements to make it more obvious what's happening.

Let a1=λp1(x),a2=(1λ)p2(x)b1=λq1(x),b2=(1λ)q2(x).

Using those substitutions, with Log Sum Inequality, we have

(λp1(x)+(1λ)p2(x))logλp1(x)+(1λ)p2(x)λq1(x)+(1λ)q2(x)=(a1+a2)loga1+a2b1+b2a1loga1b1+a2loga2b2=λp1(x)logλp1(x)λq1(x)+(1λ)p2(x)log(1λ)p2(x)(1λ)q2(x)=λp1(x)logp1(x)q1(x)+(1λ)p2(x)logp2(x)q2(x)

Summing both sides of this over xX gives us

D(λp1+(1λ)p2λq1+(1λ)q2)λD(p1q1)+(1λ)D(p2q2).

Intuition \@{convexity-of-relative-entropy-intuition}

relative-entropy is a convex @surface over @pairs (p,q), with a flat-bottomed zero valley along p=q, rising as p and q differ.

Convexity of Relative Entropy The image above was generated using GPT-5.6 Sol.

Another way to think of this is that mixing p1 and p2, and q1 and q2 can't make the results more distinguishable than the weighted average distinguishabilities between p1 and q1 and p2 and q2, i.e., mixing distributions tends to wash out distinctions.

Referenced by (1 direct)
Theorem: Concavity of Entropy \@{concavity-of-entropy}

H(p) is a concave function of p.

Proof \@{proof-of-concavity-of-entropy}

Let u be the uniform distribution on |X| outcomes. Then from the definition of @relative-entropy,

D(Pu)=H(p,u)H(p)H(p)=H(p,u)D(pu).

Then, from the definition of cross-entropy

H(p,u)=xXp(x)logu(x)=xXp(x)log1|X|=xXp(x)(log1log|X|)=xXp(x)log|X|=log|X|

So,

H(p)=log|X|D(pu),

and by Convexity of Relative Entropy, entropy is a concave function.

Intuition \@{concavity-of-entropy-intuition}

The intuition is that mixing distributions can never decrease uncertaintity.

Convexity of Relative Entropy The image above was generated using GPT-5.6 Sol.

We already proved Uniform distribution maximizes entropy using Lagrangian multipliers, but the proof above shows it in another way. If p=u, then D(pu)=0, and since log|X| is constant in |X|, H is maximized by u.

Theorem: Concavity and Convexity of Mutual Information \@{concavity-and-convexity-of-mutual-information}

TODO: Cover & Thomas Theorem 2.7.4.

Data-Processing Inequality

Definition: Markov Chain \@{markov-chain}

TODO: Cover & Thomas, Section 2.8.

Theorem: Data-Processing Inequality \@{data-processing-inequality}

TODO: Cover & Thomas Theorem 2.8.1.

Corollary: Processing Cannot Increase Information \@{processing-cannot-increase-information}

TODO: Cover & Thomas, corollary to Theorem 2.8.1.

Sufficient Statistics

Definition: Sufficient Statistic \@{sufficient-statistic}

TODO: Cover & Thomas, Section 2.9.

Theorem: Characterization of Sufficiency \@{characterization-of-sufficiency}

TODO: Cover & Thomas, Section 2.9.

Definition: Minimal Sufficient Statistic \@{minimal-sufficient-statistic}

TODO: Cover & Thomas, Section 2.9.

Fano's Inequality

Theorem: Fano's Inequality \@{fanos-inequality}

TODO: Cover & Thomas Theorem 2.10.1.

Corollary: Weak Form of Fano's Inequality \@{weak-form-of-fanos-inequality}

TODO: Cover & Thomas, Section 2.10.