Skip to main content
KetQat

Appearance

Topic · intermediate

Classical Information Theory

Shannon entropy, relative entropy and mutual information, the inequalities that govern them (Gibbs, data processing, Fano, Pinsker), typicality and the source coding theorem, and channel capacity, as the classical template for quantum entropy and quantum Shannon theory.

ExpositionMachine-checkedUpdated 2026-12-01 · last verified 2026-12-01

AI-assisted text, machine-checked, not yet reviewed by a person. Citations resolve and an automated pass compared the statements with the cited sources. That is not peer review; check the sources for anything you depend on.

Overview

Information theory, founded by Shannon, asks how much a random source can be compressed and how fast data can be sent reliably through a noisy channel. Both questions have exact answers in the limit of many independent uses, and both answers are entropies: a source of entropy HH compresses to HH bits per symbol, and a channel carries at most its capacity, the largest mutual information between its input and output.

This page sets out the classical quantities, entropy, relative entropy and mutual information, the inequalities that relate them, and the two coding theorems. They are the template for quantum entropy and quantum Shannon theory, where every classical quantity has a counterpart and most, but not all, classical properties survive. The probability background is in probability theory; the construction of practical codes is in coding theory. The standard textbook is Cover and Thomas.

Intuition

The entropy H(X)H(X) is the average surprise −log⁡2p(x)-\log_2 p(x) of an outcome: a fair coin carries one bit, a coin that always lands heads carries none. Its operational meaning comes from looking at long sequences. Among the 2n2^n binary strings of length nn produced by a biased coin, essentially all of the probability sits on about 2nH2^{n H} "typical" strings that contain the expected proportion of heads, and they are all about equally likely. To store such a sequence one only needs to name which typical string occurred, which takes nHnH bits.

The relative entropy D(p∥q)D(p \Vert q) measures how surprised you are, on average, if you believe the data come from qq while they actually come from pp. It is zero only when the two agree and it is the rate at which evidence against qq accumulates per sample. The mutual information I(X;Y)I(X; Y) measures how much observing YY reduces uncertainty about XX. The data-processing inequality formalises the intuition that you cannot learn more about XX by processing YY, and Fano's inequality says that if you can guess XX from YY almost always, little uncertainty about XX remains once YY is known.

Prerequisites

Discrete probability, expectation and the law of large numbers; convexity and Jensen's inequality. All logarithms are base 2 unless written ln⁡\ln.

Mathematical Definitions

DefinitionShannon entropyEstablished definition

Let XX be a random variable with values in a finite set X\mathcal{X} and distribution p(x)=Pr⁡[X=x]p(x) = \Pr[X = x]. Its Shannon entropy is

H(X)=−∑x∈Xp(x)log⁡2p(x)=E[−log⁡2p(X)],H(X) = -\sum_{x \in \mathcal{X}} p(x) \log_2 p(x) = \mathbb{E}\big[ -\log_2 p(X) \big],

with the convention 0log⁡20=00 \log_2 0 = 0. It depends only on the distribution, so one also writes H(p)H(p). For two random variables X,YX, Y with joint distribution p(x,y)p(x, y), the joint entropy H(XY)H(XY) is the entropy of the pair, and the conditional entropy is

H(X∣Y)=H(XY)−H(Y)=∑yp(y) H(X∣Y=y),H(X \mid Y) = H(XY) - H(Y) = \sum_{y} p(y)\, H(X \mid Y = y) ,

the average over yy of the entropy of the conditional distribution p(x∣y)p(x \mid y). The binary entropy function is h2(p)=−plog⁡2p−(1−p)log⁡2(1−p)h_2(p) = -p \log_2 p - (1 - p)\log_2(1 - p) for p∈[0,1]p \in [0, 1], the entropy of a Bernoulli(pp) variable.

Basic properties, all in chapter 2 of Cover and Thomas:

  • 0≤H(X)≤log⁡2∣X∣0 \le H(X) \le \log_2 \abs{\mathcal{X}}, with H(X)=0H(X) = 0 iff XX is deterministic and H(X)=log⁡2∣X∣H(X) = \log_2\abs{\mathcal{X}} iff XX is uniform;
  • H(X∣Y)≥0H(X \mid Y) \ge 0, and H(X∣Y)≤H(X)H(X \mid Y) \le H(X) (conditioning does not increase entropy), with equality iff XX and YY are independent;
  • chain rule H(X1…Xn)=∑i=1nH(Xi∣X1…Xi−1)H(X_1 \dots X_n) = \sum_{i=1}^{n} H(X_i \mid X_1 \dots X_{i-1}), and hence subadditivity H(X1…Xn)≤∑iH(Xi)H(X_1 \dots X_n) \le \sum_i H(X_i);
  • H(f(X))≤H(X)H(f(X)) \le H(X) for every function ff.

The upper bounds follow from Gibbs' inequality. The definition is due to Shannon. The quantum generalisation is the von Neumann entropy, which equals the Shannon entropy of the eigenvalue distribution; unlike H(X∣Y)H(X \mid Y), the quantum conditional entropy can be negative.

Holds when
  • Random variables take values in finite sets; countable alphabets work the same way when the sums converge.
  • Logarithms are base 2 (bits) unless stated; natural logarithms give nats.
