Channel Capacity

The information capacity of a discrete memoryless channel, worked examples, jointly typical sequences, Shannon's second theorem and its converse, Hamming codes, feedback, and source–channel separation

· 54 min read · 10,647 words

Motivation: what does it mean for A to communicate with B?

When we say that A communicates with B, we mean that the physical acts of A have induced a desired physical state in B. The operator’s keystroke must end up as the right letter on the receiver’s tape. This transfer is a physical process and is therefore subject to the uncontrollable ambient noise and imperfections of the signalling hardware itself. The communication is successful if the receiver and the transmitter agree on what was sent.

Everything we have built so far measured how much information a source produces. This chapter asks the dual question: given a fixed, noisy wire, how much can we push through it and still agree at the other end?

flowchart LR
  W["Message W"] --> E[Encoder]
  E --> Xn["X^n"]
  Xn --> CH["Channel p(y|x)"]
  CH --> Yn["Y^n"]
  Yn --> D[Decoder]
  D --> WH["W-hat: estimate of message"]

The core difficulty. Each possible input sequence induces a probability distribution on output sequences. Since two different input sequences may give rise to the same output sequence, the inputs are confusable — and a confused receiver cannot agree with the sender.

IntuitionThe plan in one sentence

We will show we can choose a “nonconfusable” subset of input sequences, so that with high probability there is only one highly likely input that could have caused any particular output. By mapping the source into appropriately “widely spaced” input sequences, we can transmit with very low probability of error. The maximum rate at which this can be done is the capacity.

In this chapter we find the maximum number of distinguishable signals for nn uses of a channel. This number grows exponentially with nn, and the exponent is the channel capacity. Characterizing that exponent as a maximum mutual information is the central and most famous success of information theory.

ImportantThe duality with compression

There is a duality between data compression and data transmission. During compression we remove all the redundancy in the data to reach the most compressed version possible; during transmission we add redundancy in a controlled fashion to combat channel errors. The at the end shows these two halves can be designed completely independently without losing anything.


The channel and its information capacity

DefinitionDiscrete channel

A discrete channel is a system consisting of an input alphabet X\mathcal{X}, an output alphabet Y\mathcal{Y}, and a probability transition matrix p(yx)p(y \mid x) expressing the probability of observing output symbol yy given that we send symbol xx.

The channel is memoryless if the probability distribution of the output depends only on the input at that time and is conditionally independent of previous channel inputs or outputs.

IntuitionThe physical anchor