DefinitionRelative entropy (Kullback–Leibler divergence)Established definition

For probability distributions pp and qq on a finite set X\mathcal{X}, the relative entropy of pp with respect to qq is

D(p∥q)=∑x∈Xp(x)log⁡2p(x)q(x),D(p \Vert q) = \sum_{x \in \mathcal{X}} p(x) \log_2 \frac{p(x)}{q(x)} ,

with the conventions 0log⁡(0/q)=00 \log(0/q) = 0 and plog⁡(p/0)=+∞p \log(p/0) = +\infty for p>0p > 0. Thus D(p∥q)<∞D(p \Vert q) < \infty exactly when the support of pp is contained in the support of qq. It is the expectation under pp of the log-likelihood ratio log⁡2(p(X)/q(X))\log_2(p(X)/q(X)).

D(p∥q)≥0D(p \Vert q) \ge 0 with equality iff p=qp = q (Gibbs' inequality), but DD is not a metric: in general D(p∥q)≠D(q∥p)D(p \Vert q) \ne D(q \Vert p) and the triangle inequality fails. Entropy and mutual information are special cases: for uu uniform on X\mathcal{X}, H(p)=log⁡2∣X∣−D(p∥u)H(p) = \log_2\abs{\mathcal{X}} - D(p \Vert u), and I(X;Y)=D(pXY∥pX⊗pY)I(X; Y) = D(p_{XY} \Vert p_X \otimes p_Y). It is jointly convex in (p,q)(p, q) and cannot increase when the same stochastic map is applied to both arguments.

Operationally, D(p∥q)D(p \Vert q) is the optimal exponent with which the probability of mistaking qq for pp (accepting pp when the nn samples come from qq) decays while the error probability under pp is kept bounded (Stein's lemma, chapter 11 of Cover and Thomas). The quantity was introduced by Kullback and Leibler. The quantum generalisation is the quantum relative entropy, with the corresponding quantum Stein lemma.

Holds when
  • Distributions on a finite set; logarithms base 2 unless stated.
DefinitionMutual informationEstablished definition

For random variables XX and YY with joint distribution p(x,y)p(x, y), the mutual information is

I(X;Y)=H(X)−H(X∣Y)=H(X)+H(Y)−H(XY)=∑x,yp(x,y)log⁡2p(x,y)p(x) p(y),I(X; Y) = H(X) - H(X \mid Y) = H(X) + H(Y) - H(XY) = \sum_{x, y} p(x, y) \log_2 \frac{p(x, y)}{p(x)\, p(y)} ,

where HH is the Shannon entropy. Equivalently I(X;Y)=D(pXY∥pX⊗pY)I(X; Y) = D(p_{XY} \Vert p_X \otimes p_Y), the relative entropy between the joint distribution and the product of its marginals. For a third variable ZZ the conditional mutual information is

I(X;Y∣Z)=H(X∣Z)−H(X∣YZ)=∑zp(z) I(X;Y∣Z=z).I(X; Y \mid Z) = H(X \mid Z) - H(X \mid YZ) = \sum_z p(z)\, I(X; Y \mid Z = z) .

Properties (chapter 2 of Cover and Thomas):

  • I(X;Y)=I(Y;X)≥0I(X; Y) = I(Y; X) \ge 0, with equality iff XX and YY are independent; likewise I(X;Y∣Z)≥0I(X; Y \mid Z) \ge 0;
  • I(X;Y)≤min⁡{H(X),H(Y)}I(X; Y) \le \min\{H(X), H(Y)\} and I(X;X)=H(X)I(X; X) = H(X);
  • chain rule I(X;YZ)=I(X;Y)+I(X;Z∣Y)I(X; Y Z) = I(X; Y) + I(X; Z \mid Y);
  • if ff is injective, I(f(X);Y)=I(X;Y)I(f(X); Y) = I(X; Y).

For a channel W(y∣x)W(y \mid x) and input distribution pXp_X, I(X;Y)I(X; Y) is the rate achievable with codewords drawn from pXp_X, and its maximum over pXp_X is the capacity in the noisy-channel coding theorem, as defined by Shannon. The quantum generalisation is the quantum mutual information.

Holds when
  • Random variables with finite alphabets; logarithms base 2.

Theorems

Inequalities

TheoremGibbs' inequality (nonnegativity of relative entropy)Established result

For probability distributions pp and qq on a finite set X\mathcal{X},

D(p∥q)  ≥  0,with equality if and only if p=q,D(p \Vert q) \;\ge\; 0, \qquad \text{with equality if and only if } p = q ,

where DD is the relative entropy.

Consequences, for random variables with finite alphabets:

  1. H(X)≤log⁡2∣X∣H(X) \le \log_2 \abs{\mathcal{X}}, with equality iff XX is uniform, because log⁡2∣X∣−H(X)=D(pX∥u)\log_2\abs{\mathcal{X}} - H(X) = D(p_X \Vert u) for the uniform distribution uu;
  2. I(X;Y)≥0I(X; Y) \ge 0, with equality iff XX and YY are independent, because I(X;Y)=D(pXY∥pX⊗pY)I(X; Y) = D(p_{XY} \Vert p_X \otimes p_Y);
  3. H(X∣Y)≤H(X)H(X \mid Y) \le H(X), since the difference is I(X;Y)I(X; Y), and likewise I(X;Y∣Z)≥0I(X; Y \mid Z) \ge 0 by averaging (2) over ZZ.

The statement and these corollaries are in chapter 2 of Cover and Thomas. The quantum analogue, nonnegativity of the quantum relative entropy, is known as Klein's inequality.

Holds when
  • Distributions on a finite set.
Proof · Proof of Gibbs' inequality

If some xx has p(x)>0=q(x)p(x) > 0 = q(x), then D(p∥q)=+∞>0D(p \Vert q) = +\infty > 0 and p≠qp \ne q. Otherwise let S={x:p(x)>0}S = \{x : p(x) > 0\}. Since log⁡2\log_2 is strictly concave, Jensen's inequality for the probability weights p(x)p(x), x∈Sx \in S, gives

−D(p∥q)=∑x∈Sp(x)log⁡2q(x)p(x)  ≤  log⁡2∑x∈Sp(x)q(x)p(x)=log⁡2∑x∈Sq(x)  ≤  log⁡21=0.-D(p \Vert q) = \sum_{x \in S} p(x) \log_2 \frac{q(x)}{p(x)} \;\le\; \log_2 \sum_{x \in S} p(x) \frac{q(x)}{p(x)} = \log_2 \sum_{x \in S} q(x) \;\le\; \log_2 1 = 0 .

Equality in the first step holds iff q(x)/p(x)q(x)/p(x) takes one value cc on SS, and in the second iff ∑x∈Sq(x)=1\sum_{x \in S} q(x) = 1. Together these give c=1c = 1, i.e. q=pq = p on SS, and q=0q = 0 off SS, so p=qp = q. The corollaries follow from the identities quoted in the statement. This is the proof in chapter 2 of Cover and Thomas.

TheoremData-processing inequality (classical)Established result
  1. Mutual information. If X→Y→ZX \to Y \to Z is a Markov chain, i.e. p(x,y,z)=p(x) p(y∣x) p(z∣y)p(x, y, z) = p(x)\, p(y \mid x)\, p(z \mid y), then

    I(X;Z)  ≤  I(X;Y),I(X; Z) \;\le\; I(X; Y) ,

    with equality iff I(X;Y∣Z)=0I(X; Y \mid Z) = 0. In particular I(X;g(Y))≤I(X;Y)I(X; g(Y)) \le I(X; Y) for every function gg.

  2. Relative entropy. For every stochastic map (channel) W(y∣x)W(y \mid x) and distributions p,qp, q on its input, with output distributions (pW)(y)=∑xp(x)W(y∣x)(pW)(y) = \sum_x p(x) W(y \mid x) and qWqW defined likewise,

    D(pW∥qW)  ≤  D(p∥q).D(pW \Vert qW) \;\le\; D(p \Vert q) .

Part 1 is in chapter 2 of Cover and Thomas; part 2 follows from the log-sum inequality proved there. The quantum version of part 2, for quantum channels, is the data-processing inequality for relative entropy.

Holds when
  • Finite alphabets.
  • For part 1, X -> Y -> Z is a Markov chain, that is X and Z are conditionally independent given Y.
Proof · Proof of the classical data-processing inequality

Part 1. By the chain rule for mutual information, in two orders,

I(X;YZ)=I(X;Z)+I(X;Y∣Z)=I(X;Y)+I(X;Z∣Y).I(X; YZ) = I(X; Z) + I(X; Y \mid Z) = I(X; Y) + I(X; Z \mid Y) .

The Markov property says that given Y=yY = y, XX and ZZ are independent, so I(X;Z∣Y=y)=0I(X; Z \mid Y = y) = 0 for each yy and I(X;Z∣Y)=0I(X; Z \mid Y) = 0. Hence I(X;Z)=I(X;Y)−I(X;Y∣Z)≤I(X;Y)I(X; Z) = I(X; Y) - I(X; Y \mid Z) \le I(X; Y), because conditional mutual information is nonnegative (Gibbs' inequality). For Z=g(Y)Z = g(Y) the chain X→Y→g(Y)X \to Y \to g(Y) is Markov.

Log-sum inequality. For nonnegative a1,…,aka_1, \dots, a_k and positive b1,…,bkb_1, \dots, b_k, with a=∑iaia = \sum_i a_i and b=∑ibib = \sum_i b_i, ∑iailog⁡2(ai/bi)≥alog⁡2(a/b)\sum_i a_i \log_2 (a_i / b_i) \ge a \log_2 (a / b). Indeed f(t)=tlog⁡2tf(t) = t \log_2 t is convex on [0,∞)[0, \infty), and Jensen's inequality with weights bi/bb_i / b at the points ti=ai/bit_i = a_i / b_i gives ∑i(bi/b)f(ti)≥f(∑iai/b)=f(a/b)\sum_i (b_i/b) f(t_i) \ge f(\sum_i a_i / b) = f(a/b); multiply by bb. Terms with bi=0b_i = 0 and ai=0a_i = 0 contribute nothing, and if some bi=0<aib_i = 0 < a_i the left side is +∞+\infty.

Part 2. For each output yy apply the log-sum inequality to ax=p(x)W(y∣x)a_x = p(x) W(y \mid x) and bx=q(x)W(y∣x)b_x = q(x) W(y \mid x), whose sums are (pW)(y)(pW)(y) and (qW)(y)(qW)(y):

(pW)(y)log⁡2(pW)(y)(qW)(y)≤∑xp(x)W(y∣x)log⁡2p(x)q(x).(pW)(y) \log_2 \frac{(pW)(y)}{(qW)(y)} \le \sum_x p(x) W(y \mid x) \log_2 \frac{p(x)}{q(x)} .

Summing over yy and using ∑yW(y∣x)=1\sum_y W(y \mid x) = 1 gives D(pW∥qW)≤D(p∥q)D(pW \Vert qW) \le D(p \Vert q). Part 1 is the chain-rule argument of chapter 2 of Cover and Thomas, where the log-sum inequality is also proved.

TheoremFano's inequalityEstablished result

Let XX take values in a finite set X\mathcal{X}, let YY be any random variable, let X^=g(Y)\hat X = g(Y) be an estimate of XX, and let Pe=Pr⁡[X^≠X]P_e = \Pr[\hat X \ne X]. Then

H(X∣Y)  ≤  h2(Pe)+Pelog⁡2(∣X∣−1),H(X \mid Y) \;\le\; h_2(P_e) + P_e \log_2\big(\abs{\mathcal{X}} - 1\big) ,

where h2h_2 is the binary entropy function. A weaker form often suffices: H(X∣Y)≤1+Pelog⁡2∣X∣H(X \mid Y) \le 1 + P_e \log_2\abs{\mathcal{X}}, so that Pe≥(H(X∣Y)−1)/log⁡2∣X∣P_e \ge \big(H(X \mid Y) - 1\big)/\log_2\abs{\mathcal{X}}.

The bound is tight: equality holds when, conditioned on an error, XX is uniform over the ∣X∣−1\abs{\mathcal{X}} - 1 wrong values, independently of YY. In the converse of the noisy-channel coding theorem, XX is a uniformly random message of nRnR bits and YY the channel output; Fano gives nR=H(X)≤I(X;Y)+1+PenR≤nC+1+PenRnR = H(X) \le I(X; Y) + 1 + P_e nR \le nC + 1 + P_e nR, so the error probability cannot vanish when R>CR > C. The inequality is in chapter 2 of Cover and Thomas.

Holds when
  • X takes values in a finite set with at least two elements.
  • The estimate is any function of Y; by data processing, the bound also holds for any estimate X-hat with X -> Y -> X-hat Markov.
Proof · Proof of Fano's inequality

Let E=1[X^≠X]E = \mathbf{1}[\hat X \ne X], so Pr⁡[E=1]=Pe\Pr[E = 1] = P_e. Expand H(EX∣Y)H(E X \mid Y) with the chain rule for entropy in two ways.

First, H(EX∣Y)=H(X∣Y)+H(E∣XY)=H(X∣Y)H(E X \mid Y) = H(X \mid Y) + H(E \mid X Y) = H(X \mid Y), because EE is a function of XX and X^=g(Y)\hat X = g(Y), so H(E∣XY)=0H(E \mid XY) = 0.

Second, H(EX∣Y)=H(E∣Y)+H(X∣EY)H(E X \mid Y) = H(E \mid Y) + H(X \mid E Y). Conditioning does not increase entropy, so H(E∣Y)≤H(E)=h2(Pe)H(E \mid Y) \le H(E) = h_2(P_e). And

H(X∣EY)=(1−Pe) H(X∣Y,E=0)+Pe H(X∣Y,E=1).H(X \mid E Y) = (1 - P_e)\, H(X \mid Y, E = 0) + P_e\, H(X \mid Y, E = 1) .

Given E=0E = 0 and Y=yY = y, X=g(y)X = g(y) is determined, so the first term is 00. Given E=1E = 1 and Y=yY = y, XX lies in X∖{g(y)}\mathcal{X} \setminus \{g(y)\}, a set of ∣X∣−1\abs{\mathcal{X}} - 1 elements, so its conditional entropy is at most log⁡2(∣X∣−1)\log_2(\abs{\mathcal{X}} - 1), and so is the average over yy. Combining, H(X∣Y)≤h2(Pe)+Pelog⁡2(∣X∣−1)H(X \mid Y) \le h_2(P_e) + P_e \log_2(\abs{\mathcal{X}} - 1). The weaker form uses h2≤1h_2 \le 1 and ∣X∣−1≤∣X∣\abs{\mathcal{X}} - 1 \le \abs{\mathcal{X}}. For a randomised estimate X^\hat X with X→Y→X^X \to Y \to \hat X Markov, apply the result to (X,X^)(X, \hat X) with gg the identity and use H(X∣Y)≤H(X∣X^)H(X \mid Y) \le H(X \mid \hat X), which is the data-processing inequality. This is the proof in chapter 2 of Cover and Thomas.

EquationPinsker's inequalityEstablished result
D(p∥q)  ≥  ∥p−q∥122ln⁡2,equivalentlydTV(p,q)≤12De(p∥q)D(p \Vert q) \;\ge\; \frac{\norm{p - q}_1^{2}}{2 \ln 2}, \qquad \text{equivalently} \qquad d_{\mathrm{TV}}(p, q) \le \sqrt{\tfrac{1}{2} D_e(p \Vert q)}

Here ∥p−q∥1=∑x∣p(x)−q(x)∣=2 dTV(p,q)\norm{p - q}_1 = \sum_x \abs{p(x) - q(x)} = 2\, d_{\mathrm{TV}}(p, q) (total variation distance). The inequality is in chapter 11 of Cover and Thomas.

Proof. Let A={x:p(x)>q(x)}A = \{x : p(x) > q(x)\}, a=p(A)a = p(A) and b=q(A)b = q(A), so a≥ba \ge b and ∥p−q∥1=2(a−b)\norm{p - q}_1 = 2(a - b). The map x↦1[x∈A]x \mapsto \mathbf{1}[x \in A] sends pp and qq to the Bernoulli distributions with parameters aa and bb, and by the data-processing inequality it does not increase the relative entropy. So it suffices to show, in nats,

g(b)=aln⁡ab+(1−a)ln⁡1−a1−b−2(a−b)2  ≥  0for 0<b≤a.g(b) = a \ln\frac{a}{b} + (1 - a)\ln\frac{1 - a}{1 - b} - 2(a - b)^2 \;\ge\; 0 \qquad \text{for } 0 < b \le a .

(If b=0<ab = 0 < a the relative entropy is infinite and there is nothing to prove; for a=1a = 1 the second term is 00 by the convention 0ln⁡0=00 \ln 0 = 0.) We have g(a)=0g(a) = 0 and

g′(b)=−ab+1−a1−b+4(a−b)=(b−a)(1b(1−b)−4)≤0g'(b) = -\frac{a}{b} + \frac{1 - a}{1 - b} + 4(a - b) = (b - a)\Big( \frac{1}{b(1 - b)} - 4 \Big) \le 0

for b≤ab \le a, because b(1−b)≤1/4b(1 - b) \le 1/4. So gg is non-increasing on (0,a](0, a] and g(b)≥g(a)=0g(b) \ge g(a) = 0. Hence De(p∥q)≥2(a−b)2=∥p−q∥12/2D_e(p \Vert q) \ge 2(a - b)^2 = \norm{p - q}_1^2 / 2, and dividing by ln⁡2\ln 2 gives the form in bits.

The quantum version, with the same constant and the trace norm, is the quantum Pinsker inequality. The converse direction fails: distributions can be close in total variation and have infinite relative entropy if the support condition fails.

Holds when
  • Distributions on a finite set; D in bits, D_e = (ln 2) D in nats.

Typicality and compression

TheoremAsymptotic equipartition propertyEstablished result

Let X1,X2,…X_1, X_2, \dots be i.i.d. with distribution pp and entropy H=H(X1)H = H(X_1), and write p(xn)=∏i=1np(xi)p(x^n) = \prod_{i=1}^{n} p(x_i) for xn=(x1,…,xn)x^n = (x_1, \dots, x_n). Then −1nlog⁡2p(Xn)→H-\frac{1}{n}\log_2 p(X^n) \to H in probability. For δ>0\delta > 0 define the typical set

Tδ(n)={xn∈Xn:∣−1nlog⁡2p(xn)−H∣≤δ}.T_\delta^{(n)} = \Big\{ x^n \in \mathcal{X}^n : \Big| -\tfrac{1}{n}\log_2 p(x^n) - H \Big| \le \delta \Big\} .

Then:

  1. Pr⁡[Xn∈Tδ(n)]→1\Pr[X^n \in T_\delta^{(n)}] \to 1 as n→∞n \to \infty; in particular it exceeds 1−ϵ1 - \epsilon for every ϵ>0\epsilon > 0 and all sufficiently large nn;
  2. every xn∈Tδ(n)x^n \in T_\delta^{(n)} has 2−n(H+δ)≤p(xn)≤2−n(H−δ)2^{-n(H + \delta)} \le p(x^n) \le 2^{-n(H - \delta)};
  3. ∣Tδ(n)∣≤2n(H+δ)\abs{T_\delta^{(n)}} \le 2^{n(H + \delta)} for every nn;
  4. ∣Tδ(n)∣≥(1−ϵ) 2n(H−δ)\abs{T_\delta^{(n)}} \ge (1 - \epsilon)\, 2^{n(H - \delta)} for all sufficiently large nn.

So the typical set carries almost all the probability, has about 2nH2^{nH} elements out of ∣X∣n\abs{\mathcal{X}}^n, and its elements are nearly equiprobable. Note that the single most likely sequence need not be typical. The property was stated by Shannon and proved in general (for stationary ergodic sources) by McMillan; the i.i.d. statement is chapter 3 of Cover and Thomas. Its quantum analogue, the typical subspace of ρ⊗n\rho^{\otimes n} with dimension about 2nS(ρ)2^{n S(\rho)}, is the core of Schumacher compression and of the HSW theorem.

Holds when
  • X_1, X_2, ... are independent and identically distributed with a distribution p on a finite set.
  • Entropy in bits; delta > 0 is a fixed tolerance.
Proof · Proof of the asymptotic equipartition property

With probability one each XiX_i lies in the support of pp, so Zi=−log⁡2p(Xi)Z_i = -\log_2 p(X_i) is a well-defined random variable taking finitely many values. The ZiZ_i are i.i.d. with mean EZi=−∑xp(x)log⁡2p(x)=H\mathbb{E}Z_i = -\sum_x p(x) \log_2 p(x) = H and finite variance, and −1nlog⁡2p(Xn)=1n∑i=1nZi-\frac{1}{n}\log_2 p(X^n) = \frac{1}{n}\sum_{i=1}^{n} Z_i. The weak law of large numbers gives convergence in probability to HH, which is statement 1, since Xn∈Tδ(n)X^n \in T_\delta^{(n)} exactly when the average is within δ\delta of HH.

Statement 2 is the definition of Tδ(n)T_\delta^{(n)} rewritten: ∣−1nlog⁡2p(xn)−H∣≤δ\abs{-\frac1n \log_2 p(x^n) - H} \le \delta iff n(H−δ)≤−log⁡2p(xn)≤n(H+δ)n(H - \delta) \le -\log_2 p(x^n) \le n(H + \delta).

For statement 3, by statement 2, 1≥∑xn∈Tp(xn)≥∣T∣ 2−n(H+δ)1 \ge \sum_{x^n \in T} p(x^n) \ge \abs{T}\, 2^{-n(H + \delta)}.

For statement 4, take nn large enough that Pr⁡[Xn∈T]≥1−ϵ\Pr[X^n \in T] \ge 1 - \epsilon; then by statement 2, 1−ϵ≤∑xn∈Tp(xn)≤∣T∣ 2−n(H−δ)1 - \epsilon \le \sum_{x^n \in T} p(x^n) \le \abs{T}\, 2^{-n(H - \delta)}.

The argument is the one in chapter 3 of Cover and Thomas.

TheoremSource coding theorem (lossless compression)Established result

Let X1,X2,…X_1, X_2, \dots be i.i.d. on a finite set X\mathcal{X} with entropy HH. A block code of length nn and rate RR is a pair of maps fn:Xn→{0,1}mf_n : \mathcal{X}^n \to \{0, 1\}^{m} and gn:{0,1}m→Xng_n : \{0, 1\}^{m} \to \mathcal{X}^n with m≤⌈nR⌉m \le \lceil nR \rceil; its error probability is Pr⁡[gn(fn(Xn))≠Xn]\Pr[g_n(f_n(X^n)) \ne X^n].

  1. Achievability. For every R>HR > H there are block codes of rate RR whose error probability tends to 00 as n→∞n \to \infty.
  2. Strong converse. For every R<HR < H and every sequence of block codes with m≤nRm \le nR, the probability of correct decoding tends to 00.

The rate is in bits per source symbol. A related zero-error statement for variable-length codes: the expected length LL of an optimal prefix-free code for one symbol satisfies H≤L<H+1H \le L < H + 1, so coding blocks of nn symbols achieves rate below H+1/nH + 1/n (chapter 5 of Cover and Thomas). The theorem is due to Shannon; the block-coding form with the typical set is chapter 3 of Cover and Thomas. The quantum analogue, Schumacher compression, replaces HH by the von Neumann entropy.

Holds when
  • An i.i.d. source on a finite alphabet with entropy H in bits.
  • Fixed-length block coding with error probability that must vanish as n grows; the variable-length zero-error version is a separate statement quoted below.
Proof · Proof of the source coding theorem

Write T=Tδ(n)T = T_\delta^{(n)} for the typical set of the asymptotic equipartition property.

Achievability. Let R>HR > H and δ=(R−H)/2>0\delta = (R - H)/2 > 0. Then ∣T∣≤2n(H+δ)≤2nR≤2⌈nR⌉\abs{T} \le 2^{n(H + \delta)} \le 2^{nR} \le 2^{\lceil nR \rceil}, so there is an injective map fn:T→{0,1}⌈nR⌉f_n : T \to \{0, 1\}^{\lceil nR \rceil}; extend fnf_n arbitrarily to all of Xn\mathcal{X}^n and let gng_n invert it on fn(T)f_n(T). Every xn∈Tx^n \in T is recovered, so the error probability is at most Pr⁡[Xn∉T]\Pr[X^n \notin T], which tends to 00.

Strong converse. Let R<HR < H and δ=(H−R)/2>0\delta = (H - R)/2 > 0. Any decoder gn:{0,1}m→Xng_n : \{0, 1\}^{m} \to \mathcal{X}^n with m≤nRm \le nR has an image SS of at most 2nR2^{nR} sequences, and decoding is correct only if Xn∈SX^n \in S. Using the upper bound p(xn)≤2−n(H−δ)p(x^n) \le 2^{-n(H - \delta)} on TT,

Pr⁡[Xn∈S]≤Pr⁡[Xn∈S∩T]+Pr⁡[Xn∉T]≤2nR 2−n(H−δ)+Pr⁡[Xn∉T]=2−n(H−R)/2+Pr⁡[Xn∉T],\Pr[X^n \in S] \le \Pr[X^n \in S \cap T] + \Pr[X^n \notin T] \le 2^{nR}\, 2^{-n(H - \delta)} + \Pr[X^n \notin T] = 2^{-n(H - R)/2} + \Pr[X^n \notin T] ,

and both terms tend to 00. This follows chapter 3 of Cover and Thomas.

Channel coding

A discrete memoryless channel W(y∣x)W(y \mid x) is used independently on each symbol, as the binary symmetric channel and the binary erasure channel are.

TheoremNoisy-channel coding theoremEstablished result

Let W(y∣x)W(y \mid x) be a discrete memoryless channel with input alphabet X\mathcal{X} and output alphabet Y\mathcal{Y}. Define its capacity

C  =  max⁡PXI(X;Y),C \;=\; \max_{P_X} I(X; Y) ,

the maximum over input distributions PXP_X of the mutual information, in bits, between the input X∼PXX \sim P_X and the output YY distributed according to W(⋅∣X)W(\cdot \mid X).

A code of length nn and rate RR is a set of M=⌈2nR⌉M = \lceil 2^{nR} \rceil codewords in Xn\mathcal{X}^n together with a decoder Yn→{1,…,M}\mathcal{Y}^n \to \{1, \dots, M\}.

  1. Achievability. For every R<CR < C and every ϵ>0\epsilon > 0 there is, for all sufficiently large nn, a code of length nn and rate RR whose probability of decoding error is at most ϵ\epsilon for every transmitted codeword.
  2. Converse. If R>CR > C, there is a constant ϵ0(R)>0\epsilon_0(R) > 0 such that every code of rate RR, of any length, has average probability of decoding error at least ϵ0(R)\epsilon_0(R) when the codewords are used with equal probability.

The theorem is due to Shannon, whose argument for achievability chooses the codewords at random; a complete proof of both parts, by joint typicality and Fano's inequality, is in chapter 7 of Cover and Thomas. No proof is recorded here. The special case of the erasure channel, with linear codes, is proved in full in a separate record.

The theorem is an existence statement. It does not say how to find the codes, and the random codes in its proof have no efficient decoder.

Holds when
  • A discrete memoryless channel, that is, finite input and output alphabets and independent, identical action W(y∣x)W(y \mid x) on each transmitted symbol.
  • No feedback; the encoder and decoder may use arbitrarily long blocks and unlimited computation.
  • The converse stated here is the weak converse (error probability bounded away from zero).
EquationCapacity of the binary symmetric channelEstablished result
CBSC(p)  =  1−h(p),h(p)=−plog⁡2p−(1−p)log⁡2(1−p)C_{\mathrm{BSC}}(p) \;=\; 1 - h(p), \qquad h(p) = -p \log_2 p - (1-p) \log_2 (1-p)

For the binary symmetric channel, I(X;Y)=H(Y)−H(Y∣X)=H(Y)−h(p)I(X; Y) = H(Y) - H(Y \mid X) = H(Y) - h(p), because given XX the output is XX flipped with probability pp. The entropy H(Y)H(Y) is at most 1 bit, with equality for a uniform input, which gives the formula; by the noisy-channel coding theorem this maximum of the mutual information is the capacity. The value appears as an example in Shannon's paper.

The capacity is 1 at p=0p = 0, falls to 0 at p=1/2p = 1/2 and is symmetric under p↦1−pp \mapsto 1 - p. Numerically h(0.11)≈0.4999h(0.11) \approx 0.4999, so a channel that flips 11% of the bits still supports rates up to about one half.

Holds when
  • Memoryless binary symmetric channel with crossover probability 0≤p≤10 \le p \le 1; h(0)=h(1)=0h(0) = h(1) = 0.
  • Capacity in bits per channel use, in the sense of the noisy-channel coding theorem.

Worked Examples

Entropy and an optimal code

Let XX take values a,b,c,da, b, c, d with probabilities 12,14,18,18\tfrac12, \tfrac14, \tfrac18, \tfrac18. Then

H(X)=12⋅1+14⋅2+18⋅3+18⋅3=1.75 bits,H(X) = \tfrac12 \cdot 1 + \tfrac14 \cdot 2 + \tfrac18 \cdot 3 + \tfrac18 \cdot 3 = 1.75 \text{ bits},

less than the log⁡24=2\log_2 4 = 2 bits of a uniform variable on four values. The prefix-free code a↦0a \mapsto 0, b↦10b \mapsto 10, c↦110c \mapsto 110, d↦111d \mapsto 111 has expected length 12⋅1+14⋅2+14⋅3=1.75\tfrac12 \cdot 1 + \tfrac14 \cdot 2 + \tfrac14 \cdot 3 = 1.75 bits, meeting the lower bound of the source coding theorem exactly because every probability is a power of 12\tfrac12.

Mutual information through a binary symmetric channel

Send a uniformly random bit through BSC(p)\mathrm{BSC}(p) with p=0.11p = 0.11. The output is uniform, so H(Y)=1H(Y) = 1, and H(Y∣X)=h2(0.11)H(Y \mid X) = h_2(0.11). Numerically, h2(0.11)=−0.11log⁡20.11−0.89log⁡20.89≈0.3503+0.1496=0.4999h_2(0.11) = -0.11 \log_2 0.11 - 0.89 \log_2 0.89 \approx 0.3503 + 0.1496 = 0.4999, so

I(X;Y)=H(Y)−H(Y∣X)=1−h2(0.11)≈0.500 bits per use.I(X; Y) = H(Y) - H(Y \mid X) = 1 - h_2(0.11) \approx 0.500 \text{ bits per use}.

The uniform input is optimal for this channel, so this is its capacity: about two channel uses are needed per message bit, however good the code.

Pinsker on two coins

For p=(0.5,0.5)p = (0.5, 0.5) and q=(0.6,0.4)q = (0.6, 0.4), D(p∥q)=0.5log⁡2(5/6)+0.5log⁡2(5/4)≈0.02945D(p \Vert q) = 0.5\log_2(5/6) + 0.5\log_2(5/4) \approx 0.02945 bits, and ∥p−q∥1=0.2\norm{p - q}_1 = 0.2. Pinsker's inequality asserts D≥0.04/(2ln⁡2)≈0.02885D \ge 0.04/(2\ln 2) \approx 0.02885 bits, which holds and is nearly tight because the distributions are close. In the reverse direction, D(q∥p)≈0.0290D(q \Vert p) \approx 0.0290 bits, illustrating that relative entropy is not symmetric.

Conditioning can increase mutual information

Let XX and YY be independent uniform bits and Z=X⊕YZ = X \oplus Y. Then I(X;Y)=0I(X; Y) = 0, but given ZZ, YY determines XX, so I(X;Y∣Z)=H(X∣Z)−H(X∣YZ)=1−0=1I(X; Y \mid Z) = H(X \mid Z) - H(X \mid YZ) = 1 - 0 = 1 bit. Unlike entropy, mutual information is not monotone under conditioning in either direction; this example is the classical core of the one-time pad.

Applications

Limitations and Common Pitfalls

  • Units. Bits for log⁡2\log_2, nats for ln⁡\ln; exponential error bounds are often stated in nats while entropies are quoted in bits.
  • Relative entropy is not a distance. It is asymmetric, violates the triangle inequality and is infinite whenever the first distribution has weight outside the support of the second.
  • Asymptotic statements. The coding theorems describe limits of many independent uses. At finite block length, or for correlated sources, the relevant quantities are one-shot entropies and second-order corrections (one-shot theory).
  • The most likely sequence is usually not typical. For a coin with Pr⁡[1]=0.9\Pr[1] = 0.9, the all-ones string is the single most probable sequence of length nn, but for it −1nlog⁡2p(xn)=log⁡2(1/0.9)≈0.152-\frac{1}{n}\log_2 p(x^n) = \log_2(1/0.9) \approx 0.152, while H=h2(0.1)≈0.469H = h_2(0.1) \approx 0.469. For any δ<0.317\delta < 0.317 it lies outside the typical set, which consists of strings with about 0.9n0.9n ones, each individually less likely.
  • Classical intuitions that fail quantumly. H(X∣Y)≥0H(X \mid Y) \ge 0 and H(XY)≥H(X)H(XY) \ge H(X) always hold classically, but the quantum conditional entropy can be negative, and capacities of quantum channels need not be additive.
  • Entropy is a property of a distribution, not of a single string. The information content of one given string is the subject of algorithmic (Kolmogorov) complexity, a different theory.
Builds on

Open in the knowledge graph

Contributions about this record

Nobody has published a contribution about it yet.

Publish a result, reproduction or commentPropose a correction to this page

References

  1. C. E. Shannon (1948). A Mathematical Theory of Communication. Bell System Technical Journal 27 (3), 379-423. doi:10.1002/j.1538-7305.1948.tb01338.x
  2. Thomas M. Cover, Joy A. Thomas (2005). Elements of Information Theory. Wiley (2nd edition). doi:10.1002/047174882X
  3. S. Kullback, R. A. Leibler (1951). On Information and Sufficiency. The Annals of Mathematical Statistics 22, 79-86. doi:10.1214/aoms/1177729694
  4. Brockway McMillan (1953). The Basic Theorems of Information Theory. The Annals of Mathematical Statistics 24, 196-219. doi:10.1214/aoms/1177729028

Contributors

  • KetQat maintainers · @ketqatConceptualization; Supervision (CRediT roles)
  • Claude (AI drafting assistant)Writing, original draft (CRediT roles)

Review history

  1. Automated source check · Pass · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)

    Topic's own text checked: the 1.75-bit entropy and prefix code, BSC(0.11) mutual information (h_2(0.11) = 0.4999, capacity 0.5001), the Pinsker two-coin numbers (D = 0.02945, bound 0.02885, reverse 0.02905 bits), the XOR conditioning example, and the atypical most-likely sequence (0.152 vs 0.469, threshold 0.317) all recomputed; intuition and pitfalls consistent with Polyanskiy and Wu, Information Theory: From Coding to Learning (open PDF). Embedded records carry their own review states.

Revision history

  1. 2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e

Current revision a181c981aa6cf30a. Source file knowledge/records/topic/classical-information-theory.md in the content repository (readable there once it is public).