p(yx)p(y \mid x) is exactly the noise profile of the copper wire we have been carrying since [[entropy-mutual-information#Conditional entropy H(YX)H(Y \mid X)|conditional entropy]]: “if E is keyed, what is the chance T prints?” Memorylessness says the wire has no thermal hangover — a burst of static on pulse 5 does not make pulse 6 more likely to fail. This is an assumption about the physics, and real wires with capacitance violate it.

DefinitionInformation channel capacity

The information channel capacity of a discrete memoryless channel is

C=maxp(x)I(X;Y)C = \max_{p(x)} I(X;Y)

where the maximum is taken over all possible input distributions p(x)p(x).

ComponentDetail
SignatureC:P(YX)[0,)C : \mathcal{P}(\mathcal{Y} \mid \mathcal{X}) \rightarrow [0, \infty) — it is a functional of the channel, i.e. of the transition matrix.
DomainThe noise profile p(yx)p(y \mid x) alone: the fixed physical property of the wire the telecom has installed.
What is maximized overp(x)p(x), the sender’s input distribution — the one thing an engineer controls. The wire is given; the language used on it is a design choice.
CodomainA single non-negative real: the bits per channel use that this wire can carry.

WarningTwo different meanings of the word “capacity”

The definition above is an optimization over distributions — pure mathematics, no codes in sight. Separately there is an operational capacity: the highest rate in bits per channel use at which information can actually be sent with arbitrarily low probability of error. These are a priori different quantities. Shannon’s second theorem establishes that they are equal, which is why we then drop the word “information” and just say capacity. Until is proved, keep them mentally separate.

IntuitionWhy maximize rather than just evaluate

I(X;Y)I(X;Y) depends on both the wire and the operator’s habits. A wire that could carry 1 bit per use carries almost nothing if the operator only ever presses one key (I=0I = 0 for a deterministic source). The capacity asks what the wire is worth when driven optimally, so it is a property of the hardware rather than of whoever happens to be sitting at it.


Examples of channel capacity

Working the examples before the general theory is worthwhile: each one isolates a different reason a wire can or cannot carry information, and the last two are the workhorses of the entire field.

Noiseless binary channel

flowchart LR
  X0["0"] --> Y0["0"]
  X1["1"] --> Y1["1"]

ExampleC=1C = 1 bit

The binary input is reproduced exactly at the output. Any transmitted bit is received without error, so one error-free bit can be transmitted per channel use, and the capacity is 1 bit. The formula agrees: C=maxI(X;Y)=1C = \max I(X;Y) = 1 bit, achieved by p(x)=(12,12)p(x) = (\tfrac{1}{2}, \tfrac{1}{2}).

Noisy channel with nonoverlapping outputs

flowchart LR
  X0["0"] -->|1/2| A["1"]
  X0 -->|1/2| B["2"]
  X1["1"] -->|1/3| C["3"]
  X1 -->|2/3| D["4"]

ExampleC=1C = 1 bit — the channel appears noisy but really is not

Each input has two possible outputs, so the output is a random consequence of the input. But the two output sets {1,2}\{1,2\} and {3,4}\{3,4\} are disjoint, so the input can be determined from the output and every transmitted bit is recovered without error. Capacity is again 1 bit, achieved by p(x)=(12,12)p(x) = (\tfrac{1}{2}, \tfrac{1}{2}).

IntuitionRandomness is not the enemy — overlap is

This example is the cleanest possible separation of two ideas people conflate. The channel injects genuine randomness (H(YX)>0H(Y \mid X) > 0), yet loses zero information, because the randomness never creates ambiguity about the input. What destroys information is not noise per se but confusability: two inputs that can produce the same output.

Noisy typewriter

ExampleC=log13C = \log 13 bits

The input is either received unchanged with probability 12\tfrac{1}{2}, or transformed into the next letter with probability 12\tfrac{1}{2}. With 26 input symbols, the outputs of A and B overlap (both can print B), so the full alphabet is confusable.

The trick: use only every alternate input symbol — {A,C,E,,Y}\{A, C, E, \ldots, Y\}, 13 of them. Now no two used inputs can produce the same output, and we transmit one of 13 symbols with zero error per use. Hence C=log13C = \log 13 bits per transmission.

Confirming with the formula, using that H(YX)=1H(Y \mid X) = 1 bit for every input (each input has two equally likely outputs):

C=max(H(Y)H(YX))=maxH(Y)1=log261=log13C = \max\big(H(Y) - H(Y \mid X)\big) = \max H(Y) - 1 = \log 26 - 1 = \log 13

achieved by p(x)p(x) uniform over all the inputs.

RemarkTwo different optima, one capacity

Note the mild paradox: the zero-error scheme uses 13 inputs, while the distribution achieving the information capacity is uniform over all 26. Both give log13\log 13. This channel is the mental picture to keep for the whole chapter — argues that for large block lengths every channel looks like the noisy typewriter, with a nonconfusable subset of inputs hiding inside a confusable alphabet.

Binary symmetric channel

flowchart LR
  X0["0"] -->|1 - p| Y0["0"]
  X0 -->|p| Y1["1"]
  X1["1"] -->|p| Y0
  X1 -->|1 - p| Y1

The BSC complements the input symbol with probability pp. This is the simplest model of a channel with errors, yet it captures most of the complexity of the general problem.

WarningWhy the BSC is qualitatively harder than everything above

When an error occurs, a 00 is received as a 11 and vice versa — and the bits received do not reveal where the errors occurred. In a sense every received bit is unreliable. Unlike the noisy typewriter there is no nonconfusable subset to retreat to: every input can produce every output. That we can still send at a nonzero rate with arbitrarily small error is the counterintuitive content of Shannon’s theorem.

DerivationCapacity of the BSC

Step 1: Expand mutual information from the receiver’s side.

I(X;Y)=H(Y)H(YX)=H(Y)xp(x)H(YX=x)I(X;Y) = H(Y) - H(Y \mid X) = H(Y) - \sum_x p(x) H(Y \mid X = x)

Step 2: The inner conditional entropy is the same for every input. Given X=xX = x, the output is xx with probability 1p1-p and xˉ\bar{x} with probability pp — a binary distribution with entropy H(p)H(p), regardless of which xx was sent. This is the “symmetric” in binary symmetric channel:

=H(Y)xp(x)H(p)=H(Y)H(p)= H(Y) - \sum_x p(x) H(p) = H(Y) - H(p)

Note H(p)H(p) is now a constant the input distribution cannot influence — the noise term is untouchable, so maximizing II reduces to maximizing H(Y)H(Y).

Step 3: Bound H(Y)H(Y) by the maximum entropy bound. YY is a binary random variable, so H(Y)1H(Y) \le 1:

I(X;Y)1H(p)I(X;Y) \le 1 - H(p)

Step 4: Check achievability. Equality needs H(Y)=1H(Y) = 1, i.e. YY uniform, which a uniform input distribution delivers (by symmetry of the channel).

FormulaBSC capacity

C=1H(p) bitsC = 1 - H(p) \text{ bits}

IntuitionReading the formula

You start with 1 bit per use and the wire taxes you exactly H(p)H(p) bits — the entropy of the coin flip that decides whether each bit is flipped. At p=12p = \tfrac{1}{2}, H(p)=1H(p) = 1 and C=0C = 0: the output is independent of the input and the wire is dead. At p=1p = 1 the capacity is back to 1 bit, because a wire that always lies is as good as one that always tells the truth.

Binary erasure channel

flowchart LR
  X0["0"] -->|1 - alpha| Y0["0"]
  X0 -->|alpha| YE["e"]
  X1["1"] -->|alpha| YE
  X1 -->|1 - alpha| Y1["1"]

The analogue of the BSC in which bits are lost rather than corrupted: a fraction α\alpha of the bits are erased, and crucially the receiver knows which bits have been erased. Two inputs, three outputs.

DerivationCapacity of the BEC

Step 1: Set up. As before, C=maxp(x)(H(Y)H(YX))C = \max_{p(x)}\big(H(Y) - H(Y \mid X)\big), and given any input the output is “that input” w.p. 1α1-\alpha or “erasure” w.p. α\alpha, so H(YX)=H(α)H(Y \mid X) = H(\alpha) and

C=maxp(x)H(Y)H(α)C = \max_{p(x)} H(Y) - H(\alpha)

Step 2: Intuition check — the naive guess fails. The first guess for maxH(Y)\max H(Y) would be log3\log 3, since YY has three values. But no choice of input distribution achieves it: the erasure probability α\alpha is imposed by the wire, so Pr(Y=e)=α\Pr(Y = e) = \alpha is fixed and cannot be tuned to 13\tfrac13. The maximum-entropy bound is not tight here, and we must compute H(Y)H(Y) honestly.

Step 3: Decompose H(Y)H(Y) using the erasure indicator. Let E=1{Y=e}E = \mathbb{1}\{Y = e\}. Since EE is a function of YY, appending it is free: H(Y)=H(Y,E)H(Y) = H(Y, E). Now chain-rule the other way:

H(Y)=H(Y,E)=H(E)+H(YE)H(Y) = H(Y, E) = H(E) + H(Y \mid E)

Step 4: Evaluate both terms. Let Pr(X=1)=π\Pr(X = 1) = \pi. Then H(E)=H(α)H(E) = H(\alpha). For H(YE)H(Y \mid E): given E=1E = 1 there is no uncertainty (Y=eY = e, contributing 0); given E=0E = 0 the output equals the input, contributing H(π)H(\pi), and this case has weight 1α1 - \alpha. So

H(Y)=H((1π)(1α),α,π(1α))=H(α)+(1α)H(π)H(Y) = H\big((1-\pi)(1-\alpha),\, \alpha,\, \pi(1-\alpha)\big) = H(\alpha) + (1-\alpha)H(\pi)

Step 5: Maximize and cancel.

C=maxπ[(1α)H(π)+H(α)]H(α)=maxπ(1α)H(π)=1αC = \max_\pi \big[ (1-\alpha)H(\pi) + H(\alpha) \big] - H(\alpha) = \max_\pi (1-\alpha)H(\pi) = 1 - \alpha

achieved at π=12\pi = \tfrac{1}{2}.

FormulaBEC capacity

C=1αC = 1 - \alpha

IntuitionWhy this answer is the obvious one

A proportion α\alpha of the bits are lost outright, so we can recover at most a proportion 1α1 - \alpha of them, and the capacity is at most 1α1 - \alpha. What is not immediately obvious is that this rate is achievable — that follows from Shannon’s second theorem.

ExampleFeedback makes the BEC trivial

If the receiver can talk back, it is very clear what to do: if a bit is lost, retransmit it until it gets through. Bits get through with probability 1α1 - \alpha, so the effective rate is 1α1 - \alpha — we hit capacity with a scheme a child could design.

Later we prove 1α1 - \alpha is the best achievable both with and without feedback. This previews the surprising result that feedback does not increase the capacity of a discrete memoryless channel: here it bought us enormous simplicity, not extra rate.


Symmetric channels

The problem. The examples above were each solved by an ad hoc argument. Is there a structural condition under which the capacity has a closed form? There is, and it generalizes exactly what made the BSC easy.

Consider the channel

p(yx)=[0.30.20.50.50.30.20.20.50.3]p(y \mid x) = \begin{bmatrix} 0.3 & 0.2 & 0.5 \\ 0.5 & 0.3 & 0.2 \\ 0.2 & 0.5 & 0.3 \end{bmatrix}

where the entry in row xx, column yy is p(yx)p(y \mid x). All the rows are permutations of each other, and so are the columns.

DefinitionSymmetric and weakly symmetric channels

  • A channel is symmetric if the rows of p(yx)p(y \mid x) are permutations of each other and the columns are permutations of each other.
  • A channel is weakly symmetric if every row is a permutation of every other row, and all the column sums xp(yx)\sum_x p(y \mid x) are equal.

ExampleAnother symmetric channel

Y=X+Z(modc)Y = X + Z \pmod{c}, where ZZ has some distribution on {0,1,,c1}\{0, 1, \ldots, c-1\}, XX has the same alphabet as ZZ, and ZZ is independent of XX. Every row is the distribution of ZZ, cyclically shifted.

ExampleWeakly symmetric but not symmetric

p(yx)=[131612131216]p(y \mid x) = \begin{bmatrix} \tfrac{1}{3} & \tfrac{1}{6} & \tfrac{1}{2} \\[2pt] \tfrac{1}{3} & \tfrac{1}{2} & \tfrac{1}{6} \end{bmatrix} The two rows are permutations of each other and every column sums to 23\tfrac{2}{3}, but the columns are not permutations of one another.

TheoremCapacity of a weakly symmetric channel

C=logYH(row of transition matrix)C = \log \lvert \mathcal{Y} \rvert - H(\text{row of transition matrix})

achieved by a uniform distribution on the input alphabet.

ProofThe two symmetry conditions do two separate jobs

Step 1: The rows being permutations kills the noise term’s dependence on p(x)p(x). Letting rr denote a row of the transition matrix, every row has the same entropy H(r)H(r), so

I(X;Y)=H(Y)H(YX)=H(Y)H(r)I(X;Y) = H(Y) - H(Y \mid X) = H(Y) - H(r)

Step 2: Bound the remaining term. By the maximum entropy bound,

I(X;Y)logYH(r)I(X;Y) \le \log \lvert \mathcal{Y} \rvert - H(r)

with equality iff the output distribution is uniform.

Step 3: The equal column sums make the uniform input produce a uniform output. Take p(x)=1/Xp(x) = 1/\lvert \mathcal{X} \rvert. Then

p(y)=xXp(yx)p(x)=1Xxp(yx)=cX=1Yp(y) = \sum_{x \in \mathcal{X}} p(y \mid x) p(x) = \frac{1}{\lvert \mathcal{X} \rvert} \sum_x p(y \mid x) = \frac{c}{\lvert \mathcal{X} \rvert} = \frac{1}{\lvert \mathcal{Y} \rvert}

where cc is the (common) column sum. So the bound in Step 2 is attained.

IntuitionWhat each condition buys

Rows permutations \Rightarrow the noise cost H(YX)H(Y \mid X) is a constant the sender cannot influence, so the problem collapses to maximizing H(Y)H(Y). Equal column sums \Rightarrow the easiest possible input (uniform) already maximizes H(Y)H(Y). Weak symmetry keeps exactly these two properties and discards the rest, which is why the theorem is stated for it rather than for full symmetry.

ExampleThe 3×33 \times 3 channel above

C=log3H(0.5,0.3,0.2)C = \log 3 - H(0.5, 0.3, 0.2) achieved by a uniform input distribution.

RemarkConnection to the second law

The transition matrix of a symmetric channel is doubly stochastic — the same condition that, in the second law discussion, characterized exactly when the uniform distribution is stationary and entropy genuinely increases. Both places, it is the statement “this dynamics has no preferred direction among the symbols.”


Properties of channel capacity

#PropertyReason
1C0C \ge 0Since I(X;Y)0I(X;Y) \ge 0 (a [[information-inequalities#Consequences of Jensen’s inequality
2ClogXC \le \log \lvert \mathcal{X} \rvertC=maxI(X;Y)maxH(X)=logXC = \max I(X;Y) \le \max H(X) = \log \lvert \mathcal{X} \rvert.
3ClogYC \le \log \lvert \mathcal{Y} \rvertSame reason, from the other side.
4I(X;Y)I(X;Y) is a continuous function of p(x)p(x)
5I(X;Y)I(X;Y) is a concave function of p(x)p(x)Follows from the concavity results built on the [[information-inequalities#The log sum inequality

ImportantWhy concavity matters practically

I(X;Y)I(X;Y) is concave over a closed convex set (the simplex of input distributions), so a local maximum is a global maximum — no risk of an optimizer getting trapped. Properties 2 and 3 make the maximum finite, which justifies writing maximum rather than supremum in the definition. Together these mean the capacity can be found by standard nonlinear optimization: constrained maximization via Kuhn–Tucker conditions, the Frank–Wolfe gradient search, or the iterative Arimoto–Blahut algorithm.

WarningNo closed form in general

For a general channel there is no closed-form solution for the capacity. The channels for which we can write one down — the symmetric and weakly symmetric families above — are special, and we lean on them precisely because they are the tractable cases.


Preview of the channel coding theorem

Before the formal proof, here is why CC bits per use ought to be transmissible. The basic idea: for large block lengths, every channel looks like the noisy typewriter, with a subset of inputs producing essentially disjoint output sets.

IntuitionThe counting argument

Fix a typical input nn-sequence. The channel scatters it over approximately 2nH(YX)2^{nH(Y \mid X)} possible YY sequences, all roughly equally likely — this is the “blur” the wire applies to one codeword. Meanwhile the total number of typical YY sequences is about 2nH(Y)2^{nH(Y)}.

We want no two XX sequences to produce the same YY output, or we cannot decide which was sent. So we must pack disjoint blurs of size 2nH(YX)2^{nH(Y \mid X)} into a space of size 2nH(Y)2^{nH(Y)}, and the number of disjoint sets is at most

2nH(Y)2nH(YX)=2n(H(Y)H(YX))=2nI(X;Y)\frac{2^{nH(Y)}}{2^{nH(Y \mid X)}} = 2^{n(H(Y) - H(Y \mid X))} = 2^{nI(X;Y)}

Hence we can send at most about 2nI(X;Y)2^{nI(X;Y)} distinguishable sequences of length nn.

NoteWhat this argument does and does not establish

This is a sphere-packing upper bound — it shows you cannot do better. A stronger version of the same idea is what the next sections turn into a proof that the rate II is actually achievable with arbitrarily low error. Upper bound first, achievability after.


Definitions

Before the theorem we need the vocabulary precise. Everything here is bookkeeping, but the converse proof leans on the exact definitions.

DefinitionDiscrete channel (formal)

A discrete channel, denoted (X,p(yx),Y)(\mathcal{X}, p(y \mid x), \mathcal{Y}), consists of two finite sets X\mathcal{X} and Y\mathcal{Y} and a collection of pmfs p(yx)p(y \mid x), one for each xXx \in \mathcal{X}, with p(yx)0p(y \mid x) \ge 0 and yp(yx)=1\sum_y p(y \mid x) = 1 for every xx.

Definitionnnth extension of a DMC

The nnth extension is the channel (Xn,p(ynxn),Yn)(\mathcal{X}^n, p(y^n \mid x^n), \mathcal{Y}^n) where

p(ykxk,yk1)=p(ykxk),k=1,2,,np(y_k \mid x^k, y^{k-1}) = p(y_k \mid x_k), \qquad k = 1, 2, \ldots, n

RemarkWithout feedback, the extension factorizes

If the channel is used without feedback — i.e. the input symbols do not depend on past outputs, p(xkxk1,yk1)=p(xkxk1)p(x_k \mid x^{k-1}, y^{k-1}) = p(x_k \mid x^{k-1}) — the transition function reduces to a clean product:

p(ynxn)=i=1np(yixi)p(y^n \mid x^n) = \prod_{i=1}^n p(y_i \mid x_i)

“Discrete memoryless channel” means without feedback unless stated otherwise. The distinction matters: the proof fails at exactly the point where this factorization is used.

Definition(M,n)(M, n) code

An (M,n)(M, n) code for the channel (X,p(yx),Y)(\mathcal{X}, p(y \mid x), \mathcal{Y}) consists of:

  1. An index set {1,2,,M}\{1, 2, \ldots, M\}.
  2. An encoding function Xn:{1,,M}XnX^n : \{1, \ldots, M\} \rightarrow \mathcal{X}^n, yielding codewords xn(1),,xn(M)x^n(1), \ldots, x^n(M). The set of codewords is the codebook.
  3. A decoding function g:Yn{1,,M}g : \mathcal{Y}^n \rightarrow \{1, \ldots, M\}, a deterministic rule assigning a guess to each possible received vector.

DefinitionThe three error probabilities

  • Conditional probability of error given index ii was sent: λi=Pr(g(Yn)iXn=xn(i))=ynp(ynxn(i))1(g(yn)i)\lambda_i = \Pr\big(g(Y^n) \ne i \mid X^n = x^n(i)\big) = \sum_{y^n} p(y^n \mid x^n(i))\, \mathbb{1}\big(g(y^n) \ne i\big)
  • Maximal probability of error: λ(n)=maxi{1,,M}λi\lambda^{(n)} = \max_{i \in \{1, \ldots, M\}} \lambda_i
  • Arithmetic average probability of error: Pe(n)=1Mi=1MλiP_e^{(n)} = \frac{1}{M} \sum_{i=1}^M \lambda_i

NoteRelations between them, and a subtlety

If WW is chosen uniformly over {1,,M}\{1, \ldots, M\} and Xn=xn(W)X^n = x^n(W), then Pe(n)=Pr(Wg(Yn))P_e^{(n)} = \Pr(W \ne g(Y^n)), and obviously Pe(n)λ(n)P_e^{(n)} \le \lambda^{(n)}.

Pe(n)P_e^{(n)} is only a mathematical construct of the λi\lambda_i and is a genuine probability of error only when the message is uniform. Both the achievability and converse proofs choose a uniform WW to bound the error — this lets us establish the behaviour of λ(n)\lambda^{(n)} too, and thereby characterize the channel regardless of how it is actually used.

One would expect the maximal and average probabilities to behave very differently, but we prove below that a small average error implies a small maximal error at essentially the same rate.

DefinitionRate, achievability, and operational capacity

  • The rate of an (M,n)(M, n) code is R=logMnR = \frac{\log M}{n} bits per transmission.
  • A rate RR is achievable if there exists a sequence of (2nR,n)(\lceil 2^{nR} \rceil, n) codes such that the maximal probability of error λ(n)0\lambda^{(n)} \rightarrow 0 as nn \rightarrow \infty.
  • The capacity of a channel is the supremum of all achievable rates.

(We write (2nR,n)(2^{nR}, n) for (2nR,n)(\lceil 2^{nR}\rceil, n) throughout.)

IntuitionWhat the definition of achievable is really demanding

Not “error is small for some nn” but “error can be driven to zero while the rate is held fixed at RR.” Sending more slowly as nn grows is not allowed. Rates below capacity yield arbitrarily small error probability for sufficiently large block lengths.


Jointly typical sequences

The problem. The decoder must decide which codeword caused the received YnY^n. Maximum likelihood is optimal but hard to analyze. Instead we will decode by asking whether a codeword and the output “look like they came from the joint distribution” — which requires a joint version of the typical set.

DefinitionJointly typical set

The set Aϵ(n)A_\epsilon^{(n)} of jointly typical sequences {(xn,yn)}\{(x^n, y^n)\} with respect to p(x,y)p(x,y) is the set of nn-sequences with empirical entropies ϵ\epsilon-close to the true entropies:

Aϵ(n)={(xn,yn)Xn×Yn:A_\epsilon^{(n)} = \left\{ (x^n, y^n) \in \mathcal{X}^n \times \mathcal{Y}^n : \right. 1nlogp(xn)H(X)<ϵ,\left\lvert -\tfrac{1}{n} \log p(x^n) - H(X) \right\rvert < \epsilon, 1nlogp(yn)H(Y)<ϵ,\left\lvert -\tfrac{1}{n} \log p(y^n) - H(Y) \right\rvert < \epsilon, 1nlogp(xn,yn)H(X,Y)<ϵ}\left. \left\lvert -\tfrac{1}{n} \log p(x^n, y^n) - H(X,Y) \right\rvert < \epsilon \right\}

where p(xn,yn)=i=1np(xi,yi)p(x^n, y^n) = \prod_{i=1}^n p(x_i, y_i).

IntuitionWhy all three conditions are needed

The first two say each sequence is individually typical — plausible as a tape from its own source. The third is the one that does the work: it says the pair is typical, i.e. the two tapes are typical of each other. Dropping it would let an arbitrary pairing of two perfectly ordinary tapes count as jointly typical, and the decoder would have no discriminating power at all.

TheoremJoint AEP

Let (Xn,Yn)(X^n, Y^n) be sequences of length nn drawn i.i.d. according to p(xn,yn)=i=1np(xi,yi)p(x^n, y^n) = \prod_{i=1}^n p(x_i, y_i). Then:

  1. Pr((Xn,Yn)Aϵ(n))1\Pr\big((X^n, Y^n) \in A_\epsilon^{(n)}\big) \rightarrow 1 as nn \rightarrow \infty.
  2. Aϵ(n)2n(H(X,Y)+ϵ)\big\lvert A_\epsilon^{(n)} \big\rvert \le 2^{n(H(X,Y) + \epsilon)}.
  3. If (X~n,Y~n)p(xn)p(yn)(\tilde{X}^n, \tilde{Y}^n) \sim p(x^n)p(y^n) — independent, with the same marginals — then Pr((X~n,Y~n)Aϵ(n))2n(I(X;Y)3ϵ)\Pr\big((\tilde{X}^n, \tilde{Y}^n) \in A_\epsilon^{(n)}\big) \le 2^{-n(I(X;Y) - 3\epsilon)} and, for sufficiently large nn, Pr((X~n,Y~n)Aϵ(n))(1ϵ)2n(I(X;Y)+3ϵ)\Pr\big((\tilde{X}^n, \tilde{Y}^n) \in A_\epsilon^{(n)}\big) \ge (1-\epsilon)\, 2^{-n(I(X;Y) + 3\epsilon)}

ImportantProperty 3 is the whole proof of the coding theorem in one line

Read it as: a codeword unrelated to the received sequence looks jointly typical with it only with probability about 2nI2^{-nI}. So we can afford about 2nI2^{nI} rival codewords before one of them fools us. Everything in is a union bound over that number.

ProofPart 1 — three applications of the weak law

Step 1: Each marginal concentrates. By the weak law of large numbers, 1nlogp(Xn)E[logp(X)]=H(X)-\frac{1}{n} \log p(X^n) \rightarrow -\mathbb{E}[\log p(X)] = H(X) in probability. So given ϵ>0\epsilon > 0 there exists n1n_1 such that for all n>n1n > n_1,

Pr{1nlogp(Xn)H(X)ϵ}<ϵ3\Pr\left\{ \left\lvert -\tfrac{1}{n} \log p(X^n) - H(X) \right\rvert \ge \epsilon \right\} < \frac{\epsilon}{3}

Step 2: Repeat for YY and for the pair. Identically, 1nlogp(Yn)H(Y)-\frac{1}{n}\log p(Y^n) \rightarrow H(Y) and 1nlogp(Xn,Yn)H(X,Y)-\frac{1}{n}\log p(X^n, Y^n) \rightarrow H(X,Y) in probability, giving n2n_2 and n3n_3 with each failure probability below ϵ/3\epsilon/3.

Step 3: Union bound. Choosing n>max{n1,n2,n3}n > \max\{n_1, n_2, n_3\}, the probability of the union of the three bad events is less than 3ϵ/3=ϵ3 \cdot \epsilon/3 = \epsilon. Hence Pr(Aϵ(n))>1ϵ\Pr(A_\epsilon^{(n)}) > 1 - \epsilon. This is why each budget was set to ϵ/3\epsilon/3 — so the three failures sum to exactly ϵ\epsilon.

ProofPart 2 — total probability bounds the count

Identical in shape to the size bound in the single-variable AEP:

1=xn,ynp(xn,yn)Aϵ(n)p(xn,yn)Aϵ(n)2n(H(X,Y)+ϵ)1 = \sum_{x^n, y^n} p(x^n, y^n) \ge \sum_{A_\epsilon^{(n)}} p(x^n, y^n) \ge \big\lvert A_\epsilon^{(n)} \big\rvert\, 2^{-n(H(X,Y) + \epsilon)}

since each jointly typical pair has probability at least 2n(H(X,Y)+ϵ)2^{-n(H(X,Y)+\epsilon)}. Rearranging gives Aϵ(n)2n(H(X,Y)+ϵ)\lvert A_\epsilon^{(n)} \rvert \le 2^{n(H(X,Y) + \epsilon)}.

ProofPart 3 — count the pairs, then price each one under independence

Upper bound. If X~n\tilde{X}^n and Y~n\tilde{Y}^n are independent with the same marginals, then

Pr((X~n,Y~n)Aϵ(n))=(xn,yn)Aϵ(n)p(xn)p(yn)\Pr\big((\tilde{X}^n, \tilde{Y}^n) \in A_\epsilon^{(n)}\big) = \sum_{(x^n, y^n) \in A_\epsilon^{(n)}} p(x^n) p(y^n)

There are at most 2n(H(X,Y)+ϵ)2^{n(H(X,Y) + \epsilon)} terms (part 2), and each term is at most 2n(H(X)ϵ)2n(H(Y)ϵ)2^{-n(H(X) - \epsilon)} \cdot 2^{-n(H(Y) - \epsilon)} by joint typicality:

2n(H(X,Y)+ϵ)2n(H(X)ϵ)2n(H(Y)ϵ)=2n(I(X;Y)3ϵ)\le 2^{n(H(X,Y) + \epsilon)}\, 2^{-n(H(X) - \epsilon)}\, 2^{-n(H(Y) - \epsilon)} = 2^{-n(I(X;Y) - 3\epsilon)}

using I(X;Y)=H(X)+H(Y)H(X,Y)I(X;Y) = H(X) + H(Y) - H(X,Y) and collecting the three ϵ\epsilon‘s — which is where the 3ϵ3\epsilon comes from.

Lower bound. For nn large, Pr(Aϵ(n))1ϵ\Pr(A_\epsilon^{(n)}) \ge 1 - \epsilon, so

1ϵAϵ(n)p(xn,yn)Aϵ(n)2n(H(X,Y)ϵ)1 - \epsilon \le \sum_{A_\epsilon^{(n)}} p(x^n, y^n) \le \big\lvert A_\epsilon^{(n)} \big\rvert\, 2^{-n(H(X,Y) - \epsilon)}

giving Aϵ(n)(1ϵ)2n(H(X,Y)ϵ)\lvert A_\epsilon^{(n)} \rvert \ge (1-\epsilon) 2^{n(H(X,Y) - \epsilon)}. Feeding this count through the same product bound in the other direction:

Pr((X~n,Y~n)Aϵ(n))(1ϵ)2n(H(X,Y)ϵ)2n(H(X)+ϵ)2n(H(Y)+ϵ)=(1ϵ)2n(I(X;Y)+3ϵ)\Pr\big((\tilde{X}^n, \tilde{Y}^n) \in A_\epsilon^{(n)}\big) \ge (1-\epsilon) 2^{n(H(X,Y) - \epsilon)} 2^{-n(H(X) + \epsilon)} 2^{-n(H(Y) + \epsilon)} = (1-\epsilon) 2^{-n(I(X;Y) + 3\epsilon)}

IntuitionThe picture

There are about 2nH(X)2^{nH(X)} typical XX sequences and about 2nH(Y)2^{nH(Y)} typical YY sequences — so 2n(H(X)+H(Y))2^{n(H(X)+H(Y))} possible pairings. But only 2nH(X,Y)2^{nH(X,Y)} pairs are jointly typical, so not all pairs of typical sequences are jointly typical. A randomly chosen pair is jointly typical with probability about 2nI(X;Y)2^{-nI(X;Y)}, so you can consider about 2nI(X;Y)2^{nI(X;Y)} pairs before stumbling on one — suggesting about 2nI(X;Y)2^{nI(X;Y)} distinguishable signals.

Equivalently, from the decoder’s seat: for a fixed received YnY^n there are about 2nH(XY)2^{nH(X \mid Y)} conditionally typical inputs, out of 2nH(X)2^{nH(X)} typical inputs overall, so a random rival codeword lands in that set with probability 2nH(XY)/2nH(X)=2nI(X;Y)2^{nH(X \mid Y)}/2^{nH(X)} = 2^{-nI(X;Y)}.


Channel coding theorem

ImportantWhy the result is counterintuitive

If the channel introduces errors, how can one correct them all? Any correction process is itself subject to error, ad infinitum. Shannon broke this apparent regress with three ideas:

  • Allow an arbitrarily small but nonzero probability of error.
  • Use the channel many times in succession, so the law of large numbers comes into effect.
  • Average the probability of error over a random choice of codebooks, which symmetrizes the problem and shows the existence of at least one good code.

TheoremChannel coding theorem (Shannon’s second theorem)

For a discrete memoryless channel, all rates below capacity CC are achievable. Specifically, for every rate R<CR < C there exists a sequence of (2nR,n)(2^{nR}, n) codes with maximum probability of error λ(n)0\lambda^{(n)} \rightarrow 0.

Conversely, any sequence of (2nR,n)(2^{nR}, n) codes with λ(n)0\lambda^{(n)} \rightarrow 0 must have RCR \le C.

NoteDecoding rule used in the proof

We decode by joint typicality: look for a codeword jointly typical with the received sequence, and if it is unique, declare it. This is suboptimal (maximum likelihood is optimal) but it is simple to analyze and still achieves all rates below capacity.

ProofAchievability — random coding, union bound, then three code surgeries

Setup: generate a random codebook. Fix p(x)p(x). Generate 2nR2^{nR} codewords independently according to p(xn)=i=1np(xi)p(x^n) = \prod_{i=1}^n p(x_i), and display them as the rows of a matrix

C=[x1(1)xn(1)x1(2nR)xn(2nR)]\mathcal{C} = \begin{bmatrix} x_1(1) & \cdots & x_n(1) \\ \vdots & & \vdots \\ x_1(2^{nR}) & \cdots & x_n(2^{nR}) \end{bmatrix}

Every entry is i.i.d. p(x)\sim p(x), so Pr(C)=w=12nRi=1np(xi(w))\Pr(\mathcal{C}) = \prod_{w=1}^{2^{nR}} \prod_{i=1}^n p(x_i(w)).

The protocol.

  1. A random code C\mathcal{C} is generated as above.
  2. C\mathcal{C} is revealed to both sender and receiver, who also know p(yx)p(y \mid x).
  3. A message WW is chosen uniformly: Pr(W=w)=2nR\Pr(W = w) = 2^{-nR}.
  4. The wwth codeword Xn(w)X^n(w) is sent.
  5. The receiver receives Ynip(yixi(w))Y^n \sim \prod_i p(y_i \mid x_i(w)).
  6. The receiver declares W^\hat{W} if (Xn(W^),Yn)(X^n(\hat{W}), Y^n) is jointly typical and there is no other index WW^W' \ne \hat{W} with (Xn(W),Yn)Aϵ(n)(X^n(W'), Y^n) \in A_\epsilon^{(n)}. If no such W^\hat{W} exists, or more than one does, an error is declared.
  7. Error event E={W^W}\mathcal{E} = \{\hat{W} \ne W\}.

Step 1: Average over codebooks, and exploit symmetry. Rather than analyze one code, compute

Pr(E)=CPr(C)Pe(n)(C)=12nRw=12nRCPr(C)λw(C)\Pr(\mathcal{E}) = \sum_\mathcal{C} \Pr(\mathcal{C}) P_e^{(n)}(\mathcal{C}) = \frac{1}{2^{nR}}\sum_{w=1}^{2^{nR}} \sum_\mathcal{C} \Pr(\mathcal{C}) \lambda_w(\mathcal{C})

By the symmetry of the code construction, CPr(C)λw(C)\sum_\mathcal{C} \Pr(\mathcal{C})\lambda_w(\mathcal{C}) does not depend on ww — every codeword was generated the same way. So we may assume without loss of generality that W=1W = 1 was sent:

Pr(E)=Pr(EW=1)\Pr(\mathcal{E}) = \Pr(\mathcal{E} \mid W = 1)

This is the single biggest simplification in the proof, and it is bought entirely by randomizing the codebook.

Step 2: Name the two ways to fail. Define Ei={(Xn(i),Yn)Aϵ(n)}E_i = \{(X^n(i), Y^n) \in A_\epsilon^{(n)}\} for i{1,,2nR}i \in \{1, \ldots, 2^{nR}\}. With W=1W = 1 sent, an error occurs if either:

  • E1cE_1^c — the true codeword is not jointly typical with the output, or
  • E2E3E2nRE_2 \cup E_3 \cup \cdots \cup E_{2^{nR}} — some wrong codeword is.

By the union bound,

Pr(EW=1)P(E1cW=1)+i=22nRP(EiW=1)\Pr(\mathcal{E} \mid W=1) \le P(E_1^c \mid W=1) + \sum_{i=2}^{2^{nR}} P(E_i \mid W=1)

Step 3: Bound the first source of error. By joint AEP part 1, P(E1cW=1)0P(E_1^c \mid W = 1) \rightarrow 0, so P(E1cW=1)ϵP(E_1^c \mid W=1) \le \epsilon for nn sufficiently large.

Step 4: Bound each rival. By the code generation process, Xn(1)X^n(1) and Xn(i)X^n(i) are independent for i1i \ne 1; hence so are YnY^n and Xn(i)X^n(i) (since YnY^n depends only on Xn(1)X^n(1)). So joint AEP part 3 applies exactly: P(EiW=1)2n(I(X;Y)3ϵ)P(E_i \mid W = 1) \le 2^{-n(I(X;Y) - 3\epsilon)}.

Step 5: Assemble.

Pr(E)ϵ+i=22nR2n(I(X;Y)3ϵ)=ϵ+(2nR1)2n(I(X;Y)3ϵ)\Pr(\mathcal{E}) \le \epsilon + \sum_{i=2}^{2^{nR}} 2^{-n(I(X;Y) - 3\epsilon)} = \epsilon + \big(2^{nR} - 1\big) 2^{-n(I(X;Y) - 3\epsilon)}

ϵ+23nϵ2n(I(X;Y)R)    2ϵ\le \epsilon + 2^{3n\epsilon}\, 2^{-n(I(X;Y) - R)} \;\le\; 2\epsilon

if nn is sufficiently large and R<I(X;Y)3ϵR < I(X;Y) - 3\epsilon. Read the exponent: the number of rivals grows like 2nR2^{nR} and each is fooled with probability 2nI2^{-nI}, so the product vanishes precisely when R<IR < I.

Step 6: Three surgeries to upgrade the conclusion.

  1. Optimize the input distribution. Choose p(x)=p(x)p(x) = p^*(x), the distribution achieving capacity. Then the condition R<I(X;Y)R < I(X;Y) becomes R<CR < C.
  2. Remove the average over codebooks. Since the average error over codebooks is 2ϵ\le 2\epsilon, at least one codebook C\mathcal{C}^* has Pr(EC)2ϵ\Pr(\mathcal{E} \mid \mathcal{C}^*) \le 2\epsilon. (An exhaustive search over all (2nR,n)(2^{nR}, n) codes would find it.) This is the classic probabilistic-existence move: we never construct a good code, we prove the average is good and conclude one must be.
  3. Convert average error into maximal error. The arithmetic average 12nRiλi(C)2ϵ\frac{1}{2^{nR}}\sum_i \lambda_i(\mathcal{C}^*) \le 2\epsilon implies at least half the indices have λi<4ϵ\lambda_i < 4\epsilon — otherwise that half alone would contribute more than 2ϵ2\epsilon to the average. Throw away the worst half of the codewords. The survivors have maximal probability of error below 4ϵ4\epsilon, and we are left with 2nR12^{nR - 1} codewords, i.e. rate R=R1nR' = R - \frac{1}{n} — negligible for large nn.

Combining: a code of rate R1nR - \frac{1}{n} with λ(n)4ϵ\lambda^{(n)} \le 4\epsilon, proving achievability of any rate below capacity.

WarningRandom coding is a proof technique, not a signalling scheme

Codes are selected at random merely to symmetrize the mathematics and show that a good deterministic code exists. The theorem shows good codes exist for long block lengths; it does not provide a way to construct them. Generating a random code will likely give a good one, but without structure it is very hard to decode — naive table lookup needs an exponentially large table. Hence the theorem is not a practical coding scheme.

RemarkThe best code needs no channel to agree on

Since C\mathcal{C}^* can be found by exhaustive search from the channel description alone, the Kolmogorov complexity of the best code is a small constant. So “revealing C\mathcal{C}^* to sender and receiver” in step 2 costs nothing: they merely agree in advance to use the best (2nR,n)(2^{nR}, n) code.


Zero-error codes

Motivation for the converse. The converse argument is clearest if we first run it in the case where absolutely no errors are allowed. We show Pe(n)=0RCP_e^{(n)} = 0 \Rightarrow R \le C, and then the general converse will be the same chain with one extra ingredient.

ProofThe zero-error chain

Assume a (2nR,n)(2^{nR}, n) code with zero probability of error, so the decoder output g(Yn)g(Y^n) equals WW with probability 1 — meaning WW is determined by YnY^n, i.e. H(WYn)=0H(W \mid Y^n) = 0. Assume WW uniform, so H(W)=nRH(W) = nR. Then

nR=H(W)=H(WYn)=0+I(W;Yn)=I(W;Yn)nR = H(W) = \underbrace{H(W \mid Y^n)}_{= 0} + I(W; Y^n) = I(W; Y^n)

(a)I(Xn;Yn)(b)i=1nI(Xi;Yi)(c)nC\overset{(a)}{\le} I(X^n; Y^n) \overset{(b)}{\le} \sum_{i=1}^n I(X_i; Y_i) \overset{(c)}{\le} nC

where (a) is the data processing inequality applied to the Markov chain WXn(W)YnW \rightarrow X^n(W) \rightarrow Y^n, (b) is proved below as the single-letterization lemma using the memorylessness of the channel, and (c) is the definition of information capacity. Hence for any zero-error code and all nn: RCR \le C.

IntuitionWhat each of the three inequalities costs you

(a) You cannot learn more about the message than the channel input carries — encoding cannot manufacture information. (b) Using the channel nn times gives you at most nn times one use — no synergy across uses. (c) Each single use is worth at most CC by definition. The converse is just these three facts stacked.


Fano’s inequality and the converse

For codes with small but nonzero error, the step H(WYn)=0H(W \mid Y^n) = 0 fails. The new ingredient is Fano’s inequality, which lower-bounds error probability in terms of conditional entropy — here used in the reverse direction, to bound the residual entropy by the error rate.

The setup: WW is uniform on {1,,2nR}\{1, \ldots, 2^{nR}\}, and WXn(W)YnW^W \rightarrow X^n(W) \rightarrow Y^n \rightarrow \hat{W} forms a Markov chain, with Pr(W^W)=12nRiλi=Pe(n)\Pr(\hat{W} \ne W) = \frac{1}{2^{nR}}\sum_i \lambda_i = P_e^{(n)}.

LemmaFano’s inequality for a codebook

For a DMC with codebook C\mathcal{C} and input message WW uniformly distributed over 2nR2^{nR} values,

H(WW^)1+Pe(n)nRH(W \mid \hat{W}) \le 1 + P_e^{(n)} nR

ProofApply the general Fano bound with alphabet size 2nR2^{nR}

Since WW is uniform, Pe(n)=Pr(WW^)P_e^{(n)} = \Pr(W \ne \hat{W}). Apply the general form H(Pe)+PelogWH(WW^)H(P_e) + P_e \log \lvert \mathcal{W} \rvert \ge H(W \mid \hat{W}) with W=2nR\lvert \mathcal{W} \rvert = 2^{nR}, and weaken H(Pe)1H(P_e) \le 1.

LemmaUsing a DMC nn times does not raise the per-use capacity

Let YnY^n be the result of passing XnX^n through a DMC of capacity CC. Then

I(Xn;Yn)nCfor all p(xn)I(X^n; Y^n) \le nC \qquad \text{for all } p(x^n)

ProofSingle-letterize via memorylessness, then drop the joint entropy

Step 1: Expand and use memorylessness.

I(Xn;Yn)=H(Yn)H(YnXn)=H(Yn)i=1nH(YiY1,,Yi1,Xn)I(X^n; Y^n) = H(Y^n) - H(Y^n \mid X^n) = H(Y^n) - \sum_{i=1}^n H(Y_i \mid Y_1, \ldots, Y_{i-1}, X^n)

=H(Yn)i=1nH(YiXi)= H(Y^n) - \sum_{i=1}^n H(Y_i \mid X_i)

since by the definition of a DMC, YiY_i depends only on XiX_i and is conditionally independent of everything else. This is the step that would fail with feedback.

Step 2: Subadditivity of joint entropy. By the independence bound, H(Yn)iH(Yi)H(Y^n) \le \sum_i H(Y_i):

I(Xn;Yn)i=1nH(Yi)i=1nH(YiXi)=i=1nI(Xi;Yi)I(X^n; Y^n) \le \sum_{i=1}^n H(Y_i) - \sum_{i=1}^n H(Y_i \mid X_i) = \sum_{i=1}^n I(X_i; Y_i)

Step 3: Definition of capacity. Each term is at most CC, so I(Xn;Yn)nCI(X^n; Y^n) \le nC.

IntuitionWhat this lemma rules out

It says there is no economy of scale in using a noisy wire. You might hope that correlating inputs across time uses could squeeze out extra bits; Step 2 shows correlation among the YiY_i only ever reduces H(Yn)H(Y^n) below the sum, never raises it. The best you can do is treat the uses independently.

ProofConverse to the channel coding theorem

If λ(n)0\lambda^{(n)} \rightarrow 0 then Pe(n)0P_e^{(n)} \rightarrow 0. Fix the encoding and decoding rules, so WXn(W)YnW^W \rightarrow X^n(W) \rightarrow Y^n \rightarrow \hat{W}, with WW uniform. Then

nR=(a)H(W)=(b)H(WW^)+I(W;W^)nR \overset{(a)}{=} H(W) \overset{(b)}{=} H(W \mid \hat{W}) + I(W; \hat{W}) (c)1+Pe(n)nR+I(W;W^)\overset{(c)}{\le} 1 + P_e^{(n)} nR + I(W; \hat{W}) (d)1+Pe(n)nR+I(Xn;Yn)\overset{(d)}{\le} 1 + P_e^{(n)} nR + I(X^n; Y^n) (e)1+Pe(n)nR+nC\overset{(e)}{\le} 1 + P_e^{(n)} nR + nC

where (a) is uniformity of WW, (b) is an identity, (c) is Fano’s inequality for WW taking at most 2nR2^{nR} values, (d) is the data processing inequality, and (e) is the lemma above.

Divide by nn:

RPe(n)R+1n+CR \le P_e^{(n)} R + \frac{1}{n} + C

Letting nn \rightarrow \infty, the first two terms on the right vanish, so RCR \le C.

FormulaThe converse rearranged as an error floor

Pe(n)1CR1nRP_e^{(n)} \ge 1 - \frac{C}{R} - \frac{1}{nR}

IntuitionReading the error floor

If R>CR > C, then 1C/R1 - C/R is a positive constant and the probability of error is bounded away from 0 for all sufficiently large nn — and hence for all nn, since a zero-error code for small nn could be concatenated into zero-error codes for large nn. You cannot achieve arbitrarily low error above capacity, no matter how clever the code or how long the block.

RemarkWeak versus strong converse

This is the weak converse. A strong converse also holds: for rates above capacity, the probability of error goes exponentially to 1. So capacity is a very sharp dividing point — below it Pe(n)0P_e^{(n)} \rightarrow 0 exponentially, above it Pe(n)1P_e^{(n)} \rightarrow 1 exponentially.


Equality in the converse

Motivation. We know R<CR < C works and R>CR > C does not. Examining where the converse chain is tight tells us what a capacity-achieving code must look like — useful guidance for code designers.

Repeating the converse steps with Pe=0P_e = 0:

nR=H(W)=I(W;W^)(a)I(Xn(W);Yn)=H(Yn)i=1nH(YiXi)(b)i=1nI(Xi;Yi)(c)nCnR = H(W) = I(W;\hat{W}) \overset{(a)}{\le} I(X^n(W); Y^n) = H(Y^n) - \sum_{i=1}^n H(Y_i \mid X_i) \overset{(b)}{\le} \sum_{i=1}^n I(X_i; Y_i) \overset{(c)}{\le} nC

StepEquality conditionDesign meaning
(a) data processingI(Yn;Xn(W)W)=0I(Y^n; X^n(W) \mid W) = 0 and I(Xn;YnW^)=0I(X^n; Y^n \mid \hat{W}) = 0All codewords are distinct, and W^\hat{W} is a sufficient statistic for decoding.
(b) subadditivityThe YiY_i are independentThe induced output sequence must look memoryless.
(c) definition of CCXip(x)X_i \sim p^*(x)Each coordinate must be distributed according to the capacity-achieving input distribution.

ImportantWhat a capacity-achieving code looks like

Distinct codewords, and an output whose coordinates are i.i.d. according to the output distribution induced by the optimal input:

p(y)=xp(x)p(yx)p^*(y) = \sum_x p^*(x) p(y \mid x)

The distribution referred to here is the empirical distribution on X×Y\mathcal{X} \times \mathcal{Y} induced by a uniform distribution over codewords:

p(xi,yi)=12nRw=12nR1(Xi(w)=xi)p(yixi)p(x_i, y_i) = \frac{1}{2^{nR}} \sum_{w=1}^{2^{nR}} \mathbb{1}\big(X_i(w) = x_i\big) p(y_i \mid x_i)

In slogan form: a good code makes the channel output look like pure noise.

ExampleNoisy typewriter

Using every alternate input letter gives 13 codewords of block length 1, achieving log13\log 13. If the codewords are chosen i.i.d. uniform on {1,3,5,,25}\{1, 3, 5, \ldots, 25\}, the channel output is i.i.d. uniform on {1,2,,26}\{1, 2, \ldots, 26\} — exactly as the equality conditions predict.

ExampleBinary symmetric channel

Given any input sequence, every output sequence has positive probability, so we cannot distinguish even two codewords with zero error: the zero-error capacity of the BSC is zero. Still, the conditions inform us: efficient codes induce a YY distribution that looks i.i.d. Bernoulli(12\tfrac12), and at rates close to capacity the decoding sets almost exactly tile the space of output sequences. Above capacity the decoding sets begin to overlap, and the error probability can no longer be made small.


Hamming codes

The problem. The coding theorem promises block codes exist but gives no construction, and a random code is undecodable in practice. Useful codes must also be simple enough to encode and decode efficiently.

IntuitionThe naive scheme and why it fails

The most obvious way to add redundancy is repetition: send 11111 for a 1 and 00000 for a 0. On a BSC the optimum decoder is a majority vote, and an error occurs only if three or more bits flip. By lengthening the repetition we can drive error arbitrarily low — but the rate goes to zero with block length. Simple, but useless. We need redundancy that grows slower than the message.

The improvement is to combine bits so each extra bit checks a subset of the information bits. The simplest instance is a parity check code: given n1n-1 information bits, choose the nnth so the parity of the block is even. An odd number of errors is then detected — but not located, and even numbers of errors are missed entirely. Hamming codes extend this to multiple parity checks over overlapping subsets.

Construction

Consider a binary code of block length 7, all operations mod 2. Take all nonzero binary vectors of length 3 as the columns of a matrix:

H=[000111101100111010101]H = \begin{bmatrix} 0 & 0 & 0 & 1 & 1 & 1 & 1 \\ 0 & 1 & 1 & 0 & 0 & 1 & 1 \\ 1 & 0 & 1 & 0 & 1 & 0 & 1 \end{bmatrix}

The codewords are the null space of HH (vectors cc with Hc=0Hc = 0). Since HH has rank 3, the null space has dimension 73=47 - 3 = 4, giving 24=162^4 = 16 codewords:

0000000 0001111 0010110 0011001
0100101 0101010 0110011 0111100
1000011 1001100 1010101 1011010
1100110 1101001 1110000 1111111

DefinitionMinimum weight and minimum distance

  • Minimum weight: the smallest number of 1’s in any nonzero codeword.
  • Minimum distance: the smallest number of places in which two codewords differ.

For a linear code (one closed under addition, as this is, being a null space) the difference of two codewords is a codeword, so minimum distance equals minimum weight.

DerivationWhy the minimum distance here is exactly 3

At least 3: all columns of HH are different and nonzero, so no single column is zero (weight 1 impossible) and no two columns can add to 000000 (weight 2 impossible).

Exactly 3: the sum of any two columns is itself one of the columns of the matrix (all seven nonzero 3-vectors are present), so some three columns do sum to zero, giving a weight-3 codeword.

IntuitionWhy distance 3 gives single-error correction

The minimum distance measures how far apart codewords are, and hence how distinguishable they remain at the channel output. If a codeword cc is corrupted in one place, the result differs from cc in 1 place but from every other codeword in at least 2 — so it is unambiguously closest to cc.

Syndrome decoding

DerivationFinding the error position without searching all codewords

HH is called the parity check matrix: Hc=0Hc = 0 for every codeword. Let eie_i be the vector with a 1 in position ii. If the codeword is corrupted at position ii, the received vector is r=c+eir = c + e_i, and

Hr=H(c+ei)=Hc=0+Hei=HeiHr = H(c + e_i) = \underbrace{Hc}_{=\,0} + He_i = He_i

which is exactly the iith column of HH. So computing HrHr (three bits) names the corrupted position directly; flipping that bit recovers the codeword. No search over the 16 codewords is required.

RemarkSystematic form

Examining the first 4 bits of the codewords above, they cycle through all 242^4 combinations — so those 4 bits can carry the message and the other 3 are determined. A code in this form (first kk bits the message, last nkn-k the parity checks) is systematic. This code is identified by block length n=7n=7, information bits k=4k=4, and minimum distance d=3d=3: the (7,4,3)(7,4,3) Hamming code.

ExampleThe Venn diagram picture

Draw three overlapping circles, creating four intersection regions and three regions belonging to a single circle. Place the 4 information bits in the intersection regions, then place a parity bit in each of the three remaining regions so that each circle has even parity.

Now flip one information bit. The parity constraint is violated for exactly the circles that region belongs to — and the only single-bit error that could violate that particular pair of circles is the bit sitting at their intersection. Working through every case shows the code detects and corrects any single-bit error. This is syndrome decoding drawn rather than computed: the three circles are the three rows of HH.

CorollaryGeneral Hamming codes

Using ll rows in HH (i.e. all nonzero binary ll-vectors as columns) gives a code with block length n=2l1n = 2^l - 1, k=2ll1k = 2^l - l - 1 information bits, and minimum distance 3. All of these are Hamming codes and correct one error.

Beyond Hamming

NoteThe historical gap between promise and practice

With large block lengths there will usually be more than one error per block, so single-error correction is not enough. For a BSC with crossover pp we want a code correcting up to npnp errors while carrying n(1H(p))n(1 - H(p)) information bits.

  • 1950s: Reed–Solomon (multiple-error correction, nonbinary); Bose– Ray-Chaudhuri and Hocquenghem generalize Hamming via Galois field theory to tt-error-correcting BCH codes.
  • Until 1972: every known code correcting nαn\alpha errors had asymptotic rate 0 — the repetition problem never really went away.
  • 1972: Justesen gives codes with positive asymptotic rate and positive asymptotic minimum distance as a fraction of block length.
  • 1993: Berrou et al. introduce turbo codes — two interleaved convolutional codes with a cooperative decoder, where each decoder feeds its “opinion” of each bit to the other and iterates until they agree. Surprisingly, this allows efficient decoding at rates close to capacity.
  • 1997: MacKay and Neal show an iterative message-passing algorithm achieves near-capacity rates for Gallager’s LDPC codes.

Both turbo and LDPC codes remain active research areas and are deployed in wireless and satellite channels. As an everyday example, compact disc players use two interleaved (32,28,5)(32, 28, 5) and (28,24,5)(28, 24, 5) Reed–Solomon codes, letting the decoder correct bursts of up to 4000 errors.

RemarkBlock codes versus convolutional codes

Everything above is a block code: it maps a block of information bits to a codeword with no dependence on past blocks. One can also design codes where each output block depends on past inputs as well; a highly structured form of this is a convolutional code.


Feedback capacity

The problem. Suppose all received symbols are sent back immediately and noiselessly to the transmitter, which can use them to decide what to send next. Can we do better? We saw feedback made the BEC trivially easy. Does it raise the rate?

flowchart LR
  W["Message W"] --> E[Encoder]
  E --> Xi["X_i(W, Y^(i-1))"]
  Xi --> CH["Channel p(y|x)"]
  CH --> Yi["Y_i"]
  Yi --> D[Decoder]
  Yi -.->|noiseless feedback| E
  D --> WH["W-hat"]

DefinitionFeedback code and feedback capacity

A (2nR,n)(2^{nR}, n) feedback code is a sequence of mappings xi(W,Yi1)x_i(W, Y^{i-1}) — each input a function only of the message WW and the previously received values — together with decoding functions g:Yn{1,,2nR}g : \mathcal{Y}^n \rightarrow \{1, \ldots, 2^{nR}\}, with Pe(n)=Pr(g(Yn)W)P_e^{(n)} = \Pr(g(Y^n) \ne W) for WW uniform.

The capacity with feedback CFBC_{FB} is the supremum of all rates achievable by feedback codes.

TheoremFeedback does not increase capacity

CFB=C=maxp(x)I(X;Y)C_{FB} = C = \max_{p(x)} I(X;Y)

WarningWhy the old converse proof breaks

CFBCC_{FB} \ge C is immediate (a nonfeedback code is a special case). The other direction cannot reuse the earlier converse: Lemma 7.9.2 is no longer true, because XiX_i now depends on past received symbols, so it is false that YiY_i depends only on XiX_i and is conditionally independent of future XX‘s. The single-letterization step collapses.

ProofRoute the argument through WW instead of XnX^n

The fix: instead of bounding I(Xn;Yn)I(X^n; Y^n), bound I(W;Yn)I(W; Y^n) — the message is not adaptively chosen, so it is immune to the feedback problem.

Step 1: Fano and data processing, as before. Let WW be uniform, so Pr(WW^)=Pe(n)\Pr(W \ne \hat{W}) = P_e^{(n)}:

nR=H(W)=H(WW^)+I(W;W^)1+Pe(n)nR+I(W;W^)1+Pe(n)nR+I(W;Yn)nR = H(W) = H(W \mid \hat{W}) + I(W; \hat{W}) \le 1 + P_e^{(n)} nR + I(W; \hat{W}) \le 1 + P_e^{(n)} nR + I(W; Y^n)

Step 2: Expand I(W;Yn)I(W; Y^n) and insert XiX_i for free.

I(W;Yn)=H(Yn)H(YnW)=H(Yn)i=1nH(YiY1,,Yi1,W)I(W; Y^n) = H(Y^n) - H(Y^n \mid W) = H(Y^n) - \sum_{i=1}^n H(Y_i \mid Y_1, \ldots, Y_{i-1}, W)

=H(Yn)i=1nH(YiY1,,Yi1,W,Xi)=H(Yn)i=1nH(YiXi)= H(Y^n) - \sum_{i=1}^n H(Y_i \mid Y_1, \ldots, Y_{i-1}, W, X_i) = H(Y^n) - \sum_{i=1}^n H(Y_i \mid X_i)

The first equality here is because XiX_i is a function of Y1,,Yi1Y_1, \ldots, Y_{i-1} and WW — precisely the property that broke the old proof is what makes adding XiX_i to the conditioning set free here. The second is because, conditional on XiX_i, the output YiY_i is independent of WW and of past YY‘s.

Step 3: Finish exactly as before.

I(W;Yn)iH(Yi)iH(YiXi)=iI(Xi;Yi)nCI(W; Y^n) \le \sum_i H(Y_i) - \sum_i H(Y_i \mid X_i) = \sum_i I(X_i; Y_i) \le nC

Step 4: Combine and take limits. nRPe(n)nR+1+nCnR \le P_e^{(n)} nR + 1 + nC; dividing by nn and letting nn \rightarrow \infty gives RCR \le C. Hence CFB=CC_{FB} = C.

IntuitionWhat feedback does and does not buy

Feedback can help enormously in simplifying encoding and decoding — the BEC retransmission scheme hits capacity with no code design at all. But it cannot increase the capacity. The reason is visible in Step 2: feedback lets the encoder react, but it cannot change H(YiXi)H(Y_i \mid X_i), the noise the wire injects on each use. You can steer better; you cannot make the wire quieter.


Source–channel separation theorem

The problem. We now have two results: data compression (representable at rate R>HR > H) and data transmission (reliable at rate R<CR < C). Is H<CH < C necessary and sufficient to send a source over a channel?

Consider sending digitized speech over a DMC. We could design a code mapping speech samples directly into channel inputs, or we could compress the speech and then channel-code the compressed bits. It is not obvious we lose nothing with the two-stage method, since compression does not look at the channel and channel coding does not look at the source.

flowchart LR
  V["V^n"] --> SE[Source encoder]
  SE --> CE[Channel encoder]
  CE --> CH["Channel p(y|x)"]
  CH --> CD[Channel decoder]
  CD --> SD[Source decoder]
  SD --> VH["V-hat^n"]

ImportantWhy we want this to be true

If it is, we can design a communication system as two independent halves: source codes for the most efficient representation of the data, channel codes appropriate for the channel — and their combination is as good as anything designed jointly. This is why everything is reduced to a common binary representation in practice, an enormous reduction in complexity: ATM networks and the Internet let speech, video, and digital data share one channel precisely because of this theorem.

WarningIt is not always true, and two examples show why it can mislead

There are multiuser channels where the decomposition breaks down. And two simple situations look like counterexamples:

  • English text over an erasure channel. Compress the text optimally and send it, and the erasures are very hard to decode. Send the English directly and you can lose up to about half the letters and still make sense of it.
  • Speech under white noise. The human ear can distinguish speech at very high noise levels, so it may be better to send uncompressed speech than the compressed version.

In both, the redundancy in the source happens to be well suited to the channel. The theorem is an asymptotic statement about achievable rates, not a claim that two-stage systems are better at every finite block length or under a mismatched distortion criterion.

TheoremSource–channel coding theorem

If V1,V2,,VnV_1, V_2, \ldots, V_n is a finite-alphabet stochastic process satisfying the AEP and H(V)<CH(\mathcal{V}) < C, there exists a source–channel code with Pr(V^nVn)0\Pr(\hat{V}^n \ne V^n) \rightarrow 0.

Conversely, for any stationary process, if H(V)>CH(\mathcal{V}) > C the probability of error is bounded away from zero and it is not possible to send the process over the channel with arbitrarily low error.

NoteWhat is assumed about the source

Only that it has a finite alphabet and satisfies the AEP. That covers i.i.d. sequences and the states of a stationary irreducible Markov chain; in fact any stationary ergodic source satisfies the AEP.

ProofAchievability — two-stage encoding

Step 1: Index only the typical source sequences. Since the process satisfies the AEP, there is a typical set Aϵ(n)A_\epsilon^{(n)} of size at most 2n(H(V)+ϵ)2^{n(H(\mathcal{V}) + \epsilon)} carrying most of the probability. Encode only sequences in the typical set; everything else is declared an error, contributing at most ϵ\epsilon.

Step 2: Count the bits needed. There are at most 2n(H+ϵ)2^{n(H+\epsilon)} such sequences, so n(H+ϵ)n(H + \epsilon) bits suffice to index them.

Step 3: Ship the index through the channel. By the channel coding theorem we can transmit the index with error below ϵ\epsilon provided

H(V)+ϵ=R<CH(\mathcal{V}) + \epsilon = R < C

Step 4: Reconstruct. The receiver enumerates Aϵ(n)A_\epsilon^{(n)} and picks the sequence at the estimated index. Union-bounding the two failure modes:

P(VnV^n)P(VnAϵ(n))+P(g(Yn)VnVnAϵ(n))ϵ+ϵ=2ϵP(V^n \ne \hat{V}^n) \le P\big(V^n \notin A_\epsilon^{(n)}\big) + P\big(g(Y^n) \ne V^n \mid V^n \in A_\epsilon^{(n)}\big) \le \epsilon + \epsilon = 2\epsilon

for nn sufficiently large. So H(V)<CH(\mathcal{V}) < C suffices.

ProofConverse — Fano plus data processing, one more time

We show Pr(V^nVn)0\Pr(\hat{V}^n \ne V^n) \rightarrow 0 forces H(V)CH(\mathcal{V}) \le C, for any source–channel code Xn():VnXnX^n(\cdot) : \mathcal{V}^n \rightarrow \mathcal{X}^n (possibly random) and any decoder gn():YnVng_n(\cdot) : \mathcal{Y}^n \rightarrow \mathcal{V}^n.

Step 1: Fano’s inequality for the whole block.

H(VnV^n)1+Pr(V^nVn)logVn=1+Pr(V^nVn)nlogVH(V^n \mid \hat{V}^n) \le 1 + \Pr(\hat{V}^n \ne V^n) \log \lvert \mathcal{V}^n \rvert = 1 + \Pr(\hat{V}^n \ne V^n)\, n \log \lvert \mathcal{V} \rvert

Step 2: Chain the inequalities.

H(V)(a)H(V1,,Vn)n=1nH(VnV^n)+1nI(Vn;V^n)H(\mathcal{V}) \overset{(a)}{\le} \frac{H(V_1, \ldots, V_n)}{n} = \frac{1}{n} H(V^n \mid \hat{V}^n) + \frac{1}{n} I(V^n; \hat{V}^n)

(b)1n(1+Pr(V^nVn)nlogV)+1nI(Vn;V^n)\overset{(b)}{\le} \frac{1}{n}\big(1 + \Pr(\hat{V}^n \ne V^n) n \log \lvert \mathcal{V} \rvert\big) + \frac{1}{n} I(V^n; \hat{V}^n)

(c)1n(1+Pr(V^nVn)nlogV)+1nI(Xn;Yn)(d)1n+Pr(V^nVn)logV+C\overset{(c)}{\le} \frac{1}{n}\big(1 + \Pr(\hat{V}^n \ne V^n) n \log \lvert \mathcal{V} \rvert\big) + \frac{1}{n} I(X^n; Y^n) \overset{(d)}{\le} \frac{1}{n} + \Pr(\hat{V}^n \ne V^n) \log \lvert \mathcal{V} \rvert + C

where (a) is the definition of the entropy rate of a stationary process, (b) is Fano, (c) is data processing along VnXnYnV^nV^n \rightarrow X^n \rightarrow Y^n \rightarrow \hat{V}^n, and (d) is memorylessness of the channel.

Step 3: Take the limit. As nn \rightarrow \infty, Pr(V^nVn)0\Pr(\hat{V}^n \ne V^n) \rightarrow 0 and 1n0\tfrac1n \rightarrow 0, leaving H(V)CH(\mathcal{V}) \le C.

ImportantThe whole theory in three sentences

Data compression is a consequence of the AEP: a small subset (of size 2nH2^{nH}) of all source sequences carries most of the probability, so we can represent the source with small error using HH bits per symbol. Data transmission is a consequence of the joint AEP: for long blocks the channel output is very likely jointly typical with the input codeword, while any other codeword is jointly typical with probability 2nI\approx 2^{-nI}, so about 2nI2^{nI} codewords still give negligible error. Separation says we can design the two independently and combine them for optimal performance.

A stationary ergodic source can be transmitted over a channel if and only if its entropy rate is less than the channel capacity.


Quick reference

ObjectStatementReads as
Information capacityC=maxp(x)I(X;Y)C = \max_{p(x)} I(X;Y)The wire’s worth when driven optimally.
Noiseless binaryC=1C = 1
Nonoverlapping outputsC=1C = 1Noise without confusability costs nothing.
Noisy typewriterC=log13C = \log 13A nonconfusable subset hidden in a confusable alphabet.
BSCC=1H(p)C = 1 - H(p)One bit, minus the entropy of the flip.
BECC=1αC = 1 - \alphaYou keep the fraction that isn’t erased.
Weakly symmetricC=logYH(row)C = \log \lvert \mathcal{Y} \rvert - H(\text{row})Uniform input is optimal.
Joint typicalitythree empirical entropies within ϵ\epsilonThe pair is typical of each other.
Joint AEP part 3Pr(independent pair typical)2nI\Pr(\text{independent pair typical}) \approx 2^{-nI}A rival codeword fools you with prob. 2nI2^{-nI}.
Coding theoremR<CR < C \Rightarrow achievableReliable communication below capacity.
Converseλ(n)0RC\lambda^{(n)} \to 0 \Rightarrow R \le CAnd nowhere above it.
Error floorPe(n)1CR1nRP_e^{(n)} \ge 1 - \frac{C}{R} - \frac{1}{nR}Above capacity, error is bounded away from 0.
Single-letterizationI(Xn;Yn)nCI(X^n; Y^n) \le nCNo economy of scale in channel uses.
Hamming(7,4,3)(7,4,3), HrHr = column of the errorSyndrome names the corrupted bit.
FeedbackCFB=CC_{FB} = CFeedback simplifies; it does not enlarge.
Separationpossible iff H(V)<CH(\mathcal{V}) < CDesign source and channel codes independently.

Facts to keep to hand:

  • Capacity bounds: 0Clogmin{X,Y}0 \le C \le \log \min\{\lvert \mathcal{X} \rvert, \lvert \mathcal{Y} \rvert\}; I(X;Y)I(X;Y) is concave in p(x)p(x), so local max == global max.
  • No closed form for CC in general — symmetry is the escape hatch; otherwise Arimoto–Blahut.
  • Achievability slack: error ϵ+23nϵ2n(IR)\le \epsilon + 2^{3n\epsilon} 2^{-n(I - R)}, small when R<I3ϵR < I - 3\epsilon.
  • The three code surgeries: optimize p(x)p(x) \to pick the best codebook \to discard the worst half of codewords (rate cost 1n\tfrac1n, converts average error to maximal).
  • Every converse in this chapter is Fano ++ data processing ++ single-letterization. Recognizing that triple is worth more than memorizing any individual chain.

References

  • [[lit/cover2006-elements|Cover & Thomas, Elements of Information Theory]] — Chapter 7

← All notes